A 2D real-time grand-strategy game engine and a game prototype built on it. Written in C++ on SDL2.
The repo has two targets:
- libcapri - the engine. Renders a tile map with smoothed tile borders and objects on the tiles, and provides a small UI framework. Designed to handle large maps — on the order of a million tiles with tens of thousands of objects, in real time.
- Regnum - an early game prototype built on top of libcapri.
Built with CMake. Requires the SDL2 and SDL2_ttf libraries.
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make regnum
This will create exec file in build directory; on Linux, run it with
./regnum
- Pathfinding - hierarchical, Dijkstra-based. Movement isn't limited to the 8 grid directions - a tile connects to more than 8 neighbours in the path graph. Paths are searched over a two-level graph: a coarse graph between hubs (villages/towns) and a fine per-tile graph. Objects also have a movement-range limit unless they pass through a hub - mirroring real-army supply constraints.
- Map rendering - viewport culling. Only visible tiles are drawn; scrolling redraws just the newly exposed edge, not the whole view. (No zoom yet; planned two zoom levels plus a cached minimap.)
- Smoothed borders — per-edge autotiling. Each tile border is drawn as 4 edges; each edge is rendered as one of 9 variants selected from the neighbouring edges.
- Objects - spatial index + culling. A simple spatial index (per-tile buckets keyed by (x, y)), culled to the viewport, drawn in two layers.
- UI framework. Hierarchical widgets, row/column layout, mostly immediate-mode, bubbling events.
An older project from my university years and shortly after; not actively maintained.
