A 2D, turn-based RPG developed in C++ using SDL2, featuring three unique characters and AI-powered enemy decision-making via OpenAI's GPT-3.5 Turbo.
Note: The Fire Knight is controlled by AI. See prompt here.
- Play as Fire Knight, Ground Monk, or Water Priestess.
- Turn-based combat system.
- Enemy AI powered by GPT-3.5 Turbo (requires OpenAI API key).
- Save and load game progress using SQLite.
- Animated sprites and backgrounds.
- Text-based menus for actions and stats.
Fire Knight 🔥 | Water Priestess 🌊 | Ground Monk 🪨 |
---|---|---|
![]() |
![]() |
![]() |
- Fire Knight: High damage, high energy cost, aggressive play.
- Ground Monk: Balanced stats, adaptable.
- Water Priestess: Lower damage, efficient energy usage, excels at sustained combat.
- Choose your character and battle against an AI enemy.
- Each turn, select an action: Attack, Check Stats, Save, or Run.
- Attacks consume energy and deal damage; each character has four attack types.
- The battle ends when either character's health or energy reaches zero.
- SDL2
- SDL2_image
- SDL2_ttf
- nlohmann_json
- libcurl
- sqlite3
- Clone the repository:
git clone https://github.com/ramirezfernando/turn-based-rpg.git
- Install dependencies (macOS example using Homebrew):
brew install sdl2 sdl2_image sdl2_ttf nlohmann_json sqlite3
- Add your OpenAI API key to
api_key.txt
in the project root.
- Build and run:
make game
- The game automatically creates a SQLite database at
src/database/database.sqlite
. - You can save your progress to one slot and load it from the main menu.
assets/ # Game art assets (backgrounds, characters, text box)
images/ # Demo and roster images
src/
background/ # Background rendering
characters/ # Character classes and logic
constants/ # Game and asset constants
database/ # SQLite save/load logic
text_box/ # Text box rendering and menu logic
utils/ # Utility functions
main.cpp # Entry point
game.cpp/.h # Main game loop and logic
Makefile # Build instructions
api_key.txt # Your OpenAI API key (not tracked by git)
Special thanks to: