Hands-on Rust: Effective Learning through 2D Game Development and Play (PragProg)

Sorry about the delay in replying - family decided we needed to celebrate beta release 1!

The book walks you through installing Rust and writing some console programs to get you started with the language. Then it turn to Flappy Dragon (a Flappy Bird clone). Then you build and iteratively improve a dungeon crawler (roguelike) over the subsequent chapters. It introduces ECS in the Compose Dungeon Denizens chapter - and uses the ECS architecture from that point onwards.

The book uses Bracket Lib for rendering and helper functions rather than libtcod. That’s the same back-end I use in the tutorial on my website. I actually created it (a long time ago!) before there were good libtcod ports available, but tcod was a huge influence on its design. The book doesn’t delve into the very-low-level land of actually initializing a window, putting glyphs on the screen and maintaining console state efficiently; that wouldn’t be very newcomer friendly and the art of initializing a GL/Vulkan/Metal context and keeping it happy could easily fill another 300 pages. Instead, the book sits just above the hardware-specific layer. Readers learn to manage game loop, timing and engine state - but use the virtual console to actually render output and receive keystrokes.

Likewise, I used Legion for the ECS library. I’ve written ECS libraries, and would love to walk people through making them one day - but that could easily be a book in and of itself. Legion is a very good library - and (starting with 0.3) is pretty user-friendly. So I went with it. Also, the people who wrote it have been very helpful in putting the book together.

WASM. Bracket-lib supports WASM output (the tutorial you linked has playable WASM builds of every example), but the book doesn’t dig into WASM builds in much detail. I plan on releasing an article on my website (linked from the book) that will explain how to do this, closer to the end of the beta cycle.

It’s worth noting that while the dungeon crawler/roguelike is the primary example - it’s not a book about dungeon crawlers (the tutorial is 100% about roguelikes). The outlining process actually started with a curriculum of what the newcomer needs to learn to become good at Rust. Then the game examples are constructed around that, teaching the language by making games - and having fun along the way. (The original working title was “Learn Rust by Making Games”)

I hope you enjoy the book! My driving motivation is always “I hope people make fun things with this”. It seriously makes my day when someone sends me a message about something they’ve built. :slight_smile:

6 Likes