Making Games with Castle

Jason Riggs
Castle Games Blog
Published in
3 min readOct 28, 2018

Castle is a fun new way to make, share, and play games. We built it atop the beloved LÖVE framework and have added workflow and sharing enhancements. This is just the beginning- there is much more to come!

Some things we’ve created in Castle

To learn how it works, let’s look at perhaps the “Hello, world!” of games: Chapter 1, in which we steer a circle through the ceaseless void:

This circle has a lot to ponder, but the necessary time and space to do it…

It will take a few minutes to re-create this demo by following the instructions here: http://www.playcastle.io/get-started

Sharing your Creations

You can share your game with anyone who has Castle by sending them a URL.

For example, this tutorial’s source code lives here: https://github.com/schazers/castle-tutorial

Click the main.lua file inside that tutorial

Then, click on the “raw” button pictured below:

This raw link contains plain text of your code. Copy the URL from the URL bar. For this tutorial, it is:

https://raw.githubusercontent.com/schazers/castle-tutorial/master/main.lua

Paste this link into Castle’s URL bar, and hit Enter. You’ll notice your game loads over-the-air from its live address on github.

(Sidenote: due to Github’s internals, occasionally it can take a moment for the content at your raw URL to match any recent changes to your main.lua file. Just wait a moment — your raw URL’s code will update soon enough. If you are a github guru, you can avoid this delay by using the raw URL of that particular commit’s SHA.)

(Sidenote 2: if you prefer not to use github, you may serve your file from any file hosting service which serves plain text files)

Castle also supports deep linking. This means you may alter your raw URL’s protocol from “https” to “castle”, like this:

castle://raw.githubusercontent.com/schazers/castle-tutorial/master/main.lua

For anyone who has downloaded castle, clicking on this link from the web will open Castle and then launch your game. That means that although you’ve created a performant native game, people in the Castle community won’t need to download anything to play them: just a click of a link.

There’s also an easy way to share your game with anyone, regardless of whether they have Castle. While running your game using its “castle://” raw github url, open the right sidebar of Castle, and note the share button at the bottom:

Clicking this will generate a link to a game sharing page unique to your game, like this one: https://www.playcastle.io/games?name=Circle%20Demo&author=schazers&url=castle://raw.githubusercontent.com/schazers/castle-tutorial/master/main.lua

Okay, that concludes our brief introduction to developing games with Castle!

Here are some links to anyone curious about how to go further:

The LÖVE wiki is located here: https://love2d.org/wiki/Main_Page

There are countless tutorials for learning LÖVE’s api, and the documentation is fantastic. Note that Castle supports LÖVE’s latest version, 11.0, so make sure you don’t use any outdated parts of their framework. Some of them are lurking on the site.

The LÖVE community also has a wonderful, curated set of resources here: https://github.com/love2d-community/awesome-love2d

Likewise, so does the Lua community. Keep in mind that Castle runs using LuaJIT 5.1: https://github.com/LewisJEllis/awesome-lua

Contact Us!

Please leave us a message below with any thoughts, and definitely let us know if you make anything in Castle!

You can find us on twitter here: https://twitter.com/playcastle_io

And on discord here: http://discord.gg/4C7yEEC

My discord username in that channel is schazers. I’d love to speak with you! Message me there.

Thanks for reading,

Jason

--

--