3 ms·
If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials. In addition to the (very good!) tutorial on the OP by Toma
by otikik 7y ago
If you are interested in both roguelikes and rust, there's an embarrassment of riches for tutorials.
In addition to the (very good!) tutorial on the OP by Tomas Sedovic, I wanted to mention the rust roguelike tutorial by Herbert Wolverson / The Bracket:
http://bfnightly.bracketproductions.com/rustbook/ http://bfnightly.bracketproductions.com/rustbook/
The main difference is that on this case they use rltk_rs, a pure-rust library for roguelike development, instead of libtcod. It is also way, way longer.
I don't know how/if Hervert has even attempted at solving the issues mentioned by Tomas with regards to repetition / code generation and literate programming.
- runevault 7y agoOh this meets my interests very much. I was considering spending some time with rust during my Christmas vacation and this seems like a good candidate for leveling up my rust skills. Thanks for the link!
- TomasSedovic 7y agoFor what ever it's worth, anyone looking into starting a roguelike in Rust would probably do much better by folloving the The Bracket link above. In addition to it being a pure Rust library (which does make a difference when you get started, but also when you try to distribute your game) it compiles to WebAssembly as well meaning you can use the same code to produce a game that runs on the desktop and the web. And the tutorial covers much more ground as well, including ECS for those interested. And finally, both the tutorial and tcod-rs are barely maintained anymore. I try to address questions/fix serious issues from time to time, but the chances of this seeing any significant developments in the future are very slim. The RLTK stuff is actively maintained and developed. (I'm not the OP, but I did write the linked post, the tutorial -- which is based on the classic Python+libtcod one as well as started tcod-rs)
- izend 7y agoI've been looking for some more examples of using the Specs project, thanks!
- andolanra 7y agoThe bfnightly tutorial is a very good tutorial, but I do want to warn that it's not always terribly idiomatic Rust: Herbert was using the writing of the tutorial as a way of practicing Rust, so there are places where the explanations aren't quite correct and other places where the code isn't what an experienced Rust programmer would write. An example that jumped out at me (this from Chapter 8) was the use of &s.to_string() which is an expression that could be shortened to just s. (Specifically, s has type &str, calling to_string() on it converts it to a String, and borrowing it allows it to be coerced back to a &str but now with unnecessary copying.) Elsewhere (this from Chapter 3) it has explanations like > Copy and Clone allow this [type] to be used as a "value" type (that is, it just passes around the value instead of pointers) which is also not a correct explanation, or at least is a misleading one: things can still be passed by value even without Copy and Clone and without any pointers at all. (Arguably, he meant, "You can share the value without using borrows," but that's not what the explanation said.) That said, all this is nitpicky (and I suspect that Herbert would be receptive to feedback along these lines—I just haven't had a chance yet to provide it!) because the tutorial's explanation of roguelike-writing is still very good, and in fact I've been following it as a guide for writing a tutorial on top of a different Rust library myself! But I do want to warn about using it as a model for learning Rust specifically.
- platz 7y agoMy understanding is that the only reason for example literals can be passed without borrows is because in fact they are Copy