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

Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters—and what better way to learn than by making games. Each chapter in this book presents hands-on, practical projects ranging from "Hello, World" to building a full dungeon crawler game. With this book, you'll learn game development skills applicable to other engines, including Unity and Unreal.

Herbert Wolverson @herbert

Tammy Coron @Paradox927

Rust is an exciting new programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters—and what better way to learn than by making games. Each chapter in this book presents hands-on, practical projects ranging from “Hello, World” to building a full dungeon crawler game. With this book, you’ll learn game development skills applicable to other engines, including Unity and Unreal.

Rust is an exciting programming language combining the power of C with memory safety, fearless concurrency, and productivity boosters. With Rust, you have a shiny new playground where your game ideas can flourish.

Each chapter in this book presents hands-on, practical projects that take you on a journey from “Hello, World” to building a full dungeon crawler game. Start by setting up Rust and getting comfortable with your development environment. Learn the language basics with practical examples as you make your own version of Flappy Bird. Discover what it takes to randomly generate dungeons and populate them with monsters as you build a complete dungeon crawl game. Run game systems concurrently for high-performance and fast game-play, while retaining the ability to debug your program. Unleash your creativity with magical items, tougher monsters, and intricate dungeon design. Add layered graphics and polish your game with style.


Herbert Wolverson has worked as a programmer and an indie game developer since the late 1990s. He’s taught programming and IT skills at a variety of levels, contributes to multiple Open Source projects, and is active in the game development scene.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

7 Likes

Corresponding tweet for this thread:

Share link for this tweet.

1 Like

This looks like a really nice, fun way to learn Rust!

It’s on my list of books I’d like to read one day :nerd_face:

2 Likes

I’m really excited to have this Rust book from Herbert Wolverson @herbert available now in beta. I’m trying to convince the author to do a Rust Brain Teasers book when he recovers a bit from writing this book, so hopefully, we have even more content to look forward to on Rust.

3 Likes

I’m excited to have the book out in beta! Hopefully, I’ll be able to get to work on the Brain Teasers very soon. I have some fun ideas cooking for that one. :slight_smile:

Thanks for all the hard work on the book!

3 Likes

Brain Teasers sounds like a good idea Margaret!

Hi @herbert, do you think it might be worth including a chapter on Rust for WebAssembly too? I think a lot of people interested in Rust will be interested in it for that (me included!) I know PragProg have a Rust/WASM book but I wonder if including something in your book could be beneficial as well?

1 Like

I’ve had this book’s sales page open and have been looking for the buy button for two days! I’ve got so many questions!

  • Is it correct that this book includes a basic flappy bird clone and then most of the book is devoted to a single dungeon crawler?

  • Does it use libtcod like this (great) Rust-based roguelike tutorial I’ve gone through?

  • Is the resulting dungeon crawler WASM-compatible? One thing I really wished after building my first Rust roguelike was that I could have shared it on a web site.

  • How much does the book lean on higher-level libraries for the graphics and I/O?

  • Does the dungeon crawler use an ECS?

Thanks so much for making a Rust book on games!

Edit: I just realized that you’re the one behind bracketproductions.com and that your ECS-based roguelike tutorial was recommended to me as a next step by the author of the tutorial I did. Really looking forward to your book!

3 Likes

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:

5 Likes

Ah nice, thanks Herbert! :smiley:

Sounds great, and makes me want to read this book even more :nerd_face:

2 Likes

This looks like a great book, definitely looking to buy it. Small question, where can I see how much of it is finished? I tried to find some sort of progress details on the book page on pragprog and couldn’t find it.

Thanks for writing it.

3 Likes

The 1st beta takes you up to the end of Take Turns with the Monsters, and includes two of the three appendices. Subsequent betas will add chapters until its all done (getting the beta now includes subsequent betas and the final e-book). I believe the goal is to release betas every couple of weeks until its done.

6 Likes

Congratulations @herbert!

3 Likes

Thanks @herbert for building a book for Rust community. Most of us Rust beginner are stuck in between noob and intermediate.

I hope to reach that advance level with this book. I will buy this now (ʘᴗʘ✿)

3 Likes

The excitement in this thread is making me want to put Rust (and this book) higher up my learning list :see_no_evil:

I wonder if those of you who are going to be getting this book might be interested in writing a journal about your experience, or, if there’s a few of you perhaps even start a book club thread (like the one a few of us currently have here)? I am sure lots of people would be interested in reading your thoughts about this book - I know I would :blush:

4 Likes

Herbert Wolverson also has some quality free learning material for Rust. One third of my Rust bookmarks consist of free learning material he produced. I’m also planning to buy this book somewhere in the next year.

5 Likes

Never seen a language reach the level of coolness that Rust has and this book appears to be a very good way to get started. I am also happy wasm is to be covered even if by supplemental content—thank you, @herbert :crab:

3 Likes

Hands-in Rust looks like a great book during the winter break. I know what I want for Christmas!

3 Likes

read the book. Now I understand ECS system really well. So far the book is till Message Queue for movement, more to be added soon.

Im hoping I can use the learning with Bevy engine to make a 2D game :slight_smile:

2 Likes

Beta 2 is out :nerd_face:

B2.0 Updates include:

  • Added Chapter 8, Health and Melee Combat
  • Added Chapter 9, Victory and Defeat
  • Numerous errata fixes
3 Likes