This is a maze game written in C++ using SFML. A maze is procedurally generated using a depth-first backtracker algorithm. The player explores the maze, solves riddles to earn power-ups (vision radius expansion, invisibility, and combat abilities), encounters enemies, and races to reach the exit. The project requires a C++17 compiler and SFML.
- A C++17-capable compiler (
g++, MSVC, clang) - SFML (graphics, window, system)
- A TrueType font (
.ttf) placed in./fonts/(recommended)
- Create an empty project and add all
.cppand.hfiles from thesrc/folder. - Configure include and library directories for SFML (or use
vcpkgto install SFML):vcpkg install sfml:x64-windows - Link the following libraries:
sfml-graphics.libsfml-window.libsfml-system.libsfml-audio.lib(for music support)
- Build the project (press
F7or use Build > Build Solution). - Run the executable:
./The-Enlightened-Path.exefrom PowerShell in the project directory.
-
Install SFML development libraries:
- Windows (MSYS2):
pacman -S mingw-w64-x86_64-sfml - Ubuntu/Debian:
sudo apt-get install libsfml-dev - macOS:
brew install sfml
- Windows (MSYS2):
-
Compile from the project root directory:
g++ -std=c++17 -o maze_game src/*.cpp -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio -
Run the game:
./maze_game
- Ensure a TTF font exists in
./fonts/(e.g.,fonts/DejaVuSans.ttforfonts/arial.ttf). The game searches multiple locations, but having afontsfolder is recommended. - Place audio file
haunted.wavin the project root (or modify the path insrc/Game.cpp). - The game auto-generates
riddles.txtif it doesn't exist. - Leaderboard scores are saved to
leaderboard.txtin the working directory.
- Move:
W/A/S/Dor arrow keys - Start/New Game:
SPACE - Leaderboard:
TAB - Submit riddle answer:
ENTER(type while riddle is active) - Close riddle:
ESC - Give Up (in-game):
G
All source files are located in the src/ folder.
src/main.cpp— Program entry point; constructsGameand callsrun()src/Game.h/src/Game.cpp— Main game state machine, rendering loop, input handling, leaderboard management, and overall game orchestration
src/Maze.h/src/Maze.cpp— Maze data structure, recursive backtracker generator algorithm, and maze renderingsrc/Cell.h/src/Cell.cpp— Individual maze cell representation, wall data, and cell rendering logic
src/Player.h/src/Player.cpp— Player position, movement mechanics, vision radius, and player rendering
src/Enemy.h/src/Enemy.cpp— Enemy entity class with AI pathfinding logic, collision detection, and enemy rendering. Enemies patrol the maze autonomously and pursue the player when detected within their vision range. Includes state management for different enemy behaviors (idle, patrolling, chasing).
src/Riddle.h/src/Riddle.cpp— Riddles and riddle marker rendering within the mazesrc/GameObject.h/src/GameObject.cpp— Base classes for in-world objects providing shared functionality for game entities
- Maze size / cell size: Constants in
src/Game.h(e.g.COLS,ROWS,CELL_SIZE). Adjust with care. - Enemy behavior: Modify enemy speed, vision range, and pathfinding logic in
src/Enemy.cpp - Font: Place a
.ttfin./fonts/or change the font path list inGame::Game()withinsrc/Game.cpp - Leaderboard file:
leaderboard.txtin the working directory