Adding Game to your Castle Profile

By The Castle Team // 1-30-2019
If you made a game you want to share with others, you can add it to your Castle profile. This article describes why, and how, you would do that.

Why add games to my profile?

When you add a game you made to your Castle profile, here are some things you get:
  • A permanent link you can share, like
  • A game card that shows up on your profile.
  • Presence in Castle Search, Recents, and anywhere else Castle might want to surface your game to players.
A profile which contains one game
A profile which contains one game

How do I add games to my profile?

1. Log in to Castle.

If you already have a Castle account, make sure you're logged in. If you don't have a Castle account, now is a good time to create one.
Take note of your username that you used to log in or sign up with Castle.

2. Make sure your game has a Castle Project File.

A Castle Project File describes the title and artwork for your game, and proves that you are the author of the game.
Most Castle games already have a simple project file automatically, usually called project.castle. If you don't have one, follow this guide to add one to your game.

3. Add your Castle username to your Project File.

Note: If you created your project through Castle's New Project button, you can probably skip this step because Castle performed it for you automatically.
Take note of the username you use to log in to Castle. Using a text editor, edit your game's Project File and add owner: your-castle-username.
For example, if your username is mario, your Project File might look like this:
main: main.lua
title: Exploding Snake
owner: mario

4. Upload your game's code somewhere.

Castle doesn't host games for you, so you need to make sure your game's source code is somewhere online where Castle can load it.
The most common way to upload a Castle game is to push it to some hosted source control service, like Github or Bitbucket. You are also welcome to host it on your own website, some other service, or anywhere that gives you a public url for your game's code.
Here is an example github repository containing a simple Castle game. Notice that it contains all the Lua code for the game, as well as the castle_tutorial.castle project file.

5. Find the uploaded url to your game's Castle Project File.

For example, if you uploaded your game to Github, you can get the url to the .castle file by clicking the "Raw" button:
You'll end up with a url that looks like this one:

6. Add your game's code url to Castle.

Open Castle and view your own profile. From your profile, click the Add Game button.
A profile which shows the Add Game button
You should see a form with a text box and some instructions.
A profile showing the Add Game form with a text box
Paste the url from step 4 into the box. This tells Castle where to go load your game. When Castle finds your game, it will render a preview for you.
A profile showing a preview of a game to be added
Click Add.
Congratulations! You've now added this game to your profile.

What's next?

Now that your game is on your profile, anybody in Castle can find it and play it. You might want to make sure the game looks great, for example by adding some artwork or a primary color. There are lots of ways to customize your game's appearance, so check out the Castle Project File Reference for the full list.
If you upload any changes to your game's code, your players will receive those changes immediately. This is because Castle doesn't host your code, and just reads it from the url you provided.
For metadata changes you make to your Castle Project File, like artwork and title, Castle maintains an index of that information so people can view it on your profile. Castle will update this index about once a day. If you want to synchronize metadata changes immediately, you can view your own profile and click the SYNC DATA button:
A profile showing the SYNC DATA button for a game
Happy creating!