plan(O): Phase O — DatPath Unification — filed + active (pre-empts M1.5)

Phase O extracts the WB pieces we actually use (mesh pipeline, texture
decode, GL state, scenery, terrain blending, EnvCell/portal decode —
roughly 3-5K LOC) into src/AcDream.Core/Rendering/Wb/, swaps their
dat dependency from DefaultDatReaderWriter to our DatCollection, and
drops the WorldBuilder.Shared + Chorizite.OpenGLSDLBackend project
references. WB stays in references/ as a read reference, not as a
project dependency. MIT attribution in NOTICE.md.

Tagline: ONE thing touches the DATs.

Discipline: verbatim copy first, no "improvements" while extracting.
Refactors land in follow-up phases. Out of scope: re-porting from
retail decomp; perf optimization; API cleanup.

User direction 2026-05-21: pre-empts M1.5. M1.5 paused at its
2026-05-20 baseline; A6/A7 don't touch dat infrastructure so no
rework needed when it resumes.

Files:
- docs/superpowers/specs/2026-05-21-phase-o-dat-path-unification-design.md (new, full spec)
- docs/plans/2026-04-11-roadmap.md (Phase O block inserted before M1.5; M1.5 marked PAUSED)
- CLAUDE.md (Currently-working-toward line updated; M1.5 block marked paused)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-05-21 13:59:33 +02:00
parent f02bd1fb4d
commit 0d85fe1f10
3 changed files with 322 additions and 15 deletions

View file

@ -85,7 +85,63 @@ Plus polish that doesn't get its own phase number:
## Phases ahead — agreed order
### Milestone M1.5 — "Indoor world feels right" (active, opened 2026-05-20)
### Phase O — DatPath Unification (ACTIVE — pre-empts M1.5 by user direction 2026-05-21)
**Tagline:** ONE thing touches the DATs.
**Filed:** 2026-05-21. **Status:** active. **Spec:** [`docs/superpowers/specs/2026-05-21-phase-o-dat-path-unification-design.md`](../superpowers/specs/2026-05-21-phase-o-dat-path-unification-design.md).
**Problem:** As of Phase N.4 (2026-05-08) we run TWO dat readers in
process — our `DatCollection` and WorldBuilder's
`DefaultDatReaderWriter` (constructed inside `WbMeshAdapter.cs:79`).
Both open the same four `.dat` files independently. Costs:
~50-100 MB duplicated index cache, double seeks on shared blocks, and
the cross-check awkwardness in `WbMeshAdapter.cs:224-229`. AC community
feedback flagged WB's dat-touching as "built for tools, not runtime";
the double-reader is the most concrete manifestation.
**Approach:** Extract the WB pieces we actually use (mesh pipeline,
texture decode, GL state, scenery, terrain blending, EnvCell/portal
decode — roughly 3-5K LOC) into `src/AcDream.Core/Rendering/Wb/`.
Verbatim copy first, no "improvements" while extracting. Adapt
constructors to consume our `DatCollection` instead of
`IDatReaderWriter`. Drop the two project references
(`WorldBuilder.Shared` + `Chorizite.OpenGLSDLBackend`) at the end.
WB is MIT-licensed; attribute in `NOTICE.md`. Keep `references/WorldBuilder/`
in-tree for read-reference (not as a project dependency).
**Why pre-empt M1.5:** User direction 2026-05-21 — we want this
foundational decoupling done before further milestone work compounds
the WB dependency. M1.5's Phase A6/A7 indoor work doesn't touch dat
infrastructure, so it can resume cleanly after Phase O lands.
**Tasks** (full breakdown in spec §5; ~7-8 working days):
- **O-T1** — WB call-graph audit. Produce the exact "must extract" list.
- **O-T2** — Create `src/AcDream.Core/Rendering/Wb/` + `NOTICE.md` attribution.
- **O-T3** — Extract texture / GL infrastructure (no dat dependency, low risk).
- **O-T4** — Extract mesh pipeline (`ObjectMeshManager` + types) + `DatCollection` swap.
- **O-T5** — Extract scenery + terrain blending pipelines + `DatCollection` swap.
- **O-T6** — Extract EnvCell + portal renderers + `DatCollection` swap.
- **O-T7** — Drop the two project references. Drop `_wbDats` and cross-check code.
- **O-T8** — Verification gate: three-scene visual side-by-side with main (Holtburg, inn, dungeon).
- **O-T9** — Ship. Update CLAUDE.md + `worldbuilder-inventory.md` to reflect new ownership.
**Acceptance** (full list in spec §6):
- `dotnet build` + `dotnet test` green; ~1147 test count maintained.
- Zero `using WorldBuilder.*` or `Chorizite.OpenGLSDLBackend.*` in `src/AcDream.*`.
- `DefaultDatReaderWriter` referenced in zero places in our source.
- Resident memory at `radius=4 + 50 entities visible`: **≥ 50 MB reduction** vs. pre-O main.
- Visual side-by-side identical for the three reference scenes; user confirms.
- `NOTICE.md` includes WB MIT attribution.
**Non-goals** (explicit, spec §8): re-porting from retail decomp;
performance optimization of extracted code; API cleanup. Verbatim
copy + swap to `DatCollection` only. Refactors in follow-up phases.
**After Phase O ships:** M1.5 resumes from its 2026-05-20 baseline
with no code changes lost — M1.5 doesn't touch WB-extracted territory.
### Milestone M1.5 — "Indoor world feels right" (PAUSED for Phase O — see above)
The current top of the work order. Two phases (A6 + A7) inside one
milestone. M2 ("kill a drudge") is deferred until M1.5 lands —