Game Development in Rust
Hey I wrote a book! You should buy it!
It's been out for two months, so it's probably time to actually blog about it. In the spirit of Scott Hanselman saying I have a "finite number of keystrokes" I'm going to base this on the twitter thread I already wrote, specifically on how the book came to be.
Game Development has been a semi-professional hobby of mine for m entire career. My first job was at a AAA game company, I got laid-off by Take Two, I have a masters in Video Game Development, and I've done a bunch of mini-hobby games for talks and fun. I've never returned to the game industry for practical reasons. The "Game" industry generally doesn't put much stock in traditional software development, so my experience wouldn't be considered particulalrly useful. They frequently work very long hours and pay poorly, admittedly a broad generalization, so I've let it be a sometimes hobby.
When COVID hit I started watching Twitch streams, and eventually started doing my own. I guess it was the programmer version of starting a podcast without starting a podcast. I was learning Rust and Godot in public, and wrote a blackjack game and an iPhone app. So I blogged about it:
https://paytonrules.com/post/games-in-rust-with-godot-part-one/
Unfortunately the blog becamse obsolete almost immediately, but it caught the attention of Packt who reached out and asked about a book. We spent some time going back and forth on a proposal, a looong time in fact, and settled on Rust and WebAssembly. Why not Godot? Well at the time I thought Godot 4 was just around the corner, and I'd get burned by the code changing underneath me. It turns out Godot 4 is still in development but the way you write Rust in Godot has changed again significantly, so it was the right call. No shade to Godot - I still think it's great!
The book itself is essentially just me writing an endless runner and you getting to follow along. Most of the game was developed on-stream, although eventually I dropped that as deadlines loomed, and you can play it at https://rust-games-webassembly.netlify.app. The game doesn't use an engine, since that space is changing rapidly as well, and instead you create your own small one loosely based on XNA. When I say loosely - it's the basics - but more than enough to get yourself started for a game jam or to understand what the heck the Bevy docs are talking about.
I'm particularly proud of the sections on state machines, which I ended up completely rewriting. Apologies to my poor suffering editor Feza who had to get versions of chapters that were "done" that looked completely different on second draft. A big thanks to @brooks_patton and https://twitter.com/ironchamber for acting as tech reviewers. Without them it would be a significantly worse book.
What's to come? Well the book is available at Packt and amazon. There's some challenges at the end that are still being developed. I'm going to try and stream those (the first is already done) over on my twitch stream just as soon as I get consistent time and discipline. I hope to hear from you all working on your own games, and you can always track me down on the hellsite/twitter.