← Back to Dev Blog

Daily Scrum Log -- 2026-06-04 (Day 30) - dungeon_delve

Summary

Day 30 introduced the Dungeon Delve System — two persistent dungeon locations (Sunken Catacombs near Thornhaven, Forgotten Vault near Millhaven) that the hero can enter while resting in town. Each dungeon has 3 floors with escalating monster difficulty, ending in a boss encounter. Clearing a dungeon earns gold/rep rewards and a 72-hour Prosperous buff for the town. Sealed dungeons reopen after 168 game-hours. processSystemTicks helper extracted from SimEngine to bring it from 306 → 290 lines. SAVE_VERSION 20 → 21. 1005 tests passing across 86 files.


Project Manager

Contribution: Led Day 30 scrum; selected Dungeon Delve System as the Day 30 milestone feature.

Key Decisions:

  • Dungeon Delve chosen because heroes had no compelling local activity — they would bounce between towns without a reason to stay. Dungeons give the hero a structured risk/reward loop tied to their current location.
  • Two dungeons, one per town, preserves the world's sense of geography. Thornhaven gets the undead-themed Sunken Catacombs; Millhaven gets the bandit-themed Forgotten Vault.
  • 3 floors (3 kills / 2 kills / 1 boss kill) gives a satisfying arc without bogging down the autonomous sim. Boss floor is a single elite monster at +7 level bonus — genuinely dangerous.
  • SimEngine.js truncation/line-count debt was addressed today: processSystemTicks extracted to SimEngineHelpers.js, bringing SimEngine from 306 → 290 lines.
  • SAVE_VERSION 19 → 20 (quest board, Day 29) → 21 (dungeon, today). Old saves load cleanly — dungeon defaults to null → DungeonSystem.restore() applies safe defaults.
  • File truncation bug (Write tool silently truncates at character limits) hit SimEngineHelpers.js, SimSnapshot.js, PersistenceManager.js, and World.js during this session. All repaired via Python byte-level patching. The advanceRegion bug introduced by an incorrect repair (resetting to index 0) was caught and fixed.
  • npm run build unavailable in sandbox (known Vite 8/rolldown issue). Zero syntax errors via node --check on all modified files; 1005/1005 tests pass.

World Designer

Contribution: Designed the two dungeons, their floor structure, and reward scaling.

Dungeon Designs:

Dungeon Town Icon Color Monster Pool Flavor
Sunken Catacombs Thornhaven fa-dungeon #8860d0 Skeleton, Revenant, Wraith, Troll Underground crypt with crumbling passages
Forgotten Vault Millhaven fa-vault #d06030 Bandit, Orc, Drake, Wraith Ancient vault with runic wards

Floor Structure:

Floor Name Kills Required Monster Level Bonus Gold Range Rep
1 Upper Depths 3 +2 60–100g 12
2 Middle Chambers 2 +4 100–140g 20
3 Boss Lair 1 +7 200–240g 45
  • Dungeon entry: 4% chance per resting hour when hero is in the dungeon's town
  • On clear: Prosperous buff lasts 72 game-hours (visible in dungeonsMeta)
  • Dungeon reseals for 168 game-hours after clearing, then reopens organically

Backend Developer

Contribution: Implemented DungeonSystem.js, refactored SimEngine and helpers, wired dungeon into sim loop.

DungeonSystem.js — 140 lines:

  • #meta per-dungeon state: state (open/active/cleared), clearedAt, prosperousUntil
  • #run current hero run: { heroName, dungeonId, floor, killsThisFloor }
  • tryEnter(heroName, heroTown) — 4% chance; sets dungeon active, returns entry message
  • recordKills(heroName, count) — accumulates kills; on threshold: advances floor or clears dungeon
  • markClearedAt(dungeonId, totalHours) — sets reset timer + prosperous buff
  • abandonRun() — hero starts travel; dungeon reopens
  • tickResets(totalHours) — returns reopen events after 168h
  • dungeonsMeta(totalHours) — decorated array with live prosperous flag
  • serialize() / restore() — full save/load with forward-compat defaults

World.js — Added spawnDungeonEncounter(heroTown, floorLevelBonus) using town-specific dungeon monster pools (undead for Thornhaven, bandits for Millhaven). Added extraLevelBonus optional param to spawnEncounter.

SimEngine.js (290 lines, down from 306):

  • processSystemTicks extracted to SimEngineHelpers — covers season/weather/festival/caravans/guilds/personality/crime/disasters/questBoard initial tick. Saves ~30 lines.
  • Import: DungeonSystem, processSystemTicks added
  • In #tick: dungeon try-enter when resting, dungeon combat branch (skips normal encounter), floor-progress on kills, dungeon cleared rewards, abandon-on-death and abandon-on-travel
  • In snapshot: dungeon state (currentFloor, meta) added
  • In #maybeSave + #loadSave: dungeon persisted/restored

PersistenceManager.js — SAVE_VERSION 20 → 21. dungeon added to save/load params. SimSnapshot.jsdungeon field added.

File repairs this session: SimEngineHelpers.js, SimSnapshot.js, PersistenceManager.js, World.js all suffered Write-tool truncation. Repaired via Python. World.js advanceRegion repair introduced index-0 regression; caught and fixed.


Frontend Developer & Designer

Contribution: Added dungeon visibility to TopBar and HeroPanel; wired dungeon prop through App.jsx.

TopBar.jsx:

  • Import: faDungeon added
  • New badge: when dungeon.currentFloor is non-null, renders a pulsing purple fa-dungeon badge showing ${floorName} ${kills}/${required}. Tooltip shows full dungeon name and floor info.

HeroPanel.jsx:

  • Import: faDungeon added; dungeonFloor prop added
  • When dungeonFloor is present, renders a progress card between the quest and bounty sections: dungeon name, floor name, progress bar (kills/required), floor number indicator.

App.jsx:

  • dungeonFloor: state?.dungeon?.currentFloor ?? null added to heroPanelProps
  • dungeon={state?.dungeon ?? null} passed to <TopBar />

Tester / QA

Contribution: Wrote DungeonSystem.test.js — 10 tests.

Test Coverage:

  • Two open dungeons on init
  • Hero not in dungeon initially
  • No double-entry when already inside
  • Floor 1 data correct on entry
  • No floor clear before kill threshold
  • Floor 1 clears after 3 kills → advances to floor 2
  • Dungeon cleared after 3-floor run (gold ≥ 200, rep ≥ 45)
  • No reopen before 168h reset timer
  • Dungeon reopens after 168h with correct event message
  • AbandonRun reopens dungeon
  • Serialize/restore round-trip preserves floor number
  • Prosperous buff visible within 72h window

Results: 1005 tests passing across 86 files (up from 993).