What’s new in Castle, May 16 2019

By Ben Roth // 5-16-2019
Hello! We've been busy working on some improvements to Castle. In particular, we've added some new APIs you can use to scale your graphics perfectly, save high scores, and more. Here's the low down:

Customize your game's screen dimensions and scaling behavior

The width and height of your game are fundamental to the way you present it to your players. Another important thing is how your game adapts when its window is resized, when it's run on different devices, and generally when the available screen space changes.
To accommodate these considerations, we've added new dimensions and scaling keys you can provide in your Castle Project File. Here are a few possible things you can do:
  • Make your game a specific absolute size, like 320x240 screen units.
  • Take up the full screen space available and implement your own sizing behavior in code.
  • Automatically scale smoothly when the size changes.
  • Alternately, use scaling: step to ensure pixel art graphics always stay crisp at different sizes.
  • Just take the default! In this case your game will be 800x450 (16:9).
Check out the full Game Dimensions and Scaling guide to learn more.
An example of a Castle game which uses step scaling
An example of a Castle game which uses step scaling

Store game data in the cloud

We added the castle.storage namespace to the Castle api. Use this to store data about your game for future use. There are two types of storage: Global per-game storage, and also per-user storage.
Global storage is sandboxed within a particular game, but shared across all players of that game. You might use global storage to maintain a public leaderboard of high scores in your game, or to maintain shared world state across all users.
User storage is sandboxed to the particular Castle account playing the game. You could use this to store a particular player's achievements or character attributes, or to save private high scores.
Castle's storage is a key-value store. Because these APIs is store data in the cloud, a single Castle account shares user data across all devices on which that person plays your game.
See the Storage API Reference for more details on how to use the Castle storage API.

Automatically run multiplayer games in the cloud while developing

When building a multiplayer game in Castle, Castle runs an instance of your game on a server. In development, it's annoying to need to repeatedly upload your game just to test changes.
Now you can enable Multiplayer Auto Upload in the Castle development console, and Castle will automatically upload your code every time you reload your game.
This option is only available for games which enable multiplayer in their Castle Project File.
Multiplayer Auto Upload in Castle
Multiplayer Auto Upload in Castle

We changed more things

  • Added castle.system, a few APIs for getting information about the current machine running your game. See the docs.
  • Added castle.game and castle.post APIs. We'll discuss these much more in a future post, so stay tuned! Feel free to ask us if you're interested now.
  • Fixed an issue where joysticks and gamepads didn't work consistently on Windows.
  • Fixed an issue where some users would see the game appear in the corner of the screen for some reason.
  • We fixed a lot of bugs that you never noticed.

That's it for now!

Thanks for reading! If you've opened the Castle Desktop Client recently, you already have all these updates. If you'd like to get Castle, grab it from castle.games. Please get in touch and let us know what you think!
For more updates, check out our changelog from April 4.