Complete Roguelike Tutorial, using Rust + tcod
This is a port of the (in)famous Python+libtcod tutorial:
The code is all implemented but we plan to clean it up in a few places before splitting it into parts and writing the tutorial text.
The text is in the doc
directory, you can look at the rendered tutorial at:
Running the tutorial code
If you want to try running a part of the tutorial using the reference code here, all you have to do is run this cargo command:
cargo run --bin name-of-part
For example, if you would like to run the reference code that is at the end of Part 1 then you run this command:
cargo run --bin part-1b-movement
Contributing
The Rust source files in src/bin/.rs
are all auto-generated from the tutorial pages themselves.
The single source of truth for both the code and the final pages is in doc/
.adoc
.
If you want to make changes to the Rust files, you need to edit the corresponding pages in doc/
.
Note that since the code can be laid out in a different order than the tutorial, this involves a little bit of digging.
You can check the doc/rs/*.adoc
files for how is each final Rust file constructed from the tutorial snippets.
Building the Rust files
First, you need to have Asciidoctor installed.
Next, after making some changes to the files under the doc
directory, run the following:
make clean docs
This will generate the HTML tutorial as well as the corresponding Rust files in the target/tutorial/
directory.
You can preview them there and verify that everything looks correct.
src/bin/
Updating the generated files in Run the following command:
make update-cargo-bin
It will regenerate the documents and copy the Rust files into src/bin
src/bin
matches the source documents
Validating that Run:
make diff-rust
This will build the documents and diff them against the versions in src/bin/
.
They should match.
Contributing changes
Make sure you build build the documents, with no leftovers files and update the src/bin/
files:
make clean docs update-cargo-bin
Before opening a pull request, make sure that make diff-rust
ends up empty.
Project Status
The tutorial is more or less finished: all the chapters have been written.
You can follow them and build your own roguelike.
You can also check out this repository and run for example cargo run --example part-13-adventure-gear
to play the final version (or any of the previous ones).
There are of course things that could use updating, such as the language and general flow of the text.
The structure of the tutorial itself could use some cleaning up too and some e.g. the rand
crate we use is wildly out of date.
Finally, there are improvements and fixes that could be done in the tcod-rs
crate this tutorial is based on.
For more suggestions, check out the Issues section.
However, the original author has moved on to other things and no one else has volunteered to take over the maintenance of this repository.
Issues and pull requests will not be ignored, but it can take weeks before you get a reply. And anything involving more than a minimal time investment will likely take even longer.
Sorry!
If you do wish to help out with the maintenance, please open an issue or send en email to <[email protected]>.
Other Rougelike tutorials for Rust
The RLTK Tutorial by TheBracket - It uses the RLTK project developed by the same person - Unlike libtcod, RLTK is written in pure Rust which makes building and distributing your game easier
(feel free to suggest other tutorials!)
Thanks!
This tutorial has been put together by the following people:
(sorted alphabetically)