A complete text-based adventure game framework in Rust. Create, play, and share interactive stories with rich narratives and inventory systems.
-
Build the project:
cargo build --release
-
Create a new adventure:
./target/release/nemu create my_adventure
-
Play the adventure:
./target/release/nemu play my_adventure/my_adventure.toml
-
Try in-game commands like:
look- examine your surroundingsgo north- move in a directiontake key- pick up itemsinventory- check your items
- Room-based navigation with text descriptions and atmospheric details
- Inventory system with item combinations and usage mechanics
- Save/load game states with multiple slots and quick save/load
- Natural language command parsing
- Story files in TOML format with scripting capabilities
- Complex branching narratives with flags and conditions
- Rust (latest stable)
# Clone the repository
git clone https://github.com/yourusername/nemu.git
cd nemu
# Build the project
cargo build --release
# The binary will be available as 'nemu' in target/release/# Create a new story template
./target/release/nemu create my-adventure
# Validate a story file
./target/release/nemu validate my-adventure.toml
# Play a story
./target/release/nemu play my-adventure.tomlOnce playing a story, use these commands:
look- Look around the current roomgo [direction]- Move in a direction (north, south, east, west)n/s/e/w- Short forms for directionstake [item]- Pick up an itemdrop [item]- Drop an iteminventory- Check your inventoryhelp- Show available commandsquit- Exit the game
Stories are written in TOML format. Here's an example:
[story]
title = "The Mysterious Forest"
start_room = "forest_entrance"
[rooms.forest_entrance]
title = "Dark Forest Entrance"
description = "You stand at the edge of a dark forest. Ancient trees loom overhead."
exits = { north = "deep_forest", east = "clearing" }
items = ["stick"]
[rooms.deep_forest]
title = "Deep in the Forest"
description = "Thick branches block most sunlight. You hear mysterious sounds."
exits = { south = "forest_entrance" }
items = ["mushroom", "berries"]
[items.stick]
name = "wooden stick"
description = "A sturdy stick that might be useful."
[items.mushroom]
name = "strange mushroom"
description = "A glowing mushroom that seems to pulse with light."
[items.berries]
name = "red berries"
description = "Small red berries that smell sweet."-
Create a new story:
cargo run -- create my_adventure
-
Look at the generated story:
cat my_adventure/my_adventure.toml
-
Play the story:
cargo run -- play my_adventure/my_adventure.toml
-
In the game, try:
look- to see your surroundingsgo north- to move to another roomtake key- to pick up an iteminventory- to see what you're carrying
# Build in debug mode
cargo build
# Run directly
cargo run -- create my_adventure
# Play included examples:
cargo run -- play haunted_house.toml
cargo run -- play ancient_temple.tomlsrc/
├── main.rs # CLI entry point
├── lib.rs # Library exports
├── engine/
│ ├── mod.rs # Game engine module
│ ├── game.rs # Main game state
│ ├── room.rs # Room management
│ ├── item.rs # Item system
│ └── parser.rs # Command parsing
├── story/
│ ├── mod.rs # Story loading
│ └── loader.rs # TOML parser
└── cli/
├── mod.rs # CLI commands
├── play.rs # Play command
└── create.rs # Story creation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Test your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT