Version 1.0.0
A retro terminal adventure that teaches Rust through 14 quests, runnable demos, quizzes, ranks, dungeon bosses, and links to official docs. The codebase is heavily commented so you can learn how the game works while learning how Rust works.
๐ฏ๏ธ The Dungeon Master speaks: Shadows of bad code creep across the Kingdom of Rust. Only a brave hero who masters ownership, traits, and the borrow checker can restore the realm. Sync this repo, run cargo run, and step through the mossy gate โ your legend begins at the hub campfire.
Your kit: ๐ง wizard ยท โ๏ธ๐ก๏ธ combat ยท ๐ฏ๏ธ torchlight ยท ๐ scrolls ยท ๐งญ๐บ๏ธ quest map ยท ๐ฃ logic bombs ยท ๐ฅ streak flame ยท ๐ฒ Dungeon Master ยท โค๏ธ hearts
Prerequisites: Rust 1.75+ (install via rustup or your distroโs rustc/cargo packages). Use Windows Terminal, WezTerm, or iTerm2 for emoji and colors.
rustc --version # must be 1.75.0 or newergit clone <your-fork-or-repo-url>
cd rust-quest
cargo run # enter the hub โ the Dungeon Master welcomes you
cargo test # run tests
cargo doc --open # browse annotated API docsOn first launch you enter the hub with a ๐ฒ Dungeon Master intro inviting you to save the Kingdom of Rust. Pick quests from the crossterm ๐งญ Quest Map ๐บ๏ธ, and progress is saved to .rust-test/progress.json.
Contributing? See CONTRIBUTING.md. AI / agent contributors: see AGENTS.md for architecture, save format, and safe edit boundaries.
Dedicated to Ayush โ built to help you learn Rust by playing a game and reading the source. You've got this. ๐
Hub โ main menu
Quest map โ pick your next room
Challenge โ quiz battle
Gameplay & systems
- Hearts vitality system (quiz, healing potions, save schema v6)
- Background music with fixed, cycle-on-quest, and mute modes
- Auto-chain to the next quest after passing a challenge
Progress & save
- Versioned JSON progress with music and hearts persistence
Quests & learning
- 14 quests with demos, shuffled quizzes, and boss questions
Story & narrative
- Dungeon Master hub intro, per-quest rooms, four epic phase bosses
See Game Features (v1.0.0) for the full catalog.
| Feature | What it does |
|---|---|
| 14 quests | Cargo โ Advanced Cargo; sequential unlock, demos, memory-safety notes, official doc links |
| Learn / Challenge / Resources | Study runes (+15 XP once), quiz foe (+25 XP), open book & video scrolls in-browser |
| Quest map | Crossterm map โ pick rooms, auto-chain to the next quest after a passed challenge |
| Sandbox | Replay any quest demo without XP pressure |
| Practice mode | Unlock All skips the sequential lock for replay |
14 cargo run --example โฆ |
Standalone runnable demos per topic |
| Feature | What it does |
|---|---|
| Challenge quizzes | 4 questions per quest (3 + boss); choices shuffled; โฅ75% to pass |
| Hearts (vitality) | Start with 3 โค๏ธ (max 5); wrong answers โ1, correct +1; saved in progress |
| Weakened state | At 0 hearts you cannot fight โ DM directs you to heal first |
| Healing potions | Restore hearts via Learn, Resources links, post-quiz book chapters, book study guide |
| Epic dungeon bosses | Four phase bosses after each arc โ mixed boss quizzes, +50 bonus XP |
| Achievements | e.g. No Panic, Borrow Slayer, phase boss clears, Full Stack Rustacean |
| Feature | What it does |
|---|---|
| 10 ranks | Initiate โ Champion; tied to quest completion, not XP alone |
| XP bar & streak | XP once per learn/challenge step; ๐ฅ streak for consecutive play days |
| JSON save | .rust-test/progress.json โ versioned schema with migrations (hearts, music, bosses, โฆ) |
| Champion victory | One-time celebration when all 14 quests are cleared |
| Book study guide | Hub menu list of book topics outside the 14 quests, with links |
| Feature | What it does |
|---|---|
| Dungeon Master hub intro | Welcome lore for new heroes; nudge toward the next unfinished quest on return |
| Per-quest rooms | Room arrival, foe taunts, learn/challenge copy in narrative.rs |
| Four epic phases | The Cellar, Archives, Forge, Summit โ each with a named boss and book chapter tie-in |
| Post-quiz book prompt | Offer The Rust Book chapter after a pass (defaults Yes if any answer was wrong) |
| Feature | What it does |
|---|---|
| Resource browser | Per-quest Rust Book, Rust by Example, std docs, YouTube โ hub or in-quest |
| Background music | MP3 auto-discovery in assets/music/ โ fixed track, cycle on quest start, or mute (saved) |
| Pinned track | Fixed mode keeps playing across quests without restarting from 0:00 |
Full agent-oriented details: AGENTS.md.
| Priority | Feature | Goal |
|---|---|---|
| ๐ฎ | More lore | Deeper DM copy, room descriptions, phase and boss storylines |
| ๐ฎ | Richer quizzes & bosses | Harder questions, varied boss mechanics, better feedback tied to mistakes |
| ๐ฎ | Broader topic coverage | Stronger beginner โ intermediate path (and room to grow beyond) |
| ๐ฎ | Difficulty setting | Easy / Normal / Hard โ select beginner, intermediate, or advanced topic depth per run |
Contributions welcome โ see CONTRIBUTING.md.
Main Menu - Hub (Player stats, Dungeon Master intro, hearts) wraps every return to the Main Menu. Pick quest steps in any order; Learn before Challenge is recommended.
Hub menu: ๐งญ Quest Map ยท ๐ Resources ยท ๐ ๏ธ Sandbox ยท ๐ Book study guide ยท ๐ Unlock All ยท ๐พ Reset ยท ๐ผ Music ยท โ Quit
Each quest follows four steps:
- ๐ก Learn โ see Rust concepts run with explanations (+15 XP once; lore potion when weakened)
- โ๏ธ Challenge โ 4 questions (3 + boss); need โฅ75% to pass; hearts rise and fall with answers
- ๐ฅ Reward โ XP, rank checks, achievements; auto-advance to the next quest on pass
- ๐ Explore โ optional links in your browser (scrolls also restore hearts when below max)
Background music plays from assets/music/ (MP3). Choose a fixed track or cycle per quest from the Music menu; mute is saved separately.
Quest map: โ/โ move ยท Enter select ยท Esc back
| # | Quest | Topics |
|---|---|---|
| 1 | ๐ฆ Cargo | build, run, test, doc, manifest |
| 2 | ๐ข Types | primitives, mutability, tuples, arrays |
| 3 | ๐ฆ Ownership | move, borrow, slices |
| 4 | ๐๏ธ Structs & Enums | match, impl, derive |
| 5 | Option, Result, ? |
|
| 6 | ๐ Collections | Vec, String, HashMap |
| 7 | โก Traits & Generics | traits, bounds, impl Trait |
| 8 | โณ Lifetimes | 'a, elision, struct lifetimes |
| 9 | ๐๏ธ Modules & Prelude | mod, pub, use, prelude |
| 10 | ๐ Iterators & Closures | map, filter, closures |
| 11 | ๐ง Smart Pointers | Box, Rc, Arc, RefCell |
| 12 | ๐งต Concurrency | threads, Mutex, Send/Sync |
| 13 | โ Testing & Docs | #[test], cargo doc |
| 14 | ๐ Advanced Cargo | features, workspaces |
Quests unlock in order. ๐ Unlock All lets you practice without waiting.
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) | ๐น Borrow Checker Warden | Ch 1โ6, 9 |
| The Archives โ Abstractions | Collections โ Lifetimes (3) | ๐ฟ Generic Golem | Ch 8, 10 |
| The Forge โ Craft | Modules โ Smart Pointers (3) | ๐ป Closure Phantom | Ch 7, 13, 15โ16 |
| The Summit โ Mastery | Concurrency โ Advanced Cargo (3) | ๐ Thread Dragon | Ch 11โ12, 14 |
Complete all 14 quests to become ๐ Rust Quest Champion โ a full victory celebration with treasure, potions, and a nudge to revisit every quest and resource link.
๐ Book study guide (hub menu): topics we donโt have a dedicated quest for yet โ control flow, functions, pattern depth, macros intro โ with links into the book.
Ranks unlock when you complete quests (challenge passed), not from XP alone.
| Rank | Requirement |
|---|---|
| ๐ฅ Initiate | Start playing |
| ๐ฆ Cargo Runner | Complete Cargo |
| ๐ฆ Memory Keeper | Complete Ownership |
| โ๏ธ Pattern Knight | Complete Structs & Enums |
| ๐ก๏ธ Error Handler | Complete Errors |
| ๐ Collection Hero | Complete Collections |
| โก Trait Master | Complete Traits & Generics |
| โณ Lifetime Sage | Complete Lifetimes |
| ๐๏ธ Module Architect | Complete Modules & Prelude |
| ๐ Rust Quest Champion | Complete all 14 quests |
XP (+15 learn, +25 challenge) fills a progress bar. โค๏ธ Hearts (3โ5) track quiz vitality โ heal via Learn, Resources, or book chapters. ๐ฅ Streak counts consecutive days you complete a step. Progress file: .rust-test/progress.json (schema v6; safe to delete to start over).
From the hub, open ๐ Resources โ open lore scrolls to launch browser links per quest โ the same scrolls available inside each questโs ๐ Consult scrolls step.
| Scroll | Opens |
|---|---|
| ๐ The Rust Book | Official book chapter for that quest |
| ๐ Rust by Example | Runnable examples for the topic |
| ๐ std docs | Standard library docs (when linked) |
| ๐ YouTube scrolls | Curated video links per quest |
Always-on references (also linked throughout quests):
- The Rust Book โ primary lore
- Rust by Example โ short runnable lessons
- Standard library (
std) โ API reference - Rust Reference โ language details
- rustup.rs โ install the toolchain and begin your journey
Per-quest URLs live in src/resources/links.rs and each src/topics/*.rs file.
| Command | Purpose |
|---|---|
cargo run |
Play Rust Quest |
cargo run --example ownership |
Run one quest demo |
cargo test |
Run game + topic tests |
cargo doc --open |
Read rustdoc |
cargo check |
Fast compile check |
Examples exist for every quest: cargo run --example cargo, --example types, etc.
| Command | Purpose |
|---|---|
.\scripts\run_tests.ps1 |
Full suite on Windows |
./scripts/run_tests.sh |
Same on macOS/Linux |
cargo test |
Unit + integration + doc tests |
cargo test -- --nocapture |
Show test output |
Test types: unit tests in src/game/*.rs, integration tests in tests/, doc tests in /// comments.
.
โโโ Cargo.toml โ bump [package].version for releases (currently 1.0.0)
โโโ README.md
โโโ CONTRIBUTING.md
โโโ AGENTS.md โ architecture for AI agents
โโโ assets/music/ โ background MP3 tracks
โโโ src/
โ โโโ main.rs
โ โโโ version.rs โ VERSION from Cargo.toml
โ โโโ game/
โ โ โโโ hub.rs โ hub + menus
โ โ โโโ narrative.rs โ DM room lore
โ โ โโโ ui/retro.rs โ boxes, title banner, main menu frame
โ โโโ topics/
โ โโโ resources/links.rs โ quest URL table
โโโ examples/
โโโ tests/
โโโ scripts/
flowchart LR
Play["cargo run"] --> Game["game/"]
Read["src/topics/"] --> Learn["Rust concepts"]
Game --> Topics["topics/"]
Game --> Narrative["narrative.rs"]
Suggested order for Ayush:
src/main.rsโ startup flowsrc/game/state.rsโ unlocks, XP, rankssrc/game/ui/map.rsโ crossterm quest mapsrc/game/narrative.rsโ Dungeon Master encounter copysrc/topics/registry.rsโ quest list- Any file in
src/topics/for a quest you played src/game/ui/retro.rsโ terminal styling and boxes
Look for comment prefixes:
// LEARN:โ Rust concept explained// GAME:โ why this game code exists
Agent contributors: start with AGENTS.md before editing hub, save format, or quest registry.
| Topic | The Rust Book | Rust by Example |
|---|---|---|
| Cargo | Hello Cargo | Crates |
| Types | Variables | Variables |
| Ownership | Ch. 4 | Ownership |
| Structs & Enums | Ch. 5โ6 | Structs |
| Errors | Ch. 9 | Error |
| Collections | Ch. 8 | Vector |
| Traits | Ch. 10 | Traits |
| Lifetimes | Lifetimes | Lifetimes |
| Modules | Ch. 7 | Modules |
| Iterators | Ch. 13 | Iterators |
| Smart pointers | Ch. 15 | Rc |
| Concurrency | Ch. 16 | Threads |
| Testing | Ch. 11 | Tests |
More: The Rust Book ยท Rust by Example ยท std docs ยท Rust Reference
| Error pattern | Meaning | Fix |
|---|---|---|
| use of moved value | ownership transferred | clone, borrow &T, or redesign |
| cannot borrow as mutable twice | two &mut at once |
narrow scope, use references sequentially |
| borrowed value does not live long enough | dangling reference | extend owner lifetime or return owned data |
Send / Sync trait bound |
unsafe thread sharing | use Arc<Mutex<T>>, understand sharing rules |
We welcome bug fixes, quest improvements, narrative polish, tests, and docs.
- CONTRIBUTING.md โ setup, PR checklist, code style, how to add quests and music
- AGENTS.md โ architecture and constraints for AI coding agents
Run .\scripts\run_tests.ps1 (Windows) or ./scripts/run_tests.sh before opening a PR.
MIT โ see LICENSE-MIT.
๐ฒ The Dungeon Master closes with this: Install Rust. Sync the project. Run one quest by ๐ฏ๏ธ torchlight, read the matching source file, and follow the ๐ book link when a ๐ฃ logic bomb stumps you. The Kingdom of Rust awaits โ see you at ๐ Rust Quest Champion.*


