Skip to content
Port of the "Complete Roguelike Tutorial, using python+libtcod" to Rust + tcod
Rust Other
  1. Rust 99.5%
  2. Other 0.5%
Branch: master
Clone or download
tomassedovic Add `build-crate` make target
Not sure it'll be super useful, but it creates a proper crate in
`target/crate/` with the generated Rust files.

We can use it to easily run the generated code before updating the
`src/bin` contents.
Latest commit 5f6e593 Oct 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Use `Key::text()` rather than `Key.printable` Oct 2, 2019
src/bin Use `Key::text()` rather than `Key.printable` Oct 2, 2019
.dockerignore Add Dockerfile Jul 18, 2018
.gitignore
Cargo.lock Generate Rust code from the tutorial text (#53) Oct 1, 2019
Cargo.toml Fix the Cargo.toml maintenance key Oct 1, 2019
Gemfile Update Gemfile to build on recent systems Jun 13, 2018
Gemfile.lock
Makefile Add `build-crate` make target Oct 2, 2019
README.adoc Generate Rust code from the tutorial text (#53) Oct 1, 2019
arial10x10.png Import the current progress of the tutorial Aug 4, 2015
menu_background.png Import the current progress of the tutorial Aug 4, 2015
rustfmt.toml Formatted all the example code files with default rustfmt settings Apr 23, 2019

README.adoc

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.

Updating the generated files in src/bin/

Run the following command:

make update-cargo-bin

It will regenerate the documents and copy the Rust files into src/bin

Validating that src/bin matches the source documents

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 <tomas@sedovic.cz>.

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)

You can’t perform that action at this time.