A modular C++ / SFML game AI project demonstrating an AI-controlled agent for a 2D platformer. The project explores neuroevolution, autonomous gameplay, fitness evaluation, simulation loops, and reusable game engine systems.
The system uses an evolutionary learning approach to train neural-network-based controllers to navigate a platformer environment and compare AI behaviour against manual human play.
| AI-Controlled Mode | Manual Mode |
|---|---|
This project is a refactored version of a Master’s dissertation exploring how an AI agent can learn to play a 2D platformer level using evolutionary learning techniques.
The project combines a custom 2D game framework with an AI controller, allowing automated agents to be evaluated, selected, and improved across generations using gameplay performance metrics.
- AI controller using evolutionary learning strategies
- Neural-network-based gameplay control
- Fitness evaluation based on gameplay performance
- Manual play mode for testing and comparison
- Custom 2D engine systems built with C++ and SFML
- Game state management for menus, loading, gameplay, and pause states
- Physics and collision handling
- Player and enemy entity systems
- Debugging and simulation tooling
- Performance logging for AI experimentation
The AI controller uses a population-based learning process where each controller attempts to complete the level and is scored using a fitness function.
- Generate a population of neural-network controllers.
- Run each controller through the platformer level.
- Evaluate performance using fitness metrics such as distance, survival, and completion.
- Select stronger controllers for mutation and crossover.
- Repeat across generations to improve gameplay behaviour.
This allows the agent to gradually learn movement, jumping, obstacle avoidance, and level progression.
The project is structured around reusable game and AI systems. Gameplay, AI decision-making, physics, rendering, and state management are kept modular to support maintainability and experimentation.
AI-Game-Controller/
└── SFMLGameEngine/
├── Bin/ → Downloadable builds
├── Code/ → Source code
├── Resources/ → Fonts, sprites, shaders, and outputs
├── Previews/ → Screenshots and GIFs
└── README.md → Project documentation
- C++
- SFML
- Visual Studio
- Object-oriented programming
- Evolutionary algorithms
- Artificial neural networks
- 2D physics and collision systems
- Game state architecture
- Windows 10 or later
- Visual Studio 2019 or 2022
- SFML-compatible environment
- Clone the repository.
- Open the Visual Studio solution.
- Build the project.
- Run the executable.
A standalone executable is also available in the repository download section.
- Save/load support for trained neural networks
- Visual AI debugging overlays
- Additional level files and training scenarios
- Adjustable AI training parameters
- Cross-platform release builds
- Improved simulation speed and optimisation