Repository navigation
fix(render): the stores-filling caption stays quiet during an attack and backs off when ignored (#435) - #437
Conversation
…and backs off when ignored (#435) Render-only (no sim change, no simVersion bump). The caption is never owed while the army warning is disarmed (a wave is under way); an owed-unshown one is dropped. Each time it is shown and no Food Storage is designated before it would next be owed, the next cooldown doubles (1200 up to 9600 ticks); a new Food Storage resets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014f19cRizFGHLP5SS7if1Qn
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughStores-filling captions are suppressed during active army-warning waves, and pending unshown offers are cleared while dwell time continues. Repeated shown captions increase their cooldown up to 480 seconds. An increase in designated or completed Food Storage count resets the cooldown. Simulation-tick hooks now provide army-warning state. ChangesStores-Filling Caption Behavior
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant GameScene
participant beforeSimTick
participant noteStoresFillingTick
participant armyWaveUnderWay
GameScene->>beforeSimTick: pass caption state and army-warning state
beforeSimTick->>noteStoresFillingTick: pass tick data and army-warning state
noteStoresFillingTick->>armyWaveUnderWay: check whether a wave is active
armyWaveUnderWay-->>noteStoresFillingTick: return wave status
Merge Risk: ⚪ Minimal · up to The caption timing change is mergeable after normal checks; no actionable risk remains identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
The "Your stores are nearly full" caption nagged: it could take the screen while an enemy wave was marching in, and it repeated every 60 s once the player stopped adding larders. Render-only: no sim change, no simVersion bump.
Rule 1: quiet during an attack. From the moment the army warning fires for a wave (march, gathering or invasion) until it re-arms (the invasion ended / the army dispersed), the caption is never owed. "Wave under way" is the army-warning module's own state: the new
armyWaveUnderWay(state)is!state.armed. A caption owed but not yet shown when the warning fires is dropped like a stale one (freeing its cooldown). The dwell clock keeps running, so a trigger that still holds afterwards owes it again. Judged per sim tick innoteStoresFillingTick(beforeSimTickpassescaptions.armyWarning); the army warning's armed state itself is advanced once per frame (nextArmyWarning), so a wave's start or end can shift the owe tick by up to one frame, and the frame step drops anything a stale read owed, so it never shows during a wave. Silence lasts until the warning re-arms: the army dispersed (fewer than 4 loitering in the gathering radius, fewer than 3 inside the tunnels) and any invasion ended (rout, or the AI's 1800-tick invasion timeout), plus 200 quiet ticks.Rule 2: back off when ignored. Each time the caption is shown again with no Food Storage designated since the last show, the next cooldown doubles. The waits after successive ignored shows are 1, 2, 4, 8, 8... min (1200, 2400, 4800, 9600, 9600 ticks;
STORES_FILLING_COOLDOWN_MAX_TICKS= 9600 is the cap): the first repeat stays at 1200, doubling starts at the second ignored show. Designating a new Food Storage (designated + completed count goes up since the show) resets it to 1200. A caption dropped unshown does not advance the back-off. The storage hint's last-offer interplay is unchanged (still 1200). State (cooldownTicks,shownStorageCount) lives inStoresFillingCaptionState, reset with the session.Measurement
Scripted harness (playtest-5
pace5.ts, real render modules), seeds 0-19, before = origin/main f4ab287, after = this branch. "During an attack" = a show between an army warning and that invasion's end (exact show ticks joined against the invasion windows).The novice builds on every show, so the back-off never engages for it and its show count is unchanged; its win/max differences are run-to-run divergence from the changed timing. The one remaining novice-Normal "during an attack" show is a boundary case of the join (the army warning was armed at every after-build show: 0 shows with it disarmed).
Tests
src/render/stores-filling-caption.test.ts: quiet during an attack (not owed while disarmed; owed-unshown dropped; owed again after re-arm; shown caption keeps its cooldown), back-off sequence 1200/2400/4800/9600/9600 and the cap, reset on a new Food Storage, unshown drop does not advance, session reset, and batching invariance (frames of 1, 2, 3, 5 ticks give identical owe ticks) for both rules.npm run verifypasses (5376 passed, 1 skipped); the stores-filling, storage-hint and army-warning e2e specs pass unchanged (20 passed).Closes #435
🤖 Generated with Claude Code
Summary by CodeRabbit