Introducing Gate

As I mentioned previously, I've been trying my hand at game development in Rust recently using SDL2. Even though SDL2 is a general purpose cross-platform game library, I still think it is good practice for a game developer to create a layer of code specific to their own needs that acts as a gateway between the game logic and everything else (rendering, audio, user input, loading and saving data, etc.). This keeps the game logic clean and helps with possible migrations later. So, I did write that layer of code. And after I wrote it, I thought others might benefit from seeing this code, so I decided to make it open source.

This is how Gate was created. Gate is tailored to my own use cases, so it might not line up exactly with what other game developers want, but it may be a good starting point regardless. Things like the user input and audio just ended up being a thin wrapper over SDL2, so there's not much exciting happening there. But the rendering uses an interesting shader that I wrote for displaying pixel art properly at any scaling or rotation. Also, the texture packing takes place as part of the build process, and I generate enums to easily reference assets from the source code. Pretty cool!

To go along with Gate, I made a demo game that demonstrates its capabilities. This is a simple 2D platformer, and it is also open source. It's actually pretty fun, despite being short. Currently, you need to build from source in order to actually play the game, which is a bit of a problem for non-coders. I'm hoping to make a WebAssembly/WebGL backend for Gate so that anyone can just play it on a webpage. If you just want to see some footage, you can watch this video.

Tags: coding, gamedev