January 25, 2024 - Programming a Dungeon Crawler Roguelike in Rust
Dungeon Crawler Roguelike from Hands-on Rust by Herbert Wolverson
As part of becoming a programmer rather than just a coder, I've been learning the Rust programming language. Although I've already successfully contributed Rust code to an open source project, I saw a lot of area capacity to learn more.
Over the last month, I've been working through the second half of Hands-on Rust which takes a project-based approach to learning the syntax, paradigms, patterns, etc. The projects are two very simple video games: A Flappy Bird clone, and a Roguelike Dungeon Crawler.
Deploying the game to this website required a few more days of work. The framework that allows the game to be playable in the web browser is called Web Assembly, or "WASM". It is still a relatively new technology and support for it within web browsers and hosting providers is still spotty.
Dungeon Crawler Roguelike
You can play it in your web browser. It is a basically a class-project and more of a proof-of-concept than a finished game.
You will need a keyboard to play and your screen resolution should be >= 1024 pixels wide. If you are using an Ad Blocker that blocks scripts, you will need to turn it off in order for the game to load.
I made a minimal number of customizations to the game that differ from the book project, mostly to make it more challenging. As of this writing, I can only win it about 25% of the time. Although I'd love to continue working on this, fixing gameplay issues and adding enhancements, I think moving on to another project will help me learn more faster.
Hands-on Rust
Hand-on Rust is an excellent book, and I highly recommend it to folks who are:
- new to the rust programming language
- like video games
- learn well through guided projects / tutorials
The book starts with the absolute basics of installing Rust, and goes all the way to discussing concurrency and many of the idiosyncratic features of Rust like the Borrow Checker and Traits. The author also wrote a follow up blog post about compiling and deploying the completed games to the web using Web Assembly ("WASM") so that they can be played in a web browser and not just on a desktop.
When I finished the book, I had the sad feeling that it was over - like I felt when I finished watching the final episode of The Expanse TV series. Fortunately, I understand that the author intends to release another book that I'm hopeful will focus on using the Bevy game engine which is built with Rust.