# Seele β€” Engine Documentation (for coding agents) > **Start here if you are a coding agent (or a human new to the repo) and need to > navigate the Seele engine and the MeshShadingDemo test harness.** This `docs/` > tree is the *per-subsystem navigation layer*. It complements β€” it does **not** > replace β€” the engine-root [`AGENTS.md`](../AGENTS.md), which is the > map + the hard rules. Read that first; use this tree to drill into a specific > area. --- ## 0. What this repository is (30-second orientation) - **`Seele`** is a C++ game engine. It lives in this submodule (`external/Seele` inside the parent monorepo). It has a **Vulkan** and **Metal** backend, an ECS (entt-based), a render graph, a Slang-based material/shader system, a Jolt-based physics layer, a full **flexbox UI**, and an **asset pipeline**. ~320 source files under `src/Engine/`. - **`MeshShadingDemo`** is a *test game* built against Seele. It is **not** the product; it is the integration harness. The engine is the product. The demo shows how a real consumer composes a game (scene, systems, materials, render-graph overrides) against the engine. - The **engine↔demo boundary** is a strict ABI: the engine's per-OS `GameInterface` `dlopen`/`LoadLibrary`-loads the demo's shared library and resolves exactly two C symbols (`createInstance` / `destroyInstance`). See [`cross-repo.md`](cross-repo.md) for the full contract. **The single best first read is [`../AGENTS.md`](../AGENTS.md)** (engine root): the memory model, the `update`/GPU phase split, the Jolt ground rules, the culling note, and a subsystem map. Everything below is the per-subsystem drill- down it points into. --- ## 1. The cross-repo contract (read before touching either repo) πŸ“„ [`cross-repo.md`](cross-repo.md) β€” **the orientation doc for working across both repos.** It covers: 1. The repo relationship (engine = submodule, demo = harness). 2. **The engine↔demo ABI** β€” the two-C-symbol contract (`createInstance` / `destroyInstance`), how the per-OS `GameInterface` loads the demo's shared lib, and the **shader-copy-on-reload** gotcha. 3. **The demo-side `ComponentSystem<...>` pattern** (the only pattern you need for per-frame demo logic), with the canonical `FlyCamSystem` example. 4. **The CMake contract** β€” in-tree `add_subdirectory` (what the demo does) vs. the engine's out-of-tree `install(EXPORT)` / `FILE_SET HEADERS` path. 5. A **practical "where do I look" task map** and the three invariants that save hours. > **Rule of thumb:** engine changes go *in the submodule* (commit inside > `external/Seele`, then re-record the submodule pointer in the parent). The > demo never edits engine code. --- ## 2. Per-subsystem deep dives Each doc follows the same shape: **key types & where they live** (a per-type table mapping each public type to its defining header), **data flow / lifecycle**, **where to look** (file:line pointers), and **gotchas & sharp edges**. Links below are to the real files. ### Core engine | Area | Doc | What it covers | |---|---|---| | **Scene / ECS / Components / Actors** | [scene-ecs](subsystems/scene-ecs-components-actors.md) | The entt registry, `Actor`, `Component` model, how the demo composes a scene in `setupScene`. The foundation everything else builds on. | | **Component Systems & the Update Loop** | [systems](subsystems/systems-update-loop.md) | `System`, `SystemGraph`, `ComponentSystem`, the per-frame tick order, the CPU/GPU phase split. | | **Game Interface & Frame Loop** | [game-interface](subsystems/game-interface.md) | `Game` (abstract), `GameView`, the render/update protocol (`beginUpdate`/`update`/`commitUpdate`/`prepareRender`/`render`), the frame loop. | | **Window & view layer** | [window](subsystems/window.md) | `Window`, `WindowManager`, `View`, `GameView` β€” the OS window, the render/update protocol, the frame loop wiring. | ### Graphics (GPU) | Area | Doc | What it covers | |---|---|---| | **Graphics Abstract Backend** | [graphics-backend](subsystems/graphics-abstract-backend.md) | `Gfx::Graphics` β€” the backend-agnostic API (buffers, textures, pipelines, descriptors, render passes). The layer you write against. | | **Render Graph & Render Passes** | [render-graph](subsystems/render-graph-and-passes.md) | The auto-invalidated render graph, render passes, dependencies, **meshlet layout**, and the **ray-tracing** paths. | | **GPU Resources** | [graphics-resources](subsystems/graphics-resources.md) | Buffers, textures, shaders, pipelines, descriptor sets in the abstract layer β€” and how they map to the backends. | | **Vulkan Backend** | [vulkan](subsystems/vulkan-backend.md) | `Vulkan::Graphics` β€” the concrete Vulkan implementation, its gotchas, and the RT path. | | **Metal Backend** | [metal](subsystems/metal-backend.md) | `Metal::Graphics` β€” the concrete Metal implementation, its gotchas, and the RT path. | | **Materials & Shader Graphs** | [materials](subsystems/materials-shader-graphs.md) | `ShaderExpression` β€” the Slang-based material/shader-graph system, parameter binding, and how the demo overrides the render graph. | ### Simulation & content | Area | Doc | What it covers | |---|---|---| | **Physics (Jolt)** | [physics](subsystems/physics.md) | The Jolt wrapper, `PhysicsSystem`, `CollisionSystem`, BVH broadphase, witness-based narrowphase. | | **UI (flexbox)** | [ui](subsystems/ui.md) | The full flexbox layout engine (two-phase measure/place), the element tree, widgets, theming/styles, the `UIRender` quad pipeline. A separate render path from the 3D scene. | | **Asset Pipeline** | [assets](subsystems/asset-pipeline.md) | `AssetManager`, loaders, storage β€” how assets are loaded, cached, and streamed. | ### Platform & core | Area | Doc | What it covers | |---|---|---| | **Platform / OS abstraction** | [platform](subsystems/platform.md) | Per-OS `GameInterface` (Windows/Linux/Mac), dynamic library loading (`dlopen`/`LoadLibrary`/`NSCreateObject`), input enums, and the **shader-copy-on-reload** mechanism. This is where the engine↔demo boundary is physically enforced. | | **Core Utilities** | [core-utils](subsystems/core-utilities.md) | Math, containers, log, time, memory, reflection, **serialization** β€” the cross-cutting utilities every other subsystem uses. | --- ## 3. How to use this tree (agent workflow) 1. **Orient** β€” read [`../AGENTS.md`](../AGENTS.md) (rules) + [`cross-repo.md`](cross-repo.md) (the contract). Ten minutes, saves hours. 2. **Locate** β€” use the table above (or `cross-repo.md` Β§5's task map) to find the subsystem doc for your task. 3. **Navigate** β€” the subsystem doc's **key-types table** tells you *which header* defines each type; **where-to-look** gives file:line pointers into the actual source. Go to the source β€” this tree is a *map*, not the source of truth for implementation detail. 4. **Respect the rules** β€” the memory model (`DEFINE_REF`/`DECLARE_REF`, `RefPtr`/`OwningPtr`/`UniquePtr`), the CPU/GPU phase split, and the Jolt ground rules from `AGENTS.md` apply everywhere. When a doc and `AGENTS.md` disagree, `AGENTS.md` wins. **If a subsystem doc is missing or wrong** (the engine moves fast), update it here β€” the format is simple and consistent (key types β†’ data flow β†’ where to look β†’ gotchas). Keep `AGENTS.md` for cross-cutting *rules* and this tree for *per-subsystem navigation*. --- ## 4. Pointers to the rest of the repo - [`../AGENTS.md`](../AGENTS.md) β€” **the rules + map** (start here). - [`../README.md`](../README.md) β€” the human-facing engine README (build instructions, features). - [`../OPTIMIZATIONS.md`](../OPTIMIZATIONS.md) β€” the optimization notes (meshlet/culling strategy). - [`../Culling.md`](../Culling.md) β€” the culling design note (referenced by the render-graph and physics docs). - [`../CMakeLists.txt`](../CMakeLists.txt) β€” the engine build (install/export path; see `cross-repo.md` Β§4.2). - `src/Engine/` β€” the source tree, ~320 files, ~20 subsystems (the per-subsystem docs above map onto it directory-by-directory).