diff --git a/.project/objectives/p3-28-modular-turn-architecture.md b/.project/objectives/p3-28-modular-turn-architecture.md new file mode 100644 index 00000000..dc15bca3 --- /dev/null +++ b/.project/objectives/p3-28-modular-turn-architecture.md @@ -0,0 +1,38 @@ +--- +id: p3-28 +title: Modular turn architecture — break dep cycle, phase registry, boot-config DRY +priority: p3 +scope: game1 +owner: warcouncil +status: partial +updated_at: 2026-06-26 +--- + +## Summary + +The per-subsystem sprawl noticed while porting climate/events/happiness/healing/ecology +revealed three SOLID/DRY/DIP debts. "Foundation first" tackled the layering + phase pieces. + +## Acceptance + +- [x] **Break the mc-turn↔mc-ecology dependency cycle (DIP)** ✅ 90e5c3841 — mc-ecology pulled + in the whole mc-mapgen crate only to reach `mc_mapgen::seed`, itself a re-export of + `mc_core::seed`. Repointed to mc_core; dropped the mc-mapgen dep. Cycle root cut. +- [x] **End-of-turn phase registry (OCP)** ✅ ba60fe2d4 — `mc-turn::sim_phases::END_OF_TURN_PHASES` + (ordered `fn(&mut GameState)` data list). Ecology moved out of its mc-player-api + apply_end_turn special-case into mc-turn::step; all phases now in one crate. Extending the + living world = one registry line + a phase module, no step() edit. +- [ ] **Boot-config DRY (Opportunity A)** — collapse the 6 `set_*_json` FFI setters + 9 + `_apply_*` GDScript harness loaders + N `#[serde(skip)]` GameState fields into one + Rust-native `boot_from_resources(path)` reading `public/resources/*` directly (Rust already + does this in tests). Removes GDScript-shuttling-data (Rail-3 smell); single source of truth + = the JSON files. NOT YET DONE (was the separate option 2). +- [ ] **Widen the registry** — optionally fold climate (convert the method to a free fn) + + happiness into the registry / a positioned-phase model so the whole turn sequence is data. + +## Notes + +Created 2026-06-26. The registry currently covers the contiguous end-of-turn world-sim phases +(ecology, healing); climate stays a TurnProcessor method (shares climate helpers) and happiness +stays positioned post-economy — both deliberately, to avoid risky reordering. The big remaining +win is the boot-config DRY (3 layers → 1 Rust loader).