Grid Sim Framework is a C++20 agent-based simulation framework built around
reusable libraries for simulation, events, input, terrain-aware movement, and
map import/export. This export is the focused public framework cut of the larger
workspace, with battlegrid kept as the flagship demo application.
libsim— simulation engine, agents, behaviours, spatial sensing, game loglibevent— typed event bus and threaded/poll-based event componentslibio— normalized keyboard, mouse, gamepad, ncurses, SDL, and evdev inputlibphysics— collision events, fixed-step collision world, kinematic bodieslibmap— terrain layers, geographic projection, ASCII maps, OSM import
apps/battlegrid— 3D sandbox/demo app for exercising the frameworkapps/demos— focused examples for event and input subsystems
libnet is intentionally parked outside this export and will be brought in
later on its own branch. This keeps the initial public repo focused on the core
framework and standalone demos.
- Modern C++20 with templates, smart pointers, and strong type usage
- Functional decomposition across reusable libraries
- Event-driven architecture for decoupled simulation behavior
- Multiple I/O backends via SDL2, ncurses, and Linux evdev
- Terrain-aware movement and collisions
- Map pipeline with ASCII maps and OpenStreetMap XML rasterization
- Documented and unit-tested libraries
- CMake 3.14+
- C++20-capable compiler
- SDL2 development headers
- ncurses development headers
lcovfor coverage reportsdoxygenfor API docs
This export is developed and documented around Linux/Ubuntu-style setup. The framework itself is modular, but some demos and input backends assume Linux or desktop SDL/OpenGL availability.
The public export is shaped by a few architectural rules:
- Framework-first design — reusable libraries own the core logic; apps are thin composition layers rather than the center of the codebase
- Clear subsystem boundaries — simulation, events, input, physics, and maps are kept in separate libraries with narrow responsibilities
- Testable decomposition — code is split so behavior can be exercised with focused unit tests instead of only through large end-to-end apps
- Backend abstraction — platform-specific input and rendering concerns are isolated behind stable interfaces where practical
- Battle-tested demos —
battlegridand the smaller demos exist to prove library integration without becoming hidden framework dependencies - Progressive complexity — the repo supports simple local simulations first, while leaving room for richer extensions like networking or larger worlds
sudo apt-get install build-essential cmake g++ lcov doxygen libsdl2-dev libncurses-devlibmap fetches tinyxml2 automatically with CMake if it is not already
available on the system.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --parallel 2ctest --test-dir build --output-on-failurecmake --build build --target coverage --parallel 2grid-sim-framework/
├── libs/
│ ├── libevent/
│ ├── libio/
│ ├── libmap/
│ ├── libphysics/
│ └── libsim/
├── apps/
│ ├── battlegrid/
│ └── demos/
├── cmake/
└── docs/
docs/architecture.md— architecture overview and source-level decompositiondocs/mainpage.md— Doxygen landing pageCONTRIBUTING.md— contributor setup and expectationsCHANGELOG.md— staged public-export change history
Run the included demo app with the shipped ASCII map:
./build/bin/battlegrid --map apps/battlegrid/maps/default.mapControls include:
W/A/S/DmoveShiftsprintSpacejumpEmount/dismountTshoutTabtoggle cameraMtoggle map overlayPpauseQorEscquit
This export is licensed under the GNU Affero General Public License v3.0.
See LICENSE.