sots-re/findings/objects/00-inventory.md

42 lines
2.8 KiB
Markdown

# Object-model inventory (from RTTI)
The binary retains **full MSVC RTTI — 1,924 type descriptors** across **41,411 functions**.
Extracted directly from the `.?AV`/`.?AU` type-descriptor strings. This is the spine of the
object-model map. Raw list: `rtti-raw.txt`. Cleaned: `classes-game.txt` (1,404),
`classes-mars.txt` (194), `serializable-types.txt` (179).
> Note: Ghidra's headless RTTI analyzer ran but built 0 `SymbolType.CLASS` namespaces on our
> query — a tooling detail to sort out in ReVa (re-run/point the right analyzer, or read the
> demangled names). The RTTI itself is present and rich; names here come straight from the binary.
## Architecture (two namespaces)
- **`Mars`** — the **engine** (194 classes). SOTS1's engine is *Mars* (SOTS2 later used *Mercury*).
- Render: `DrawDevice`, `Camera`, `BatchedPrimitiveImpl`, `Decal`, `Effect`/`EffectPool`,
particle painters (`Beam`, `Billboard`, `BaseParticlePainter`), `Dictionary<Mesh|Model|Texture>`.
- Scene/entity/physics: `EntityBase`, `EntityFactory`, `PhysicalEntity`, `Body`, `RigidBody`,
`Dynamics`, `CombatSim`, `SceneObject`.
- Serialization: `IStreamable` + `StreamableHelper<T>`/`VectorHelper<T>`/`StreamableEnum` (every
serializable type is wrapped — see `serializable-types.txt`). Asset I/O: **`Buffer::gobio`**
(the `.gob` reader/writer).
- Net: `BitStreamImpl`/`BitStreamExt`, `FNM*` (framed network messages).
- UI framework: `Control`, `Button`, `CheckBox`, `Dialog`, `DockablePanel`, `DropDownList`, `EditView`.
- **`Game`** — game logic + UI (1,404 classes), built on Mars.
## High-value targets (object model — goal #1)
The empire is modeled as a **Player** (SOTS terminology), not "Empire" (that's UI).
- **Player/empire:** `Game::AIPlayer`, `Game::ClientPlayer`, `Game::GameSetup_Player`, `Game::PlayerAid`.
- **Star map:** `Game::StarSystem` (+ `PlayerView@StarSystem`), `Game::Planet` / `DOPlanet` / `Creator::Planet`.
- **Ships/design:** `Game::ShipData`, `Game::ShipDesignDef`, `Game::DesignList`, `Game::ObservedDesign`.
- **Fleets:** `Game::FleetLayout` (+ manager/list UI around it).
- **Combat:** `Game::GameCombatSim`, the `Game::CombatCommand*` hierarchy (~40 command types),
`Game::Encounter*` results, `Mars::CombatSim`, `Mars::CombatSimContactHandler`.
- **Base entity:** `Game::Actor` → `Game::TargetableEntity` → `Mars::PhysicalEntity` → `Mars::EntityBase`.
## Control-flow / renderer anchors
- Entry / bootstrap: `Mars::AppStartup`.
- Renderer: `Mars::DrawDevice` + `Camera` → D3D9 device init (`Direct3DCreate9`/`CreateDevice`).
## How this feeds the campaign
`serializable-types.txt` ≈ the save/on-disk data model — the ideal cross-reference against the
community save-editor structs (verify layouts against real saves). The Player/StarSystem/Planet/
ShipDesignDef cluster is the first deepen-set; `Buffer::gobio` anchors the `.gob` parser for `verify/`.