Repository navigation
feat(ui): new-game screen — choose difficulty, then press Start (#304) - #312
Conversation
Add `difficulty` to the render-side settings blob so the new-game screen can reopen on the tier the player last started a round with. Default Normal; the stored value is accepted only when it is exactly one of the three tier names, otherwise it falls back to the default without touching its siblings. A pre-#304 blob without the key loads as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…button (#304) Options first, one Start button last. The boot-time "Choose Difficulty" overlay becomes a "New Game" screen: three radio-style rows (Easy / Normal / Hard, default Normal, visible selected state) each carrying a plain-language line about what the tier changes, and a single "Start game" button. Only Start — or Enter — begins the round; clicking a row just moves the selection. The screen reopens on the persisted last-used tier (settings.difficulty), which is written on Start. - boot-overlay-layout.ts: the screen is a section stack (title → difficulty → opponent slot → start) computed purely from the LayoutContext, centered as a group (#213/#238 discipline). The opponent slot has height 0 on main; the Jev opponent picker (PR #298) inserts its section by passing the height it needs, and nothing else moves. - difficulty-copy.ts: the row copy DERIVES its numbers from the sim's [Easy, Normal, Hard] triplets (egg-interval numerator, WarFooting / Invading fighter thresholds, spider hunger threshold at 50 ms/tick), so it cannot drift from the constants; the wording is pinned by a test so a retune shows up in review. - ui-scene.ts: re-render-in-place rows (the survey overlay's shape), an Enter binding scoped to the screen, `__phase9_ui.selectedDifficulty` for Playwright, and a scene-level pointer guard so clicks on the boot overlays no longer fall through to the HUD chain beneath the scrim. - game-scene.ts: onStart callbacks (persist, then bootFresh) on both the fresh-boot and restart paths; the SavePrompt path is unchanged. The dev-only `__phase9_test.getRoundDifficulty()` lets a spec prove Start booted the selected tier. Render-only: no sim change, no simVersion bump. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…add #304 spec Every spec that starts a round used to carry its own "poll-click Normal" loop. The screen is now two steps (pick a row, press Start), so the loop lives once in tests/helpers/boot.ts (settleToPlaying, plus the activeOverlay / bootScreen / selectedDifficulty reads) and the four boot-flow specs — phase-09-session, menu-and-dialog, survey-overlay, touch-smoke — use it. The helper also refuses to mistake the pre-overlay frame (activeOverlay defaults to 'none' before any boot overlay has been shown) for Playing. Rects come from tests/helpers/geometry.ts, which evaluates the pure layout function at the default layout (DIFFICULTY_ROW_RECTS, NEW_GAME_START_RECT) — no inline pixels in specs. New tests/new-game-screen.spec.ts: default selection is Normal; a row click moves the selection without starting; Start boots the selected tier; Enter starts on the current selection; the last-used tier persists across a reload; an unknown stored tier falls back to Normal. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
Adversarial-review findings on the #304 screen, all render/test-side: - Dispatch: the rows and the Start button no longer carry per-object pointerdown handlers. Phaser fires those BEFORE the scene-level handler, so a Start handler that hid the screen let the very same dispatch reach the HUD chain beneath the scrim with the screen already gone (harmless at today's geometry, the speed/pause widget once the Jev opponent section pushes Start down). Hit-testing now lives in the scene-level pointerdown handler (dispatchNewGameClick: Start → commit, row → select, else absorbed), the pause menu's rule. Regression assertion: after Start, speedMultiplier is still 1×, the view is the surface, no overlay is up. - smoke.spec's "underground screenshot" was vacuous once the boot overlays absorbed clicks (both screenshots byte-identical): it now starts a round, clicks VIEW_TOGGLE and asserts activeView === 'underground' first. - Copy precision: hungerTicks accrues only outside Feeding, so the line reads "Spider gets hungry N s after a meal" (clock starts when the meal ends); pinned strings updated. - Negative coverage: Enter on a real Continue/New Game SavePrompt leaves it up (SCEN-04); the touch project drives the screen with page.touchscreen taps (settleToPlaying `via: 'touch'`) so the touch path is pinned. - Website embed: the Enter Key handler ignores events typed into an input, textarea, select or contenteditable (the keydown bubbles to Phaser's window listener); e2e injects a host-page <input> and proves Enter there does not start a round while Enter on the game still does. - Save-fallback paths (corrupt / pre-V22 / future-build save on Continue) boot fresh on the persisted tier instead of a hard-coded Normal; the bootFresh default parameter is gone so every caller states the tier. - Stale "Choose Difficulty" comments in the specs updated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
77d7062 moved the new-game screen's rows and Start onto the scene-level pointerdown handler but left the GameOver "Restart" and SavePrompt "Continue" / "New Game" buttons on per-object handlers. Those run BEFORE the scene-level handler for the same pointer, and both Restart and New Game synchronously OPEN the new-game screen — so the same click was then hit-tested against the freshly built rows. Before 77d7062 objects created mid-dispatch were not in Phaser's hit list, so this could not happen. Confirmed: GAME_OVER_RESTART_RECT lies inside the Hard row (every Restart selected Hard regardless of the persisted tier); SAVE_PROMPT_NEW_GAME_RECT straddles the Normal/Hard rows. Fix: the single-dispatcher rule now covers all three boot overlays. The GameOver and SavePrompt buttons keep setInteractive() only; their callbacks are captured at show time and dispatched by the scene-level handler (dispatchGameOverClick / dispatchSavePromptClick, checked BEFORE the new-game branch in recomputeActiveOverlay precedence), each branch returning whether or not it hit a button — an opening click can never reach the screen it opened. Specs (tests/new-game-screen.spec.ts): with a persisted Easy (Start on Easy → Save Now → reload), New Game clicked inside the Hard band and inside the Normal band opens on Easy and stays there; GameOver Restart (inside the Hard band) opens on Easy and Start then boots Easy. Game over is reached deterministically through a dev-only __phase9_test.forceGameOver() seam that drives the SAME render-side transition a terminal tick outcome takes — the onTickOutcome body is extracted verbatim into GameScene.enterGameOver(outcome); the sim is never touched. Band points are derived from the exported rects (button ∩ row), so the test throws rather than passing vacuously if a future layout removes the overlap. GAME_OVER_RESTART_RECT is re-exported from tests/helpers/geometry.ts and clickCanvasPoint added to tests/helpers/boot.ts. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
|
@codex review |
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: LightAxe/subterrans/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (16)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughChangesDifficulty-based new-game flow
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~60 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant Player
participant UIScene
participant GameScene
participant Settings
Player->>UIScene: choose Easy, Normal, or Hard
Player->>UIScene: press Start or Enter
UIScene->>GameScene: commit selected difficulty
GameScene->>Settings: save started difficulty
GameScene->>GameScene: start round with selected difficulty
🚥 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. Breezy! 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". |
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
…ce, Jev options only when selected (#304) Items 3–4 of #304 on the Jev beta branch, rebuilt on main's new-game screen (#312) instead of the old difficulty-buttons overlay: an explicit Opponent section between Difficulty and Start, the Jev options shown only once Jev is selected, and the free-text box captioned for whose orders they are. The screen, top to bottom, on a build with a Jev endpoint: Difficulty (main's three radio rows, unchanged) Opponent two radio-style rows with a one-liner each — "Standard AI · The built-in rule-based enemy colony." "Jev (beta) · TypeSafe's Jev model plays the enemy; you can instruct it." Jev options ONLY while the Jev row is selected: "Custom instructions for Jev, your opponent" (+ n/300 counter), the four standing-orders presets, and the free-text box Start game (main's single Start; Enter also starts) Defaults are Normal + Standard AI; nothing above Start starts a round. On a build with no endpoint no section is drawn at all — the screen is main's, pixel for pixel — so Standard AI is implied rather than shown disabled (the plain-build specs pass with no geometry change). - boot-overlay-layout.ts: the section is laid out INSIDE the stack's opponentSlot (opponentSectionH / opponentSectionLayout / newGameScreenWithOpponent), so it inherits the LayoutContext discipline and the stack re-centres around it. Its height follows the picker: caption + two 30 px rows collapsed, + caption line / presets / 46 px free-text rect expanded — 190 px, exactly what keeps the fully expanded stack inside the shipping canvas with NEW_GAME_STACK_MIN_TOP clear at both ends (pinned by a test). The old top-anchored opponentPickerLayout (and its hint "Set the opponent below first", moot now that rows do not start the game) is gone. - opponent-copy.ts: the section's strings, pinned by a test that also guards each row's one-liner against wrapping. - ui-scene.ts: the section draws from the same re-render-in-place path as the difficulty rows; ALL clicks dispatch through dispatchNewGameClick (Start → commit, difficulty row → select, opponent row → toggleKind, preset → selectPreset, else absorbed — no per-object pointer handlers). The free-text box is a DOM <textarea> from the shared overlay-field factory (keydown stops propagation, so Enter inside it never reaches the Enter-starts binding; the caption doubles as its aria-label), torn down on hide, on leaving the Jev row and on scene shutdown, and never part of the Phaser group so a re-render keeps focus and caret. A canvas click blurs it explicitly — Phaser preventDefault()s the canvas mousedown, so the browser would otherwise leave every later key in the box. commitNewGame reads the picker's config BEFORE hiding. __phase9_ui.selectedOpponent is published alongside selectedDifficulty. The n/300 counter follows the drawn caption rather than sitting at the column's right edge, where the HUD view-toggle shows through the scrim. - opponent-picker-state.ts: re-selecting the lit preset returns the same state object, so the overlay's identity check skips a needless rebuild. - game-scene.ts: dev-only __phase9_test.getRoundOpponent() so a spec can prove Start booted the selected opponent. - tests: geometry.ts exports the Jev-build rect sets for BOTH picker states (the stack moves between them); boot.ts gains selectedOpponent; jev-opponent.spec.ts pins the defaults, options hidden until Jev, the caption, nothing-above-Start-starts, Enter inside the box not starting, persistence across reload, and textarea teardown. Render-only: no sim change, no simVersion bump; settings persistence (opponent / jevOrders) is unchanged from the branch. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
Main-side part of #304 (items 1–2 and the Start button). The opponent picker and Jev options (items 3–4) stay on
feat/jev-opponent(#298), which rebases onto this; the layout exposes anopponentSlotbetween the difficulty rows and Start for it.What changed
[Easy, Normal, Hard]triplets insrc/sim/constants.tsand pinned by a unit test so a retune surfaces in review:src/platform/settings.ts(stored on Start; corrupt or missing values fall back to Normal; the save-fallback paths that boot without the screen also honour it).src/render/boot-overlay-layout.ts(newGameScreenLayoutis a pure function of the layout context; the section stack re-centres and clamps at the top) and are mirrored intests/helpers/geometry.ts.settleToPlaying(page, tier, { via: 'mouse' | 'touch' })helper replaces the per-spec boot loops; newtests/new-game-screen.spec.tscovers default Normal, Hard-click-does-not-start, Start boots Hard, Enter starts, persistence across reload, unknown stored tier → Normal, Enter in a host input, no HUD fall-through after Start, and the opening-click replay cases (New Game inside the Hard/Normal bands with a persisted Easy; Restart via a new DEV-only__phase9_test.forceGameOver()that calls the extractedenterGameOver). The smoke underground screenshot now really toggles the view.Render-only: nothing under
src/sim, no simVersion bump.Verification
npm run verifygreen (127 files, 3118 tests); fullnpm run test:e2e(chromium + chromium-touch + webkit) 47 passed, retries 0.Closes the main-side acceptance items of #304; the Jev items follow on #298.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wnk2sCfgZTMftaaWShvjdh
Summary by CodeRabbit
New Features
Bug Fixes