A classic turn-based console RPG built in Python. Explore maps, battle enemies, manage a party, and progress through a fantasy world — all from your terminal.
Tech Used:
Python 3, Object-Oriented Programming (OOP), JSON (save data), CSV (game data), SQLite (experimental), terminal-based game loops
- 🗺️ Map Exploration: Move around a grid-based world with multiple maps.
- ⚔️ Turn-Based Combat: Strategic battles with party members and enemies.
- 🧠 Vocations: Unique character classes like Warrior, Mage, and Healer.
- 📊 Stat Growth: Exponential scaling stats based on vocation and level.
- 🎒 Inventory System: Carry and use items during and outside combat.
- 💾 Saving and Loading: Save your progress and resume where you left off. (in Progress)
- Quest system with support for branching and converging paths
- Persistent quest state (save/load)
- Quest journal UI
- Deeper NPC interaction tied to quest progression
- Separation of game logic from terminal UI
- Headless execution mode for simulation and testing
- Fuzzy logic–based AI agents for automated gameplay
More Info: Architecture, Versioning, and Future Plans
The game currently runs entirely in the terminal, with game logic and user interaction closely coupled. This design was chosen intentionally to prioritize learning, iteration speed, and clarity during early development.
Future versions aim to separate core game logic from the terminal UI. The long-term goal is for the game engine to behave like a callable system:
input: game_state + action
output: new_game_state + reward + done + info
This will allow:
- headless execution (no UI)
- deterministic simulation
- automated testing
- AI-driven gameplay
A future goal is to experiment with fuzzy logic–based AI agents that can play the game. Rather than simulating key presses, AI agents will:
- observe simplified game state features
- choose actions from a defined action space
- interact with the same engine as human players
Planned AI work includes:
- deterministic, seeded randomness
- clean action and observation interfaces
- headless simulation for large numbers of runs
- fuzzy logic heuristics for combat decisions
This project treats versions as eras of learning rather than feature checklists.
- v1.0 — Core RPG systems (pre-quests, save system incomplete)
- v2.0+ — Quest system, improved saves, AI experimentation
The v1.0 version is preserved as a time capsule via Git tags. All future development builds forward in the same repository.
- Python 3.8+
- A terminal (this is a console-only game)
For the smoothest gameplay and proper screen rendering, run this game in:
▶ Windows Terminal (from Microsoft Store)
It handles map refreshing, movement, and input far better than Command Prompt or some IDE terminals.
If you're using Windows, we strongly recommend launching the game from Windows Terminal for optimal performance.
git clone https://github.com/nievyx/class-based-rpg-python.git
cd class-based-rpg-pythonNote: If the repository name or URL has changed, update the commands above accordingly.
Click to view Project File Structure
root/
├── main.py # Entry point
├── README.md
├── .gitignore
├── __init__.py
│
├── battle/
│ └── system.py # Battle system logic
│
├── data/
│ ├── maps/ # Map files / layouts
│ ├── enemies.py # Enemy definitions
│ ├── spell_list.py # Spell data (non-class)
│ ├── vocations.csv # Class / vocation data (CSV)
│ ├── demo.gif
│ └── __init__.py
│
├── entities/
│ ├── entities.py # Base entity logic
│ ├── party.py # Party management
│ ├── vocations.py # Vocation logic
│ └── __init__.py
│
├── items/
│ ├── items_db.db # SQLite database (generated)
│ ├── create_db.py # Create items database
│ ├── delete_db.py # Delete items database
│ ├── if_exists.py # DB existence checks
│ ├── item_logic.py # Item behavior / effects
│ ├── weapons.py # Weapon definitions
│ ├── __init__.py
│ └── __pycache__/
│
├── map_manager.py # Map loading / transitions
├── overworld.py # World navigation logic
├── tile.py # Tile definitions
│
├── save/
│ ├── save.json # Game save data (JSON)
│ ├── save_system.py # Save/load logic
│ └── __init__.py
│
├── spells/
│ ├── spells.py # Spell classes / logic
│ └── __init__.py
│
├── ui/
│ ├── attack_menu.py
│ ├── health_bar.py
│ ├── inventory_menu.py
│ ├── spell_menu.py
│ └── __init__.py
│
└── utils/
└── getch.py # Terminal input helperThis project intentionally separates different types of game data to explore multiple data representations (code, CSV, JSON, SQLite). Below is a quick guide to where new content should be added.
Click here for details
- Location:
data/enemies.py - Copy an existing enemy definition and adjust stats.
- Location:
spells/spells.py/data/spell_list.py - Spells are implemented as classes for behavior flexibility.
- Location:
items/ - Items exist as Python objects and as an experimental SQLite database.
- Location:
data/vocations.csv - Add a new row following the existing format.
- Location:
data/maps/ - Create a new map file and register it with the map manager.
- Location:
save/save.json - Automatically read/written by the save system.
