Rust Quest: retro terminal adventure to help beginners learn Rust, written in Rust

A retro terminal adventure that teaches Rust through 14 quests, runnable demos, quizzes, ranks, dungeon bosses, and links to official Rust docs. The codebase is heavily commented so you can learn how the game works while learning how Rust works.

Quest map (14 quests)

# Quest Topics
1 :package: Cargo build, run, test, doc, manifest
2 :1234: Types primitives, mutability, tuples, arrays
3 :crab: Ownership move, borrow, slices
4 :building_construction: Structs & Enums match, impl, derive
5 :warning: Errors Option, Result, ?
6 :books: Collections Vec, String, HashMap
7 :high_voltage: Traits & Generics traits, bounds, impl Trait
8 :hourglass_not_done: Lifetimes 'a, elision, struct lifetimes
9 :card_index_dividers: Modules & Prelude mod, pub, use, prelude
10 :counterclockwise_arrows_button: Iterators & Closures map, filter, closures
11 :brain: Smart Pointers Box, Rc, Arc, RefCell
12 :thread: Concurrency threads, Mutex, Send/Sync
13 :white_check_mark: Testing & Docs #[test], cargo doc
14 :rocket: Advanced Cargo features, workspaces

Epic phases & dungeon bosses

Quests are grouped into four story arcs tied to The Rust Book. When you finish the last quest in a phase, a dungeon boss fight unlocks β€” a mixed quiz using each quest’s boss question from that phase (β‰₯75% to win, +50 bonus XP).

Phase Quests Boss Book chapters
The Cellar β€” Foundations Cargo β†’ Errors (5) :ogre: Borrow Checker Warden Ch 1–6, 9
The Archives β€” Abstractions Collections β†’ Lifetimes (3) :moai: Generic Golem Ch 8, 10
The Forge β€” Craft Modules β†’ Smart Pointers (3) :ghost: Closure Phantom Ch 7, 13, 15–16
The Summit β€” Mastery Concurrency β†’ Advanced Cargo (3) :dragon: Thread Dragon Ch 11–12, 14

Complete all 14 quests to become :crown: Rust Quest Champion β€” a full victory celebration with treasure, potions, and a nudge to revisit every quest and resource link.

Hi, just looking at the project description, I’m wondering if it’s the game contents that relate to learning Rust, or rather just the looking through the source code.

Also if you want to make this more interesting to read – I assume not everyone would just download and execute a random project just to get a feeling what it’s about/like – you might want to share some images as to what the gameplay actually looks like. This may be e.g. screenshots, it could also be videos/gifs: Especially for terminal-based environments, there are dedicated tools that can easily record some (part of an) interactive session into a small file.

Yes each dungeon room maps to a Rust Programming book chapter teaches you 3 code lessons and then tests your knowledge. It is actually fun and has helped me learn the la gauge myself. My 12yo loved it and so I thought it would be fun to share with community.

Downloading the source and reading it is extra credit and just helps people learn it even more deeply to see it in action and making it a game helps people learn it also. Experimental idea!

Good feedback on screenshots, excellent idea.

The act of downloading a Git project, installing rust and running the game via cargo run is itself an intro lesson to get people acquainted with that workflow.

The project came from me helping a college student learn about Git and Rust.

Hmmm.
I am not sure if part of the game is getting the failing tests from

cargo test

to pass?

failures:
game::ui::retro::tests::main_menu_frame_ornaments_match_box_width
game::ui::retro::tests::top_and_bottom_match_side_rows

because when I run the game and select "Quest Map" the display is messed up and looks like.

Is that the game, a good challenge to fix the game so you can play it. But looking at those failing test functions they look like they call other functions and use math and that might not be "beginner"

Is fixing that broken "Quest Map" or the two failing tests part of the game?

Maybe on my free time today I will dig in while I await your response.

ps
On 13.5 debian. Tried gnome-terminal and alacritty 0.18.0-dev both had the same issue with the map.
pps
the image should be a video because everything is flashing around the screen, the game does not freeze, just can not read the map.
The other stuff I tested "worked", ie the resources loaded in my browser.

Could be a terminal sizing issue? Try in windows terminal? What OS? Will check on this in a bit. Thanks for giving it a try.

Ok I applied some fixes that might help with UI redraw and display width. However I could not reproduce. I found issues under WSL and older Rust so also added support for older Rust versions.

LMK if this helps,

The idea is after you beat the game and win you go back and read remaining resources and then read the source code itself to see how the game was built.

I could integrate the process more and teach from examples within the actual game code if that would be more interesting. Trying to make it approachable by beginners and even kids if possible.

Some people like forum mods don't quite understand the concept so I should explain it even more in the README. I'm curious to hear your feedback when you get it working.

Cheers,

linux debian 13.5
Current rust.

Thanks for paying attention....

LOL.....how do I do an update.
Just kidding. I know.

cd rust-quest
git pull
cargo test

All the test pass but there is warning about dead code.

warning: function `enable_windows_vt` is never used
  --> src/game/ui/terminal.rs:53:4
   |
53 | fn enable_windows_vt() {}
   |    ^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

The flicker on the Quest Map is now gone, but the image looks basically the same. The line lengths look off.
If I resize my terminal window and use the scrollbar I can see the "Cargo Workflow" is highlighted a different color. The arrow keys do not work, the highlighted text does not change. "esc" and "q" work and bring me back up the main menu.

I also tried it on my systems non-gui terminal and still it looks skewed.

So I played a bit anyway.
Kind of fun, (to simple for me but I am not a total noob.)
I hit "enter" and played the Cargo Workflow and it worked.
When I went back to the "Quest Map" and hit "Enter" the "Types and variables" room started.

The content of the Cargo Workflow was fine and understandable. I will take a break and play more later.

If you fix the Quest Map display, you may have a good resource for beginners. The code is readable and it appears you took the effort to design so others can modify.

One more thing..

cargo clippy

points out a couple of issues. One with "format!" inside another "format!" and another about calling "iter().copied().collect()" instead of "to_vec()"

EDIT.
Ok, I played a bit more. Now about the content...

The "Study the runes" parts are hard to understand what is code and what is advice. You mix comments about the code and code. Some of your comments about the code look like it could be code? I suggest in the start you teach a little bit about

  • What a "line" of code is.
  • What a comment is.
  • What a block is.

Then in your "Study the runes" parts instead of something like this where when I read it looks like the part "len = 5" is code and should be an error because len is not "mut". Or is the "len = 5" a comment telling us what len has been set to.

Step 3 β€” shared borrow (&T)
  let len = s3.len();  // &s3 implicitly
  len = 5 β€” we read s3 without taking ownership.
  Many &T borrows are allowed if nobody has &mut.

If you teach a little in the start about what code and comments are, you could write your runes like this.

// Step 3 β€” shared borrow (&T)
  let len = s3.len();  // &s3 implicitly
//  len = 5 β€” we read s3 without taking ownership.
//  Many &T borrows are allowed if nobody has &mut.

Or you might just want to do it another way.

# Step 3 β€” shared borrow (&T)
  let len = s3.len();  // &s3 implicitly
# len = 5 β€” we read s3 without taking ownership.
# Many &T borrows are allowed if nobody has &mut.

That is also easier to see what is code and what is talking about code.