Codebound: Turn-Based Terminal RPG Engine
Turn-based terminal RPG in C++17 with a multi-phase boss, audio events and a saved leaderboard.
3 min read
A modular, turn-based terminal RPG and battle simulation engine written in modern C++ featuring audio integration, multi-tier enemy AI, and persistent leaderboard tracking.
Description
Codebound is an interactive console role-playing game built from scratch in C++. It demonstrates advanced object-oriented architecture through polymorphic character hierarchies, state-driven battle encounters, multi-phase boss mechanics, audio event management, and score persistence.
Key Game Systems
- Polymorphic Entities: Base
Characterclass inherited byPlayer, regularEnemy, and multi-phaseBosssubclasses with virtual action methods. - Combat Mechanics: Dynamic damage calculation incorporating critical strikes, defense mitigation, elemental vulnerabilities, and special abilities.
- Boss Encounter Architecture: Multi-phase boss battle with adaptive decision-making depending on player health and tactical state.
- Audio Management Subsystem: Event-driven
AudioManagertriggering sound effects and ambient tracks for critical encounters and level transitions. - Persistent Leaderboard: File-backed
Leaderboardsubsystem that serializes player statistics, high scores, and run duration to disk.
System Architecture
┌─────────────────┐ ┌─────────────────┐
│ Player │ │ Enemy │
└────────┬────────┘ └────────┬────────┘
│ │
▼ ▼
┌─────────────────────────────────────┐
│ Character (Base) │
└──────────────────┬──────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Battle / Combat Engine │
└───────────┬───────────────┬─────────┘
│ │
▼ ▼
┌─────────────────┐ ┌───────────────┐
│ AudioManager │ │ Leaderboard │
└─────────────────┘ └───────────────┘
Repository Structure
Codebound/
├── AudioManager.h/cpp # Audio playback driver and sound effect triggers
├── Character.h/cpp # Base entity class with attributes and virtual methods
├── Player.h/cpp # Player class with inventory, skills, and stats
├── Enemy.h/cpp # Regular enemy variations and encounter behaviors
├── Boss.h/cpp # Multi-stage boss entity with specialized attack patterns
├── Leaderboard.h/cpp # High score record management and disk serialization
├── main.cpp # Game loop, input handling, and terminal rendering
└── Makefile # Automated compilation script
Requirements
- Compiler: GCC (
g++) or Clang supporting C++17 - Operating System: macOS, Linux, or Windows (WSL)
- Audio Libraries: Native macOS audio utilities (
afplay) or SDL2/OpenAL on Linux
Installation & Compilation
Clone the repository:
git clone https://github.com/ADM1SH/codebound.git
cd codebound
Compile using the Makefile or manual command:
g++ -std=c++17 -Wall -Wextra -O2 -o codebound *.cpp
Usage
Start the game:
./codebound
Gameplay Controls
- Navigate menus using numeric keys
[1],[2],[3]. - During combat:
[1]Attack: Standard physical strike.[2]Skill: Special energy attack dealing scaled damage.[3]Defend: Reduce incoming damage by 50% for one turn.[4]Inventory: Consume healing potions or stat buffs.
Support
Report bugs or game balance suggestions to: https://github.com/ADM1SH/codebound/issues
Roadmap
- Done: Core character inheritance and combat math.
- Done: Multi-phase boss battle logic.
- Done: Persistent leaderboard file I/O.
- Done: Terminal audio manager integration.
- To do: Add procedural dungeon room generation.
- To do: Implement equipment inventory system with randomized loot drops.
Contributing
- Fork the repository.
- Create a branch:
git checkout -b feature/procedural-dungeon. - Write clean, modular C++ code adhering to existing conventions.
- Test thoroughly and open a Pull Request.
Authors and Acknowledgment
- Adam Anwar (ADM1SH) - Game designer and lead developer.
License
MIT License. See LICENSE for details.
Project Status
Active indie game project. Periodic updates for content balance and engine expansion.