A from-scratch C++20 implementation of the Citadels (2016 Revised/Deluxe Edition) board game: a data-driven rules engine covering the full 27-character / 84-district roster, built so any 8-or-9-character "cast" and any 14-unique-district set can be configured without touching engine code.
This is a game engine, not yet a playable game — there is no CLI and no AI opponents wired up yet. See Status below for exactly what runs today.
Done and tested:
- Full rules data for all 27 characters and all 84 districts (54 basic + 30 unique),
loaded from
config/*.json— seedocs/GAME_RULES.mdanddocs/RULE_COVERAGE.mdfor sourcing and confidence notes on every value. - Character selection (the secret draft), resource collection, construction, and
end-game scoring, each as an independent, unit-testable system
(
include/systems/). - Character abilities for the base 8 cast (Assassin, Thief, Magician, King, Bishop,
Merchant, Architect, Warlord) as independent, registry-dispatched classes
(
include/abilities/). Game/TurnManager: the orchestration layer that actually drives a round — character selection, the ascending-rank turn loop, round completion, and the game-end check (include/core/Game.hpp,include/systems/TurnManager.hpp).- Integration tests (
tests/integration/) covering turn order, Assassin/Thief resolution, the game-end trigger, and a full round through the real character draft, run under both a plain build and-fsanitize=address,undefined.
Not implemented yet:
- The other 19 of 27 characters have rules data but no
ICharacterAbilityclass —config/game_rules.json's default cast only uses the base 8, so the engine is fully correct as configured today, but a custom cast drawing on the rest of the roster will need those classes written first. - Most unique district effects (only Dragon Gate, Imperial Treasury, and Wishing Well's end-game scoring bonuses are wired up; the rest build and score at face value only).
- AI player strategies (
include/ai/,include/core/IPlayerStrategy.hppis defined but has no implementations yet). - A CLI (
include/cli/,src/cli/) andsrc/main.cpp— there is currently no way to actually play a game end to end, only to drive the engine from tests or a harness you write yourself.
See docs/ARCHITECTURE.md and docs/GAME_FLOW.md for the full design. In short:
cli/ -> presentation only, no game rules (not yet implemented)
ai/ -> decision-making, via GameView + Action (not yet implemented)
systems/ -> orchestrates rules; the only layer that mutates GameState
abilities/ -> one class per character ability, pure rule units
models/ -> plain data holders (Player, CharacterCard, DistrictCard, City, Deck<T>)
core/ -> Game (facade/FSM driver), GameState, GameConfig, GamePhase, Event bus
GameState holds everything, including other players' hands and secret picks.
GameView is a redacted, read-only snapshot built per viewer — the only channel a
player-controlling strategy (human or AI) can read from, so hidden information can't
leak by construction rather than by convention.
- CMake 3.22+
- A C++20 compiler (GCC or Clang)
- Internet access on first configure (CMake
FetchContentpulls nlohmann/json and GoogleTest)
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
ctest --test-dir build --output-on-failureThis builds the citadels_engine static library and the citadels_tests test
binary. There is no citadels executable yet — CMakeLists.txt only adds that
target once src/main.cpp exists, so the build above succeeds without one.
Disable tests with -DCITADELS_BUILD_TESTS=OFF if you only want the engine library.
config/ Rules, character, and district data (JSON)
docs/ Rule coverage, architecture, and flow documentation
include/ Public headers, mirroring src/
src/ Implementation, by layer (core, models, systems, abilities, ai, cli)
tests/ GoogleTest unit/integration/scenario tests
Apache License 2.0 — see LICENSE.