Three parallel read-only reviews (save/boundary, perf/lifecycle, battle/economy)
produced verified findings; each was confirmed with a probe before fixing.
Battle logic:
- storm_cooldown was set to 10s on use but never decremented, disabling the
button for the rest of every battle. Now ticks with speed-scaled delta.
touch_input_test verifies 9.8s -> 0 after 12s.
- set_p3a_scenario ignored the per-wave seed passed to setup(), so every wave
of a multi-wave node reused seed 10001. Now accepts an explicit seed from
GameRoot.
Performance:
- set_roster rebuilt all hero cards every frame (~35 nodes + styleboxes/frame,
~2100 nodes/sec at 60fps). Now diffs by hero id and updates labels/energy
in place; visible_node_test asserts card instance ids are unchanged across
an identical set_roster call.
- VfxView.configure() called _ready() before add_child() triggered Godot's
_ready() again, creating two Sprite2Ds per effect (double overdraw). Added
an _ensure_sprite validity guard like UnitView.
- VFX manifest was reopened + JSON-parsed per effect spawn (~16/sec under held
taps); now cached in a static.
- SfxPlayer._played (test-only telemetry) grew unbounded; capped at 64.
Save/profile:
- muted and low_power were written by settings but absent from DEFAULT_PROFILE,
so _normalize() dropped them on every save -> settings never persisted.
Added to defaults + migration; save_corruption_test verifies.
- An unclaimed offline report was overwritten by the next launch after any
intervening save, silently losing earned gold. build_offline_report now
preserves a pending report; p3b test models claim/clear between scenarios.
- hero_levels values are clamped to 1..10000 (negative/huge values gave free
or overflowing upgrade costs) and unlocked_heroes is deduped (repeat ids
triple-counted roster DPS).
Robustness:
- hit-stop restore coroutine now uses a generation token so a stale coroutine
cannot end a newer hit-stop after clear_all.
Full gate P2_CHECKS_PASS. All logs still 0 script/parse errors and 0 lambda-
capture errors. prototype/ untracked.
Continues the MVP work from the UI and numbers baseline.
Animation. The frame runs were already in the repository but had never been
packed for runtime use. pack_animation_strip.py now derives one shared scale
and one shared foot line from the union of every frame in a state, so the
character does not jitter between frames; H01 idle/attack, EG01 idle/hit and
B01 idle/hit are packed as transparent fixed-grid atlases. UnitView plays
them with the node origin on the foot line, loops idle, plays hit once and
falls back, and flashes on damage. Content-to-art bindings live in the
content fixture, so no character id is hardcoded in the HUD.
Touch. The previous HUD used gui_input callbacks, which is not proof of a
mobile input path. run_touch_test.sh now feeds InputEventScreenTouch through
Input.parse_input_event and checks that taps on the tap toggle, an enemy card
and the storm button produce the right events on the right tick. It also
caught a real bug: Godot emulates mouse presses from touches, so one tap was
firing both handlers; enemy taps are now debounced.
Economy. The paper model had the reward and upgrade curves but the runtime
only subtracted gold from a balance that was always zero. The scene now owns
permanent progress: victory grants the reward from the shared rules, upgrades
cost a growing amount, hero DPS rises per level, and the next battle is
created with the upgraded roster DPS. run_economy_loop_test.sh proves four
N01 clears pay for the first upgrade and that duplicate grants and losses
behave correctly. The economy pacing was left at four wins rather than
weakening it to satisfy the test.
tools/run_p2_checks.sh now runs 11 gates; all pass. PRODUCTION/38 records
P2-IMP-02/03 and P2-BAT-02 as PASS. Remaining P2 holds: profiler/visual
limit, shield-break and ultimate VFX, real-device safe area and performance.