New tools for 2D game development

Published on Jul 16th 2019 by happens

Are you looking to build 2D games with Amethyst? Well, we've got some great news for you! Getting started just became a whole lot easier. There's been 2 recent project releases that we want to tell you more about; encourage you to use them, give us feedback and maybe even contribute!

Amethyst 2D Starter ⚡

The first release I want to talk about is the Amethyst 2D starter. Following the example of several prominent web frameworks, we now offer an officially supported seed project that you can use to get something on your screen as quickly as possible. This project will always use the latest API and offer an idiomatic setup, including all boilerplate code needed to open a window, receive inputs and render something simple.

Up until now, the CLI was the recommended way to start out new projects. Please note that the CLI is not deprecated by this! This starter is meant to be used for more specific use cases, while the CLI will generate an empty project for you.

We're also planning on providing more starter projects for different types of games, such as:

  • Generic 3D Games
  • FPS Games
  • Games with networking support (using our laminar project)

If you're interested in creating a starter template for one of these or another type of game, please contact us! We can give you pointers, review your code and make sure you're using the engine optimally. Creating one of these can be a great way to get to know the engine, without committing to a full project!

Amethyst's tools

In the long run, we want to integrate the starter projects back into the CLI, and enable the CLI to use them as sources. We also want to offer options flags and switches for more customization, such as the option to include a basic UI and menus, or custom render groups. This way, we could allow other people to provide 3rd party starter projects for more specific use cases, and maybe even the option to generate and scaffold more systems, entities and other things for existing projects. As always, feel free to reach out if you're interested in helping with this!

Sheep 🐑

The sheep project was started a while ago to provide a unified spritesheet packing solution for the Amethyst ecosystem. It lay dormant for some time due to a focus on other issues, and just provided a very naive packing algorithm - which didn't have much use for real world applications. However, I recently found the time to implement the MAXRECTS algorithm, which is the algorithm most often used for packing sprites, and should provide optimal results in most use cases. If you want to learn more about how the algorithm works, I used this amazing paper by Jukka Jylänki to decide on an algorithm, and his implementation served as a great reference for my own.

Sheep now also supports outputting its results into multiple textures, which means you can throw all of your sprites in there and then import them all at once, without having to worry about exceeding the maximum texture resolution limits imposed by the graphics driver.

The CLI has been published to, so if you want to try it out, you can simply run:

cargo install sheep_cli

Make sure you have your cargo binary directory in your PATH, and then use it like this:

sheep pack sprites/*.png

Sheep's future

Going forward, we're looking to establish sheep as the natural way to process your sprites for use in Amethyst games. There's a few things that will need to happen for this to work seamlessly:

  • Add support for more image formats (input and output)
  • Integrate sheep into the assets pipeline

If you're looking to help, we're always happy about contributions! Just hop on our discord and we can discuss what you're interested in. Of course, the improvements that could be made are not limited to what I mentioned above - I could also imagine providing a way to add "middlewares", which allows additional optimization steps for images (like trimming whitespace off the edges of input sprites or better compression); adding support for flipped sprites (which is mentioned in the paper linked above); implementing more output formats, and much more. Just give us a shout and we'll have a talk!

That's it for now.

Thanks for reading. All beginnings are difficult - but we're hoping that this will make it a bit easier!