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

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!

5 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?

2 Likes

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!

4 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:

6 Likes

Ah nice, thanks Herbert! :smiley:

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

3 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.

4 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.

7 Likes

Congratulations @herbert!

4 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 (ʘᴗʘ✿)

5 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:

5 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.

6 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:

4 Likes

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

4 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:

3 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
4 Likes

It’s a really good book … I’m about half way through. :grinning:

5 Likes

I have the book but still need to find time to work through it, maybe this holidays …

2 Likes

Glad you like the book! Herbert is working on another Rust book, which is now in beta: Rust Brain Teasers: Exercise Your Mind by Herbert Wolverson

5 Likes

Purchased :sunglasses:

4 Likes

A post was split to a new topic: Hands on Rust: Need help with error - thread ‘main’ panicked at 'Failed to load texture