Phase 18 — Audio (music director + SFX catalog + bus wiring)
Adds an AudioManager autoload with three buses (Master, Music routed to Master, SFX routed to Master), a small catalog of looping music + one-shot SFX, and a single persistent AudioStreamPlayer for the music director. Music * Day and night loops swap on Clock.phase_changed (night during the night phase, day everywhere else). Tracks pulled from Retro Farming Music 1 (day) and Cozy Melodies Pack 1 (night), both loopable OGG. SFX * Tree.fell, Rock.mined, BigRock.mined → tree_fell / mine_tick. * EventBus.pawn_took_damage → combat_hit (Sword Pack 1). * EventBus.storyteller_event_fired → ui_confirm sting. * EventBus.alert_added → ui_click. * play_sfx is rate-limited per key (80ms cooldown) so fast-sim doesn't saturate the mixer. Settings + suspend * SettingsMenu master/music/sfx sliders now live-bind to the bus dB via Audio.set_*_linear (linear → dB internally, 0 → -80dB silence). The ambient slider is intentionally unwired; no ambient bus this pass. * NOTIFICATION_APPLICATION_PAUSED + FOCUS_OUT mute the Master bus to match the existing "no background sim" rule. Resume + focus restore it. Bundle housekeeping * Two zipped packs in the ElvGames bundle (Cozy Melodies Pack 1, Retro Farming Music 1) extracted in place to keep pack identity intact for the license/credits string. 8 OGG files curated into audio/ at ~5.3MB. Verified end-to-end via MCP runtime: buses online, day_loop plays at boot, manual phase swap day→night→day round-trips, slider linear→dB mapping correct (0.5 → -6.02dB, 0.0 → -80dB), tree_fell SFX triggers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
fb07a3fa15
commit
d819c13a9d
25 changed files with 437 additions and 8 deletions
12
memory.md
12
memory.md
|
|
@ -272,6 +272,18 @@ Same scope as locked in `~/claude/ideas/rimlike/plan.md`. Realistic timeline 3
|
|||
- **Pattern recorded — "iteration-source bugs hide behind boot-seed shortcuts".** The Phase 4 seed `SAMPLE_TREES` / `SAMPLE_ROCKS` was always being chopped/mined because providers auto-picked. Player only noticed when they painted designations and the behavior didn't change. Boot seeds that mirror "default OK" state can mask gate logic; when adding any new gate (designation, skill, capability), playtest the FRESH state, not just the seeded state.
|
||||
- **Other audit findings (deferred, not fixed this session)**: CraftingProvider has an ingredient re-scan race (ingredient may disappear between lines 73 and 91); PlantProvider only handles harvest (sow stubbed for Phase 17); RestProvider is a Phase 3 smoke-test leftover that could be deprecated. All low priority.
|
||||
|
||||
- **ConstructionProvider reachability gate** added later same day after player report: chop designations weren't being honored. Root cause: a leftover `build_door` designation at the test shed wall (36, 27) was unreachable (wall in the way), but ConstructionProvider (priority 6) kept offering it to every pawn every tick, and Decision picked it over chop (priority 5). JobRunner cancelled the doomed walk each tick — busy-spin starved chop. Same fix shape as Doctor/Eat: pre-check `pathfinder.find_path` before issuing a job; for blocking sites (walls) probe from an adjacent walkable cell.
|
||||
- **Door-replaces-wall replacement build** added by user request. Painting `build_door` on a tile occupied by a Wall (ghost OR completed) atomically demolishes the wall in place and spawns the door ghost. Reverses Wall._complete cleanly: unstamps wall_layer, marks pathfinder walkable, recomputes rooms. Source of truth is World.build_queue so the rule covers both designation-painted walls AND pre-built seeds (cabin, test shed) which self-register via Wall._ready. Other replacement combos (floor-on-floor, wall-on-door) NOT in scope; would need separate refund/destroy rules.
|
||||
|
||||
- **Phase 18 (Audio) shipped same day** — bug-triage sprint extended into Phase 18 once the job system was solid. Scope:
|
||||
- 8 curated OGG files copied into `audio/{music,sfx}/` from the ElvGames bundle (Retro Farming Music 1, Cozy Melodies Pack 1, UI Pack 1, Woodcutting & Mining 1, Sword Pack 1). Two source zips (Cozy Melodies Pack 1, Retro Farming Music 1) were extracted in-place inside the bundle's Tier 1 dir.
|
||||
- New `autoload/audio.gd` singleton: 3 buses (Master, Music routed to Master, SFX routed to Master), lazy stream loading with per-key cache, rate-limited play_sfx (80ms cooldown to prevent chop-tick spam at ULTRA), single persistent AudioStreamPlayer for the music director, automatic music swap on `Clock.phase_changed` (day_loop ↔ night_loop), mute on `NOTIFICATION_APPLICATION_PAUSED` + `FOCUS_OUT`.
|
||||
- SettingsMenu sliders (master/music/sfx) live-bound via `value_changed.connect(Audio.set_*_linear)`. Ambient slider intentionally unwired — no ambient bus this pass.
|
||||
- SFX wiring: `Tree.fell` → tree_fell, `Rock.mined` / `BigRock.mined` → mine_tick, EventBus.pawn_took_damage → combat_hit, storyteller_event_fired → ui_confirm sting, alert_added → ui_click.
|
||||
- MCP runtime verified all paths: buses online, music swap day→night→day round-trips, volume sliders correctly map linear→dB (0.5 → -6.02dB, 0.0 → -80dB silent), SFX trigger on demand.
|
||||
- **Pattern recorded — "rate-limit per-key SFX or the mixer chokes at fast sim speed".** First instinct was per-chop-tick SFX from `Tree.on_chop_tick`; at ULTRA (12× speed, ~12 chop ticks/sec/pawn × 3 pawns) that would saturate the audio mixer. Moved to completion-only SFX (Tree.fell, Rock.mined) plus an 80ms per-key cooldown in `play_sfx`. Future ambient/tick-based SFX should reuse this throttle.
|
||||
- **Pattern recorded — "extract zipped asset packs into their own named folder, in place".** The bundle ships some packs as zips (Cozy Melodies Pack 1, Retro Farming Music 1) and others as already-extracted folders. Each zip's top-level entry was a folder matching its name, so `unzip -q` in-place created the expected `Cozy Melodies Pack 1/` directory alongside the .zip without flattening. Don't extract to a generic name like `audio_extracted/` — preserve the pack identity so licensing/credits stay traceable.
|
||||
|
||||
## External references
|
||||
|
||||
- **Forgejo repo:** https://git.rdx4.com/megaproxy/rimlike (private)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue