Skip to content

Solution Map

github-actions[bot] edited this page Nov 26, 2026 · 4 revisions

Solution map

What each part of the repository holds and how the parts depend on each other. The authoritative version, including the build-target rules, is ARCHITECTURE.md. The .csproj references are the final authority.

Layering

Dependencies point downward only. The Godot adapter references DK2.Presentation.

godot/DK2.Godot            presentation and integration
        └───────────────► DK2.Presentation
DK2.Tools / DK2.Harness / DK2.Convert       net10.0 executables and tooling
        │
        ├──────────────► DK2.Presentation ──► DK2.Assets ◄── DK2.Art (KMF, textures)
        │                       │                  │            │
DK2.AI ──────► DK2.Simulation ──┘                  │
        │         │                                │
        │         └──► DK2.Pathfinding             │
        └──────► DK2.Data.Model ◄── DK2.Data (parsers)
                       │
                   DK2.Core                net10.0

Shared assemblies and the Godot adapter target net10.0.

Projects in src/

Project Role Depends on
DK2.Core Primitives with no game rules: fixed-point Fp32, GameTick, TilePos, hashing, the seeded SimRandom, Confidence and the Dk2Behavior attribute —
DK2.Data.Model Immutable game definitions with no IO. This is the seam between data and simulation Core
DK2.Data Readers for the original data (KWD, KLD, SDT, maps, audio and movies), plus campaign, save, settings and high-score storage Core, Data.Model
DK2.Pathfinding The original game's router (NavMesh, MeshRouter, Funnel) Core
DK2.Simulation All game rules and all mutable state (WorldState), advanced only by GameSimulation.Tick Core, Data.Model, Pathfinding
DK2.AI The computer keeper, which acts as an input source to the simulation Core, Data.Model, Simulation
DK2.Assets Logical asset keys and how they are resolved. All asset access goes through this layer Core, Data.Model
DK2.Art Readers for the player's original art: KMF models, engine textures and the art catalogue Assets, Data
DK2.Presentation Turns world state into drawables, independent of the renderer: HUD, panels, camera paths, cutscenes Core, Data, Data.Model, Simulation, Assets
DK2.Convert Converts original art to glTF/GLB and PNG Art, Assets, Data
DK2.Harness Headless scenario runner: runs YAML scenarios and writes reports, events and per-tick hashes Core, Data, Data.Model, Simulation, AI, Assets, Presentation
DK2.Tools The dk2tools command line: status, docs, kb, coverage, convert, replay, simmatrix and the data inspectors (README) Assets, Convert, Core, Data, Data.Model, Simulation

Godot

godot/DK2.Godot hosts rendering, cameras, input, audio and HUD. Game rules and simulation state live in the shared C# projects.

Tests: tests/

Project Covers
DK2.Core.Tests, DK2.Data.Tests, DK2.Simulation.Tests, DK2.AI.Tests, DK2.Assets.Tests, DK2.Presentation.Tests, DK2.Convert.Tests, DK2.Tools.Tests Unit tests for the project of the same name
DK2.Behavior.Tests Behaviour checked against the real shipped data (*OnRealDataTests). These are skipped without DK2_DIR
DK2.Oracle.Tests Checks our code against the original: runs functions from DKII.EXE and compares with state captured from the running game
DK2.TestSupport Shared fixtures and helpers

Architecture tests read the built assemblies to check engine independence and each project's target framework.

Documentation and research: docs/

Path Holds
HANDOFF.md Current state and the next useful action
DECISIONS.md Architectural and behavioural decisions (ADR-numbered)
ARCHITECTURE.md Layering, simulation rules, system order, world state
TRAPS.md Known pitfalls
research/ One document per DK2 mechanic (combat, rooms, spells, camera, lighting, campaign…), plus open questions
research/functions/ The function knowledge base: one record per DKII.EXE function, named by address
plans/ Dated design and implementation plans

Everything else

Path Holds
scenarios/ Declarative YAML experiments by topic (creatures, fog, imps, keepers, mana, rooms, smoke, spells, tiles, triggers) (guide)
tools/ghidra Headless Ghidra queries against DKII.EXE and the per-agent MCP server
tools/kb Function knowledge base tooling
tools/oracle State and memory capture from the running original game
tools/blender Repeatable Blender scripts for asset work
tools/perf, tools/meshreplay Capture analysis and mesh replay, used for visual verification
reverse-engineering/ Method and notes for the binary work
original-reference/ Reference material about the original game; no game files
DK2_REIMPLEMENTATION_PLAN.md The overall plan, milestones and acceptance criteria
AGENTS.md Contributor and AI-agent rules: source order, evidence storage, documentation budgets

Where does a change belong?

  • A game rule or a balance behaviour: DK2.Simulation, with numbers from DK2.Data.Model and a research note in docs/research/.
  • Something you see on screen that is engine-neutral: DK2.Presentation.
  • Godot rendering, input or editor work: godot/DK2.Godot.
  • Reading a new original file format: DK2.Data (or DK2.Art for models and textures).
  • The computer opponent: DK2.AI.

For the detailed version, see HANDOFF.md, "Where to work".

Clone this wiki locally