Hands-On Rust: Feedback/impressions from beta 1

Title: Hands-on Rust

I’m caught up to the end of the current beta, and thought I’d pass along current impressions. (If this is the wrong place, or inappropriate, just say so)

I’m rather enjoying putting the game together. Games are not an area I’ve explored before.

That said, I’m mainly here to learn Rust. I feel like, at this point, my focus is much more directed on learning more about Legion, etc. and how it’s systems work, and don’t really feel that I’m picking up much “new Rust” in the past couple of chapters.

There’s also a bit of a feeling that all the Legion macros and the like are isolating me from what’s really going on. For example, not much explanation of why the functions I create in the systems modules are never called directly in my code. I’ve done enough work with other frameworks to intuit that the framework is taking those functions and generating the *_system() functions to wire everything up. (Similar feeling re: the #[resource] annotations, etc.). I understand that a book at this level isn’t going to explain how to write macros (maybe even read them), but feel like it could use a bit more elaboration on what they’re setting up for me (they are wetting my appetite to learn more about hem as I get my bearings about me more with basic Rust).

I suppose those suggestions seem a bit contradictory (more explanation of what legion is doing, less focus on Legion and more on Rust), but I feel they’re associated.

Looking forward to next beta.

3 Likes

Thank you, I’m glad your enjoying it!

Legion does take care of quite a bit of state management behind the scenes - and it really would require its own book to get into the gory details. It’s very similar to maintaining your own structs - both for components and resources. (You can get 90% of the way to your own resource system with the lazy_static crate, by the way). The curriculum behind the last two chapters in beta1 are focused on reinforcing state management - which is vital to any Rust program - and getting the user really comfortable with iterators. Iterators are amazing, and used judiciously they make Rust a joy to use for real-world programs. So the iterator examples are gradually gaining complexity, with a view to helping the reader sublimate the idea behind them: they are a really useful view into your data that lets you filter, transform and aggregate data to get exactly what you need in an efficient manner.

Beta 2 (its off to production, should be available this week) includes a lot of fixes, and two more chapters.

The first continues in the iterator/state vein, while bringing in some useful math utilities and introduces message-passing as a concept. So many modern Rust apps use the messaging model that it’s an important concept for the reader. You’ll also learn about some gamedev concepts - using components to differentiate entities, rendering a HUD and using the console for debugging.

The second chapter introduces a big core Rust feature: traits. You’ll consume traits and implement trait methods (you’ll write your own traits in a later chapter) - which is fundamental knowledge for working with Rust’s ever-growing library infrastructure. This will help you learn about Dijkstra/flow maps (a gamedev concept, also very useful whenever you need graph traversal in a non-game), sorting, and a bit more state management.

The book itself is structured around the idea of learning as you go - so it’s introducing new things and then reinforcing them with practical gamedev. By the end you’ll be enjoying serialization, creating your own traits and will have what you need to write most Rust programs. There isn’t room to get into really advanced topics like writing your own macros and complex generic types - but some of those will be up on my website (linked from the book’s final chapter) for free. With any luck, I’ll get to write more books, too!

2 Likes

I really can’t wait to start reading this book :blush: and anything you can do to make the journey easier for those new to Rust will be greatly appreciated - by me if no-one else - I’m not the smartest person around so can do with all the hand-holding and help I can get :see_no_evil:

Thanks for all your hard work on this book Herbert, and to everyone who’s been providing feedback too - I’m sure with your help the book is going to be even better :nerd_face:

1 Like