Skip to content

EazyTom/rust-quest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Rust Quest ๐Ÿง™โš”๏ธ

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


Quick Start โ€” Answer the call

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 newer
git 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 docs

On 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. ๐Ÿ†


Screenshots

Hub โ€” main menu

Rust Quest hub main menu with player stats, hearts, and quest options

Quest map โ€” pick your next room

Rust Quest crossterm quest map

Challenge โ€” quiz battle

Rust Quest challenge quiz battle screen


What's New

v1.0.0 โ€” 2026-06-27

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.


Game Features (v1.0.0)

Core learning loop

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

Quizzes, hearts & bosses

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

Progress & persistence

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

Story & narrative

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)

Resources & Audio

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.


Planned Features

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.


How to play

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:

  1. ๐Ÿ’ก Learn โ€” see Rust concepts run with explanations (+15 XP once; lore potion when weakened)
  2. โš”๏ธ Challenge โ€” 4 questions (3 + boss); need โ‰ฅ75% to pass; hearts rise and fall with answers
  3. ๐Ÿ”ฅ Reward โ€” XP, rank checks, achievements; auto-advance to the next quest on pass
  4. ๐Ÿ“– 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 Map (14 quests)

# 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 โš ๏ธ Errors 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.


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) ๐Ÿ‘น 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 & Progress

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).


In-game Resources (๐Ÿ“œ hub menu)

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):

Per-quest URLs live in src/resources/links.rs and each src/topics/*.rs file.


Commands

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.


Testing

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.


Project layout

.
โ”œโ”€โ”€ 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"]
Loading

Reading the source code

Suggested order for Ayush:

  1. src/main.rs โ€” startup flow
  2. src/game/state.rs โ€” unlocks, XP, ranks
  3. src/game/ui/map.rs โ€” crossterm quest map
  4. src/game/narrative.rs โ€” Dungeon Master encounter copy
  5. src/topics/registry.rs โ€” quest list
  6. Any file in src/topics/ for a quest you played
  7. 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.


Official learning links

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


Appendix: common borrow-checker errors

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

Contributing

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.


License

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.*

About

learn rust. earn ranks.

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages