Files
agentic-labs-challenge-subm…/underdepths/logs/phase4_polish.log
T
2026-08-12 18:44:04 +02:00

22 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Phase 4 is complete and nothing regressed. Here's a summary of what was built:
## Phase 4 — Polish, Audio, Persist: Complete
**New files:**
- **`engine/serializers.py`** — Thin JSON converters for `Rect`, `Item`, `Enemy`, `Player`, `GameMap`. Tuples→lists, sets→lists; `visible` grids excluded (recomputed on load); effects timers persisted.
- **`engine/game_state.py`** — `GameSession` (`@dataclass(slots=True)`) as the single source of truth: `player`, `dungeon` (all 10 floors), `current_floor`, `log` (capped at 50), `turn`, `state`, `rng_seed`. Implements `new_game`, `apply_action` (move/pickup/descend/save/quaff/read/equip/wait), `to_dict`/`from_dict`, `save`/`load`. Each turn: runs all live enemies with per-enemy FOV (player tile hidden when invisible), recomputes player FOV into `visible`+`explored`, then resolves death/victory. Fixed a stale-floor bug so post-descent processing targets the new floor.
- **`engine/audio.py`** — `AudioEngine` synthesizes 8 tones (hit/miss/damage/pickup/stairs/levelup/death/victory) with stdlib `array` written straight into `pygame.mixer.Sound(buffer=...)` (no numpy, no asset files). Mixer init is fully guarded; never raises; plays are no-ops when disabled/muted.
- **`render/camera.py`** — Player-centered, map-clamped viewport (50×30 tiles).
- **`render/renderer.py`** — Colored 16×16 tiles (visible/explored/unexplored), type-coded entities, stairs glyph, top bar (floor/HP/level/XP), color-coded log panel, equipment + sound bottom bar, context prompts (`Press G to pick up <name>` / `Press > (Shift+.) to descend`), plus main-menu and end-screen drawing.
- **`main.py`** (rewritten) — Full state machine: menu (New Game/Continue[only if save]/How to Play/Quit) with keyboard+mouse; How-to-Play before each New Game and via `?`; `g`/`>`/`i`/`e`/`q`/`r`/`S`/`m`/Esc all wired to `apply_action` tuples; death screen deletes save → menu on keypress; victory screen likewise. Headless-safe: under dummy drivers it runs a scripted playthrough (menu→play→save→continue→help→mute) and exits 0, cleaning up its own test save.
**Verification:**
- Phase 4: 7/7 ✅ · Phase all: 27/27 ✅ · Smoke play: 6/6 ✅ · Phases 1–3 re-verified ✅
- `python main.py` headless exits 0; audio survives forced mixer failure; 8-run randomized stress + forced full-descent-to-victory integration tests had **0 crashes**; save/load mid-descent and effects-timer persistence confirmed.