A classic roguelike blackspire game built with Rust, featuring procedurally generated dungeons, turn-based combat, and an Entity Component System (ECS) architecture. Navigate through dangerous levels, battle monsters, collect items, and retrieve the legendary Amulet of Yala to save your hometown!
- Procedurally Generated Dungeons: Three different map generation algorithms (Rooms, Cellular Automata, Drunkard's Walk) create unique dungeons every playthrough
- Turn-Based Combat: Strategic turn-based gameplay where every move matters
- Field of View: Realistic line-of-sight mechanics - you can only see what your character can see
- Multiple Enemy Types: Face off against Goblins, Orcs, Ogres, and Ettins, each with different stats and behaviors
- Item System: Collect and use healing potions, weapons, and magical items
- Multiple Levels: Progress through multiple dungeon levels, each more challenging than the last
- Themes: Different visual themes (Dungeon, forest, ice, ...) for varied aesthetics
- HUD: Comprehensive heads-up display showing health, inventory, and game information
- Tooltips: Hover over entities to see their names and details
- Language: Rust (Edition 2021+)
- ECS Framework: Legion - High-performance Entity Component System
- Game Engine: bracket-lib - Terminal-based game library
- Serialization: RON - Rusty Object Notation for template files
- Serialization Framework: Serde - Framework for serializing and deserializing Rust data structures
Before you begin, ensure you have the following installed:
- Rust: Version 1.70.0 or later
- Install from rustup.rs
- Verify installation:
rustc --version
- Cargo: Comes bundled with Rust
- Verify installation:
cargo --version
- Verify installation:
- Visual Studio Build Tools or Visual Studio with C++ development tools
- Windows SDK
build-essentialpackage (includes GCC, make, etc.)sudo apt-get update sudo apt-get install build-essential
- Xcode Command Line Tools
xcode-select --install
-
Clone the repository
git clone https://github.com/pragmatic-rustacean/Blackspire.git cd blackspire/blackspire -
Verify the project structure Ensure you have the following structure:
blackspire/ โโโ Cargo.toml โโโ src/ โ โโโ main.rs โ โโโ ... โโโ resources/ โโโ dungeonfont.png โโโ terminal8x8.png โโโ template.ron
Build the project in debug mode (faster compilation, slower runtime):
cargo buildThe executable will be located at: target/debug/blackspire.exe (Windows) or target/debug/blackspire (Linux/macOS)
Build an optimized release version (slower compilation, faster runtime):
cargo build --releaseThe optimized executable will be located at: target/release/blackspire.exe (Windows) or target/release/blackspire (Linux/macOS)
Note: The release build uses Link-Time Optimization (LTO) for maximum performance.
Check if the code compiles without building:
cargo checkRun the game directly with Cargo (debug mode):
cargo runRun the optimized release version:
cargo run --releaseAfter building, you can run the executable directly:
Windows:
.\target\release\blackspire.exeLinux/macOS:
./target/release/blackspireImportant: Make sure you run the executable from the blackspire directory, as the game expects the resources/ folder to be in the current working directory.
You can also copy the executable to a different folder but ensure you also copy the resources folder into the folder that contains your executable.
Your goal is to navigate through multiple dungeon levels, defeat monsters, collect items, and ultimately retrieve the Amulet of Yala on the final level to save your hometown.
| Key | Action |
|---|---|
โ โ โ โ |
Move player (Arrow Keys) |
G |
Pick up item at current location |
0-9 |
Use item from inventory (0-9 correspond to inventory slots) |
- Turn-Based: The game uses a turn-based system. After you move, enemies take their turn
- Combat: Move into an enemy to attack them. Combat is automatic
- Health: Your health is displayed in the HUD. If it reaches 0, it's game over
- Field of View: You can only see tiles within your field of view radius
- Level Progression: Find the exit staircase (
>) to advance to the next level - Victory: Collect the Amulet of Yala (
|) on the final level to win
- Healing Potion (
!): Restores health when used - Dungeon Map (
{): Reveals the entire map - Rusty Sword (
/): Weapon that increases damage - Shiny Sword (
S): Better weapon with higher damage - Huge Sword (
/): Powerful weapon for later levels
- Goblin (
g): Weak enemy, 1 HP, appears on all levels - Orc (
o): Moderate enemy, 2 HP, appears on all levels - Ogre (
O): Strong enemy, 5 HP, appears on levels 1-2 - Ettin (
E): Very strong enemy, 10 HP, appears on level 2
blackspire/
โโโ Cargo.toml # Project metadata and dependencies
โโโ Cargo.lock # Locked dependency versions
โโโ README.md # This file
โโโ resources/ # Game assets
โ โโโ dungeonfont.png # Main game font
โ โโโ terminal8x8.png # Terminal font
โ โโโ template.ron # Entity templates (monsters, items)
โโโ src/
โ โโโ main.rs # Entry point and game loop
โ โโโ camera.rs # Camera system for viewport
โ โโโ components.rs # ECS component definitions
โ โโโ map.rs # Map and tile definitions
โ โโโ player.rs # Player-related logic
โ โโโ turn_state.rs # Game state machine
โ โโโ map_builder/ # Procedural map generation
โ โ โโโ mod.rs
โ โ โโโ automata.rs # Cellular automata algorithm
โ โ โโโ drunkard.rs # Drunkard's walk algorithm
โ โ โโโ rooms.rs # Room-based algorithm
โ โ โโโ prefab.rs # Prefab room placement
โ โ โโโ themes.rs # Visual themes
โ โโโ spawner/ # Entity spawning logic
โ โ โโโ mod.rs
โ โ โโโ template.rs # Template loading and spawning
โ โโโ systems/ # ECS systems
โ โโโ mod.rs
โ โโโ chasing.rs # Enemy AI - chasing player
โ โโโ combat.rs # Combat resolution
โ โโโ end_turn.rs # Turn state transitions
โ โโโ entity_render.rs # Entity rendering
โ โโโ fov.rs # Field of view calculations
โ โโโ hud.rs # Heads-up display
โ โโโ map_render.rs # Map rendering
โ โโโ movement.rs # Movement handling
โ โโโ player_input.rs # Player input handling
โ โโโ random_move.rs # Enemy AI - random movement
โ โโโ tooltip.rs # Tooltip system
โ โโโ use_item.rs # Item usage system
โโโ target/ # Build output (gitignored)
Issue: Game crashes with "Couldn't find specified file" error
- Solution: Make sure you're running the game from the
dungeon-dragonsdirectory where theresources/folder is located
Issue: Build fails with linker errors
- Solution: Ensure you have the required build tools installed for your platform (see Prerequisites)
Issue: Game runs slowly
- Solution: Use the release build (
cargo run --release) instead of debug build
Issue: Fonts not displaying correctly
- Solution: Verify that
resources/dungeonfont.pngandresources/terminal8x8.pngexist in the correct location
Contributions are welcome! This project follows open-source best practices and we appreciate your help in making it better.
-
Fork the repository
- Click the "Fork" button on GitHub
-
Create a feature branch
git checkout -b feature/your-feature-name
Or for bug fixes:
git checkout -b fix/your-bug-fix
-
Make your changes
- Write clean, well-commented code
- Follow Rust conventions and style guidelines
- Add comments for complex logic
- Update documentation as needed
-
Test your changes
cargo build --release cargo run --release
Ensure the game compiles and runs correctly
-
Commit your changes
git add . git commit -m "Description of your changes"
Write clear, descriptive commit messages
-
Push to your fork
git push origin feature/your-feature-name
-
Create a Pull Request
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Fill out the PR template with:
- Description of changes
- What was changed and why
- Any breaking changes
- Screenshots (if UI changes)
- Code Style: Follow Rust's official style guide. Use
cargo fmtto format your code - Documentation: Add doc comments for public functions and types
- Testing: Add tests for new features when possible
- Breaking Changes: Clearly document any breaking changes in your PR
- Issues: Before starting work on a large feature, consider opening an issue to discuss it first
- ๐ Bug fixes
- โจ New features (new enemies, items, map generation algorithms)
- ๐ Documentation improvements
- ๐จ UI/UX enhancements
- โก Performance optimizations
- ๐งช Additional tests
- ๐ Localization support
This project adheres to a code of conduct that all contributors are expected to follow:
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Respect different viewpoints and experiences
This project is currently unlicensed. If you'd like to use this code, please contact the author or consider adding a license file.
- Built with bracket-lib by The Amethyst Foundation
- Uses Legion ECS for entity management
- Inspired by classic roguelike games like Rogue, NetHack, and Angband
Author: James Muriuki Maina
Email: geniusinrust@gmail.com
Potential features for future versions:
- Save/Load game functionality
- More enemy types and behaviors
- Additional items and equipment
- Character classes with unique abilities
- More map generation algorithms
- Sound effects and music
- Configurable keybindings
- Difficulty levels
- High score system
- Multiplayer support
Current Version: 0.1.0 (MVP)
This project is currently in MVP (Minimum Viable Product) status. The core gameplay loop is complete and functional, but there's plenty of room for expansion and improvement.
Enjoy your dungeon crawling adventure! ๐ก๏ธ๐ก๏ธโ๏ธ