Docs: END-2 session log + DR-036; Backlog/Path_to_Fun/Milestones; CLAUDE.md END-2 line
Path A spine COMPLETE (14/14): Backlog SL-3 blocker cleared + marked done; Path_to_Fun END-2 done + banner; Milestones END-2 row. CLAUDE.md gains the END-2 gotcha line (replicate the outcome, don't client-derive; SiegeTimeout off during the final), net-zero via EB-1/EB-2/END-1/M7/inventory/build-grid condensations (40,445 then 40,510 w/ history note, under the 40,960 limit). DR-036 + session log capture the design, the operator forks (halt+banner, Target=4, SaveData v5), and the pre-coding + post-impl adversarial reviews. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
---
|
||||
date: 2026-06-13
|
||||
type: session
|
||||
tags:
|
||||
- session
|
||||
- endgame
|
||||
- netcode
|
||||
- persistence
|
||||
- slice
|
||||
- end-2
|
||||
permalink: gamevault/07-sessions/2026/2026-06-13-sl3-end2-final-siege-win-lose
|
||||
---
|
||||
|
||||
# SL-3 / END-2 — The charge means something: final siege, win or lose
|
||||
|
||||
> The slice's one **critical-path blocker** ([[End_Of_Month_Game_Jam_Slice]] · [[Backlog#SL-3 — END-2: Final Siege & Win/Lose (PATH-A BLOCKER)]]); the last un-built Path A spine mechanic. Full [[dots-dev]] Feature track, **review-gated** (pre-coding + post-impl adversarial reviews). Locked → [[DR-036_END2_Final_Siege_Win_Lose]]. Continues [[2026-06-12_END1_Losable_Core]] (reuses its ghost + banner pattern). Charge cadence locked in [[DR-035_End_Of_Month_Slice_Adoption]]. Spec: [[Path_to_Fun#END-2 — The charge means something: the cap arms a final siege, win or lose]].
|
||||
|
||||
## The hole END-2 closes
|
||||
END-1 gave a clear *loss* (soft Core overrun → transient flash); the goal meter still incremented past `Target` forever with no clamp and no consequence — **no terminal win, no climax**. END-2 makes the meter mean something: at the cap it arms a visibly-larger **final siege**; surviving it **latches Victory**, a Core breach during it **latches Loss**; both show a HUD banner and the run **halts**. This is the minimum "the game has a point" — it completes Path A.
|
||||
|
||||
## Operator forks (asked up front, present-the-forks ritual)
|
||||
The docs were explicit on most of END-2 (locked cadence, single-writer, clamp, arm-once, banner). Two genuine forks the source docs left open / conflicted on, plus one the review surfaced:
|
||||
- **End behavior → HALT + banner** (chosen over "keep-playing sandbox" and "retry/quit overlay now"). `Path_to_Fun`'s minimum said "keep playing"; the slice's Done Definition wants "a run with an end." Operator picked the clean terminal end; the existing **pause menu** (Esc → Quit-to-Menu/Desktop, autosave) is the escape hatch, the dedicated retry/quit overlay is **SL-5**.
|
||||
- **Run length → `Target = 4`** survived sieges → a 5th, larger final siege (was baked 10; too long for a 5–8 min run).
|
||||
- **Persist the outcome now (SaveData v5)** — the review showed that without it, a *won* run on Continue replays the final siege (the 4th-siege autosave already records `Charge==Target`), erasing the win. Operator approved the +1-byte bump rather than deferring to SL-5.
|
||||
|
||||
## Reviews earned their keep (the design changed twice)
|
||||
The written SL-3 note said *"server-only bytes, derive client-side, no save bump."* Both halves were overturned by review:
|
||||
- **Pre-coding** (3 lenses — netcode/determinism/reuse, all GO-with-changes): the outcome must **replicate** (`[GhostField]`) — the spec literally says "observe `RunOutcome`", and client-side derivation has late-join/late-focus blind spots; split into **two single-writer components** (one combined struct = two systems RMW-ing one component across an ordering boundary); fix the arming handoff + clamp + **SiegeTimeout-during-final** (a timeout cull would fake a Victory, F5).
|
||||
- **Post-impl** (4 lenses over the diff — netcode/determinism GO, persistence/regression GO-with-changes): caught **M-1** — my `RunOutcome` born-correct insert had landed *inside* the `if (HasComponent<CoreIntegrity>(prefab))` guard (my insertion line was the guard's closing brace). Latent (CoreIntegrity is always baked) but it would skip the outcome restore if the Core were ever dropped off the prefab → a finished run re-arms on Continue. Fixed, plus 5 test gaps + 3 nits (all addressed).
|
||||
|
||||
## What shipped — reuse the global ghost, split by writer
|
||||
|
||||
### Two new run-state components (CycleDirector ghost)
|
||||
- `RunPhase { byte Value }` — **server-only** (added at spawn like `CycleRuntime`/`ThreatState`, never on the ghost serializer). `RunPhaseId{Normal,FinalDefense}`. SINGLE writer: `GoalReachedSystem`.
|
||||
- `RunOutcome { [GhostField] byte Value }` — **REPLICATED** (baked on the prefab → part of the ghost → one re-bake, folded with the `Target=4` re-bake). `RunOutcomeId{InProgress,Victory,Loss}`. SINGLE writer: `CyclePhaseSystem`. The HUD shows the banner by observing it directly.
|
||||
|
||||
### `GoalReachedSystem` (new, server, `[UpdateAfter(CyclePhaseSystem)]`)
|
||||
On `Charge>=Target` ∧ `RunPhase==Normal` ∧ `RunOutcome==InProgress` (exactly once): arms `ThreatState.PendingSiegeSize = max(1,(int)((SizeBase+ScheduleSizePerWave*wave) * FinalSiegeMultiplier))` + `ArmTick=TickUtil.NonZero(now+delay)`, flips `RunPhase=FinalDefense`. Never writes `Phase`/`WaveState`/`Charge`.
|
||||
|
||||
### `CyclePhaseSystem` Siege branch split on `RunPhase==FinalDefense` (still sole Phase/WaveState/RunOutcome writer)
|
||||
- final `DefendCleared` → `RunOutcome=Victory`, Calm, **no** goal increment.
|
||||
- final `Core<=0` → `RunOutcome=Loss` (terminal: **no** ledger drain, **no** `OverrunTick` stamp → the dedicated Loss banner, not the soft flash; husks despawned).
|
||||
- Normal-phase paths **byte-unchanged** (END-1 soft loss + survived increment, now `Charge=min(Charge+1,Target)` clamped at the source → `GoalProgress` stays single-writer).
|
||||
|
||||
### Halt + the rest
|
||||
- Halt authority `RunOutcome != InProgress`: `ThreatDirectorSystem` arming sources gated `RunPhase==Normal && RunOutcome==InProgress`; **SiegeTimeout disabled during FinalDefense** (F5); `CoreRestoreSystem` + `CoreDamageSystem` skip once decided (Core freezes at its terminal value).
|
||||
- HUD: a dedicated latched `_runBanner` (NOT the per-player `_downed` overlay) — "THE ENGINE HOLDS / VICTORY" or "OVERRUN / THE FINAL STAND FELL" + an "Esc — menu" hint.
|
||||
- `FinalSiegeMultiplier` live `TuningConfig` knob (default 2.5, floored ≥1) across all 6 touch-points + the `DebugTuningReport` wire.
|
||||
- **SaveData v5** adds `RunOutcome` (additive; `MinLoadableVersion` stays 2; old saves 0-default to InProgress). Persisted at both write sites + staged through `PendingSave` + born-correct at spawn; a won/lost run loads finished + halted (the guard keeps `GoalReachedSystem` inert). Continue also clamps `Target` to the baked run-length so a pre-v5 `Target=10` save still reaches the final siege.
|
||||
|
||||
## Validation
|
||||
- **EditMode: 342/342** (330 prior + 12: 7 END-2 [arms-once+enter, Charge clamp, Victory edge, Loss edge no-soft-effects, **normal-overrun-stays-soft regression**, restored-Victory-no-rearm, SiegeTimeout-not-culling-final] + the review's 5: full-pipeline arm-not-stomped, FinalSiegeMultiplier override + sub-1 floor, SaveData v5 RunOutcome round-trip + pre-v5-defaults-InProgress). Existing CyclePhase/Threat/Tuning/Core/Save suites stay green (no regression).
|
||||
- **Play (live netcode, focused editor):** world creation clean — **no ordering cycle** from `GoalReachedSystem [UpdateAfter(CyclePhaseSystem)]`; the ghost **re-bake** is clean (`RunOutcome [GhostField]` replicates server==client — ClientWorld read `RunOutcome=InProgress`; `RunPhase` server-only — ClientWorld count 0); `Target=4` born-correct; `Goal` already climbing (2/4 via survived scheduled sieges → whole pipeline ticking). Zero console errors.
|
||||
- **Operator fun-gate is OPEN** (the slice's SL-5 work): grind the meter to full, read the final-siege escalation + telegraph, win/lose; tune `FinalSiegeMultiplier`. The retry/quit-on-banner overlay + the rich pre-final telegraph are SL-5.
|
||||
|
||||
## Deliberate cuts / notes
|
||||
- **Retry/quit-on-banner overlay** — NOT built (SL-5). The pause menu (Quit-to-Menu/Desktop, autosave) is the in-session escape hatch; the banner shows "Esc — menu".
|
||||
- **Rich final-siege telegraph** (≥3–5 s hum/sky shift/"FINAL SIEGE INCOMING") — SL-5. SL-3 reuses the existing arm-delay telegraph (PhaseEndTick countdown).
|
||||
- **Client-derive-the-banner / no-rehash** — REJECTED by review (fragile late-join). Replicating one byte + one deliberate re-bake is the correct trade.
|
||||
|
||||
## Files
|
||||
- New (Simulation): `World/RunStateComponents.cs` (RunPhase + RunOutcome + byte-const classes). New (Server): `World/GoalReachedSystem.cs`. New (Tests): `EndgameWinLoseTests.cs`.
|
||||
- Modified (Server): `World/CyclePhaseSystem.cs` (FinalDefense Victory/Loss branches + Charge clamp), `World/ThreatDirectorSystem.cs` (arming gate + SiegeTimeout-off-during-final), `World/CoreRestoreSystem.cs` + `World/CoreDamageSystem.cs` (terminal-halt guards), `World/CycleDirectorSpawnSystem.cs` (RunPhase at spawn + born-correct RunOutcome + Target clamp), `Persistence/SaveWriteSystem.cs` (persist RunOutcome).
|
||||
- Modified (Simulation): `Debug/TuningConfig.cs` (+FinalSiegeMultiplier knob + wire), `Persistence/SaveData.cs` (v5 + RunOutcome), `Persistence/SaveComponents.cs` (PendingSave.RunOutcome).
|
||||
- Modified (Authoring/Client): `Authoring/World/CycleDirectorAuthoring.cs` (Target 10→4 + bake RunOutcome), `Client/UI/WorldLauncher.cs` (stage + quit-save RunOutcome), `Client/Presentation/HudSystem.cs` (terminal banner).
|
||||
- Tests: `SavePersistenceTests.cs` (+2 RunOutcome, v5 comment fixes), `TuningConfigTests.cs` (FinalSiegeMultiplier default pin).
|
||||
- Docs: `DR-036`, this log, `Backlog` (SL-3 done), `Path_to_Fun` (END-2 built), `Milestones`.
|
||||
|
||||
## Next-session intent
|
||||
END-2 completes Path A's spine — the slice is now winnable. The remaining slice work is **tuning + polish, not code**: SL-1 (arena/camera lock), SL-2 (loop tuning, incl. the `Target=4` run-length + `FinalSiegeMultiplier`), SL-4 (visual cohesion), SL-5 (final-siege climax tuning + the retry/quit-on-banner overlay + rich telegraph + autosave-the-outcome continue/retry flow), SL-6 (polish/cut), SL-7 (package + the formal post-slice Decision-Gate note). The one open END-2 item is the **operator fun-gate**: does the climax read as distinct, prompt deliberate prep, and land the win/loss banner?
|
||||
Reference in New Issue
Block a user