DownloadsGet the Castle client.Frequently Asked QuestionsLearn more about Castle.ExamplesUse this list of examples to bootstrap your game.Quick StartGet started in under 5 minutes.Creating an AccountWhy and how to create a Castle account.Make Your First GameFollow this small tutorial to get oriented with a basic workflow.Describe your Game with a Castle Project FileThis tutorial will provide an overview and motivation for a project file.Adding Games to your ProfileShare games you made by adding them to your profile on Castle.Hosting Your Own GamesLearn how to add games to Castle which are hosted on another service.Game Dimensions and ScalingChange the dimensions and scaling behavior of your Castle game.Manually Make a New Castle Game from ScratchAn educational resource for advanced usersCastle Project File ReferenceThe project file contains the title, description and other metadata about your game.User API ReferenceGet information about users playing your game.Post API ReferenceIntegrate with Castle's post system.Storage API ReferenceStore shared or per-user data in the cloud.Game API ReferenceNavigate to or get information about other games on Castle.UI API ReferenceDisplay user interface elements such as buttons and text boxes that allow users to interact with your game.System API ReferenceGet information about or perform activities relating to the system Castle is running on.Code Loading API ReferenceLow-level functionality for loading Lua code over the network.Community Reference LinksUseful community links for learning about Lua and LÖVE.

Hosting Your Own Games

By The Castle Team // 5-21-2019

What is this for?

This guide is for creators who made a Castle game, and want to share that game on their Castle profile, but prefer to use their own file hosting service.
For most users, we recommend following this guide to add games to your profile. However, if you prefer not to upload your files to Castle, you can also host the game files yourself. Examples of non-Castle file hosting services include Github, Bitbucket, or any other website capable of serving static text files and assets.

How do I add externally-hosted games to my profile?

1. Upload your game's files somewhere.

Using your web host of choice, upload the directory containing your game's code, assets, and Castle Project File.
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 project file.
Your game must have a Castle Project File which includes your Castle username in the owner key. In most cases, Castle already added this for you. If you don't have a Castle Project File, follow this guide to add one to your game.

2. 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:

3. Add your game's hosted url to Castle.

Open Castle and view your own profile. From your profile, click the Add Game button. From here, find the button that says My game is already hosted online.
Finding the online hosting button in Castle
You should see a form with a text box and some instructions.
A profile showing the Add Game form with a hosted game url text field
Paste the Castle Project File url from step 2 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 Game.
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, find the game card and click the Update... button.
Happy creating!