Simulation bridge

This commit is contained in:
2026-05-13 01:56:50 +02:00
parent 251cfa5016
commit b939246ba4
16 changed files with 10000 additions and 198 deletions

View File

@@ -1,87 +1,4 @@
# Reactor Maintenance Rewrite Tasks
## Current State
- Approved design iteration targets the simulation model, rule removal, action economy, reactor requirements, and editor layer workflow.
- Work is proceeding on branch `design-iteration-structural-editor` in methodical commits.
- Completed commits:
- `787f1e5` Document approved design iteration.
- `3d40617` Restore complete design system documentation.
- `e1ac56d` Rework simulation rules.
- Design documentation must preserve every existing system-level rule unless a change explicitly supersedes it. Superseded sections must document the replacement behavior with equal detail.
- The next implementation iteration is the Win2D editor overhaul.
## Completed Work
- Created the approved implementation plan for:
- single multi-service consumers,
- count-based reactor requirements,
- cell-derived doors,
- 0-10 structural integrity,
- fixed automatic rule systems,
- quick/lengthy action economy,
- all-seeing-eye viewing without persistent unlocking,
- layer-aware editor visualization and tools.
- Repaired the design documentation after the hazard-interaction regression:
- restored the complete surface hazard interaction matrix,
- documented that leaked coolant plus leaked fuel directly holds unless mediated by heat/electricity,
- expanded structural integrity, consumer, reactor, all-seeing-eye, and action-economy details.
- Reworked simulation state and systems:
- removed data-driven rule predicates/effects/events from runtime state, validation, forecasts, serialization, and tests,
- replaced explicit reactor consumer bindings with unbound reactor controls plus required fuel/coolant/electricity consumer counts,
- made consumer props carrier-agnostic with per-carrier service state derived from networks beneath the cell,
- moved doors from explicit edge state to door props on floor cells with orientation inferred from opposing wall cells,
- added underground structural integrity, high-pressure degradation, automatic leak creation, structural forecasts, and repair-to-max behavior,
- removed action budgets and made movement quick while mutating interactions resolve one simulation step,
- removed persistent all-seeing-eye unlocking from simulation state,
- bumped serialized level schema to version 3.
- Updated simulation tests for the replacement systems:
- consumer derivation and disabled consumer service state,
- count-based reactor readiness and reactor-under-network positive-flow requirement,
- quick movement versus lengthy door interaction,
- inferred door blocking,
- structural degradation, automatic leaks, repair integrity reset,
- schema version 3 round-tripping and old-schema rejection.
- Kept the Win2D project compiling after the simulation model changes with narrow compatibility edits. Full editor workflow/rendering work remains outstanding.
- Verified after the simulation rework:
- `dotnet test tests\ReactorMaintenance.Simulation.Tests\ReactorMaintenance.Simulation.Tests.csproj` passed with 23 tests,
- `dotnet build ReactorMaintenance.slnx` passed with 0 warnings.
- Reworked the Win2D editor workflow:
- added the Surface/Electricity/Fuel/Coolant layer combobox,
- filtered tools by active layer and fixed exclusive tool selection,
- rendered underground networks as carrier-colored centerline networks with source dots and layer opacity rules,
- removed Rule Events, Reactor Binding, and pending workflow panels from the editor UI,
- replaced two-click electricity leak authoring with electric-layer leak access cycling,
- made Shift+left drag pan in all tools and Cursor drag move the robot or props.
- Added editor-helper tests for electricity leak access cycling and cursor drag movement behavior.
- Verified after the editor overhaul:
- `dotnet test tests\ReactorMaintenance.Simulation.Tests\ReactorMaintenance.Simulation.Tests.csproj` passed with 26 tests,
- `dotnet build ReactorMaintenance.slnx` passed with 0 warnings.
## Current Work
- Editor overhaul implementation is complete; commit is pending.
## Editor Overhaul Requirements
- Add a layer combobox with Surface, Electricity, Fuel, and Coolant.
- When Surface is active, draw the surface layer at full opacity and all underground layers at 25% opacity.
- When an underground layer is active, draw the surface layer at 50% opacity, other underground layers at 25% opacity, and the active underground layer at full opacity.
- Render coolant blue, fuel red, and electricity yellow.
- Render networks as thick lines connecting adjacent cell centers; render sources as large centered dots.
- Make tools layer-aware:
- Cursor is always available.
- Heat, Floor, Walls, Props, Consumers, Hazards, and Doors are only available for Surface.
- Network painting and Sources are only available on their respective underground layers.
- Selecting a tool must deselect all other tools. The current two-way binding can leave multiple tools selected.
- Shift+LMB should pan the view in all tools, including Cursor mode.
- Cursor LMB drag should move any prop or robot from one cell to another.
- Remove Rule Events UI.
- Remove Reactor Binding UI.
- Remove editor workflow and pending actions.
- Door cells are redesigned as single prop cells.
- Electricity leak neighbour should be toggled by using the electric leak tool on an existing electric leak cell.
## Future Work
- Add authored sample levels once the new schema stabilizes.
- Tune structural integrity balancing after playtesting.
- Extend UI affordances for inspecting per-carrier consumer service state.
# Reactor Maintenance Tasks
## Godot Frontend Integration
@@ -91,7 +8,7 @@ The Godot frontend (src/ReactorMaintenance.Godot) has a complete UX scaffold (sp
**Goal:** Connect LevelScreen to SimulationEngine so gameplay state flows between simulation and UI.
- [ ] **Task 1.1: Create GameSession class**
- [x] **Task 1.1: Create GameSession class**
- Location: src/ReactorMaintenance.Godot/Data/GameSession.cs
- Wraps SimulationEngine and holds the current LevelState
- Loads LevelState from JSON via LevelSerializer.Deserialize() using Godot FileAccess
@@ -101,7 +18,7 @@ The Godot frontend (src/ReactorMaintenance.Godot) has a complete UX scaffold (sp
- Validates actions before committing (rejects invalid moves)
- Handles level start snapshot for retry
- [ ] **Task 1.2: Create LevelStateLoader helper**
- [x] **Task 1.2: Create LevelStateLoader helper**
- Location: src/ReactorMaintenance.Godot/Data/LevelStateLoader.cs
- Static helper that takes a res://Data/Levels/... path
- Uses Godot FileAccess to read JSON string
@@ -109,7 +26,7 @@ The Godot frontend (src/ReactorMaintenance.Godot) has a complete UX scaffold (sp
- Throws descriptive exceptions for missing files or schema errors
- Supports both res:// and user:// paths
- [ ] **Task 1.3: Wire LevelScreen to GameSession**
- [x] **Task 1.3: Wire LevelScreen to GameSession**
- Update LevelScreen.Configure() to accept GameSession instead of raw CampaignLevel
- Replace placeholder grid with real viewport
- Wire CellInspector.SetCellInfo() to display live selected cell data
@@ -118,7 +35,7 @@ The Godot frontend (src/ReactorMaintenance.Godot) has a complete UX scaffold (sp
- Update LevelHeader with live global state badge (Stable/Caution/Critical/Ready)
- Update InventoryStrip with live remedy/heat shield counts
- [ ] **Task 1.4: Create res://Data/Levels/ directory and level files**
- [x] **Task 1.4: Create res://Data/Levels/ directory and level files**
- Create placeholder level files for the 3 campaign levels
- Use Win2D editor to export v3 JSON schema for each level
- Files: coolant_restart.json, fuel_bleed.json, black_start.json