With "Followed", I wanted to create a simple game that gave the exprience of exploring a labyrinth. It features randomly generated mazes, a simple 'camera', fog of war, and enemies with AI of varying complexity.
I got an
excellent book on maze generation last christmas (2019), which taught me more or less everything I know on the subject. In general, maze algorithms involve creating a spanning tree structure by connecting nodes, where edges are 'passages' and vertices are 'cells'. The new game logic grandomly requests a maze generated by one of three algorithms I've implemented to date.
I took this project as an opportunity to learn rust, and deploy a community supported lambda runtime using the serverless framework. I found rust a lot of fun to work with, although I would say it has a learning curve, owing to its extensive vocabulary. Rust enabled me to easily work with byte level data, which allowed me to create a hyper efficient transport encoding for the mazes. Each maze is a flat vector of bytes, where each cell is a byte. The passages are simply represented as positive bits. Check out the library I wrote to drive this project
here.
The API is actually capable of rapidly generating much larger mazes than the web application can draw. I hope to reuse it in a more intricate, 3D project some day.
For testing purposes I exposed the same underlying maze generation logic as a CLI that you can install with cargo.
Check it out on github.