Run outcome detection (win/loss/abandoned) #10

Closed
opened 2026-04-19 17:00:26 -07:00 by nelsong6 · 1 comment
nelsong6 commented 2026-04-19 17:00:26 -07:00 (Migrated from github.com)

Goal

Currently RunData.Outcome stays "in_progress" forever. Detect terminal states and set Outcome + EndedAt:

  • win — beat the final act boss
  • loss — player died
  • abandoned — Abandon Run used

Hooks to explore

  • RunManager.IsGameOver / IsAbandoned — state changes
  • Look for explicit events: RunEnded, GameOver on RunManager
  • Loss path: CombatManager.ProcessPendingLoss
  • Win path: room.RoomType == Boss && final act

Implementation sketch

  1. Subscribe to the run-end signal (find it first).
  2. Callback sets _currentRun.Outcome and _currentRun.EndedAt, SaveAsync.
  3. Null out _currentRun so next RunStarted creates a fresh record.

Priority

Non-blocking for M1/M2/M3 but needed before M6 (Nexus publish). "in_progress" forever confuses first-time users.

## Goal Currently `RunData.Outcome` stays "in_progress" forever. Detect terminal states and set Outcome + EndedAt: - `win` — beat the final act boss - `loss` — player died - `abandoned` — Abandon Run used ## Hooks to explore - `RunManager.IsGameOver` / `IsAbandoned` — state changes - Look for explicit events: RunEnded, GameOver on RunManager - Loss path: `CombatManager.ProcessPendingLoss` - Win path: `room.RoomType == Boss && final act` ## Implementation sketch 1. Subscribe to the run-end signal (find it first). 2. Callback sets `_currentRun.Outcome` and `_currentRun.EndedAt`, SaveAsync. 3. Null out `_currentRun` so next RunStarted creates a fresh record. ## Priority Non-blocking for M1/M2/M3 but needed before M6 (Nexus publish). "in_progress" forever confuses first-time users.
nelsong6 commented 2026-04-19 17:45:56 -07:00 (Migrated from github.com)

Implemented in 6a03da5 (auto-closed by commit message).

Approach: Harmony-postfix on `RunManager.OnEnded(bool isVictory)` — the game's canonical run-end path, called once per run with victory flag. `IsAbandoned` is set before the abandon flow transitively enters OnEnded. Three-way outcome mapping:

  • `abandoned` — IsAbandoned true (highest priority)
  • `win` — isVictory && !IsAbandoned
  • `loss` — neither

`RunTracker.OnRunEnded` stamps Outcome + EndedAt, refreshes FloorReached, saves, then nulls `_currentRun` so the next RunStarted gets a clean slate.

needs-verification: awaiting in-game test of all three outcome paths. Minimal test: win a run → verify outcome=win. Die in a run → verify outcome=loss. Abandon a run from pause menu → verify outcome=abandoned.

Implemented in 6a03da5 (auto-closed by commit message). **Approach:** Harmony-postfix on \`RunManager.OnEnded(bool isVictory)\` — the game's canonical run-end path, called once per run with victory flag. \`IsAbandoned\` is set before the abandon flow transitively enters OnEnded. Three-way outcome mapping: - \`abandoned\` — IsAbandoned true (highest priority) - \`win\` — isVictory && !IsAbandoned - \`loss\` — neither \`RunTracker.OnRunEnded\` stamps Outcome + EndedAt, refreshes FloorReached, saves, then nulls \`_currentRun\` so the next RunStarted gets a clean slate. **needs-verification:** awaiting in-game test of all three outcome paths. Minimal test: win a run → verify outcome=win. Die in a run → verify outcome=loss. Abandon a run from pause menu → verify outcome=abandoned.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens#10
No description provided.