Tech


This gamejam entry is completely written from scratch in Rust.

The repository for the dinojam code can be found here.

I started by copying some boilerplate for opening a window and drawing pixels to it from my castle-game rewrite: dinojam commit

To enhance the development process, I employed an asset manager that dynamically reloads files from disk when changes occur. For release builds, it seamlessly switches to using embedded assets. Additionally, I’ve included a straightforward font-rendering script based on a horizontal texture of symbols.

All the pixel art in the game was made using Aseprite and then exported as PNG files into the ‘assets/’ folder. Customizable configurations that can be hot-reloaded are stored as TOML files in the same directory.

Initially, I experimented with a virtual camera setup, but it quickly became cumbersome. As a result, I refactored every game object to move with a negative velocity. This approach not only streamlined the code but also prevented potential issues with excessively large position coordinates, which could lead to floating-point inaccuracies.

I briefly considered adding sound, but that meant I had to implement a whole sound engine and I also didn’t feel like spending a lot of time making music, which I’m not particularly good at.

Rust Crates

Here’s a list of Rust crates that are used and what they are used for:

  • winit: Create a window and handle window and input events
  • pixels: Draw pixels into the ‘winit’ window using a single pixel buffer
  • *blit: Draw sprites onto the pixel buffer
  • game-loop: Split the game into a separate render and update loop
  • miette: Error handling
  • image: Load the PNG sprites
  • *rotsprite: Rotate pixel art sprites with fewer artifacts
  • vek: Geometry primitives
  • assets_manager: Asset manager
  • serde: Deserialize configuration files
  • tokio: Game loop async runtime
  • fastrand: Random number generation
  • puffin: Profiler

*: crates authored by me

Get Darwin's Ascent

Leave a comment

Log in with itch.io to leave a comment.