A modular, grid-based combat simulation engine written in C++17. This project serves as both a learning tool and a foundation for more complex battlefield simulations such as autonomous agent behavior, team tactics, and spatial reasoning.
- Grid-based world representation with adjustable width and height
- Walls and obstacles that prevent unit placement
- Basic unit system with team identification (e.g., red vs. blue)
- JSON output for simulation state logging
- Terminal display visualization of grid state
- Expandable structure using modular C++ classes
combat-simulation-engine/
├── build/ # CMake build directory
├── config/ # (Reserved) Simulation configuration files
├── external/ # External dependencies (e.g., nlohmann/json)
├── include/ # Header files (Unit.hpp, Grid.hpp, etc.)
├── outputs/ # JSON output logs from simulation runs
├── scripts/ # Placeholder for run/test automation scripts
├── src/ # C++ implementation files
├── CMakeLists.txt # Root CMake build configuration
└── README.md # You're here
- CMake (v3.10+)
- A C++17-compatible compiler (e.g., MSVC, GCC, or Clang)
# From project root
mkdir build
cd build
cmake ..
cmake --build .bin/Debug/simulator.exe # Windows
./bin/simulator # Linux/MacTerminal grid display:
.#..
..U.
.#..
....
JSON state log:
{
"grid_size": [4, 4],
"units": [
{ "id": 1, "team": "red", "x": 2, "y": 1 }
],
"walls": [
[1, 0], [1, 2]
],
"status": "ok",
"version": 1.0
}- nlohmann/json — single-header JSON parser (
external/json.hpp)
- Turn-based movement system (
tick()loop) - Basic AI behavior trees
- Combat resolution mechanics (e.g., facing direction, vision cone)
- CSV or live visual output (Python tool)
- Logging and replay support
Built and maintained by Colin Haskins as a warm-up for low-level simulation tooling in C++.
MIT License — see LICENSE for details.