Work in Progress - This project is actively being developed.
A 2D tile-based text adventure game engine built with C++ and SDL2. Create interactive games with grid-based movement, dialogue systems, and scene management.
This project follows EECS 498: Game Engine Architecture from the University of Michigan.
The course teaches how to build a game engine from scratch, progressing from a hard-coded C++ text adventure to a flexible 2D engine with Lua scripting, Box2D physics, and SDL graphics.
- Actor System - Game objects with customizable properties (sprites, dialogues, movement)
- Scene Management - Multiple levels with easy transitions
- Dialogue System - Proximity-based and contact-based dialogue triggers
- Template System - Reusable actor definitions to reduce repetition
- Health & Scoring - Built-in player stats with HUD display
- Intro Sequences - Customizable intro screens with images, text, and music
- Win/Lose States - Configurable game over screens
- C++20 compiler
- CMake 3.10+
- SDL2, SDL2_image, SDL2_ttf, SDL2_mixer (vendored)
cmake -B build
cmake --build build./build/hw4The resources/ directory must be in the working directory.
text_engine/
├── src/ # Source files
├── include/ # Header files
├── resources/
│ ├── game.config # Game settings
│ ├── rendering.config # Display settings
│ ├── scenes/ # Level files (.scene)
│ ├── actor_templates/ # Reusable actor definitions (.template)
│ ├── images/ # Sprites and assets
│ └── fonts/ # TrueType fonts
└── vendored/ # Third-party libraries
{
"initial_scene": "level1",
"intro_images": ["intro1", "intro2"],
"intro_text": ["Welcome!", "Press any key..."],
"font": "default.ttf",
"intro_bgm": "music.ogg",
"game_over_bad_image": "lose.png",
"game_over_good_image": "win.png",
"hp_image": "heart.png"
}{
"x_resolution": 800,
"y_resolution": 800,
"camera_offset_x": 0,
"camera_offset_y": 0
}Scene files (.scene) define levels with actors:
{
"actors": [
{
"actor_name": "player",
"x": 5,
"y": 5,
"view_image": "player.png"
},
{
"template": "wall",
"x": 0,
"y": 0
}
]
}Templates (.template) define reusable actor properties:
{
"view_image": "wall.png",
"blocking": true
}Reference templates in scenes with the template field. Scene properties override template defaults.
| Property | Description |
|---|---|
actor_name |
Identifier (use "player" for the player) |
x, y |
Grid position |
vel_x, vel_y |
Velocity per frame |
view_image |
Sprite filename |
blocking |
Blocks movement if true |
nearby_dialogue |
Text shown when player is adjacent |
contact_dialogue |
Text shown when player touches actor |
transform_scale_x, transform_scale_y |
Sprite scaling |
transform_rotation_degrees |
Sprite rotation |
Special tags in dialogue text trigger game events:
| Tag | Effect |
|---|---|
[health down] |
Decrease player health |
[score up] |
Increase player score |
[proceed to <scene>] |
Load another scene |
you win |
Trigger win condition |
- WASD - Move player
- Any key - Advance intro/dialogue
MIT