In late 2019, I wanted to build the “killer app” for my distributed MMO. I wanted a top-down, Zelda-esque game, that uses old school low resolution tiles for a high player density onscreen, but I didn’t know where to start.
While I knew about the Rust programming language, I was ignorant about the vivid gaming community surrounding it. Rust is suited for games — it’s a fast, safe and modern programming language with a novel take on dynamic memory called “ownership”. So I decided to build the game in Rust. It’s off to the community! and holy hell were people interested. Within hours, I had several responses from people wanting to help out. We were off to the races!
As we didn’t want to reinvent the wheel, a game engine called Amethyst was selected. Amethyst enforces design patterns that help guide developers that are new in the gaming space. One of these patterns is called ECS, which I will get to later.
After selecting an engine, we needed graphics. Some quick research taught us that tiled based game are built with so-called sprite sheets. These are image files with “tiles” of a known size.
We load the image files into the engine, and then draw our scene using a tmx file and the rs-tiled library. The tmx file — an XML file generated by Tiled — forms a map by describing the placement of each tile.
Earlier I mentioned Amethyst’s ECS system. ECS stands for Entity, Component, System. An entity contains any number of components, which can be arbitrarily added (similar to a relational database).
For example, a player is an entity, which has components “Transform and sprite”. When you change elements in the transform component, the engine knows to change the sprite’s location on the screen, thus moving the character. There are several other co-relations between components like this that make working with Amethyst very pleasant. A system defines how the game acts by changing components of entities. Systems will execute every iteration of the game loop and will execute in parallel if possible. For instance, one of our systems will manage the character’s location. It runs every game loop and checks for player input. If the player requests a move, it will update the transform component in the player entity. Systems are designed so that you can bring in whatever components you need to run the game.
We’ve been working on the game (lightly) for around a month now. We are at the point where we can draw maps and move a character around. Follow me on Medium for next month’s update!
Contributing: We are looking for people who are interested to help out. No commitment required and any skill level is welcome. Please reach out if interested!