diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index df8ec6e8..ba79fcc6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -28,7 +28,7 @@ body: attributes: label: Steps to reproduce placeholder: | - 1. Open Platformer → Level Select → Orbital Ops + 1. Pick the Orbital Ops tile on the hub 2. Hold Jump in the zero-gravity bay 3. ... validations: diff --git a/README.md b/README.md index a757dd25..46e1efa8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A Godot 4 arcade collection starring Hoppy, the CodeRabbit mascot. It has a reac ```sh godot --path hoppys-adventure-arcade ``` -3. Choose **Platformer Game** (it opens on Level Select), **Endless Runner**, or **Beat’em Up → Play Code City Brawl / Play Heroes vs. Villains**. +3. Pick a game tile: **Bay Area Blitz**, **Orbital Ops**, **The Enchanted Repo**, **Endless Runner**, **Code City Brawl** or **Heroes vs. Villains**. Esc, P or Start pauses any game; **Main Menu** on the pause menu or a results screen returns to the hub. | Action | Keyboard | Controller | |---|---|---| diff --git a/docs/bay-area-blitz.md b/docs/bay-area-blitz.md index 360ea819..b7a7512b 100644 --- a/docs/bay-area-blitz.md +++ b/docs/bay-area-blitz.md @@ -9,15 +9,15 @@ Run the project normally: **Platformer Game → Play Bay Area Blitz**. For direc - Move: A/D, left/right arrows, controller left stick or D-pad. - Jump: Space/W/up arrow, controller A/Cross. Release early for a shorter jump. - Swipe: J/X, controller X/Square. Swiping is the only way to hurt a bug; there is no stomping, and touching an enemy from any side, including landing on it, costs a heart. -- Pause/resume: Escape, P or controller Start. Focus loss pauses the game. Entering the level from the menus opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. +- Pause/resume: Escape, P or controller Start. Focus loss pauses the game. Entering the level from the hub opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. - Defeat the Merge Conflict Monster, then swipe or land on the MERGE button to finish. -- Pause and results provide fresh retry, platformer menu, and arcade return. Finishing a level (any of the three) plays a short stage-clear stinger (`Assets/Audio/Platformer/stinger_stage_clear.ogg`) over the MERGE SUCCESSFUL results while the paused level music stays silent; a knockout keeps its ducked level music instead. +- The pause menu (shared with every game, see [main-menu.md](main-menu.md#pause-menu)) offers Resume, Restart, How to Play and Main Menu; the results offer a fresh **Retry** and **Main Menu**, which returns to the hub. Finishing a level (any of the three) plays a short stage-clear stinger (`Assets/Audio/Platformer/stinger_stage_clear.ogg`) over the MERGE SUCCESSFUL results while the paused level music stays silent; a knockout keeps its ducked level music instead. ## Implemented A 5,300-pixel authored city route with two jumpable gaps, optional raised token routes, two moving cable-car platforms, parallax buildings/fog, supplied Golden Gate scenery, animated Hoppy, glitch critters, Request Changes Reviewers, broken pipelines, a moving conflict zone, and a three-headed boss. The safe lower route does not require waiting for a cable car. -Three-heart health, damage knockback, post-hit protection, variable jump height, coyote time, jump buffering, swipe hit deduplication, per-run score, boss-gated completion, pause/focus handling, death/retry, level selection, and the Bay Area music track are connected. The existing menu audio/background paths were repaired to match the reorganized Assets folder. Other levels remain explicitly unavailable. +Three-heart health, damage knockback, post-hit protection, variable jump height, coyote time, jump buffering, swipe hit deduplication, per-run score, boss-gated completion, pause/focus handling, death/retry, and the Bay Area music track are connected. The existing menu audio/background paths were repaired to match the reorganized Assets folder. Other levels remain explicitly unavailable. All art comes from `Assets/bay-area-blitz-assets-only`; Hoppy uses that pack's existing platformer SpriteFrames. Sound uses existing project assets. No assets were generated or downloaded. @@ -77,7 +77,7 @@ All three platformer levels share a 3.5-second knockout cutaway for fatal hits a The level freezes and its HUD disappears while an enlarged Hoppy plays the knockout sprite animation in place, with fixed position, rotation and scale, and sees stars beneath a K.O. callout. The current level or boss music keeps playing, ducked by 12 dB, -through the existing results menu. Retry creates a fresh run; leaving restores menu audio. +through the existing results menu. Retry creates a fresh run; leaving restores the hub audio. Gameplay inputs cannot skip the cutaway, but can still finish the results fade once it appears. Run `godot --headless --path hoppys-adventure-arcade --script res://tests/platformer_knockout.gd` diff --git a/docs/booth-runbook.md b/docs/booth-runbook.md index 5ec67e97..0a548ae7 100644 --- a/docs/booth-runbook.md +++ b/docs/booth-runbook.md @@ -17,7 +17,7 @@ This runbook is for the staff who run Hoppy’s Adventure Arcade unattended at a ```sh tools/booth/macos/setup.sh --app "/Applications/Hoppy’s Adventure Arcade.app" --route heroes_vs_villains ``` - Nothing changes yet. To apply it, run the same command with `--apply` and enter the administrator password when asked. The game starts. To give each player a retry or change the attract screen, add game flags after `--`, for example `-- --retries=1 --attract=beatem_up` ([booth flags](builds.md#run-it-at-a-booth)). + Nothing changes yet. To apply it, run the same command with `--apply` and enter the administrator password when asked. The game starts. To give each player a retry, add game flags after `--`, for example `-- --retries=1` ([booth flags](builds.md#run-it-at-a-booth)). 4. Do the manual steps the script lists at the end: automatic login, Do Not Disturb, the display, the volume and the controllers. 5. Restart the Mac. The game should start on its own within a minute. @@ -40,12 +40,12 @@ Booth mode itself runs fullscreen and ignores the menu's **Quit Game**. A game n | What happens | What you'll see | |---|---| | A player walks away mid-game | After 90 seconds the game returns to the hub. | -| A player loses | Once they have used any retries you set (none by default), a **GAME OVER** card thanks them and shows their score. After six seconds the attract screen (the hub unless you set another) opens for the next player. | +| A player loses | Once they have used any retries you set (none by default), a **GAME OVER** card thanks them and shows their score. After six seconds the hub opens for the next player. | | The game crashes or closes | The watchdog opens it again within a few seconds. | | The game freezes | The watchdog restarts it within about a minute. | | Someone presses Cmd+Q | The game closes, and the watchdog opens it again. | | The player's controller disconnects | The game pauses and asks for the controller. Plug it back in, or press Start on another controller. | -| You want to clear the Endless Runner scores | Start the Endless Runner tile, pause and choose **Runner Menu**, then **Leaderboard → Reset scores**. (Or start the game once with `--route=runner`.) | +| You want to clear the Endless Runner scores | Start the Endless Runner tile, pause (Esc or Start) and choose **Leaderboard → Reset scores**, then **Reset** to confirm. | ## Stop the game for maintenance diff --git a/docs/builds.md b/docs/builds.md index 7f6457e5..dacdeca6 100644 --- a/docs/builds.md +++ b/docs/builds.md @@ -34,11 +34,11 @@ open -a "Hoppy’s Adventure Arcade.app" --args -- --booth --route=heroes_vs_vil - **Fullscreen.** The game starts fullscreen without changing the saved settings. - **Booth QR code.** A scannable, branded CodeRabbit link stays in the top-right corner on every route in booth mode. The provided code points to `https://coderabbit.link/ato26-ad?qr=1`, which identifies QR scans for attribution. To change the destination, regenerate `hoppys-adventure-arcade/Assets/booth/booth_qr.png` from the repository root with `swift hoppys-adventure-arcade/tools/booth/generate_qr.swift` and pass the output path and URL as optional arguments, then rebuild the game. -- **How-to-play cards.** Each visitor's first entry into a game opens its how-to-play card. Its pages turn by themselves every 7 seconds (28 seconds at most), so it starts play on its own and never holds off the idle reset. A new visitor starts whenever the attract route opens. See [main-menu.md](main-menu.md#how-to-play-cards). -- **Idle reset.** After 90 seconds with no keyboard, mouse, touch or controller input, any game returns to the attract route. That is the hub, whose rotating previews act as the attract screen, unless `--attract=` names `beatem_up` or `runner`, the other menus that start their own music. -- **Game over.** A lost game doesn't offer unlimited retries. A player gets `--retries=` retries (default 0); after that, the game shows no retry screen. Instead a **GAME OVER** card thanks the player, shows their score and counts down six seconds, then the attract route opens for the next player. The count starts again whenever the attract route opens. Every game takes part: Heroes vs. Villains, Code City Brawl, the platformer levels and the Endless Runner. Without `--booth`, every game keeps its own retry screen. +- **How-to-play cards.** Each visitor's first entry into a game opens its how-to-play card. Its pages turn by themselves every 7 seconds (28 seconds at most), so it starts play on its own and never holds off the idle reset. A new visitor starts whenever the hub opens. See [main-menu.md](main-menu.md#how-to-play-cards). +- **Idle reset.** After 90 seconds with no keyboard, mouse, touch or controller input, any game returns to the hub, whose rotating previews act as the attract screen. (The old `--attract=` flag is still accepted so saved booth configs keep launching; it logs a warning and changes nothing.) +- **Game over.** A lost game doesn't offer unlimited retries. A player gets `--retries=` retries (default 0); after that, the game shows no retry screen. Instead a **GAME OVER** card thanks the player, shows their score and counts down six seconds, then the hub opens for the next player. The count starts again whenever the hub opens. Every game takes part: Heroes vs. Villains, Code City Brawl, the platformer levels and the Endless Runner. Without `--booth`, every game keeps its own retry screen. - **No quitting from the menu.** The menu's **Quit Game** does nothing in booth mode; staff close the window (Cmd+Q, Alt+F4). -- **Launch route.** `--route=` opens a route at launch (`heroes_vs_villains`, `code_city_brawl`, `bay_area_blitz`, `orbital_ops`, `enchanted_repo`, `runner`, `platformer`, `beatem_up`, `hub`), with or without `--booth`. An unknown name logs an error and opens the hub. +- **Launch route.** `--route=` opens a route at launch (`heroes_vs_villains`, `code_city_brawl`, `bay_area_blitz`, `orbital_ops`, `enchanted_repo`, `runner_game`, `credits`, `hub`), with or without `--booth`. An unknown name logs an error and opens the hub. - **Keep it running.** `tools/booth/watchdog.sh` relaunches the game whenever it exits and restarts it when it hangs. The watchdog passes `--heartbeat=`, which makes the game rewrite that file with the current time every two seconds; a file that stops changing means the game is stuck. On a Mac, `tools/booth/macos/setup.sh` installs the watchdog as a login item and applies the kiosk settings. The [booth runbook](booth-runbook.md) walks staff through setup, the show days and recovery. - **Session log.** Booth mode records each game session's start and end in `user://booth/`, one file per run of the game (`sessions--.jsonl`). Each entry records the game, the local start and end times, the duration, how the session ended (`menu`, `idle`, `game_over` or `quit`), how many times the player re-entered the game, and how many times they lost (`game_overs`, stage retries included). It records nothing about players and never uses the network. A start with no end means the game stopped without quitting: a crash, a power cut or a forced kill. The game prints its file's full path at startup. `--session-log=` writes to another folder and works without `--booth`, for playtests. diff --git a/docs/code-city-brawl.md b/docs/code-city-brawl.md index a9d46a42..ddd03430 100644 --- a/docs/code-city-brawl.md +++ b/docs/code-city-brawl.md @@ -14,7 +14,7 @@ Launch Godot 4.7.1 and choose **Beat'em Up → Play Code City Brawl** from the a | Pick up nearby weapon | E or K | Y / Triangle | | Pause / resume | Escape or P | Start | -The first entry from the menus opens the game's [how-to-play card](main-menu.md#how-to-play-cards) before the opening story scenes; the pause menu's **How to Play** shows it again. +The first entry from the hub opens the game's [how-to-play card](main-menu.md#how-to-play-cards) before the opening story scenes; the pause menu's **How to Play** shows it again. W/Up changes the ground lane. Jump is a separate height above that lane. Attacks have a forward reach and depth tolerance, so standing in another lane avoids melee. Jump above ground attacks and projectiles, or sidestep their telegraphs. Late attack input buffers one next combo step; a gap of more than 0.48 seconds after recovery resets the chain. Hoppy keeps his facing through a swing, so its hit area never flips mid-attack. Pressing the other way during or right after a swing turns him for the next one, buffered combo steps included. A quick tap mid-swing is remembered until the swing ends. @@ -23,14 +23,14 @@ Hoppy has three HP. Coffee restores one HP. Each stage begins with fresh health - Hoppy lying in the defeat pose with orbiting stars. - A REVIEW FAILED card. -The sequence lasts about 3.5 seconds and restores the camera and HUD when it ends or is cancelled. The game-over menu then offers a retry from that stage's first encounter, restoring the score saved on entry. Pause freezes combat, effects and music, including during the introduction and stage transitions; losing window focus also pauses. Return-to-menu is available from pause, intros and results. +The sequence lasts about 3.5 seconds and restores the camera and HUD when it ends or is cancelled. The game-over menu then offers a retry from that stage's first encounter, restoring the score saved on entry. Pause freezes combat, effects and music, including during the introduction and stage transitions; losing window focus also pauses. **Main Menu** (the hub) is available from the pause menu, the intro and the results; the pause menu is the shared one described in [main-menu.md](main-menu.md#pause-menu). There are three gated encounters per district. Clear every living combatant, including split soldiers and reviving zombies, then walk right. In the first two districts, clearing the third encounter's wave calls in a [district boss](#district-bosses) instead of opening the gate. The ninth encounter is the Grand Merge Conflict. No confirm press is needed between stages: - **Introduction.** Three painted story scenes open the run: Code City under siege, the review pipeline breached, and Hoppy clocking in on a rooftop over the districts. - Each scene slowly pans and zooms under letterbox bars while its caption types out, then dips to black. - Each turns by itself after 4.5 seconds while a bar in the lower letterbox drains. - - In the lower bar, **Next →** turns a scene sooner, **Skip intro** goes straight to the first district, and **Return to Beat'em Up menu** leaves. + - In the lower bar, **Next →** turns a scene sooner, **Skip intro** goes straight to the first district, and **Main Menu** leaves for the hub. - **District boss down.** When a district boss falls, play stops and its adds and threats clear. Hoppy hops once in his victory pose under a DISTRICT BOSS DOWN banner (+500 points) for 1.4 seconds. - **Stage exit and entry.** After the victory hop, Hoppy runs off to the right on his own under a DISTRICT SECURED banner. The screen dips to black while the next district loads, then he runs in under its title banner. The sequence takes about 2–3 seconds; the title banner stays up for 2.8 seconds and fades over the start of combat, and messages raised in that time (such as the encounter counter) wait until it clears. The first room's enemies wait 0.8 seconds before their first telegraph. Retry uses the same run-in. - **Boss music** dips, swaps tracks at the bottom and comes back up over 0.6 seconds instead of cutting hard. @@ -42,7 +42,7 @@ There are three gated encounters per district. Clear every living combatant, inc - **Ending.** The celebration leads into a painted victory epilogue, and then the victory screen completes the run. - The epilogue is three story scenes, played like the introduction: the Grand Merge Conflict resolving, Code City coming back online, and Hoppy shipping it on a rooftop at sunrise. - Each scene holds for 5 seconds. **Next →** turns a scene sooner and **Skip** goes straight to the victory screen. Pause freezes the epilogue and resumes it on the same scene. - - The victory screen counts the final score up from zero over 1.8 seconds and shows the time taken, then **Return to Beat'em Up menu** takes focus. + - The victory screen counts the final score up from zero over 1.8 seconds and shows the time taken, then **Main Menu** takes focus. - The victory screen and game-over menu ignore confirm, click and touch input for their first 0.5 seconds, so a jump or attack press carried over from combat can't select an option. After that, the first press lands the score count at once. - **Minimap.** A minimap sits in the top-right corner, under the HUD bar and clear of the boss bar. - Its top row shows the whole run: all nine encounters as tiles, grouped by district. Cleared encounters are filled, the current one pulses, and the final boss encounter is marked. @@ -63,7 +63,7 @@ There are three gated encounters per district. Clear every living combatant, inc |---|---|---| | ![The top-right minimap during combat](previews/code-city/minimap.png) | ![The first scene of the victory epilogue](previews/code-city/ending.png) | ![The victory screen with the final score](previews/code-city/victory.png) | -[Mode 2: Heroes vs. Villains](heroes-vs-villains.md) is separately playable from the mode menu. +[Mode 2: Heroes vs. Villains](heroes-vs-villains.md) has its own tile on the hub. ## Districts and combat @@ -126,7 +126,7 @@ A leap commits to the warned destination; it does not follow Hoppy after takeoff | Area | Music in `Assets/Audio/Beat'em Up/` | |---|---| -| CLI/IDE and mode menu | `code_city_cli_ide_district.ogg` | +| CLI/IDE District | `code_city_cli_ide_district.ogg` | | Security | `code_city_security_sector.ogg` | | Git HQ | `code_city_git_hq.ogg` | | District bosses | `code_city_district_boss.ogg` | @@ -167,11 +167,11 @@ godot --path hoppys-adventure-arcade --always-on-top --script res://tests/beatem godot --path hoppys-adventure-arcade --always-on-top --script res://tests/capture_code_city_bosses.gd ``` -The logic suite covers combo buffering, turning between swings and on buffered steps, attack deduplication and depth, weapon durability, armor, shields/statuses, hammer target count, soldier splits, zombie revival, gate ownership, pickup rules, hazard warnings, jumping, pause, boss thresholds, Force Merge, retry cleanup and all four music mappings. The smoke suite injects keyboard/gamepad events, traverses all nine encounters with no confirm input between stages, beats both district bosses, verifies bounded pools and one completion, and returns to the menu. `code_city_mini_boss.gd` checks that districts 1 and 2 call in their district boss and district 3 keeps the Grand Merge Conflict; the boss's stagger, enrage and adds; and the hands-free defeat: victory hop, run-off and next district. It kills both district bosses and the Grand Merge Conflict through real swings, armed and unarmed, and checks that the victory pose holds with the weapon hidden and no i-frame flicker. It also checks: +The logic suite covers combo buffering, turning between swings and on buffered steps, attack deduplication and depth, weapon durability, armor, shields/statuses, hammer target count, soldier splits, zombie revival, gate ownership, pickup rules, hazard warnings, jumping, pause, boss thresholds, Force Merge, retry cleanup and all four music mappings. The smoke suite injects keyboard/gamepad events, traverses all nine encounters with no confirm input between stages, beats both district bosses, verifies bounded pools and one completion, and returns to the hub. `code_city_mini_boss.gd` checks that districts 1 and 2 call in their district boss and district 3 keeps the Grand Merge Conflict; the boss's stagger, enrage and adds; and the hands-free defeat: victory hop, run-off and next district. It kills both district bosses and the Grand Merge Conflict through real swings, armed and unarmed, and checks that the victory pose holds with the weapon hidden and no i-frame flicker. It also checks: - the district-boss fight track and the district track's return; - the boss bar's colour, and that it clears after a district boss falls; - pause during the hop and during the celebration; -- that a retry clears the boss. `stage_flow.gd` checks the director's phase order and durations, a single stage rebuild on black, pause during every phase, the music envelope and boss-music dip, retry, cancellation on game over and return-to-menu, and the 0.5-second menu guard. `hoppy_armed_assets.gd` requires all eleven armed sheets in both modes and checks their frames, clips, pivots, anchors, body height and carry icons. `beatemup_story.gd` checks, for both modes, that each story scene's caption types and its pan moves on the clock, the dips and bars, Next / Skip / the one-press card skip, the pause freeze, and the hands-free hand-off into the first stage. `beatemup_knockout.gd` covers the knockout in both modes: +- that a retry clears the boss. `stage_flow.gd` checks the director's phase order and durations, a single stage rebuild on black, pause during every phase, the music envelope and boss-music dip, retry, cancellation on game over and Main Menu, and the 0.5-second menu guard. `hoppy_armed_assets.gd` requires all eleven armed sheets in both modes and checks their frames, clips, pivots, anchors, body height and carry icons. `beatemup_story.gd` checks, for both modes, that each story scene's caption types and its pan moves on the clock, the dips and bars, Next / Skip / the one-press card skip, the pause freeze, and the hands-free hand-off into the first stage. `beatemup_knockout.gd` covers the knockout in both modes: - Hoppy is knocked out by direct and live hits (bullets, ground warnings, enemy and boss contact). - Phase timing: the slow-motion throw, the camera push and letterbox bars, the card, and the menu after about 3.5 seconds (never more than 4). - The HUD, minimap and control hints are hidden through the cinematic and restored after it, and the camera is restored on completion or cancellation. diff --git a/docs/enchanted-repo.md b/docs/enchanted-repo.md index df1ebe44..602ebc0c 100644 --- a/docs/enchanted-repo.md +++ b/docs/enchanted-repo.md @@ -6,7 +6,7 @@ Implemented in Godot 4.7.1 from the current shared GDD's Platformer section, the Choose **Platformer Game → Play Enchanted Repo**. Direct scene: `res://scenes/platformer/enchanted_repo.tscn`. -Move with A/D or arrows, jump with Space/W/up, swipe with J/X, pause with Escape or P. Existing gamepad mappings remain stick/D-pad movement, A/Cross jump, X/Square attack, and Start pause. Release Jump early for a short hop. Descending onto an enemy bounces Hoppy; the Monolith takes damage only in its recovery windows. Entering the level from the menus opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. +Move with A/D or arrows, jump with Space/W/up, swipe with J/X, pause with Escape or P. Existing gamepad mappings remain stick/D-pad movement, A/Cross jump, X/Square attack, and Start pause. Release Jump early for a short hop. Descending onto an enemy bounces Hoppy; the Monolith takes damage only in its recovery windows. Entering the level from the hub opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. Cross the forest and ruined castle, defeat the Legacy Monolith, then land on or swipe the unlocked MERGE button. Standing beside it or rising through it does not finish the level. Retry starts a completely fresh Enchanted Repo run. @@ -47,15 +47,15 @@ The level plays original music by Erik Thorelli from `Assets/Audio/Platformer/Th Both loop from their `.import` settings (`loop`, `loop_offset`), so the player never reaches its finished signal. The shared scene-local Music-bus player changes tracks with pause-aware fades, suspends arcade music while playing and restores it on leaving. Shared imported streams are not changed. Existing Platformer jump/hurt/UI sounds are reused. -`scenes/platformer/enchanted_repo.gd` extends the existing `modes/platformer/level.gd`. New local scripts provide art crops, enemies, branch lifecycle, timed hazards, Monolith combat, and a ground-wave subclass of Orbital's projectile. The shared player and level lifecycle are unchanged. The router and Level Select now expose the new level with its own layered artwork. The treeline uses one continuous parallax strip: `enchanted_treeline.gdshader` crossfades the painted edges in premultiplied color before applying opacity once. This avoids the darker rectangular bands caused by overlapping translucent panels. Its lower edge fades into the sky where floor gaps expose it. Terrain combines cropped kit sprites with separate collision solids, as in Orbital Ops; no editor-painted TileSet is claimed. +`scenes/platformer/enchanted_repo.gd` extends the existing `modes/platformer/level.gd`. New local scripts provide art crops, enemies, branch lifecycle, timed hazards, Monolith combat, and a ground-wave subclass of Orbital's projectile. The shared player and level lifecycle are unchanged. The router and the hub's tile grid expose the new level with its own layered artwork. The treeline uses one continuous parallax strip: `enchanted_treeline.gdshader` crossfades the painted edges in premultiplied color before applying opacity once. This avoids the darker rectangular bands caused by overlapping translucent panels. Its lower edge fades into the sky where floor gaps expose it. Terrain combines cropped kit sprites with separate collision solids, as in Orbital Ops; no editor-painted TileSet is claimed. ## Validation and limits -Run Godot with `--headless --path hoppys-adventure-arcade --log-file /tmp/enchanted-smoke.log --script res://tests/enchanted_repo_smoke.gd`. Omit `--headless` for captures at `/tmp/enchanted-{spawn,boss,core,complete,level-select}.png`. +Run Godot with `--headless --path hoppys-adventure-arcade --log-file /tmp/enchanted-smoke.log --script res://tests/enchanted_repo_smoke.gd`. Omit `--headless` for captures at `/tmp/enchanted-{spawn,boss,core,complete,return-hub}.png`. -The smoke suite passes headless and rendered: spawn, real platform/branch boarding, crumble collision and regrowth, pause, comment/vine damage phases, shields/i-frames, two-hit troll combat, complete three-gap route using movement input, safe intro, arena camera/gates, both music transitions, committed sweep, slam avoidance/damage, wave collision/pause, actual recovery swipe, both armor transitions, one-time score, defeat cleanup, MERGE, retry, pit death, and menu/audio restoration. The route uses combat invulnerability to isolate reachability. Boss boundary checks manipulate states to isolate mechanics; this is not a claim of a no-hit or fully autonomous boss playthrough. +The smoke suite passes headless and rendered: spawn, real platform/branch boarding, crumble collision and regrowth, pause, comment/vine damage phases, shields/i-frames, two-hit troll combat, complete three-gap route using movement input, safe intro, arena camera/gates, both music transitions, committed sweep, slam avoidance/damage, wave collision/pause, actual recovery swipe, both armor transitions, one-time score, defeat cleanup, MERGE, retry, pit death, and hub/audio restoration. The route uses combat invulnerability to isolate reachability. Boss boundary checks manipulate states to isolate mechanics; this is not a claim of a no-hit or fully autonomous boss playthrough. -`tests/enchanted_boundaries.gd` checks occupied branch regrowth, safe quill warning/recovery, committed jab side, Auto-Fix boss exclusion, retained bare attack art, and fresh-instance armor. Orbital's complete smoke suite and Bay Area's smoke suite pass as regressions. Rendered spawn, boss, core, results and Level Select captures were reviewed. +`tests/enchanted_boundaries.gd` checks occupied branch regrowth, safe quill warning/recovery, committed jab side, Auto-Fix boss exclusion, retained bare attack art, and fresh-instance armor. Orbital's complete smoke suite and Bay Area's smoke suite pass as regressions. Rendered spawn, boss, core, results and hub-return captures were reviewed. The original macOS sandbox aborted graphical launches before engine output; the rendered suite ran with approved graphical access. Headless import reported existing global-editor-settings/certificate sandbox warnings. No packaged exports or physical-controller session were tested. Fine animation registration, enemy death effects and longer hands-on balance testing remain polish work. No checkpoint saving or new audio assets were added. diff --git a/docs/endless-runner-contract.md b/docs/endless-runner-contract.md index d9f1e326..2e5abcd3 100644 --- a/docs/endless-runner-contract.md +++ b/docs/endless-runner-contract.md @@ -8,6 +8,12 @@ result recorded in the runner docs was produced on 4.7.0 unless it says otherwis for development; any behavioural difference found between 4.7.0 and 4.7.1 must be recorded in §10, and final acceptance of the runner re-runs the §9 commands on 4.7.1. +**Amendment 2026-11-15 (menu cleanup).** The runner menu (`runner_menu.tscn`, route `runner`) no longer +exists: the hub's tile grid routes straight to `runner_game`, `go_to_menu()` routes to `hub`, and the +leaderboard viewer with Reset scores lives in `scenes/runner/ui/leaderboard_panel.gd`, opened from the +shared pause menu's **Leaderboard** button (`scenes/runner/ui/pause_menu.gd` extends `app/pause_menu.gd`). +§2 and the `runner_menu.tscn` rows below describe the earlier flow and are kept as history. + This document is the single source of truth shared by the two agents building the Endless Runner ("The Codebase Corridor"): @@ -155,7 +161,7 @@ frontend may use it for deterministic cosmetics). | `pause()` / `resume()` / `toggle_pause()` | Only while `running`. `resume()` re-syncs held input so nothing fires on unpause | | `retry()` | Unpauses and routes to `runner_game` (fresh session) | | `retry_boss()` | v2.5 (§11.13): unpauses and routes to `runner_game`, which opens in front of the boss the run died at. Falls back to `retry()` when `boss_checkpoint` is empty | -| `go_to_menu()` | Unpauses and routes to `runner` | +| `go_to_menu()` | Unpauses and routes to `hub` (the runner menu route `runner` was removed 2026-11-15) | | `hit_stop(seconds: float)` | Brief `Engine.time_scale` dip owned by the backend (max 0.12 s) | | `submit_name(name: String) -> bool` | Sanitises (trim, strip control chars, ≤ 16, blank → `Hoppy`) and renames this run's leaderboard entry. Returns `true` if persisted. Never adds a second entry | | `get_leaderboard() -> Array[Dictionary]` | Current top 10 | @@ -179,7 +185,7 @@ means the write failed, and then `rank` is 0, `qualifies` is `false` and `leader emitted for that run. Leaderboard entry fields: `run_id, name, score:int, duration:float, seed:int, submitted_at:int`. -The runner menu reads the board without a game instance via the static +The leaderboard panel reads the board without a game instance via the static `preload("res://scenes/runner/systems/runner_leaderboard.gd").load_entries()`. ### 4.4 Input @@ -255,7 +261,7 @@ The physical floor is backend-owned and invisible once a corridor mounts. The co | `ui/pause_menu.tscn` | CanvasLayer, `process_mode ALWAYS` | Shows on `paused_changed(true)`; buttons → `game.resume()`, `game.retry()`, `game.go_to_menu()` | | `ui/game_over.tscn` | CanvasLayer, `process_mode ALWAYS`, hidden | `show_result(result: Dictionary, leaderboard: Array)` is called by the frontend itself from `run_finished`; name entry → `game.submit_name()`; Retry / Menu as above; v2.5: a **Retry Boss** button → `game.retry_boss()`, shown (and given the default focus) only while `game.boss_checkpoint` is non-empty (§11.13) | | `audio/runner_audio.tscn` | Node, `process_mode ALWAYS` | SFX on bus `SFX`; BGM via `AudioService.play_music` | -| `runner_menu.tscn` | root named **`RunnerMenu`** | See §2. Exposes `buttons: Array[Button]` with the four §2 entries (`01 Play`, `02 Leaderboard`, `03 Return to Main Menu`, `04 Quit Game`); `tests/runner_scaffold_check.gd` asserts `buttons.size() == 4` | +| `ui/leaderboard_panel.gd` | Control, built in code | Replaces the removed `runner_menu.tscn` (2026-11-15): top ten with medals, **Reset scores** with confirmation, **Close**; `leaderboard_path` is read when it opens; `ui_cancel` / `pause` close the confirmation first, then the panel | `AudioService` API available to the frontend: `play_music(stream: AudioStream, volume_db := -10.0)`, `play_default_music()`, `set_music_pitch(scale: float)`, `duck_music(db: float, seconds: float)`, diff --git a/docs/endless-runner-systems.md b/docs/endless-runner-systems.md index 8c20d0ac..9bca1218 100644 --- a/docs/endless-runner-systems.md +++ b/docs/endless-runner-systems.md @@ -103,7 +103,7 @@ a chunk's back edge passes z = +12. Lateral follow `camera.x = lerp(camera.x, pl | `tests/runner_scaffold_check.gd`, `tests/runner_logic.gd`, `tests/runner_chunk_validator.gd`, `tests/runner_smoke.gd` | SceneTree scripts | §8 | | `app/app_router.gd`, `app/audio_service.gd` | autoloads | Contract §2 / §5.6 additions | | Graybox placeholders (frozen after PR 1): `scenes/runner/ui/runner_hud.tscn/.gd`, `scenes/runner/ui/pause_menu.tscn/.gd`, `scenes/runner/ui/game_over.tscn/.gd` | | Minimal `Style`-themed UI so the loop is playable | -| `scenes/runner/runner_menu.tscn/.gd` | Node3D | Backend fallback graybox only; the frontend's F6 menu replaces it. Brought up to the contract §2 four-button set in PR 2 — `01 Play`, `02 Leaderboard` (top-10 panel from the static `runner_leaderboard.load_entries()`), `03 Return to Main Menu`, `04 Quit Game` — so `runner_scaffold_check.gd` can assert `RunnerMenu` + `buttons.size() == 4` against either scene. That is the backend's **last** edit here: once the frontend menu lands the path is exclusively frontend-owned (contract §1 rule 1) | +| `scenes/runner/runner_menu.tscn/.gd` | (removed 2026-11-15) | The backend graybox menu and the frontend's F6 menu are history: the hub routes straight to `runner_game`, and the leaderboard lives in `scenes/runner/ui/leaderboard_panel.gd`, opened from the pause menu | ## 3. Player (`runner_player.gd`) @@ -403,9 +403,9 @@ Every test that instantiates `RunnerGame` must override `leaderboard_path` to a `user://` file **before** `add_child()` — `_ready()` honours `autostart`, so a later assignment races a live run — and must delete that file and its `.tmp`/`.bak` siblings on every exit path; otherwise a run that reaches `caught` writes the player's real `user://leaderboard.cfg`. -`RunnerMenu.leaderboard_path` must be set **before** the leaderboard panel opens (before calling -`_toggle_leaderboard()` or emitting `buttons[1].pressed`), because the panel reads the path at open -time. Setting it after the panel is already open has no effect on the current open. +`RunnerGame.leaderboard_path` must be set **before** the leaderboard panel opens (before emitting the +pause menu's `leaderboard_button.pressed`), because the panel copies the path when it opens. Setting it +after the panel is already open has no effect on the current open. **`tests/runner_logic.gd`** (systems instantiated as plain nodes under `root`, driven by direct `_physics_process(1.0/60)` calls, config `duplicate()`d): @@ -427,8 +427,8 @@ auras and shield glow. **`tests/runner_scaffold_check.gd`** additionally drives the pause facade on a real `runner_game.tscn`: `toggle_pause()` both ways, then `pause()` → `start_run()` → the tree and the facade are both unpaused, -the state is `running` and `paused_changed(false)` was emitted; and it asserts the runner menu exposes -four buttons. +the state is `running` and `paused_changed(false)` was emitted; and it asserts `go_to_menu()` lands on +the hub. **`tests/runner_chunk_validator.gd`** loads every `chunks/chunk_*.tscn` and checks: V0 no hazard has mounted a visual before `chunk.setup()` handed out the RunConfig, and every hazard afterwards has the @@ -455,7 +455,7 @@ off → hit → hit → `caught`, `run_finished` exactly once ≈ 3.0 s later; l `submit_name(" Test ")` → name `Test`, count unchanged. `auto_fix` mid-run → cleared > 0 and no hit for 2 s. `pause()` for 1 s → score unchanged, `paused_changed` seen; `resume()`. Real input: `InputEventKey` with `physical_keycode = KEY_SPACE` → `player_action("jump")`. Routing: -`AppRouter.go("runner_game")` twice, then `runner`, then `hub`: `not busy`, tree unpaused, AudioService +`AppRouter.go("runner_game")` twice, then `hub`: `not busy`, tree unpaused, AudioService still has 2 children. Reset `time_scale` before quitting. **Boot check** (`--scene res://scenes/runner/runner_game.tscn --quit-after `): this plays a real diff --git a/docs/endless-runner.md b/docs/endless-runner.md index ffda295e..6e2734fc 100644 --- a/docs/endless-runner.md +++ b/docs/endless-runner.md @@ -2,13 +2,14 @@ The Codebase Corridor, F0-F10 and the merged high-fidelity A1–A9 asset pass (coordinator release scope; current headless verification below). Backend integration follows contract 2.2. Installed Godot 4.7.0 results are diagnostic, pending acceptance on the pinned 4.7.1. +**2026-11-15: the runner menu is gone.** The hub's tile grid opens `runner_game` directly and every way out of a run (pause menu **Main Menu**, game over **Main Menu** or Esc) returns to the hub; `go_to_menu()` routes to `hub`. The leaderboard viewer and its Reset scores flow moved from `runner_menu.gd` into `scenes/runner/ui/leaderboard_panel.gd`, opened from the pause menu's **Leaderboard** button (see [main-menu.md](main-menu.md#pause-menu)). Mentions of `RunnerMenu`, the `runner` route and the four-button menu below are milestone history. + ## Run Run all commands from the repository root. The project pins Godot 4.7.1; the installed 4.7.0 build is diagnostic only. Graphical commands below are host-only and coordinator-owned; none were run during this documentation pass. ```sh /Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade -/Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade --scene res://scenes/runner/runner_menu.tscn /Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade --scene res://scenes/runner/runner_game.tscn /Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade --scene res://scenes/runner/environment/dev/renderer_spike.tscn /Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade --scene res://scenes/runner/environment/dev/corridor_preview.tscn @@ -18,7 +19,7 @@ Run all commands from the repository root. The project pins Godot 4.7.1; the ins /Applications/Godot.app/Contents/MacOS/Godot --path hoppys-adventure-arcade --script res://scenes/runner/environment/dev/capture_previews.gd ``` -Development cameras use (0,4,8), looking at (0,1,-8), FOV 60. The menu camera uses (2.6,1.9,3.4), looking at (0,1,-2), FOV 55 with a slow drift. The `capture_previews.gd` runner_menu fixture writes `docs/previews/endless-runner-menu.png`; the coordinator recaptured it on the host with Hoppy at (0.7, 0, -0.3), and the latest host recapture is present in the working tree. +Development cameras use (0,4,8), looking at (0,1,-8), FOV 60. The menu camera uses (2.6,1.9,3.4), looking at (0,1,-2), FOV 55 with a slow drift. | Scene | Keys | Action | | --- | --- | --- | @@ -49,7 +50,7 @@ The menu calls the AppRouter singleton directly: Play -> `go("runner_game")`, Re The teaching layer uses a mint shield for power-ups, an orange wrench for CodeRabbit tools, and a striped DANGER triangle for hazards. Before the run intro, a visitor's first run opens the runner's [how-to-play card](main-menu.md#how-to-play-cards) (goal and tips over its menu screenshots, then lane change, jump, roll and pause), and the pause menu's **How to Play** button shows it again. GET READY carries the full grab/avoid legend; HOW TO PLAY repeats the three symbols before Play. First power-up collection, tool collection, and unblocked damage each queue one full-copy, kind-bordered 2.4-second hint per run. Boss intros and stage-clear cards defer these hints, including any active hint. The legend closes with GET READY, and no persistent gameplay panel is added. Coordinator capture views `get-ready` and `toast-grab` are available; no graphical capture was run. -HUD is on layer 10, PauseMenu 21 and GameOver 22. HUD listens to facade signals, uses responsive margins, counts up score, displays effects and pursuit, dims on pause and hides gameplay widgets on caught. Backend owns damage camera shake. Pause has no ui_cancel handler. Game Over appears only on run_finished, shows result stats and the local top ten, and saves qualifying names through the facade. Save success locks the name field and focuses Retry; failure stays editable. Retry creates a fresh scene. The mock scene demonstrates the same signals in 40 seconds with in-memory persistence. +HUD is on layer 10, GameOver 22, and the pause menu on 80 (`app/pause_menu.gd`, shared by every game; the runner's `ui/pause_menu.gd` extends it with a **Leaderboard** button that opens `ui/leaderboard_panel.gd`). HUD listens to facade signals, uses responsive margins, counts up score, displays effects and pursuit, dims on pause and hides gameplay widgets on caught. Backend owns damage camera shake. Pause has no ui_cancel handler. Game Over appears only on run_finished, shows result stats and the local top ten, and saves qualifying names through the facade. Save success locks the name field and focuses Retry; failure stays editable. Retry creates a fresh scene. The mock scene demonstrates the same signals in 40 seconds with in-memory persistence. Player feedback identified the boss name, HP plate and intro card as blocking the corridor vanishing point. Both now share the top-centre slot at x=300..980: the boss plate occupies y=8..64 with a 10-unit HP track, and the intro card occupies y=48..128 with a compact warning/title row and an 18-unit taunt row. Its 48-unit top inset clears the existing cinematic letterbox while remaining wholly above y=130. They are mutually exclusive through the existing three-second intro and spawned-boss handover. The score plate is narrowed to x=1000..1252, with the timer below it at y=140..196 and BACKLOG below that at y=208..272; APPROVALS stays on the left. This keeps the central x=300..980, y=130..480 viewing region clear of persistent boss widgets, preserves outlined panel-backed type, and kept the turn warning at y=536 clear of the pursuit alert (the warning was removed in contract 2.7). Stage-banner and stage-clear timing and layout are unchanged. Headless checks measure final container rects at 1280x720 and 1440x900 against proportionally scaled viewing bounds and check every panel pair, with only the mutually exclusive boss cards allowed to overlap. Existing capture view names are retained for coordinator overwrite of the A7 PNGs. @@ -280,7 +281,7 @@ The navy environment and dim MATRIX grid/rain reuse the hub preview palette and | Glyph atlas | scenes/runner/shaders/glyph_atlas.gd | Original project source | Replace artwork within the existing visual root; retain contract hooks, bounds and pause behavior. | | Grid, wall, hologram, radial glow, vignette | scenes/runner/shaders/*.gdshader | Original project source | Replace artwork within the existing visual root; retain contract hooks, bounds and pause behavior. | | Labels | SystemFont fallback matching menu_style.gd | Installed font licences; no font redistribution | Licensed bundled font through Style.theme() and runner_materials.gd. | -| Runner menu, leaderboard and controls card | `scenes/runner/runner_menu.gd`, shared `menu_style.gd` | Original project source; installed font licences | Replace composition and Style resources; preserve RunnerMenu root, routes, focus loop and modal cancel behavior. | +| Leaderboard panel (top ten, Reset scores) | `scenes/runner/ui/leaderboard_panel.gd`, shared `menu_style.gd` | Original project source; installed font licences | Replace composition and Style resources; preserve the node names, `leaderboard_path`, focus loop and cancel behavior the tests drive. | | HUD, approval pips, pursuit ring, power-up bars and toasts | `scenes/runner/ui/runner_hud.gd`, `hud_glyph.gd` | Original project source | Replace cosmetic widgets; retain facade signals and responsive anchors. | | Pause and game-over panels, local score rows and name entry | `scenes/runner/ui/pause_menu.gd`, `game_over.gd` | Original project source | Replace layout; preserve facade methods, focus, qualifying saves and run_finished timing. | | F5 procedural SFX | `scenes/runner/audio/sfx_synth.gd` | Original project source | Replace cached PCM recipes; keep trigger mapping, SFX bus and ten-voice cap. | @@ -340,7 +341,7 @@ The following gl_compatibility findings come from the coordinator's graphical ca | Corridor draw budget | `capture_previews.gd`, `corridor_preview` at 26 m/s; two lights, shadows off, preview UI hidden | PASS: 10 / 15 draw calls in the `CORRIDOR DRAW BUDGET` frame sample. | | Corridor screenshot sample | `capture_previews.gd`, `corridor_preview` at its default 12 m/s with preview UI visible, before the 26 m/s budget check | 9 draw calls in the `CAPTURE: corridor` frame sample; this is the corridor figure in the host `PREVIEW CAPTURE` summary below. Neither frame sample is a measured peak. | | Renderer diagnostic fixture | `capture_previews.gd`, separate `renderer_spike` scene | 23 draw calls in the `CAPTURE: spike` frame sample; separate from the corridor budget. | -| Previews | 1280x720 PNGs | Present: docs/previews/endless-runner-spike.png, docs/previews/endless-runner-corridor.png, docs/previews/endless-runner-hoppy.png, docs/previews/endless-runner-gallery.png, docs/previews/endless-runner-powerups.png, docs/previews/endless-runner-pursuer.png, and docs/previews/endless-runner-menu.png. All previews are captured on the host; the sandbox cannot render. | +| Previews | 1280x720 PNGs | Present: docs/previews/endless-runner-spike.png, docs/previews/endless-runner-corridor.png, docs/previews/endless-runner-hoppy.png, docs/previews/endless-runner-gallery.png, docs/previews/endless-runner-powerups.png and docs/previews/endless-runner-pursuer.png. All previews are captured on the host; the sandbox cannot render. | The shaders provide their own grid/wall depth fading and additive halos. Unsupported renderer effects are not configured. The implementation avoids the Compatibility-ignored glow-level/normalized/strength/blend settings specified in the brief. @@ -363,7 +364,7 @@ PREVIEW CAPTURE: PASS (spike 23 / corridor 9 / hoppy 33 / gallery 162 / menu 33 The backend's scaffold update is complete: `runner_scaffold_check.gd` asserts `buttons.size() == 4`, including Leaderboard, and all 284 checks pass on this branch. The headless menu_smoke failures on Godot 4.7.0 are tracked as a non-blocking baseline: `Mouse hover overrides old gamepad focus` and `Pointer exit releases mode preview`. -The full-loop smoke attaches a node_added guard before routing, sets autostart=false and a per-process `user://test_runner_menu_leaderboard_%d.cfg` path before each RunnerGame._ready(), and starts each scene with autopilot. Retry receives the override again. It forces hits through the real hit manager, waits for the unchanged 18 s recovery timer and catch sequence, checks run_finished and visible game over, saves Codex, retries, returns through RunnerMenu to MainMenu, checks default music restoration, and deletes temporary board/backup files. The UI facade smoke uses a separate `user://test_runner_visual_smoke_%d.cfg` path with the same cleanup. Neither test writes the real `user://leaderboard.cfg`. +The full-loop smoke attaches a node_added guard before routing, sets autostart=false and a per-process `user://test_runner_menu_leaderboard_%d.cfg` path before each RunnerGame._ready(), and starts each scene with autopilot. Retry receives the override again. It forces hits through the real hit manager, waits for the unchanged 18 s recovery timer and catch sequence, checks run_finished and visible game over, saves Codex, retries, returns to MainMenu, checks default music restoration, and deletes temporary board/backup files. The UI facade smoke uses a separate `user://test_runner_visual_smoke_%d.cfg` path with the same cleanup. Neither test writes the real `user://leaderboard.cfg`. ## Requests to backend @@ -983,8 +984,8 @@ The standard backend smoke reported `RUNNER SMOKE: FAIL (3 failures / 127 checks ### Performance: W3 prewarm completion and GPU warm-up - **Audio on workers.** `sfx_synth.gd` splits each cue into a pure `render()` (PCM math, no resources) and a main-thread `install()`. `prewarm.gd` synthesises every recipe, with its panned-whoosh and footstep variants, on `WorkerThreadPool`; `poll()` installs finished jobs within a 3 ms per-frame budget. An on-demand `Synth.sound()` still works and keeps its identity if it wins the race. -- **Nothing finalizes during play.** `Prewarm.finish()` joins every worker and runs every deferred package (boss art, glyph atlas, texture installs). `RunnerAudio.bind()` calls it inside `runner_game`'s `_ready`, behind the route veil. After the runner menu it is a no-op (`finish_ms` 0); a directly launched run pays about 1.4 s there instead of one package per frame after the run starts. -- **GPU warm-up.** `scenes/runner/warmup/gpu_warmup.gd` runs once per process in each context: from the runner menu's `_ready`, and from `bind()` in the first game (the menu's lights and Hoppy are not the game's). It mounts every runtime visual in batches, using the contract scene paths and hooks: pickups and tools with the collected state and bursts, each hazard kind with every variant plus hit and clear, bosses with FX, the pursuer, Hoppy's roll and hurt, the HUD canvas shaders, and the corridor mid-turn. The live Hoppy also wears every aura and the shield for the character batch. Copies sit at Hoppy and 5-55 m down the track, so every light combination an item meets on its way in is drawn. Each batch is drawn with `RenderingServer.force_draw(false)`, once under the live lights and once with a corridor-wide omni light. The frames are never presented; headless skips it. +- **Nothing finalizes during play.** `Prewarm.finish()` joins every worker and runs every deferred package (boss art, glyph atlas, texture installs). `RunnerAudio.bind()` calls it inside `runner_game`'s `_ready`, behind the route veil. A run launched from the hub pays about 1.4 s there instead of one package per frame after the run starts. +- **GPU warm-up.** `scenes/runner/warmup/gpu_warmup.gd` runs once per process from `bind()` in the first game (PR #104 moves it to the idle hub, one unit per frame). It mounts every runtime visual in batches, using the contract scene paths and hooks: pickups and tools with the collected state and bursts, each hazard kind with every variant plus hit and clear, bosses with FX, the pursuer, Hoppy's roll and hurt, the HUD canvas shaders, and the corridor mid-turn. The live Hoppy also wears every aura and the shield for the character batch. Copies sit at Hoppy and 5-55 m down the track, so every light combination an item meets on its way in is drawn. Each batch is drawn with `RenderingServer.force_draw(false)`, once under the live lights and once with a corridor-wide omni light. The frames are never presented; headless skips it. - gl_compatibility compiles a variant on first draw and another when an object is first omni-lit. Those compiles caused first-sight and first-grab stalls (about 40-80 ms each). - BaseMaterial3D, ParticleProcessMaterial and code-built shaders free their program with their last user, so a new spark system recompiled every time (75 ms) once earlier ones were gone. The warm-up keeps every material it drew for the process lifetime, and its state lives in Engine metadata so it survives the menu script unloading. It is released at application exit. - RunnerGame `queue_free()`s its graybox environment in the same frame as `bind()`. Its fog-less, glow-less WorldEnvironment and second Sun would make every warm draw compile variants play never uses, so the warm-up detaches that doomed node first. diff --git a/docs/heroes-vs-villains.md b/docs/heroes-vs-villains.md index c26bee83..1629c2cb 100644 --- a/docs/heroes-vs-villains.md +++ b/docs/heroes-vs-villains.md @@ -18,7 +18,7 @@ This mode uses the armored Hoppy and the [Mode 2 asset pack](heroes-vs-villains- | Pause | Escape or P | Start | | Skip presentation card | Enter / keypad Enter | View / Select | -The first entry from the menus opens the game's [how-to-play card](main-menu.md#how-to-play-cards) before the opening cards; the pause menu's **How to Play** shows it again. +The first entry from the hub opens the game's [how-to-play card](main-menu.md#how-to-play-cards) before the opening cards; the pause menu's **How to Play** shows it again. The armored hero uses eight-frame side, away and toward-camera locomotion cycles at 14 fps, with cadence scaled to analog movement and speed effects. Base travel speed is 264 pixels/second (10% above Code City Brawl). Its reference-matched white-and-orange costume is drawn consistently across all 120 gameplay cels; the away view shows the white backs of the ears. The [hero asset guide](../hoppys-adventure-arcade/Assets/Character/CodeRabbit/2D/heroes_villains/README.md) documents sources, packing, calibration and visual comparisons. @@ -26,7 +26,7 @@ Hoppy has three health points, jump avoidance, hit recovery and one shield on st - Play freezes under a white flash. - He is thrown back away from the hit, and a carried weapon is stowed while he flies. - He lands flat on his front with a burst and a bounce, and lies there with dizzy stars and a "K.O." callout while the music ducks. -- About 2.2 seconds after the hit, the game-over menu offers a retry of the current stage with its entry score and capabilities, fresh health and cleared temporary effects. Pause and focus loss stop the run, including during cards and stage transitions; return-to-menu is available through pause and results. +- About 2.2 seconds after the hit, the game-over menu offers a retry of the current stage with its entry score and capabilities, fresh health and cleared temporary effects. Pause and focus loss stop the run, including during cards and stage transitions; **Main Menu** (the hub) is available through the shared pause menu and the results. REVIEW never hurts Hoppy. Holding Q / LB for under half a second fires a mint burst on the floor around him that stuns nearby threats; stunned enemies turn blue. For 0.85 seconds after it fires, hits can't land and Hoppy glows mint, without the blink that means he was hit. It recharges in 8 seconds. @@ -44,7 +44,7 @@ Beating the AI-Augmented Hacker plays a victory epilogue of three more painted s - **Trust restored:** the core runs clean, with the four capability emblems in orbit. - **The CodeRabbit:** a hero shot over the cheering expo floor. -The victory screen follows. It counts the final score up from zero over 1.8 seconds and shows the time taken, then **Return to Beat'em Up menu** takes focus. It replaces the older static victory card, which the run no longer shows. +The victory screen follows. It counts the final score up from zero over 1.8 seconds and shows the time taken, then **Main Menu** takes focus. It replaces the older static victory card, which the run no longer shows. A minimap sits in the top-right corner, under the HUD bar and clear of both boss bars. - Its top row shows the whole run: all nine rooms as tiles, grouped by stage. Cleared rooms are filled, the current one pulses, and each stage's boss room is marked. @@ -137,6 +137,6 @@ godot --path hoppys-adventure-arcade --always-on-top --script res://tests/heroes godot --path hoppys-adventure-arcade --always-on-top --script res://tests/beatemup_knockout.gd ``` -The logic suite covers combat depth/deduplication, combo buffering, enemy defenses and special behaviors, all weapons, capability effects, hazards, pause, all boss transitions, independent PR defeat, shield edge cases, retry cleanup, the automatic stage exit after the unlock cards and all six music mappings. The smoke suite injects keyboard/controller events, traverses all nine encounters with no card or stage confirmation, checks bounded entity pools and capability retention, reaches one victory and returns to an unpaused menu. `hoppy_armed_assets.gd` requires all eleven armed sheets across both modes. `beatemup_story.gd` and `beatemup_knockout.gd` cover the story scenes and the knockout in both modes; [Code City Brawl](code-city-brawl.md#implementation-and-verification) describes them. Rendered runs save previews in `docs/previews/heroes-villains/`; `--always-on-top` keeps macOS from stalling the captures while the window is covered. +The logic suite covers combat depth/deduplication, combo buffering, enemy defenses and special behaviors, all weapons, capability effects, hazards, pause, all boss transitions, independent PR defeat, shield edge cases, retry cleanup, the automatic stage exit after the unlock cards and all six music mappings. The smoke suite injects keyboard/controller events, traverses all nine encounters with no card or stage confirmation, checks bounded entity pools and capability retention, reaches one victory and returns to the unpaused hub. `hoppy_armed_assets.gd` requires all eleven armed sheets across both modes. `beatemup_story.gd` and `beatemup_knockout.gd` cover the story scenes and the knockout in both modes; [Code City Brawl](code-city-brawl.md#implementation-and-verification) describes them. Rendered runs save previews in `docs/previews/heroes-villains/`; `--always-on-top` keeps macOS from stalling the captures while the window is covered. Godot 4.7.1 asset, logic and full-traversal checks passed, including a rendered traversal at 1280×720. On October 8, 2026, after the stage-flow and armed-sheet changes, all 26 headless CI suites passed; the rendered traversal finished with no card or stage confirmation, and the rendered `weapons_25/44/85` captures were compared against the sheet cells for all five weapons. Code City logic, motion and full-traversal regressions and menu-return layout checks also passed. The traversal bot uses invulnerability and accelerated navigation: it verifies reachability, not human difficulty balance. Physical controller feel, listening/mix QA, packaged exports and performance on target booth hardware remain playtest work. Locomotion uses the generated movement supplement; unarmed combat retains the original key poses, and armed poses come from the armed sheets. The motion suite verifies directional cycles, speed/cadence, each card's hold and auto-advance, single-press skip, pause freeze, the game-over overlay's input filter, and armed idle, attack frames, mirroring and the carry icon for every weapon, including that no carry covers Hoppy's face. diff --git a/docs/main-menu.md b/docs/main-menu.md index 239b79c8..314d7076 100644 --- a/docs/main-menu.md +++ b/docs/main-menu.md @@ -24,7 +24,7 @@ The hub shows every game as a tile, three columns by two rows, so a visitor star - **Catalog.** `scenes/main_menu/game_catalog.gd` lists the tiles in grid order: route, family eyebrow (Platformer, Endless Runner, Beat'em Up), one-line tagline, the `preview.gd` indices the tile and the showcase use (the first is the tile's art), and the Hoppy reaction. Adding a game means adding an entry there; the grid, the showcase groups and the focus map follow. - **Tile.** `game_tile.gd` is a Button (it extends `menu_button.gd`, so it grows 5% on focus or hover) with its stage art cover-cropped inside the border, a lower scrim, the family, title and tagline, and an "ENTER / A PLAY" prompt while focused or hovered. The art is the same stage plates and runner stills the background previews use, loaded once through `preview.gd`; no separate tile art exists. - **Navigation.** Left and right wrap within a row. Up and down step between the rows and, past them, to the utility button in the same column (Settings, Quit Game, Credits), which lead back onto the grid. Tab follows the order tiles, Settings, Quit Game, Credits (`main_menu.gd` `buttons`). Mouse hover focuses nothing but drives the preview and Hoppy; a click launches. -- **Launch.** A tile calls `AppRouter.go()` with its gameplay route, so the first entry opens the game's how-to-play card as before. The per-mode menus (`platformer_menu`, `runner_menu`, `beatem_menu`) are no longer on the hub's path: the games still return to them from their pause and results screens ("Return to Platformer Menu", the brawlers' and the runner's menu), and `--route=` / `--attract=` still name them. The runner's leaderboard lives in `runner_menu`, reached from a run's pause or game-over **Runner Menu** button or with `--route=runner`. +- **Launch and return.** A tile calls `AppRouter.go()` with its gameplay route, so the first entry opens the game's how-to-play card. The hub is the only menu: the per-genre menus of the three-button hub (`platformer_menu`, `runner_menu`, `beatem_menu`) and their routes (`platformer`, `runner`, `beatem_up`) are gone, and every way out of a game lands here. **Main Menu** on a game's pause menu, results, game-over or victory screen, the booth's idle return and its next-player card all call `AppRouter.go("hub")`. The runner's leaderboard moved into its pause menu (see [Pause menu](#pause-menu)). - **Hoppy.** The menu mascot stands top right, beside the title, at two thirds of its old size. The hovered tile's family picks the reaction: platformer jump, 3D runner, brawler jab. ## Behavior and ownership @@ -49,7 +49,7 @@ The **Credits** button, after Settings and Quit Game under the grid, opens `scen ## How-to-play cards -The first time a visitor enters a game, `AppRouter.go()` opens that game's how-to-play card (`app/how_to_play.gd`) over it. A visitor starts whenever the hub or the booth's attract route opens, so retries and returns from a game's own menu skip the card. `--route=` launches show it too. +The first time a visitor enters a game, `AppRouter.go()` opens that game's how-to-play card (`app/how_to_play.gd`) over it. A visitor starts whenever the hub opens, so retries and restarts skip the card. `--route=` launches show it too. - **Pages.** Each card is three or four pages: **Your goal**, **Controls**, **Tips**, and for Orbital Ops a **Zero gravity** page. Dots in the corner show where you are. - **Scenes.** Each page except Controls plays a short looping scene with a line of text under it (`app/how_to_play_demo.gd`). The scenes reuse the game's own sprite sheets: Hoppy swiping the level boss down and landing on MERGE, swiping a glitch critter, rising and sinking in the zero-G bay, crossing a laser while it's off, hopping across crumbling branches, combos against Code City soldiers and AI Slop sprites, and a REVIEW burst. The runner is 3D, so its pages pan across its menu screenshots. Captions on the scene repeat the key moment ("Off: go!", "Hold Q / LB: REVIEW"). A scene is one looping Tween bound to the page, so it runs while the game is paused and stops when the page changes. Each scene is a scaled-down window onto the game's own screen: the floor line sits where the game puts it (y 600), actors keep their in-game scale and are anchored at the feet by the same pivots the game uses, the platformer scenes draw the level's sky and ground tiles, and the beat 'em up scenes draw the room panorama so actors stand on its painted floor. Bosses stand where the game places them (y 565 in the beat 'em ups). @@ -57,9 +57,24 @@ The first time a visitor enters a game, `AppRouter.go()` opens that game's how-t - **Holding the game.** The card pauses the tree and is the root's last child, so its `_input` sees every press first and swallows it. It passes each press to `AppRouter.note_input()` (booth idle timer) and `ControllerService.observe()` (player one's pad). - **Paging and closing.** Presses in the first 0.5 s are ignored, so the press that picked the game can't skip a page. After that, a confirm, jump or attack press, a left click or a touch turns to the next page, and on the last page starts the game. Left/right (arrows, A/D, D-pad, one flip per stick push) go back and forth without closing. Pause (Esc, P, Start) skips straight to the game. Each page turns by itself after 7 s while its bar drains, so a whole card is at most 28 s. The game unpauses two physics frames after the card closes, so the closing press never also jumps or swipes. The countdown waits while the window is unfocused. If the game paused itself under the card (focus loss), it stays in its pause menu: games answer `is_player_paused()`. - **Booth.** The 90 s idle timer keeps counting under the card, and a route change removes it. -- **Pause menus.** The platformer levels, the runner and both beat 'em ups have a **How to Play** button in their pause menu. It opens the same card without a countdown; its pages turn the same way, Back or Pause closes it from any page, the game stays paused and focus returns to the button. +- **Pause menus.** Every game's pause menu has a **How to Play** button. It opens the same card without a countdown; its pages turn the same way, Back or Pause closes it from any page, the game stays paused and focus returns to the button. - **Tests.** `tests/how_to_play.gd` checks that every gameplay route has a card with a controls page, that every key and pad input a card shows is bound to its row's actions, that every sprite clip and image a page or icon uses exists, that every page builds and plays, the label text, the once-per-visitor rule, paging and closing, auto-advance, booth idle, focus loss and the pause-menu buttons. Suites run with `--script` and get no cards unless they set `AppRouter.how_to_play_enabled`. +## Pause menu + +![Pause menu over Orbital Ops](previews/pause-menu.png) + +All six games share one pause menu, `app/pause_menu.gd`, built in code in the hub's style (`menu_style.gd`, the how-to-play card's panel colours, outlined text). Esc, P or Start opens and closes it; a game pauses itself (the tree, or its own state machine) and calls `open()` / `close()`, so each game keeps its pause rules, its focus-loss pause and ControllerService's pad-disconnect pause, which synthesizes the same `pause` action. + +- **Buttons.** **Resume**, **Restart**, **How to Play**, **Main Menu**; the Endless Runner adds **Leaderboard** before Main Menu. Up and down wrap (arrows, D-pad, stick), Enter or the pad's bottom button confirms, mouse hover focuses and a click presses. The menu binds neither `pause` nor `ui_cancel` itself: Esc is both actions and the game owns the toggle, so the pad's B does nothing on the menu and Start or Esc resumes. The first press of Restart or Main Menu locks every button until the router's fade has carried the player away. +- **Restart** reloads the game's own route (a fresh scene; the how-to-play card doesn't reappear because the visitor has seen it). **Main Menu** runs the game's leave path (stop its music, cancel its sequences) and ends in `AppRouter.go("hub")`. The platformer stays paused under the router's fade and the router unpauses the tree once the hub is in; the brawlers and the runner unpause first, as before. +- **Results stay the games' own.** The platformer's MERGE SUCCESSFUL / BUILD FAILED overlay offers **Retry ** and **Main Menu**; the brawlers' REVIEW FAILED and victory screens and the runner's CAUGHT BY THE BACKLOG screen offer their retries and **Main Menu**. The Code City opening story's bar has **Main Menu** too. +- **Runner leaderboard.** **Leaderboard** opens `scenes/runner/ui/leaderboard_panel.gd` over the paused run: the local top ten with medals, **Reset scores** (a confirmation asks first; a failed reset reloads the rows from disk and says so) and **Close**. Esc, B or Start inside the panel closes the confirmation first, then the panel, and never reaches the run's pause toggle; focus returns to the Leaderboard button. The game-over screen keeps showing the top ten. +- **Audio.** The menu plays the hub's UI blips (`AudioService.sfx` processes while the tree is paused) and touches nothing else: pausable music stops with the tree as before. +- **Tests.** `tests/pause_menu.gd` opens the menu in all six games through the `pause` action and checks the buttons, focus wrap, Resume, Restart, Main Menu (hub, unpaused, hub music), the How to Play card and, for the runner, the leaderboard panel. `tests/menu_return_layout.gd` returns from Bay Area Blitz through the pause menu and the results; `tests/runner_visual_smoke.gd` drives the runner's leaderboard and Reset scores flow. + +![Runner leaderboard panel over a paused run](previews/pause-menu-runner-leaderboard.png) + ## Art and replacement points As of 2026-09-30, `hoppy.gd` uses the supplied `Assets/Character/Hoppy/2D/hoppy-sprite-pack/hoppy` SpriteFrames: idle by default, one jump on a platformer tile, and one jab then the default idle on a beat 'em up tile. Hovering or focusing the Endless Runner tile crossfades to the existing `hoppy_runner_visual.tscn` rig running in place, rendered through a transparent, isolated 512×512 SubViewport. Leaving that selection restores 2D immediately through a 0.22-second fade; idle background cycling does not switch the character. Hidden 3D rendering and rig processing are disabled. Both versions face toward the grid and share a ground anchor. `sprite_scale` and `transition_seconds` are exposed on the Hoppy node for iteration. The title uses a system monospace fallback; no final pixel font or logo was supplied. diff --git a/docs/orbital-ops.md b/docs/orbital-ops.md index 2b7d97c2..13d999f0 100644 --- a/docs/orbital-ops.md +++ b/docs/orbital-ops.md @@ -10,8 +10,8 @@ Launch the project, choose **Platformer Game → Play Orbital Ops**. Direct scen - Jump: Space/W/up, gamepad A/Cross. Release early for a shorter normal-gravity jump. - Swipe: J/X, gamepad X/Square. Descending onto an enemy also damages it and bounces Hoppy. - Zero-gravity bay: hold Jump/Up to rise, Down/S or stick/D-pad down to descend, release vertical input to brake. Normal gravity resumes outside the cyan boundaries. -- Pause: Escape/P/Start or the Pause button. Focus loss also pauses. Entering the level from the menus opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. Its card adds the zero-G rise and sink rows and a Zero gravity page showing Hoppy rise, brake and sink. -- Defeat the Deprecated API, then land on or swipe the green MERGE button. Retry always starts a fresh Orbital Ops run; return buttons lead to the platformer menu or arcade. +- Pause: Escape/P/Start or the Pause button. Focus loss also pauses. Entering the level from the hub opens its [how-to-play card](main-menu.md#how-to-play-cards); the pause menu's **How to Play** shows it again. Its card adds the zero-G rise and sink rows and a Zero gravity page showing Hoppy rise, brake and sink. +- Defeat the Deprecated API, then land on or swipe the green MERGE button. Retry always starts a fresh Orbital Ops run; **Main Menu**, on the pause menu or the results, returns to the hub. ## Level and combat @@ -58,7 +58,7 @@ Orbital-specific files: `orbital_ops.gd` owns the level and gravity region; `orb Run `Godot --headless --path hoppys-adventure-arcade --script res://tests/orbital_ops_smoke.gd --log-file /tmp/orbital-smoke.log`. Omit `--headless` for screenshots under `/tmp/orbital-*.png`. -The suite covers spawn collision, deck and shuttle boarding through inputs, shuttle transport/pause, zero-g rise/braking/descent/exit, laser warning/active/i-frames, vent forces, projectile shield/damage, melee deduplication, drone warnings/committed targeting, whole-route traversal, safe intro/pause, both music switches, arena bounds/camera, cannon/slam/dash, boss melee and one-time scoring, MERGE activation/lock, fresh retry, fall death, and menu/audio restoration. Route reachability is tested with combat invulnerability; it does not establish a no-hit difficulty rating. Most boss attack checks isolate states rather than simulate an expert player's complete fight. +The suite covers spawn collision, deck and shuttle boarding through inputs, shuttle transport/pause, zero-g rise/braking/descent/exit, laser warning/active/i-frames, vent forces, projectile shield/damage, melee deduplication, drone warnings/committed targeting, whole-route traversal, safe intro/pause, both music switches, arena bounds/camera, cannon/slam/dash, boss melee and one-time scoring, MERGE activation/lock, fresh retry, fall death, and hub/audio restoration. Route reachability is tested with combat invulnerability; it does not establish a no-hit difficulty rating. Most boss attack checks isolate states rather than simulate an expert player's complete fight. The first vacuum vent was moved back from x=960 to x=840 after expanded traversal checks exposed suction interfering with the first gap's takeoff. The final route check includes the resulting vent force and crosses both gaps without teleporting. diff --git a/docs/previews/code-city/boss_phase_1.png b/docs/previews/code-city/boss_phase_1.png index a488e951..30fdd9ac 100644 Binary files a/docs/previews/code-city/boss_phase_1.png and b/docs/previews/code-city/boss_phase_1.png differ diff --git a/docs/previews/code-city/boss_phase_2.png b/docs/previews/code-city/boss_phase_2.png index 49ae9d9d..04f64d38 100644 Binary files a/docs/previews/code-city/boss_phase_2.png and b/docs/previews/code-city/boss_phase_2.png differ diff --git a/docs/previews/code-city/boss_phase_3.png b/docs/previews/code-city/boss_phase_3.png index d475085b..ce6bf547 100644 Binary files a/docs/previews/code-city/boss_phase_3.png and b/docs/previews/code-city/boss_phase_3.png differ diff --git a/docs/previews/code-city/ending.png b/docs/previews/code-city/ending.png index 3b3512c9..9c9fd62c 100644 Binary files a/docs/previews/code-city/ending.png and b/docs/previews/code-city/ending.png differ diff --git a/docs/previews/code-city/intro.png b/docs/previews/code-city/intro.png index 4aa6b849..287efa99 100644 Binary files a/docs/previews/code-city/intro.png and b/docs/previews/code-city/intro.png differ diff --git a/docs/previews/code-city/menu.png b/docs/previews/code-city/menu.png deleted file mode 100644 index 88f5ec8a..00000000 Binary files a/docs/previews/code-city/menu.png and /dev/null differ diff --git a/docs/previews/code-city/minimap.png b/docs/previews/code-city/minimap.png index c9e05764..4e84f6f4 100644 Binary files a/docs/previews/code-city/minimap.png and b/docs/previews/code-city/minimap.png differ diff --git a/docs/previews/code-city/minimap_boss.png b/docs/previews/code-city/minimap_boss.png index 301a22c7..53723b7f 100644 Binary files a/docs/previews/code-city/minimap_boss.png and b/docs/previews/code-city/minimap_boss.png differ diff --git a/docs/previews/code-city/stage_1.png b/docs/previews/code-city/stage_1.png index 120b44c7..72e73c0b 100644 Binary files a/docs/previews/code-city/stage_1.png and b/docs/previews/code-city/stage_1.png differ diff --git a/docs/previews/code-city/stage_2.png b/docs/previews/code-city/stage_2.png index d05cc157..9475f4df 100644 Binary files a/docs/previews/code-city/stage_2.png and b/docs/previews/code-city/stage_2.png differ diff --git a/docs/previews/code-city/stage_3.png b/docs/previews/code-city/stage_3.png index 314ea1ca..5e3d7b50 100644 Binary files a/docs/previews/code-city/stage_3.png and b/docs/previews/code-city/stage_3.png differ diff --git a/docs/previews/code-city/stage_banner.png b/docs/previews/code-city/stage_banner.png index 52a9d74e..0e702007 100644 Binary files a/docs/previews/code-city/stage_banner.png and b/docs/previews/code-city/stage_banner.png differ diff --git a/docs/previews/code-city/stage_fade.png b/docs/previews/code-city/stage_fade.png index c249f2bf..73fde6e5 100644 Binary files a/docs/previews/code-city/stage_fade.png and b/docs/previews/code-city/stage_fade.png differ diff --git a/docs/previews/code-city/victory.png b/docs/previews/code-city/victory.png index 1174af9c..6971046c 100644 Binary files a/docs/previews/code-city/victory.png and b/docs/previews/code-city/victory.png differ diff --git a/docs/previews/heroes-villains/boss_agent_army.png b/docs/previews/heroes-villains/boss_agent_army.png index eab1843a..4b6e9d1e 100644 Binary files a/docs/previews/heroes-villains/boss_agent_army.png and b/docs/previews/heroes-villains/boss_agent_army.png differ diff --git a/docs/previews/heroes-villains/boss_ai_augmented_hacker.png b/docs/previews/heroes-villains/boss_ai_augmented_hacker.png index 81859408..e9ba55fb 100644 Binary files a/docs/previews/heroes-villains/boss_ai_augmented_hacker.png and b/docs/previews/heroes-villains/boss_ai_augmented_hacker.png differ diff --git a/docs/previews/heroes-villains/boss_ai_slop.png b/docs/previews/heroes-villains/boss_ai_slop.png index a1a93413..f384bddf 100644 Binary files a/docs/previews/heroes-villains/boss_ai_slop.png and b/docs/previews/heroes-villains/boss_ai_slop.png differ diff --git a/docs/previews/heroes-villains/boss_ten_thousand_line_pr.png b/docs/previews/heroes-villains/boss_ten_thousand_line_pr.png index 06528626..ed224849 100644 Binary files a/docs/previews/heroes-villains/boss_ten_thousand_line_pr.png and b/docs/previews/heroes-villains/boss_ten_thousand_line_pr.png differ diff --git a/docs/previews/heroes-villains/ending.png b/docs/previews/heroes-villains/ending.png index 3f334c49..6da65291 100644 Binary files a/docs/previews/heroes-villains/ending.png and b/docs/previews/heroes-villains/ending.png differ diff --git a/docs/previews/heroes-villains/ending_hacker_falls.png b/docs/previews/heroes-villains/ending_hacker_falls.png index eaa097a7..17363406 100644 Binary files a/docs/previews/heroes-villains/ending_hacker_falls.png and b/docs/previews/heroes-villains/ending_hacker_falls.png differ diff --git a/docs/previews/heroes-villains/ending_rabbit_stands.png b/docs/previews/heroes-villains/ending_rabbit_stands.png index addf9bd3..c614fdb9 100644 Binary files a/docs/previews/heroes-villains/ending_rabbit_stands.png and b/docs/previews/heroes-villains/ending_rabbit_stands.png differ diff --git a/docs/previews/heroes-villains/ending_trust_restored.png b/docs/previews/heroes-villains/ending_trust_restored.png index 3f334c49..6da65291 100644 Binary files a/docs/previews/heroes-villains/ending_trust_restored.png and b/docs/previews/heroes-villains/ending_trust_restored.png differ diff --git a/docs/previews/heroes-villains/fight_agent_army_phase_1.png b/docs/previews/heroes-villains/fight_agent_army_phase_1.png index efe8fa6f..370309dd 100644 Binary files a/docs/previews/heroes-villains/fight_agent_army_phase_1.png and b/docs/previews/heroes-villains/fight_agent_army_phase_1.png differ diff --git a/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_1.png b/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_1.png index 74417fc3..9ea6cb9c 100644 Binary files a/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_1.png and b/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_1.png differ diff --git a/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_3.png b/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_3.png index 25291318..4fdd5eef 100644 Binary files a/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_3.png and b/docs/previews/heroes-villains/fight_ai_augmented_hacker_phase_3.png differ diff --git a/docs/previews/heroes-villains/fight_ai_slop_phase_1.png b/docs/previews/heroes-villains/fight_ai_slop_phase_1.png index c4379820..78439a7e 100644 Binary files a/docs/previews/heroes-villains/fight_ai_slop_phase_1.png and b/docs/previews/heroes-villains/fight_ai_slop_phase_1.png differ diff --git a/docs/previews/heroes-villains/fight_ai_slop_phase_2.png b/docs/previews/heroes-villains/fight_ai_slop_phase_2.png index 4675fb0b..8b8110fc 100644 Binary files a/docs/previews/heroes-villains/fight_ai_slop_phase_2.png and b/docs/previews/heroes-villains/fight_ai_slop_phase_2.png differ diff --git a/docs/previews/heroes-villains/fight_ai_slop_phase_3.png b/docs/previews/heroes-villains/fight_ai_slop_phase_3.png index ecb52c76..281fb553 100644 Binary files a/docs/previews/heroes-villains/fight_ai_slop_phase_3.png and b/docs/previews/heroes-villains/fight_ai_slop_phase_3.png differ diff --git a/docs/previews/heroes-villains/fight_ten_thousand_line_pr_phase_1.png b/docs/previews/heroes-villains/fight_ten_thousand_line_pr_phase_1.png index 0b69a9dd..b0bbbaf1 100644 Binary files a/docs/previews/heroes-villains/fight_ten_thousand_line_pr_phase_1.png and b/docs/previews/heroes-villains/fight_ten_thousand_line_pr_phase_1.png differ diff --git a/docs/previews/heroes-villains/hoppy_victory_0.png b/docs/previews/heroes-villains/hoppy_victory_0.png index f5a5ea22..73ec379a 100644 Binary files a/docs/previews/heroes-villains/hoppy_victory_0.png and b/docs/previews/heroes-villains/hoppy_victory_0.png differ diff --git a/docs/previews/heroes-villains/hoppy_victory_1.png b/docs/previews/heroes-villains/hoppy_victory_1.png index f51faa61..bc3dbe0f 100644 Binary files a/docs/previews/heroes-villains/hoppy_victory_1.png and b/docs/previews/heroes-villains/hoppy_victory_1.png differ diff --git a/docs/previews/heroes-villains/hoppy_victory_2.png b/docs/previews/heroes-villains/hoppy_victory_2.png index 105116f1..b8755a1f 100644 Binary files a/docs/previews/heroes-villains/hoppy_victory_2.png and b/docs/previews/heroes-villains/hoppy_victory_2.png differ diff --git a/docs/previews/heroes-villains/minimap.png b/docs/previews/heroes-villains/minimap.png index edfe0973..4b968599 100644 Binary files a/docs/previews/heroes-villains/minimap.png and b/docs/previews/heroes-villains/minimap.png differ diff --git a/docs/previews/heroes-villains/minimap_boss.png b/docs/previews/heroes-villains/minimap_boss.png index 05e78188..4b8f8eee 100644 Binary files a/docs/previews/heroes-villains/minimap_boss.png and b/docs/previews/heroes-villains/minimap_boss.png differ diff --git a/docs/previews/heroes-villains/minimap_boss_dual.png b/docs/previews/heroes-villains/minimap_boss_dual.png index a64aae89..71bab65e 100644 Binary files a/docs/previews/heroes-villains/minimap_boss_dual.png and b/docs/previews/heroes-villains/minimap_boss_dual.png differ diff --git a/docs/previews/heroes-villains/mode_select.png b/docs/previews/heroes-villains/mode_select.png deleted file mode 100644 index da2b7cbd..00000000 Binary files a/docs/previews/heroes-villains/mode_select.png and /dev/null differ diff --git a/docs/previews/heroes-villains/opening.png b/docs/previews/heroes-villains/opening.png index 5b77bd32..0d889a4b 100644 Binary files a/docs/previews/heroes-villains/opening.png and b/docs/previews/heroes-villains/opening.png differ diff --git a/docs/previews/heroes-villains/opening_complication.png b/docs/previews/heroes-villains/opening_complication.png index aef9c0c0..a589d0a0 100644 Binary files a/docs/previews/heroes-villains/opening_complication.png and b/docs/previews/heroes-villains/opening_complication.png differ diff --git a/docs/previews/heroes-villains/opening_resolution.png b/docs/previews/heroes-villains/opening_resolution.png index ed15fbbc..fad9d520 100644 Binary files a/docs/previews/heroes-villains/opening_resolution.png and b/docs/previews/heroes-villains/opening_resolution.png differ diff --git a/docs/previews/heroes-villains/opening_situation.png b/docs/previews/heroes-villains/opening_situation.png index 76c4c2d3..5043b2ba 100644 Binary files a/docs/previews/heroes-villains/opening_situation.png and b/docs/previews/heroes-villains/opening_situation.png differ diff --git a/docs/previews/heroes-villains/stage_1_room_1.png b/docs/previews/heroes-villains/stage_1_room_1.png index 8000f77c..91228b5e 100644 Binary files a/docs/previews/heroes-villains/stage_1_room_1.png and b/docs/previews/heroes-villains/stage_1_room_1.png differ diff --git a/docs/previews/heroes-villains/stage_1_room_2.png b/docs/previews/heroes-villains/stage_1_room_2.png index f31e8da2..0abbadfb 100644 Binary files a/docs/previews/heroes-villains/stage_1_room_2.png and b/docs/previews/heroes-villains/stage_1_room_2.png differ diff --git a/docs/previews/heroes-villains/stage_1_room_3.png b/docs/previews/heroes-villains/stage_1_room_3.png index c4379820..78439a7e 100644 Binary files a/docs/previews/heroes-villains/stage_1_room_3.png and b/docs/previews/heroes-villains/stage_1_room_3.png differ diff --git a/docs/previews/heroes-villains/stage_2_room_1.png b/docs/previews/heroes-villains/stage_2_room_1.png index cb033e3b..da602ee3 100644 Binary files a/docs/previews/heroes-villains/stage_2_room_1.png and b/docs/previews/heroes-villains/stage_2_room_1.png differ diff --git a/docs/previews/heroes-villains/stage_2_room_2.png b/docs/previews/heroes-villains/stage_2_room_2.png index e2207c0c..c1e339f8 100644 Binary files a/docs/previews/heroes-villains/stage_2_room_2.png and b/docs/previews/heroes-villains/stage_2_room_2.png differ diff --git a/docs/previews/heroes-villains/stage_2_room_3.png b/docs/previews/heroes-villains/stage_2_room_3.png index efe8fa6f..370309dd 100644 Binary files a/docs/previews/heroes-villains/stage_2_room_3.png and b/docs/previews/heroes-villains/stage_2_room_3.png differ diff --git a/docs/previews/heroes-villains/stage_3_room_1.png b/docs/previews/heroes-villains/stage_3_room_1.png index b3dc0dcf..6f513a13 100644 Binary files a/docs/previews/heroes-villains/stage_3_room_1.png and b/docs/previews/heroes-villains/stage_3_room_1.png differ diff --git a/docs/previews/heroes-villains/stage_3_room_2.png b/docs/previews/heroes-villains/stage_3_room_2.png index caf97f3e..11d8d9fb 100644 Binary files a/docs/previews/heroes-villains/stage_3_room_2.png and b/docs/previews/heroes-villains/stage_3_room_2.png differ diff --git a/docs/previews/heroes-villains/stage_3_room_3.png b/docs/previews/heroes-villains/stage_3_room_3.png index 74417fc3..9ea6cb9c 100644 Binary files a/docs/previews/heroes-villains/stage_3_room_3.png and b/docs/previews/heroes-villains/stage_3_room_3.png differ diff --git a/docs/previews/heroes-villains/stage_enter_banner_0.png b/docs/previews/heroes-villains/stage_enter_banner_0.png index 2ea455b7..ec2b4f45 100644 Binary files a/docs/previews/heroes-villains/stage_enter_banner_0.png and b/docs/previews/heroes-villains/stage_enter_banner_0.png differ diff --git a/docs/previews/heroes-villains/stage_enter_banner_1.png b/docs/previews/heroes-villains/stage_enter_banner_1.png index 8cf73614..87fe8c46 100644 Binary files a/docs/previews/heroes-villains/stage_enter_banner_1.png and b/docs/previews/heroes-villains/stage_enter_banner_1.png differ diff --git a/docs/previews/heroes-villains/stage_enter_banner_2.png b/docs/previews/heroes-villains/stage_enter_banner_2.png index 65a22b0e..5f9570cd 100644 Binary files a/docs/previews/heroes-villains/stage_enter_banner_2.png and b/docs/previews/heroes-villains/stage_enter_banner_2.png differ diff --git a/docs/previews/heroes-villains/stage_exit_fade_0.png b/docs/previews/heroes-villains/stage_exit_fade_0.png index 45e7f7ab..ce4841b9 100644 Binary files a/docs/previews/heroes-villains/stage_exit_fade_0.png and b/docs/previews/heroes-villains/stage_exit_fade_0.png differ diff --git a/docs/previews/heroes-villains/stage_exit_fade_1.png b/docs/previews/heroes-villains/stage_exit_fade_1.png index 02a30721..6b246026 100644 Binary files a/docs/previews/heroes-villains/stage_exit_fade_1.png and b/docs/previews/heroes-villains/stage_exit_fade_1.png differ diff --git a/docs/previews/heroes-villains/unlock_change_stack.png b/docs/previews/heroes-villains/unlock_change_stack.png index 0f3febea..8e96edf6 100644 Binary files a/docs/previews/heroes-villains/unlock_change_stack.png and b/docs/previews/heroes-villains/unlock_change_stack.png differ diff --git a/docs/previews/heroes-villains/unlock_review.png b/docs/previews/heroes-villains/unlock_review.png index 0b20209d..cc774c41 100644 Binary files a/docs/previews/heroes-villains/unlock_review.png and b/docs/previews/heroes-villains/unlock_review.png differ diff --git a/docs/previews/heroes-villains/unlock_security.png b/docs/previews/heroes-villains/unlock_security.png index 2e4722b6..ef6be109 100644 Binary files a/docs/previews/heroes-villains/unlock_security.png and b/docs/previews/heroes-villains/unlock_security.png differ diff --git a/docs/previews/heroes-villains/unlock_triage.png b/docs/previews/heroes-villains/unlock_triage.png index f50ee1cc..689b46dc 100644 Binary files a/docs/previews/heroes-villains/unlock_triage.png and b/docs/previews/heroes-villains/unlock_triage.png differ diff --git a/docs/previews/heroes-villains/victory.png b/docs/previews/heroes-villains/victory.png index 10bdd381..11492bfd 100644 Binary files a/docs/previews/heroes-villains/victory.png and b/docs/previews/heroes-villains/victory.png differ diff --git a/docs/previews/main-menu-code-city.png b/docs/previews/main-menu-code-city.png deleted file mode 100644 index 85eda690..00000000 Binary files a/docs/previews/main-menu-code-city.png and /dev/null differ diff --git a/docs/previews/main-menu-heroes-villains.png b/docs/previews/main-menu-heroes-villains.png deleted file mode 100644 index 032ffe62..00000000 Binary files a/docs/previews/main-menu-heroes-villains.png and /dev/null differ diff --git a/docs/previews/main-menu-runner.png b/docs/previews/main-menu-runner.png deleted file mode 100644 index 985bb121..00000000 Binary files a/docs/previews/main-menu-runner.png and /dev/null differ diff --git a/docs/previews/pause-menu-runner-leaderboard.png b/docs/previews/pause-menu-runner-leaderboard.png new file mode 100644 index 00000000..7c68b2b0 Binary files /dev/null and b/docs/previews/pause-menu-runner-leaderboard.png differ diff --git a/docs/previews/pause-menu.png b/docs/previews/pause-menu.png new file mode 100644 index 00000000..8e9c7346 Binary files /dev/null and b/docs/previews/pause-menu.png differ diff --git a/docs/soundtrack.md b/docs/soundtrack.md index 6e3da8dc..65e01e50 100644 --- a/docs/soundtrack.md +++ b/docs/soundtrack.md @@ -153,7 +153,7 @@ These replace or upgrade tracks under `hoppys-adventure-arcade/Assets/Audio/`. E | **Enchanted Repo level** (delivered: `enchanted_repo_level.ogg`) | Traversal, retry, after the boss (`scenes/platformer/enchanted_repo.gd`) | `16-bit fantasy chiptune, SNES-era adventure stage, instrumental, 90 BPM, D dorian, mysterious enchanted forest and ruined castle, soft square lead, harp-like pulse arpeggios, breathy ocarina patch, warm triangle bass, light noise shuffle, bell sparkles, steady energy, loopable, ends on the downbeat` | | **Enchanted Repo boss** (delivered: `enchanted_repo_boss.ogg`) | The Legacy Monolith; starts in the 1.8 s intro, fading in over 0.55 s | `16-bit chiptune boss battle, SNES-era RPG fight, instrumental, 172 BPM, D minor, menacing ancient stone guardian, driving FM bass ostinato, aggressive square lead, pipe organ patch, orchestra hits, pounding noise toms, huge downbeat in the first second, loopable` | | **Orbital Ops level** (delivered: `orbital_ops_level.ogg`; the boss also got `orbital_ops_boss.ogg`, and Bay Area Blitz `bay_area_blitz_level.ogg` and `bay_area_blitz_boss.ogg`) | Traversal, retries, after the boss (`scenes/platformer/orbital_ops.gd`) | `FM synthesis chiptune, Genesis-style space station stage, instrumental, 145 BPM, E minor lifting to G major, buoyant cosmic adventure, sparkling FM bell arpeggios, slap FM bass, square lead, gated noise hi-hats, floating half-time zero-gravity breakdown, loopable` | -| **Code City Brawl: CLI/IDE District** (delivered: `code_city_cli_ide_district.ogg`) | Stage 1 and the mode menu (`modes/beatem_up/catalog.gd`) | `neon cyberpunk chiptune beat-em-up stage, 128 BPM, E minor, punchy kick and snare, FM slap bass, cyan square arpeggios, terminal beep accents, street brawler groove, loopable` | +| **Code City Brawl: CLI/IDE District** (delivered: `code_city_cli_ide_district.ogg`) | Stage 1 (`modes/beatem_up/catalog.gd`) | `neon cyberpunk chiptune beat-em-up stage, 128 BPM, E minor, punchy kick and snare, FM slap bass, cyan square arpeggios, terminal beep accents, street brawler groove, loopable` | | **Code City Brawl: Security Sector** (delivered: `code_city_security_sector.ogg`) | Stage 2 | `dark industrial chiptune, 136 BPM, F# phrygian, siren-like pulse lead, distorted FM bass, heavy breakbeat, tense, loopable` | | **Code City Brawl: Git HQ** (delivered: `code_city_git_hq.ogg`) | Stage 3 | `regal funk chiptune, 124 BPM, Bb mixolydian, brass-like FM stabs, strutting hopping bassline, triumphant headquarters, loopable` | | **Code City Brawl: district bosses** (delivered: `code_city_district_boss.ogg`) | Stack Overflow and Zero-Day, via `Catalog.MINI_BOSS_MUSIC` and `flow.swap_music` | `16-bit beat-em-up mini-boss battle, Genesis FM, instrumental, 150 BPM, E minor, alarm-like square-wave arpeggios, galloping slap FM bass, punchy breakbeat drums, brass-like FM stabs, urgent street-fight menace, huge downbeat in the first second, loopable`. The stage exit cancels the swap; the next stage starts its district track. The Grand Merge Conflict keeps its separate final-boss track. | diff --git a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/ASSET_GUIDE.md b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/ASSET_GUIDE.md index 05649bfe..d0ece033 100644 --- a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/ASSET_GUIDE.md +++ b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/ASSET_GUIDE.md @@ -9,7 +9,6 @@ - To use the art in coderabbit-arcade, copy only `bay_area/` into your project's asset directory. PNG and SpriteFrames resources use relative references; keep them together. - `animations/` contains animated GIF previews. They repeat one-shot actions deliberately for inspection. - `individual/` contains each named animation's first frame as a PNG; `frames/` contains every individual cell. -- `bay-area-preview.png` shows a staged composition. It is an illustration of scale and palette, not a playable level layout. - `sources/` preserves generated masters. Use normalized atlases for import; their frame dimensions differ from the generated masters. ## GDD coverage @@ -37,7 +36,6 @@ The source requirements below come from the Platformer Game section of the GDD ( | Fog-rolling streets | Four-frame stylized fog curl, separate alpha layer | Use low opacity and slow translation. Decorative, no collision. | | Golden Gate backdrop | 960 × 540 distant scenery plate | Single flattened plate; not internally separated bridge/sky/hill layers and not seamless. | | Enemy death / pickup feedback | Four-frame gold pixel burst, plus enemy-specific defeat frames | Can supplement GPUParticles2D; no particle system or gameplay event is installed. | -| Bay Area level-card thumbnail | Reuse `bay-area-preview.png` | Add level name/Play UI as native controls. | | Score, retry, game over, menus | Existing project's native UI work | No new raster text panels supplied; use labels/buttons. | Orbital Ops / Enchanted Repo enemies, bosses, CI lasers, vacuum vents and crumbling branches are deferred. Bug Bots appear in the general platformer catalog, but are not named as a separate Bay Area enemy in the level-specific requirements; no separate projectile Bug Bot set is claimed here. Audio is outside this sprite/animation pack. diff --git a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/README.md b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/README.md index 085c6803..bbd9ccbe 100644 --- a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/README.md +++ b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/README.md @@ -19,7 +19,6 @@ Keep each `.tres` next to its PNG; the animation resources use relative paths. T - `animations/`: animated GIF previews. - `sources/`: original generated sheets. - `preview.html`: standalone offline animation preview. -- `bay-area-preview.png`: staged art preview. - `ASSET_GUIDE.md`: coverage, frame sizes, pivots, animation names and integration notes. - `PROMPTS.md`: original artwork generation prompts. diff --git a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png deleted file mode 100644 index cb3f8b92..00000000 Binary files a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png and /dev/null differ diff --git a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png.import b/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png.import deleted file mode 100644 index 93895131..00000000 --- a/hoppys-adventure-arcade/Assets/bay-area-blitz-assets-only/bay-area-preview.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://dgrph4rim5jsq" -path="res://.godot/imported/bay-area-preview.png-0d3697884b0a4aa03b975ea774d3583b.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/bay-area-blitz-assets-only/bay-area-preview.png" -dest_files=["res://.godot/imported/bay-area-preview.png-0d3697884b0a4aa03b975ea774d3583b.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/uastc_level=0 -compress/rdo_quality_loss=0.0 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/channel_remap/red=0 -process/channel_remap/green=1 -process/channel_remap/blue=2 -process/channel_remap/alpha=3 -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/hoppys-adventure-arcade/app/app_router.gd b/hoppys-adventure-arcade/app/app_router.gd index fe505bce..c375b39c 100644 --- a/hoppys-adventure-arcade/app/app_router.gd +++ b/hoppys-adventure-arcade/app/app_router.gd @@ -13,10 +13,7 @@ const ROUTES := { "orbital_ops": "res://scenes/platformer/orbital_ops.tscn", "bay_area_blitz": "res://scenes/platformer/bay_area_blitz.tscn", "hub": "res://scenes/main_menu/main_menu.tscn", - "platformer": "res://scenes/platformer/platformer_menu.tscn", - "runner": "res://scenes/runner/runner_menu.tscn", "runner_game": "res://scenes/runner/runner_game.tscn", - "beatem_up": "res://scenes/beatem_up/beatem_menu.tscn", "credits": "res://scenes/credits/credits.tscn" } ## Packaged-build check (` --headless -- --smoke-routes`): load every route, then quit @@ -24,9 +21,9 @@ const ROUTES := { const SMOKE_FLAG := "--smoke-routes" const SMOKE_FRAMES := 30 ## Booth mode (` -- --booth`) is for unattended kiosks: the game runs fullscreen, the menu's -## Quit does nothing, and after IDLE_SECONDS without input any route returns to the attract route -## (the hub, whose rotating previews are the attract screen, unless --attract names another). -## `--route=` opens a route at launch, with or without --booth. Both are off unless passed. +## Quit does nothing, and after IDLE_SECONDS without input any route returns to the hub, whose +## rotating previews are the attract screen. `--route=` opens a route at launch, with or +## without --booth. Both are off unless passed. const BOOTH_FLAG := "--booth" const ROUTE_PREFIX := "--route=" const IDLE_SECONDS := 90.0 @@ -43,14 +40,12 @@ const SESSION_LOG_DEFAULT := "user://booth" const HEARTBEAT_PREFIX := "--heartbeat=" ## Booth game over: games call booth_game_over() when the player loses. A booth player gets ## `--retries=` retries (default 0); after that the router lays NextPlayerCard over the game -## and, NEXT_PLAYER_SECONDS later, opens the attract route for the next player. `--attract=` -## picks the attract route for this and the idle return, from ATTRACT_ROUTES. Outside booth mode -## games are unchanged. +## and, NEXT_PLAYER_SECONDS later, opens the hub for the next player. Outside booth mode games are +## unchanged. +## The hub is the only attract screen since the genre menus went. Older booth configs may still pass +## `--attract=`; it is accepted with a warning and changes nothing. const ATTRACT_PREFIX := "--attract=" -## Menus that can wait for the next player: each starts its own music (the hub through -## AudioService). Game routes would start playing by themselves, and the platformer menu would be -## silent after a beat 'em up stops the shared music. -const ATTRACT_ROUTES: Array[String] = ["hub", "beatem_up", "runner"] +const ATTRACT_ROUTE := "hub" const RETRIES_PREFIX := "--retries=" const NEXT_PLAYER_SECONDS := 6.0 var busy := false @@ -60,9 +55,8 @@ var idle_limit := IDLE_SECONDS var idle_seconds := 0.0 var session_log: BoothLog var heartbeat: BoothHeartbeat -var attract := "hub" var retry_limit := 0 -## Game overs since the attract route last opened: one player's, as far as a booth can tell. +## Game overs since the hub last opened: one player's, as far as a booth can tell. var game_overs := 0 var next_player: NextPlayerCard var next_player_left := 0.0 @@ -70,9 +64,8 @@ var next_player_left := 0.0 var soak: BoothSoak var booth_qr: Control ## How-to-play cards (app/how_to_play.gd): the first time a visitor enters a game, its card opens -## over it. A visitor starts when the hub or the booth's attract route opens, so retries and -## returns from a game's own menu skip the card. Test suites run with --script and get no cards -## unless they set this; soaks get none either. +## over it. A visitor starts when the hub opens, so retries and restarts skip the card. Test suites +## run with --script and get no cards unless they set this; soaks get none either. var how_to_play_enabled := not ("--script" in OS.get_cmdline_args()) ## Game routes whose card this visitor has seen. var how_to_play_seen := {} @@ -96,11 +89,11 @@ func _ready() -> void: if SMOKE_FLAG in args: smoke_routes.call_deferred() return - attract = attract_route(args) + warn_legacy_attract(args) retry_limit = retry_count(args) set_booth(BOOTH_FLAG in args) if booth: - print("AppRouter: booth attract route %s, %d retries per player" % [attract, retry_limit]) + print("AppRouter: booth mode, %d retries per player" % retry_limit) var beat_path := heartbeat_path(args) if beat_path != "": heartbeat = BoothHeartbeat.new(beat_path) @@ -142,9 +135,8 @@ func go(route: String, reason := "menu") -> bool: get_tree().paused = false if session_log: session_log.route_changed(route, reason) - if route == attract: + if route == ATTRACT_ROUTE: game_overs = 0 - if route == attract or route == "hub": how_to_play_seen.clear() if wants_how_to_play(route): how_to_play_seen[route] = true @@ -209,17 +201,12 @@ static func heartbeat_path(args: PackedStringArray) -> String: return arg.trim_prefix(HEARTBEAT_PREFIX) return "" -## The booth's attract route from `--attract=`: "hub" when absent or not one of -## ATTRACT_ROUTES (with a warning). -static func attract_route(args: PackedStringArray) -> String: +## `--attract=` picked another attract screen when the genre menus existed. The hub is the +## only one now: the flag is accepted so old booth configs keep launching, with a warning. +static func warn_legacy_attract(args: PackedStringArray) -> void: for arg in args: if arg.begins_with(ATTRACT_PREFIX): - var route := arg.trim_prefix(ATTRACT_PREFIX) - if route in ATTRACT_ROUTES: - return route - push_warning("--attract %s is not one of %s; the booth returns to the hub" - % [route, ", ".join(ATTRACT_ROUTES)]) - return "hub" + push_warning("%s does nothing any more; the booth always returns to the hub" % arg) ## Retries a booth player gets, from `--retries=`: 0 when absent or not a whole number. static func retry_count(args: PackedStringArray) -> int: @@ -233,7 +220,7 @@ static func retry_count(args: PackedStringArray) -> int: ## Games call this when the player loses, before showing their own retry screen. Returns true when ## the booth takes over: the player has used their retries, so the game shows nothing and the -## router thanks them and sends the booth to the attract route. Always false outside booth mode, +## router thanks them and sends the booth to the hub. Always false outside booth mode, ## while a route change is already under way (it takes the player elsewhere anyway), and during a ## soak, which changes routes itself. The session log counts every game over, booth or not. ## `score_line` is shown on the card, in the game's own style ("SCORE 01234"). @@ -269,7 +256,7 @@ func set_booth(enabled: bool) -> void: AudioService.set_attract(enabled) game_overs = 0 if finishing: - go(attract, "game_over") # The route change hides the card. + go(ATTRACT_ROUTE, "game_over") # The route change hides the card. elif next_player: next_player.hide() set_process(enabled) @@ -306,23 +293,23 @@ func note_input(event: InputEvent) -> void: idle_seconds = 0.0 func _process(delta: float) -> void: - # The game-over card owns the screen until its countdown sends the booth to the attract route. + # The game-over card owns the screen until its countdown sends the booth to the hub. if next_player and next_player.visible: next_player_left -= delta next_player.set_seconds(next_player_left) if next_player_left <= 0.0 and not busy: - # The route change hides the card; if the attract scene fails to load, try again after - # another countdown rather than every frame. + # The route change hides the card; if the hub fails to load, try again after another + # countdown rather than every frame. next_player_left = NEXT_PLAYER_SECONDS - go(attract, "game_over") + go(ATTRACT_ROUTE, "game_over") return idle_seconds += delta if idle_seconds < idle_limit or busy: return idle_seconds = 0.0 var scene := get_tree().current_scene - if scene == null or scene.scene_file_path != ROUTES[attract]: - go(attract, "idle") + if scene == null or scene.scene_file_path != ROUTES[ATTRACT_ROUTE]: + go(ATTRACT_ROUTE, "idle") func smoke_routes() -> void: # Let the launch scene finish its opening frames, as a player would, before switching. diff --git a/hoppys-adventure-arcade/app/audio_service.gd b/hoppys-adventure-arcade/app/audio_service.gd index 8ce987de..b9784725 100644 --- a/hoppys-adventure-arcade/app/audio_service.gd +++ b/hoppys-adventure-arcade/app/audio_service.gd @@ -23,6 +23,8 @@ func _ready() -> void: music.bus = "Music" sfx.bus = "SFX" add_child(music) + # UI blips must sound inside a paused game (the pause menu); music stays pausable. + sfx.process_mode = Node.PROCESS_MODE_ALWAYS add_child(sfx) default_track = TITLE_THEME music.stream = default_track diff --git a/hoppys-adventure-arcade/app/booth_log.gd b/hoppys-adventure-arcade/app/booth_log.gd index 6b9540eb..37681dc6 100644 --- a/hoppys-adventure-arcade/app/booth_log.gd +++ b/hoppys-adventure-arcade/app/booth_log.gd @@ -15,11 +15,11 @@ extends RefCounted ## level's Retry) counts as a retry within it. `game_overs` counts the session's losses, stage ## retries that stay in the game included. `ended_by` is "menu" (the player left through the ## game's own menu), "idle" (booth mode's idle return), "game_over" (booth mode sent a player who -## had used their retries back to the attract route) or "quit". A start with no end means the game +## had used their retries back to the hub) or "quit". A start with no end means the game ## stopped without quitting: a crash, a power cut or a forced kill. ## tools/booth/sessions_report.py summarizes a folder of these files. -## Routes that are games. The hub and mode menus end a session but never start one. +## Routes that are games. The hub ends a session but never starts one. const GAMES: Array[String] = ["heroes_vs_villains", "code_city_brawl", "bay_area_blitz", "orbital_ops", "enchanted_repo", "runner_game"] ## This run's file. diff --git a/hoppys-adventure-arcade/app/controller_service.gd b/hoppys-adventure-arcade/app/controller_service.gd index b8d87f4b..8c956c86 100644 --- a/hoppys-adventure-arcade/app/controller_service.gd +++ b/hoppys-adventure-arcade/app/controller_service.gd @@ -20,7 +20,7 @@ const PLAYER := &"p1" ## tests/controller_service.gd fails when a route is in neither list. const GAMEPLAY_ROUTES: Array[String] = [ "heroes_vs_villains", "code_city_brawl", "enchanted_repo", "orbital_ops", "bay_area_blitz", "runner_game"] -const MENU_ROUTES: Array[String] = ["hub", "platformer", "runner", "beatem_up", "credits"] +const MENU_ROUTES: Array[String] = ["hub", "credits"] ## Godot ships ui_accept and ui_cancel without pad buttons, so a pad could not confirm or go back ## in menus. These match the prompts: the bottom face button confirms, the right one goes back. const MENU_BINDINGS := { diff --git a/hoppys-adventure-arcade/app/next_player_card.gd b/hoppys-adventure-arcade/app/next_player_card.gd index 69f516da..a97d078d 100644 --- a/hoppys-adventure-arcade/app/next_player_card.gd +++ b/hoppys-adventure-arcade/app/next_player_card.gd @@ -1,7 +1,7 @@ extends Control ## The booth's game-over card. AppRouter lays it over a finished game when the booth player has ## used their retries: GAME OVER, the game's score line, a thank-you, and a countdown to the next -## player. It takes no input; the router opens the attract route when the countdown ends. +## player. It takes no input; the router opens the hub when the countdown ends. const Style = preload("res://scenes/main_menu/menu_style.gd") var summary: Label var countdown: Label diff --git a/hoppys-adventure-arcade/app/pause_menu.gd b/hoppys-adventure-arcade/app/pause_menu.gd new file mode 100644 index 00000000..16ed62e4 --- /dev/null +++ b/hoppys-adventure-arcade/app/pause_menu.gd @@ -0,0 +1,228 @@ +extends CanvasLayer +## The pause menu every game shows: Resume, Restart, How to Play, Main Menu, in the hub's style. +## +## A game creates one with create() and owns the pause state itself: it pauses the tree (or its own +## state machine), then calls open(); resume closes it. The menu never pauses or unpauses anything, +## and it binds neither `pause` nor `ui_cancel`: Esc is both, and every game already toggles its +## pause on the `pause` action (ControllerService synthesizes that action on a pad disconnect). +## Restart and Main Menu run the game's callables, which end in AppRouter.go(); the menu locks its +## buttons on that press so a second press during the router's fade does nothing. +## A game may add a button of its own before Main Menu (the runner's Leaderboard). + +const Style := preload("res://scenes/main_menu/menu_style.gd") +const Data := preload("res://app/how_to_play_data.gd") +const Prompts := preload("res://app/controller_prompts.gd") +const HowToPlay := preload("res://app/how_to_play.gd") + +## Above every game's HUD, results and story layers (at most 22), below the how-to-play card (89), +## ControllerService's disconnect banner (90) and the router's fade (100). +const LAYER := 80 +const DIM := Color(0.01, 0.02, 0.04, 0.86) +const PANEL := Color("142735") +const BUTTON_HEIGHT := 54 + +var route := "" +var ui: Control +var column: VBoxContainer +var eyebrow: Label +var title_label: Label +var detail_label: Label +var resume_button: Button +var restart_button: Button +var how_to_play_button: Button +var menu_button: Button +## Every button in focus order, Main Menu last. +var buttons: Array[Button] = [] +var locked := false +var _on_resume: Callable +var _on_restart: Callable +var _on_leave: Callable +var _opening := false + +## Builds a hidden menu for `game_route` under `host` and returns it. +static func create(host: Node, game_route: String, on_resume: Callable, on_restart: Callable, on_leave: Callable) -> Node: + var menu: Node = load("res://app/pause_menu.gd").new() + host.add_child(menu) + menu.setup(game_route, on_resume, on_restart, on_leave) + return menu + +func _init() -> void: + name = "PauseMenu" + layer = LAYER + process_mode = Node.PROCESS_MODE_ALWAYS + visible = false + +func _ready() -> void: + if ui == null: + _build() + +func setup(game_route: String, on_resume: Callable, on_restart: Callable, on_leave: Callable) -> void: + route = game_route + _on_resume = on_resume + _on_restart = on_restart + _on_leave = on_leave + if ui == null: + _build() + var title: String = Data.game(route).get("title", "") if Data.has_game(route) else "" + eyebrow.text = title.to_upper() + eyebrow.visible = not title.is_empty() + +func _build() -> void: + ui = Control.new() + ui.name = "Screen" + ui.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + ui.theme = Style.theme() + # Swallow clicks, so the HUD's own pause button under the menu can't be pressed through it. + ui.mouse_filter = Control.MOUSE_FILTER_STOP + add_child(ui) + var dim := ColorRect.new() + dim.color = DIM + dim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + dim.mouse_filter = Control.MOUSE_FILTER_IGNORE + ui.add_child(dim) + var center := CenterContainer.new() + center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + center.mouse_filter = Control.MOUSE_FILTER_IGNORE + ui.add_child(center) + var panel := PanelContainer.new() + var box := StyleBoxFlat.new() + box.bg_color = PANEL + box.border_color = Style.MINT + box.set_border_width_all(2) + box.content_margin_left = 34 + box.content_margin_right = 34 + box.content_margin_top = 22 + box.content_margin_bottom = 20 + panel.add_theme_stylebox_override("panel", box) + center.add_child(panel) + column = VBoxContainer.new() + column.add_theme_constant_override("separation", 14) + column.custom_minimum_size.x = 520 + panel.add_child(column) + eyebrow = _label("", 18, Style.MINT) + column.add_child(eyebrow) + title_label = _label("PAUSED", 40) + column.add_child(title_label) + detail_label = _label("", 18, Style.MINT) + detail_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART + detail_label.custom_minimum_size.x = 520 + detail_label.visible = false + column.add_child(detail_label) + resume_button = _add_button("Resume", _press_resume) + restart_button = _add_button("Restart", _press.bind(func() -> void: _on_restart.call())) + how_to_play_button = _add_button("How to Play", _show_how_to_play) + menu_button = _add_button("Main Menu", _press.bind(func() -> void: _on_leave.call())) + var hint := _label("", 18, Color("9baebc")) + Prompts.track(hint, func() -> String: + return "%s RESUME %s SELECT %s CONFIRM" % [ + Prompts.either("ESC", &"pause", true), + Prompts.keys_or_pad("↑ ↓", Prompts.if_pad("D-PAD")), + Prompts.either("ENTER", &"ui_accept", true)]) + column.add_child(hint) + _wire_focus() + +## Adds a game-specific button before Main Menu and returns it. It does not lock the menu: the +## game decides what the press does (the runner opens its leaderboard over the menu). +func add_button(text: String, on_pressed: Callable) -> Button: + var button := _add_button(text, func() -> void: + if locked or _router_busy(): + return + _play_ui(1) + on_pressed.call()) + column.move_child(button, menu_button.get_index()) + buttons.erase(button) + buttons.insert(buttons.find(menu_button), button) + _wire_focus() + return button + +func _add_button(text: String, on_pressed: Callable) -> Button: + var button := Style.button(text, BUTTON_HEIGHT) + button.name = text.replace(" ", "") + "Button" + column.add_child(button) + buttons.append(button) + button.pressed.connect(on_pressed) + button.focus_entered.connect(_focus_sound) + button.mouse_entered.connect(func() -> void: + if visible and not button.disabled: + button.grab_focus()) + return button + +## Menu text with an outline: it sits over any game's screen, and the runner's legibility rules +## (18 px, 6 px outline) apply to every label a run can show. +static func _label(text: String, size: int, color: Color = Style.CREAM) -> Label: + var label := Style.label(text, size, color) + label.add_theme_constant_override("outline_size", 6) + label.add_theme_color_override("font_outline_color", Color("0b1620")) + return label + +func _wire_focus() -> void: + for i in buttons.size(): + var above := buttons[(i - 1 + buttons.size()) % buttons.size()] + var below := buttons[(i + 1) % buttons.size()] + buttons[i].focus_neighbor_top = buttons[i].get_path_to(above) + buttons[i].focus_neighbor_bottom = buttons[i].get_path_to(below) + buttons[i].focus_previous = buttons[i].focus_neighbor_top + buttons[i].focus_next = buttons[i].focus_neighbor_bottom + +## Shows the menu with `detail` under the title ("" for none) and focuses Resume. +func open(detail := "") -> void: + detail_label.text = detail + detail_label.visible = not detail.is_empty() + _set_locked(false) + visible = true + _opening = true + resume_button.grab_focus() + _opening = false + +## Hides the menu. The game unpauses itself; this never touches the tree. +func close() -> void: + visible = false + +func is_open() -> bool: + return visible + +## Disables every button: a route change is under way and a second press must do nothing. +func lock() -> void: + _set_locked(true) + +func _set_locked(value: bool) -> void: + locked = value + for button in buttons: + button.disabled = value + +## The autoloads are looked up at run time: runner scripts preload this one before the singletons +## exist, so naming AudioService or AppRouter here would not compile there. +func _play_ui(kind: int) -> void: + var audio := get_tree().root.get_node_or_null(^"AudioService") if is_inside_tree() else null + if audio != null and audio.has_method("play_ui"): + audio.play_ui(kind) + +func _router_busy() -> bool: + var router := get_tree().root.get_node_or_null(^"AppRouter") if is_inside_tree() else null + return router != null and bool(router.get(&"busy")) + +func _press_resume() -> void: + if locked or _router_busy(): + return + _play_ui(1) + _on_resume.call() + +## Restart, Main Menu and game-specific buttons: one press, then the menu locks. +func _press(action: Callable) -> void: + if locked or _router_busy(): + return + lock() + _play_ui(1) + action.call() + +## Opens the game's how-to-play card over this menu; the game stays paused under it and focus +## returns to the button when the card closes. +func _show_how_to_play() -> void: + if not visible or locked or _router_busy(): + return + _play_ui(1) + HowToPlay.open(get_tree(), route, HowToPlay.Mode.PAUSE, how_to_play_button) + +func _focus_sound() -> void: + if visible and not _opening and not _router_busy(): + _play_ui(0) diff --git a/hoppys-adventure-arcade/app/pause_menu.gd.uid b/hoppys-adventure-arcade/app/pause_menu.gd.uid new file mode 100644 index 00000000..e60146a9 --- /dev/null +++ b/hoppys-adventure-arcade/app/pause_menu.gd.uid @@ -0,0 +1 @@ +uid://bu45utmxbadyo diff --git a/hoppys-adventure-arcade/modes/beatem_up/game.gd b/hoppys-adventure-arcade/modes/beatem_up/game.gd index 1c8fa5a5..c4129060 100644 --- a/hoppys-adventure-arcade/modes/beatem_up/game.gd +++ b/hoppys-adventure-arcade/modes/beatem_up/game.gd @@ -12,7 +12,9 @@ const StoryScene = preload("res://modes/beatem_up/story_scene.gd") const VictoryScreen = preload("res://modes/beatem_up/victory_screen.gd") const Minimap = preload("res://modes/beatem_up/minimap.gd") const Style = preload("res://scenes/main_menu/menu_style.gd") -const HowToPlay = preload("res://app/how_to_play.gd") +const PauseMenu = preload("res://app/pause_menu.gd") +## This game's AppRouter route: Restart reloads it. +const ROUTE := "code_city_brawl" const PAUSABLE := ["combat","intro","ending","stage_enter","stage_exit","knockout","boss_victory","celebration"] ## The minimap is up while Hoppy is in a room, and hidden under the story scenes and end screens. const MINIMAP_STATES := ["stage_enter","combat","stage_exit","boss_victory","finisher","knockout"] @@ -89,6 +91,8 @@ var prompt: Label var overlay: ColorRect var panel: VBoxContainer var primary: Button +## The shared pause menu (app/pause_menu.gd); `overlay` serves game over and victory only. +var pause_menu: CanvasLayer var screen_fx: ColorRect var finish_clock := 0.0 var merge_button: AnimatedSprite2D @@ -729,7 +733,7 @@ func show_victory() -> void: overlay.hide() hide_toast() prompt.text = "" - victory.show_result(Catalog.VICTORY.title,Catalog.VICTORY.line,score,elapsed,Catalog.STORY_ACCENT,"Return to Beat'em Up menu",leave) + victory.show_result(Catalog.VICTORY.title,Catalog.VICTORY.line,score,elapsed,Catalog.STORY_ACCENT,"Main Menu",leave) func toast(message: String, seconds := 2.0) -> void: # Combat opens under the fading stage title; anything said then waits for it (latest wins). @@ -835,7 +839,7 @@ func _build_ui() -> void: ui.add_child(story) intro_next = _intro_button("Next →",next_intro) intro_skip = _intro_button("Skip intro",finish_story) - intro_return = _intro_button("Return to Beat'em Up menu",leave) + intro_return = _intro_button("Main Menu",leave) victory = VictoryScreen.new() victory.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) ui.add_child(victory) @@ -850,6 +854,7 @@ func _build_ui() -> void: panel.custom_minimum_size = Vector2(720,0) panel.add_theme_constant_override("separation",18) center.add_child(panel) + pause_menu = PauseMenu.create(self, ROUTE, resume, restart, leave) ## The gameplay chrome the knockout cinematic hides and then restores (knockout.gd): the HUD ## strip and its labels, the boss bar, toast, prompt, control hints and minimap. Menus, story @@ -904,13 +909,8 @@ func show_overlay(title: String, detail: String, action: String, callback: Calla primary = Style.button(action,58) panel.add_child(primary) primary.pressed.connect(callback) - if state == "paused": - var how_to := Style.button("How to Play",54) - panel.add_child(how_to) - how_to.pressed.connect(func() -> void: - if state == "paused": HowToPlay.open(get_tree(), "code_city_brawl", HowToPlay.Mode.PAUSE, how_to)) if state != "won": - var back := Style.button("Return to Beat'em Up menu",54) + var back := Style.button("Main Menu",54) panel.add_child(back) back.pressed.connect(leave) overlay_clock = 0 @@ -973,7 +973,8 @@ func pause(detail: String) -> void: playing = false state = "paused" get_tree().paused = true - show_overlay("REVIEW PAUSED",detail,"Resume",resume) + overlay.hide() + pause_menu.open(detail) ## Jump's Space is also ui_accept, so a press carried over from the finisher or the fatal hit ## would fire the focused button before the player sees the screen. Swallow confirms (whatever @@ -997,6 +998,7 @@ func is_player_paused() -> bool: func resume() -> void: if state!="paused": return + pause_menu.close() get_tree().paused = false # The return state only means something while paused; consume it so a stale one can't steer # a later resume (pause() always sets it first). @@ -1014,7 +1016,15 @@ func resume() -> void: overlay.hide() _: begin_play() +## Main Menu, from the pause menu, the results, the knockout and the opening story. func leave() -> void: + _depart("hub") + +## Restart on the pause menu: a fresh scene, whatever state the pause interrupted. +func restart() -> void: + _depart(ROUTE) + +func _depart(route: String) -> void: if state=="leaving": return ko.cancel() party.cancel() @@ -1025,9 +1035,10 @@ func leave() -> void: for child in panel.get_children(): if child is BaseButton: child.disabled = true victory.action.disabled = true + pause_menu.lock() get_tree().paused = false music.stop() - AppRouter.go("beatem_up") + AppRouter.go(route) func _notification(what: int) -> void: if what==NOTIFICATION_APPLICATION_FOCUS_OUT and state in PAUSABLE and not test_mode: diff --git a/hoppys-adventure-arcade/modes/beatem_up/reinvent/game.gd b/hoppys-adventure-arcade/modes/beatem_up/reinvent/game.gd index 4f713a45..4ae5d1eb 100644 --- a/hoppys-adventure-arcade/modes/beatem_up/reinvent/game.gd +++ b/hoppys-adventure-arcade/modes/beatem_up/reinvent/game.gd @@ -7,7 +7,9 @@ const Boss = preload("res://modes/beatem_up/reinvent/boss.gd") const StageFlow = preload("res://modes/beatem_up/stage_flow.gd") const Knockout = preload("res://modes/beatem_up/knockout.gd") const Style = preload("res://scenes/main_menu/menu_style.gd") -const HowToPlay = preload("res://app/how_to_play.gd") +const PauseMenu = preload("res://app/pause_menu.gd") +## This game's AppRouter route: Restart reloads it. +const ROUTE := "heroes_vs_villains" const VictoryScreen = preload("res://modes/beatem_up/victory_screen.gd") const Minimap = preload("res://modes/beatem_up/minimap.gd") ## The minimap is up while the CodeRabbit is in a room, and hidden under cards and end screens. @@ -64,6 +66,8 @@ var prompt: Label var overlay: ColorRect var panel: VBoxContainer var primary: Button +## The shared pause menu (app/pause_menu.gd); `overlay` serves game over and victory only. +var pause_menu: CanvasLayer var terminal_overlay_clock := TERMINAL_OVERLAY_ARM var screen_fx: ColorRect var completion_count := 0 @@ -622,7 +626,7 @@ func win() -> void: _update_hud() overlay.hide();card_host.hide() toast_left=0;held_toast="";toast_label.hide();prompt.text="" - victory.show_result(Catalog.VICTORY.title,Catalog.VICTORY.line,score,elapsed,Catalog.STORY_ACCENT,"Return to Beat'em Up menu",leave) + victory.show_result(Catalog.VICTORY.title,Catalog.VICTORY.line,score,elapsed,Catalog.STORY_ACCENT,"Main Menu",leave) func toast(message: String, seconds := 2.0) -> void: # Combat opens under the fading stage title; anything said then waits for it (latest wins). @@ -758,6 +762,7 @@ func _build_ui() -> void: panel.custom_minimum_size = Vector2(720,0) panel.add_theme_constant_override("separation",18) center.add_child(panel) + pause_menu = PauseMenu.create(self, ROUTE, resume, restart, leave) func _update_hud() -> void: var health := "" @@ -823,13 +828,8 @@ func show_overlay(title: String, detail: String, action: String, callback: Calla primary = Style.button(action,58) panel.add_child(primary) primary.pressed.connect(callback) - if state == "paused": - var how_to := Style.button("How to Play",54) - panel.add_child(how_to) - how_to.pressed.connect(func() -> void: - if state == "paused": HowToPlay.open(get_tree(), "heroes_vs_villains", HowToPlay.Mode.PAUSE, how_to)) if state != "won": - var back := Style.button("Return to Beat'em Up menu",54) + var back := Style.button("Main Menu",54) panel.add_child(back) back.pressed.connect(leave) overlay.show() @@ -853,10 +853,7 @@ func _input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed("pause") and not event.is_echo(): if state=="paused": resume() - elif state in PAUSABLE: - pause_return_state=state - playing=false;state="paused";get_tree().paused=true - show_overlay("REVIEW PAUSED","Chain attacks, sidestep warnings, and hold %s to charge REVIEW." % Prompts.either("Q", &"review_burst"),"Resume",resume) + elif state in PAUSABLE: pause("Chain attacks, sidestep warnings, and hold %s to charge REVIEW." % Prompts.either("Q", &"review_burst")) get_viewport().set_input_as_handled() elif state=="cards" and event.is_action_pressed("heroes_popup_advance") and not event.is_echo(): if card_clock>.25: next_card() @@ -867,8 +864,15 @@ func _unhandled_input(event: InputEvent) -> void: func is_player_paused() -> bool: return state == "paused" +func pause(detail: String) -> void: + pause_return_state=state + playing=false;state="paused";get_tree().paused=true + overlay.hide() + pause_menu.open(detail) + func resume() -> void: if state!="paused": return + pause_menu.close() get_tree().paused=false # The return state only means something while paused; consume it so a stale one can't steer # a later resume (every pause sets it first). @@ -877,20 +881,27 @@ func resume() -> void: if back in ["cards","boss_victory","stage_enter","stage_exit","knockout"]: state=back;overlay.hide() else: begin_play() +## Main Menu, from the pause menu, the results and the knockout. func leave() -> void: + _depart("hub") + +## Restart on the pause menu: a fresh scene, whatever state the pause interrupted. +func restart() -> void: + _depart(ROUTE) + +func _depart(route: String) -> void: if leaving: return leaving=true;ko.cancel();flow.cancel();playing=false;state="leaving";get_tree().paused=false for child in panel.get_children(): if child is BaseButton: child.disabled=true victory.action.disabled=true + pause_menu.lock() music.stop() - AppRouter.go("beatem_up") + AppRouter.go(route) func _notification(what: int) -> void: if what==NOTIFICATION_APPLICATION_FOCUS_OUT and state in PAUSABLE and not test_mode: - pause_return_state=state - playing=false;state="paused";get_tree().paused=true - show_overlay("REVIEW PAUSED","The window lost focus.","Resume",resume) + pause("The window lost focus.") func _exit_tree() -> void: get_tree().paused = false diff --git a/hoppys-adventure-arcade/modes/platformer/level.gd b/hoppys-adventure-arcade/modes/platformer/level.gd index 04c8e993..aa837969 100644 --- a/hoppys-adventure-arcade/modes/platformer/level.gd +++ b/hoppys-adventure-arcade/modes/platformer/level.gd @@ -5,7 +5,7 @@ const Knockout = preload("res://modes/platformer/knockout.gd") const Player = preload("res://modes/platformer/player.gd") const Enemy = preload("res://modes/platformer/enemy.gd") const Style = preload("res://scenes/main_menu/menu_style.gd") -const HowToPlay = preload("res://app/how_to_play.gd") +const PauseMenu = preload("res://app/pause_menu.gd") # Preloaded so nothing is read from disk mid-run (a freed one-shot player used to drop its stream, # so every jump reloaded the WAV). const SFX := { @@ -51,9 +51,8 @@ var boss_label: Label var overlay: ColorRect var overlay_title: Label var overlay_detail: Label -var resume_button: Button -## Pause-only: reopens the level's how-to-play card over the pause menu. -var how_to_play_button: Button +## The shared pause menu (app/pause_menu.gd); the overlay below serves the results only. +var pause_menu: CanvasLayer var retry_button: Button var overlay_card: Control var results_reveal: Tween @@ -224,22 +223,21 @@ func _hud() -> void: col.add_child(overlay_title) overlay_detail = Style.label("", 18, Style.MINT) col.add_child(overlay_detail) - resume_button = Style.button("Resume") - col.add_child(resume_button) - resume_button.pressed.connect(_resume) - how_to_play_button = Style.button("How to Play") - col.add_child(how_to_play_button) - how_to_play_button.pressed.connect(_show_how_to_play) - for entry in [["Retry " + level_title, level_route], ["Return to Platformer Menu", "platformer"], ["Return to Arcade", "hub"]]: + for entry in [["Retry " + level_title, level_route], ["Main Menu", "hub"]]: var button := Style.button(entry[0]) col.add_child(button) if entry[1] == level_route: retry_button = button - button.pressed.connect(func(): - # Leaving the results unpauses the level music; end the stinger before they overlap. - stage_clear.stop() - get_tree().paused = false - AppRouter.go(entry[1])) + button.pressed.connect(_go.bind(entry[1])) overlay.hide() + pause_menu = PauseMenu.create(self, level_route, _resume, _go.bind(level_route), _go.bind("hub")) +## Every way out of the level: Restart and Main Menu on the pause menu, Retry and Main Menu on the +## results. The level stays frozen under the router's fade; go() unpauses the tree once the next +## scene is in (unpausing here first let the engine's pause bookkeeping trip during the fade). +## The stinger is stopped before the level music could resume over it. +func _go(route: String) -> void: + if AppRouter.busy: return + stage_clear.stop() + AppRouter.go(route) func _update_hud() -> void: for i in hearts.size(): hearts[i].texture = HEART_FULL if i < player.hp else HEART_EMPTY @@ -248,30 +246,19 @@ func _update_hud() -> void: if encounter == "fight": objective.text = fight_objective if player.shield: objective.text += " [SHIELD]" func _pause() -> void: - if finished: return + if finished or AppRouter.busy: return get_tree().paused = true - overlay_title.text = "TAKE A BREATHER" - overlay_detail.text = "Your commits can wait." - resume_button.show() - how_to_play_button.show() - overlay.color = PAUSE_SHADE - overlay.modulate.a = 1.0 - overlay_card.position.y = 0 - overlay.show() - resume_button.grab_focus() -func _show_how_to_play() -> void: - if get_tree().paused and not finished: - HowToPlay.open(get_tree(), level_route, HowToPlay.Mode.PAUSE, how_to_play_button) + pause_menu.open("Your commits can wait.") ## True while the player has the level paused (its pause menu is up). The how-to-play card checks ## this before unpausing, so focus loss under the card leaves the pause menu working. func is_player_paused() -> bool: - return get_tree().paused and overlay.visible and resume_button.visible and not finished + return get_tree().paused and pause_menu.is_open() and not finished func _resume() -> void: player.input_lock = 0.15 player.buffer = 0 player.attack_time = 0 get_tree().paused = false - overlay.hide() + pause_menu.close() func _finish(won: bool) -> void: if finished: return finished = true @@ -285,10 +272,9 @@ func _finish(won: bool) -> void: player.set_physics_process(false) set_physics_process(false) get_tree().paused = true + pause_menu.close() overlay_title.text = "MERGE SUCCESSFUL!" if won else "BUILD FAILED" overlay_detail.text = "%06d POINTS / %02d:%02d\n%s" % [score, int(elapsed) / 60, int(elapsed) % 60, level_title + " complete." if won else "Fresh branch. Another try."] - resume_button.hide() - how_to_play_button.hide() if won: stage_clear.play() _reveal_results(0.35) diff --git a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd b/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd deleted file mode 100644 index a3466042..00000000 --- a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd +++ /dev/null @@ -1,153 +0,0 @@ -extends Control -const Style = preload("res://scenes/main_menu/menu_style.gd") -const Catalog = preload("res://modes/beatem_up/catalog.gd") -const Heroes = preload("res://modes/beatem_up/reinvent/catalog.gd") -const Art = preload("res://modes/beatem_up/art.gd") -const HeroArt = preload("res://modes/beatem_up/reinvent/art.gd") -const Prompts := preload("res://app/controller_prompts.gd") -var backdrop: TextureRect -var caption: Label -var description: Label -var clock := 0.0 -var preview_index := 0 -var selected_mode := 0 -var started := false -var local_music: AudioStreamPlayer -var fade: Tween -const TILE_MIN_HEIGHT := 240.0 - -func _ready() -> void: - Heroes.install_input() - theme=Style.theme() - backdrop=TextureRect.new() - backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - backdrop.expand_mode=TextureRect.EXPAND_IGNORE_SIZE - backdrop.stretch_mode=TextureRect.STRETCH_KEEP_ASPECT_COVERED - backdrop.mouse_filter=Control.MOUSE_FILTER_IGNORE - add_child(backdrop) - var shade := ColorRect.new() - shade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - shade.color=Color(.02,.025,.04,.78) - shade.mouse_filter=Control.MOUSE_FILTER_IGNORE - add_child(shade) - var margin := MarginContainer.new() - margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - for side in ["left","right","top","bottom"]: margin.add_theme_constant_override("margin_"+side,32) - add_child(margin) - var column := VBoxContainer.new() - column.add_theme_constant_override("separation",12) - margin.add_child(column) - column.add_child(Style.label("HOPPY'S ADVENTURE ARCADE",16,Color("ff9a43"))) - column.add_child(Style.label("BEAT'EM UP / MODE SELECT",38)) - description=Style.label("",17) - column.add_child(description) - var tiles := HBoxContainer.new() - tiles.add_theme_constant_override("separation",36) - tiles.size_flags_vertical=Control.SIZE_EXPAND_FILL - column.add_child(tiles) - var play := game_tile("Code City Brawl","res://Assets/beatemup-story/code_city/hoppy_clocks_in.png") - play.name="CodeCityButton" - tiles.add_child(play) - play.pressed.connect(func(): launch("code_city_brawl")) - play.mouse_entered.connect(func(): focus_mode(0)) - play.focus_entered.connect(func(): focus_mode(0)) - var heroes := game_tile("Heroes vs. Villains","res://Assets/beatemup-story/heroes/send_in_the_rabbit.png") - heroes.name="HeroesButton" - tiles.add_child(heroes) - heroes.pressed.connect(func(): launch("heroes_vs_villains")) - heroes.mouse_entered.connect(func(): focus_mode(1)) - heroes.focus_entered.connect(func(): focus_mode(1)) - # Room for the selected card's grow, so it never covers the buttons below. - var gap := Control.new() - gap.custom_minimum_size.y=12 - column.add_child(gap) - var row := HBoxContainer.new() - row.add_theme_constant_override("separation",16) - column.add_child(row) - var back := Style.button("Return to Main Menu",44) - back.custom_minimum_size.x=0 - row.add_child(back) - back.pressed.connect(func(): AppRouter.go("hub")) - var quit := Style.button("Quit Game",44) - quit.custom_minimum_size.x=0 - row.add_child(quit) - quit.pressed.connect(func(): AppRouter.quit_game()) - play.focus_neighbor_bottom=play.get_path_to(back) - heroes.focus_neighbor_bottom=heroes.get_path_to(back) - back.focus_neighbor_top=back.get_path_to(play) - quit.focus_neighbor_top=quit.get_path_to(heroes) - var controls := Style.label("",14) - Prompts.track(controls, func() -> String: - return "%s: move · %s: jump · %s: combo\n%s: pick up weapon · %s: pause\nHeroes: hold %s to charge REVIEW after unlocking it" % [ - Prompts.keys_or_pad("WASD", Prompts.if_pad("stick")), Prompts.either("Space", &"brawl_jump"), Prompts.either("J or X", &"brawl_attack"), - Prompts.either("E", &"brawl_pickup"), Prompts.either("Esc", &"pause"), Prompts.either("Q", &"review_burst")]) - column.add_child(controls) - caption=Style.label("",16,Color("ffb366")) - column.add_child(caption) - local_music=AudioStreamPlayer.new() - local_music.bus="Music";local_music.volume_db=-16 - add_child(local_music) - AudioService.music.stop() - focus_mode(0,true) - play.grab_focus() - -## A square game card: the mode's painting on top, its title underneath. -func game_tile(title: String, image: String) -> Button: - # Each card takes half the row and all the height the column leaves it. - var tile := Style.button("",TILE_MIN_HEIGHT) - tile.custom_minimum_size=Vector2(0,TILE_MIN_HEIGHT) - tile.size_flags_horizontal=Control.SIZE_EXPAND_FILL - tile.size_flags_vertical=Control.SIZE_EXPAND_FILL - tile.active_scale=1.025 - var card := VBoxContainer.new() - card.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - for side in ["left","top","right"]: card.set("offset_"+side,6 if side!="right" else -6) - card.offset_bottom=-4 - card.add_theme_constant_override("separation",6) - card.mouse_filter=Control.MOUSE_FILTER_IGNORE - tile.add_child(card) - var picture := TextureRect.new() - picture.texture=load(image) - picture.expand_mode=TextureRect.EXPAND_IGNORE_SIZE - picture.stretch_mode=TextureRect.STRETCH_KEEP_ASPECT_COVERED - picture.size_flags_vertical=Control.SIZE_EXPAND_FILL - picture.clip_contents=true - picture.mouse_filter=Control.MOUSE_FILTER_IGNORE - card.add_child(picture) - var name_label := Style.label(title,26) - name_label.horizontal_alignment=HORIZONTAL_ALIGNMENT_CENTER - name_label.mouse_filter=Control.MOUSE_FILTER_IGNORE - card.add_child(name_label) - return tile - -func launch(route: String) -> void: - if started: return - started=true - AppRouter.go(route) - -func focus_mode(mode: int, force := false) -> void: - if selected_mode==mode and not force: return - selected_mode=mode;clock=0;preview_index=0 - if fade: fade.kill() - backdrop.modulate.a=1 - _update_preview() - description.text="MODE 1 · THREE DISTRICTS. ONE FINAL MERGE." if mode==0 else "MODE 2 · FOUR VILLAINS. REVIEW. TRIAGE. UNDERSTAND. SECURE." - local_music.stream=Heroes.looped(Catalog.MUSIC[0] if mode==0 else Heroes.MUSIC[0]) - local_music.play() - -func _process(dt: float) -> void: - clock+=dt - if clock>=4: - clock=0;preview_index=(preview_index+1)%3 - if fade: fade.kill() - fade=create_tween() - fade.tween_property(backdrop,"modulate:a",0.0,.3) - fade.tween_callback(_update_preview) - fade.tween_property(backdrop,"modulate:a",1.0,.3) - -func _update_preview() -> void: - backdrop.texture=load(Art.BASE+Catalog.THEMES[preview_index]+"_background.png" if selected_mode==0 else HeroArt.BASE+Heroes.THEMES[preview_index]+".png") - caption.text="%02d / %s" % [preview_index+1,Catalog.TITLES[preview_index] if selected_mode==0 else Heroes.TITLES[preview_index]] - -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("ui_cancel"): AppRouter.go("hub") diff --git a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd.uid b/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd.uid deleted file mode 100644 index f616d775..00000000 --- a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://bmp05bi2gonqq diff --git a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.tscn b/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.tscn deleted file mode 100644 index d72d6579..00000000 --- a/hoppys-adventure-arcade/scenes/beatem_up/beatem_menu.tscn +++ /dev/null @@ -1,10 +0,0 @@ -[gd_scene load_steps=2 format=3] -[ext_resource type="Script" path="res://scenes/beatem_up/beatem_menu.gd" id="1"] -[node name="BeatemMenu" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1") diff --git a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd b/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd deleted file mode 100644 index f587a9e7..00000000 --- a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd +++ /dev/null @@ -1,75 +0,0 @@ -extends Control -const Style = preload("res://scenes/main_menu/menu_style.gd") -var column: VBoxContainer -func _ready() -> void: - theme = Style.theme() - var backdrop := TextureRect.new() - backdrop.texture = load("res://Assets/bay-area-blitz-assets-only/bay_area/backdrop.png") - backdrop.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - backdrop.expand_mode = TextureRect.EXPAND_IGNORE_SIZE - backdrop.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED - add_child(backdrop) - var shade := ColorRect.new() - shade.color = Color(0.025, 0.07, 0.12, 0.85) - shade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - add_child(shade) - var margin := MarginContainer.new() - margin.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - for side in ["left", "right", "top", "bottom"]: - margin.add_theme_constant_override("margin_" + side, 48) - add_child(margin) - column = VBoxContainer.new() - column.add_theme_constant_override("separation", 20) - margin.add_child(column) - _select() -func _clear() -> void: - for child in column.get_children(): - column.remove_child(child) - child.queue_free() -func _select() -> void: - _clear() - column.add_child(Style.label("HOPPY'S ADVENTURE ARCADE / 01 · PLATFORMER", 16, Style.MINT)) - column.add_child(Style.label("LEVEL SELECT", 42)) - var row := HBoxContainer.new() - row.add_theme_constant_override("separation", 22) - row.size_flags_vertical = Control.SIZE_EXPAND_FILL - column.add_child(row) - for i in 3: - var card := VBoxContainer.new() - card.size_flags_horizontal = Control.SIZE_EXPAND_FILL - card.add_theme_constant_override("separation", 15) - row.add_child(card) - var preview := TextureRect.new() - preview.texture = load(["res://Assets/bay-area-blitz-assets-only/bay-area-preview.png", "res://Assets/orbital-ops-assets-only/orbital_ops/starfield.png", "res://Assets/enchanted-repo-assets-only/enchanted_repo/sky.png"][i]) - preview.custom_minimum_size = Vector2(0, 210) - preview.expand_mode = TextureRect.EXPAND_IGNORE_SIZE - preview.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED - preview.modulate = Color.WHITE - card.add_child(preview) - if i in [1, 2]: - var station := TextureRect.new() - station.texture = load("res://Assets/orbital-ops-assets-only/orbital_ops/station_hull.png" if i == 1 else "res://Assets/enchanted-repo-assets-only/enchanted_repo/treeline.png") - station.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - station.expand_mode = TextureRect.EXPAND_IGNORE_SIZE - station.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED - station.mouse_filter = Control.MOUSE_FILTER_IGNORE - preview.add_child(station) - card.add_child(Style.label(["BAY AREA BLITZ", "ORBITAL OPS", "ENCHANTED REPO"][i], 21)) - card.add_child(Style.label(["Cable cars. Code critters. Chaos.", "Zero gravity. Broken legacy routines.", "Ancient armor. Unstable branches."][i], 13)) - var play := Button.new() - play.text = ["PLAY BAY AREA BLITZ →", "PLAY ORBITAL OPS →", "PLAY ENCHANTED REPO →"][i] - play.custom_minimum_size.y = 58 - card.add_child(play) - if i == 0: - play.pressed.connect(func(): AppRouter.go("bay_area_blitz")) - play.grab_focus() - elif i == 1: - play.pressed.connect(func(): AppRouter.go("orbital_ops")) - else: - play.pressed.connect(func(): AppRouter.go("enchanted_repo")) - var back := Style.button("← Main Menu") - column.add_child(back) - back.pressed.connect(func(): AppRouter.go("hub")) -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("ui_cancel"): - AppRouter.go("hub") diff --git a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd.uid b/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd.uid deleted file mode 100644 index 7f9b9c83..00000000 --- a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://dhb04g7tx74ft diff --git a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.tscn b/hoppys-adventure-arcade/scenes/platformer/platformer_menu.tscn deleted file mode 100644 index bb679b5d..00000000 --- a/hoppys-adventure-arcade/scenes/platformer/platformer_menu.tscn +++ /dev/null @@ -1,10 +0,0 @@ -[gd_scene load_steps=2 format=3] -[ext_resource type="Script" path="res://scenes/platformer/platformer_menu.gd" id="1"] -[node name="ModePortal" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1") diff --git a/hoppys-adventure-arcade/scenes/runner/audio/runner_audio.gd b/hoppys-adventure-arcade/scenes/runner/audio/runner_audio.gd index 9cd3d4e8..74b78cd9 100644 --- a/hoppys-adventure-arcade/scenes/runner/audio/runner_audio.gd +++ b/hoppys-adventure-arcade/scenes/runner/audio/runner_audio.gd @@ -77,7 +77,7 @@ func bind(game: Node) -> void: # Shared warmup also covers the cinematic cues and every panned whoosh variant. bind() runs inside the # game's _ready (veil opaque, before the first frame), so whatever the menu did not absorb is # completed here rather than one package per frame during play; then every runtime shader is - # drawn once. Both are no-ops after the runner menu or an earlier run. + # drawn once. Both are no-ops after an earlier run. Prewarm.warm() Prewarm.finish() GpuWarmup.run(game) diff --git a/hoppys-adventure-arcade/scenes/runner/environment/dev/capture_previews.gd b/hoppys-adventure-arcade/scenes/runner/environment/dev/capture_previews.gd index ad7d9996..4ee51512 100644 --- a/hoppys-adventure-arcade/scenes/runner/environment/dev/capture_previews.gd +++ b/hoppys-adventure-arcade/scenes/runner/environment/dev/capture_previews.gd @@ -12,11 +12,11 @@ func run() -> void: quit(1) return root.size = Vector2i(1280, 720) - for fixture in ["renderer_spike", "corridor_preview", "hoppy_preview", "hazard_gallery", "runner_menu"]: + for fixture in ["renderer_spike", "corridor_preview", "hoppy_preview", "hazard_gallery"]: var directory := "player" if fixture == "hoppy_preview" else "environment" if fixture == "hazard_gallery": directory = "hazards/visuals" - var path := "res://scenes/runner/runner_menu.tscn" if fixture == "runner_menu" else "res://scenes/runner/%s/dev/%s.tscn" % [directory, fixture] + var path := "res://scenes/runner/%s/dev/%s.tscn" % [directory, fixture] var scene := load(path) as PackedScene if scene == null: push_error("PREVIEW CAPTURE: fixture failed to load: " + fixture) @@ -26,7 +26,7 @@ func run() -> void: root.add_child(instance) await create_timer(1.5 if fixture == "hoppy_preview" else 1.0).timeout await RenderingServer.frame_post_draw - var suffix: String = {"renderer_spike": "spike", "corridor_preview": "corridor", "hoppy_preview": "hoppy", "hazard_gallery": "gallery", "runner_menu": "menu"}[fixture] + var suffix: String = {"renderer_spike": "spike", "corridor_preview": "corridor", "hoppy_preview": "hoppy", "hazard_gallery": "gallery"}[fixture] var output := ProjectSettings.globalize_path("res://../docs/previews/endless-runner-%s.png" % suffix) var error := root.get_texture().get_image().save_png(output) if error != OK: diff --git a/hoppys-adventure-arcade/scenes/runner/runner_game.gd b/hoppys-adventure-arcade/scenes/runner/runner_game.gd index f9f20b46..0284e968 100644 --- a/hoppys-adventure-arcade/scenes/runner/runner_game.gd +++ b/hoppys-adventure-arcade/scenes/runner/runner_game.gd @@ -422,13 +422,14 @@ func retry_boss() -> void: pending_boss_checkpoint = boss_checkpoint.duplicate(true) _take_route("runner_game") +## Main Menu: back to the hub, with nothing pending for the next run. func go_to_menu() -> void: if _route_in_flight(): return resume() pending_boss_checkpoint = {} pending_intro_mode = &"full" - _take_route("runner") + _take_route("hub") ## The first route asked for wins. AppRouter ignores a go() while its veil is fading, but Game Over ## keeps focus through that fade, so a second press (Esc after Retry Boss, say) must not rewrite diff --git a/hoppys-adventure-arcade/scenes/runner/runner_menu.gd b/hoppys-adventure-arcade/scenes/runner/runner_menu.gd deleted file mode 100644 index f738f6ea..00000000 --- a/hoppys-adventure-arcade/scenes/runner/runner_menu.gd +++ /dev/null @@ -1,365 +0,0 @@ -extends Node3D -## Scene-local entry point. Gameplay and persistence remain backend-owned. -const Palette = preload("res://scenes/runner/environment/runner_palette.gd") -const Style = preload("res://scenes/runner/ui/hud_style.gd") -const Leaderboard = preload("res://scenes/runner/systems/runner_leaderboard.gd") -const GpuWarmup = preload("res://scenes/runner/warmup/gpu_warmup.gd") -const Music = preload("res://Assets/Backgrounds/cyberpunk-street-files/Assets/music/cyberpunk-street.ogg") -const Prompts := preload("res://app/controller_prompts.gd") - -var leaderboard_path := Leaderboard.DEFAULT_PATH -var leaderboard_path_at_open := Leaderboard.DEFAULT_PATH -var buttons: Array[Button] = [] -var ui: Control -var shade: TextureRect -var modal: Control -var board: VBoxContainer -var elapsed := 0.0 -var title_label: Label -var reset_btn: Button -var close_btn: Button -var reset_confirm: Control -var confirm_status: Label -@onready var audio_service: Node = get_node("/root/AudioService") -@onready var router: Node = get_node("/root/AppRouter") -@onready var camera: Camera3D = $Backdrop/Camera - -func _ready() -> void: - process_mode = Node.PROCESS_MODE_PAUSABLE - physics_interpolation_mode = Node.PHYSICS_INTERPOLATION_MODE_OFF - $Backdrop/Corridor.set_scroll_speed(3.5) - $Backdrop/Hoppy.set_anim_state(&"run") - $Backdrop/Hoppy.set_run_speed(0.25) - camera.look_at(Vector3(0, 1.0, -2)) - if audio_service.has_method("play_music"): - audio_service.play_music(Music, -12.0) - ui = Control.new() - ui.theme = Style.theme() - ui.mouse_filter = Control.MOUSE_FILTER_IGNORE - $Interface.add_child(ui) - shade = TextureRect.new() - var gradient := Gradient.new() - gradient.set_color(0, Color(0.025, 0.045, 0.08, 0.97)) - gradient.set_color(1, Color(0.025, 0.045, 0.08, 0.12)) - var texture := GradientTexture2D.new() - texture.gradient = gradient - texture.fill_to = Vector2(1, 0.1) - shade.texture = texture - shade.mouse_filter = Control.MOUSE_FILTER_IGNORE - ui.add_child(shade) - _label("C O D E R A B B I T / E N D L E S S R U N N E R", 14, Vector2(76, 39), Style.MINT) - _label("THE CODEBASE\nCORRIDOR", 60, Vector2(72, 96)) - _label("Outrun the unreviewed backlog.", 17, Vector2(77, 260)) - var column := VBoxContainer.new() - column.position = Vector2(76, 310) - column.add_theme_constant_override("separation", 12) - ui.add_child(column) - for text in ["01 Play", "02 Leaderboard", "03 Return to Main Menu", "04 Quit Game"]: - var button := Style.button(text) - column.add_child(button) - buttons.append(button) - button.focus_entered.connect(_focus_sound) - button.mouse_entered.connect(_focus_sound) - buttons[0].pressed.connect(_route.bind("runner_game")) - buttons[1].pressed.connect(_toggle_leaderboard) - buttons[2].pressed.connect(_route.bind("hub")) - buttons[3].pressed.connect(_quit) - for i in buttons.size(): - buttons[i].focus_neighbor_top = buttons[i].get_path_to(buttons[(i - 1 + buttons.size()) % buttons.size()]) - buttons[i].focus_neighbor_bottom = buttons[i].get_path_to(buttons[(i + 1) % buttons.size()]) - buttons[i].focus_previous = buttons[i].focus_neighbor_top - buttons[i].focus_next = buttons[i].focus_neighbor_bottom - var card := PanelContainer.new() - card.position = Vector2(714, 384) - card.custom_minimum_size = Vector2(490, 210) - card.add_theme_stylebox_override("panel", _panel_style()) - Style.polish(card, true) - ui.add_child(card) - var controls := VBoxContainer.new() - controls.add_theme_constant_override("separation", 8) - card.add_child(controls) - controls.add_child(Style.label("KEEP THE BUILD MOVING", 26, Style.MINT)) - var keys := Style.label("", 22) - Prompts.track(keys, func() -> String: - return "A / D · ← → Change lane\nW / SPACE / ↑ Jump\nS / CTRL / ↓ Roll\n%s Pause" % Prompts.either("ESC", &"pause", true)) - controls.add_child(keys) - controls.add_child(Style.teaching_legend(true)) - controls.add_child(Style.label("Two hits without recovery\nand the backlog catches you.", 18)) - Prompts.track(_label("", 12, Vector2(76, 670), Color("9baebc")), func() -> String: - return "%s SELECT %s CONFIRM %s BACK" % [ - Prompts.keys_or_pad("↑ ↓", Prompts.if_pad("D-PAD")), - Prompts.either("ENTER", &"ui_accept", true), - Prompts.either("ESC", &"ui_cancel", true)]) - buttons[0].grab_focus() - _process(0.0) - # Compile every gameplay shader now, behind the opaque route veil, instead of on first sight. - GpuWarmup.run(self, camera) - -func _label(text: String, size: int, position_2d: Vector2, color: Color = Style.CREAM) -> Label: - var label := Style.label(text, size, color) - var backing := PanelContainer.new() - backing.position = position_2d - Vector2(14, 8) - backing.add_theme_stylebox_override("panel", Style.panel(Style.MINT if size == 60 else Palette.SLATE, 0.88)) - Style.polish(backing, size == 60) - ui.add_child(backing) - backing.add_child(label) - if size == 60: title_label = label - return label - -func _panel_style() -> StyleBoxFlat: - var box := Style.panel(Style.MINT, 0.96) - box.content_margin_left = 24 - box.content_margin_right = 24 - box.content_margin_top = 20 - box.content_margin_bottom = 20 - return box - -func _process(delta: float) -> void: - elapsed += delta - if title_label != null: - title_label.add_theme_color_override("font_color", Style.CREAM.lerp(Style.MINT, 0.08 + 0.06 * sin(elapsed * 1.4))) - camera.position = Vector3(2.6 + sin(elapsed * 0.18) * 0.12, 1.9 + sin(elapsed * 0.23) * 0.04, 3.4) - camera.look_at(Vector3(0, 1.0, -2)) - var viewport_size := get_viewport().get_visible_rect().size - var fit := minf(1.0, minf(viewport_size.x / 1280.0, viewport_size.y / 720.0)) - ui.scale = Vector2.ONE * fit - ui.size = Vector2(1280, 720) - ui.position = (viewport_size - ui.size * fit) * 0.5 - shade.position = -ui.position / fit - shade.size = viewport_size / fit - if modal: - modal.get_child(0).position = shade.position - modal.get_child(0).size = shade.size - -func _focus_sound() -> void: - if not router.busy: - audio_service.play_ui(0) - -func _route(route: String) -> void: - if modal or router.busy: - return - audio_service.play_ui(1) - router.go(route) - -func _quit() -> void: - if modal or router.busy: - return - audio_service.play_ui(1) - router.quit_game() - -func _build_board_rows(entries: Array[Dictionary]) -> void: - for child in board.get_children(): - child.queue_free() - for i in 10: - var text := "%02d --- --- ---" % (i + 1) - if i < entries.size(): - var entry: Dictionary = entries[i] - var seconds := maxi(0, int(entry.duration)) - text = "%02d %-16s %8d %02d:%02d" % [i + 1, entry.name, entry.score, seconds / 60, seconds % 60] - var row := HBoxContainer.new() - row.add_child(rank_marker(i, i < entries.size())) - row.add_child(Style.label(text, 18)) - board.add_child(row) - -func _toggle_leaderboard() -> void: - if router.busy: - return - if modal: - _close_leaderboard() - return - audio_service.play_ui(1) - for button in buttons: - if button == buttons[1]: - continue - button.focus_mode = Control.FOCUS_NONE - button.disabled = true - modal = Control.new() - modal.name = "Leaderboard" - modal.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - ui.add_child(modal) - var dim := ColorRect.new() - dim.color = Color(0.01, 0.02, 0.04, 0.9) - modal.add_child(dim) - var panel := PanelContainer.new() - panel.position = Vector2(280, 70) - panel.custom_minimum_size = Vector2(720, 0) - panel.add_theme_stylebox_override("panel", _panel_style()) - Style.polish(panel, true) - modal.add_child(panel) - var column := VBoxContainer.new() - column.add_theme_constant_override("separation", 14) - panel.add_child(column) - column.add_child(Style.label("LOCAL LEADERBOARD", 28)) - column.add_child(Style.label("RANK NAME SCORE TIME", 18, Style.MINT)) - board = VBoxContainer.new() - board.add_theme_constant_override("separation", 8) - column.add_child(board) - leaderboard_path_at_open = leaderboard_path - var entries := Leaderboard.load_entries(leaderboard_path_at_open) - _build_board_rows(entries) - var button_row := HBoxContainer.new() - button_row.add_theme_constant_override("separation", 12) - column.add_child(button_row) - reset_btn = Style.button("Reset scores", 46) - reset_btn.name = "ResetScoresButton" - reset_btn.disabled = entries.is_empty() - reset_btn.focus_entered.connect(_focus_sound) - reset_btn.mouse_entered.connect(_focus_sound) - reset_btn.pressed.connect(_open_reset_confirm) - button_row.add_child(reset_btn) - close_btn = Style.button("Close", 46) - close_btn.name = "CloseButton" - close_btn.focus_entered.connect(_focus_sound) - close_btn.mouse_entered.connect(_focus_sound) - close_btn.pressed.connect(_close_leaderboard) - button_row.add_child(close_btn) - # Wrap focus between Reset and Close. - reset_btn.focus_neighbor_right = reset_btn.get_path_to(close_btn) - reset_btn.focus_next = reset_btn.get_path_to(close_btn) - reset_btn.focus_neighbor_left = reset_btn.get_path_to(close_btn) - reset_btn.focus_previous = reset_btn.get_path_to(close_btn) - reset_btn.focus_neighbor_top = reset_btn.get_path_to(close_btn) - reset_btn.focus_neighbor_bottom = reset_btn.get_path_to(close_btn) - close_btn.focus_neighbor_left = close_btn.get_path_to(reset_btn) - close_btn.focus_previous = close_btn.get_path_to(reset_btn) - close_btn.focus_neighbor_right = close_btn.get_path_to(reset_btn) - close_btn.focus_next = close_btn.get_path_to(reset_btn) - close_btn.focus_neighbor_top = close_btn.get_path_to(reset_btn) - close_btn.focus_neighbor_bottom = close_btn.get_path_to(reset_btn) - close_btn.grab_focus() - _process(0.0) - -func _close_leaderboard() -> void: - if not modal or router.busy: - return - modal.queue_free() - modal = null - board = null - reset_btn = null - close_btn = null - reset_confirm = null - confirm_status = null - for button in buttons: - button.disabled = false - button.focus_mode = Control.FOCUS_ALL - buttons[1].grab_focus() - audio_service.play_ui(1) - -func _open_reset_confirm() -> void: - if reset_confirm or router.busy: - return - audio_service.play_ui(1) - reset_btn.disabled = true - close_btn.disabled = true - reset_confirm = Control.new() - reset_confirm.name = "ResetConfirm" - reset_confirm.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - modal.add_child(reset_confirm) - var dim := ColorRect.new() - dim.color = Color(0.01, 0.02, 0.04, 0.9) - dim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - reset_confirm.add_child(dim) - var panel := PanelContainer.new() - panel.position = Vector2(330, 170) - panel.custom_minimum_size = Vector2(620, 0) - panel.add_theme_stylebox_override("panel", _panel_style()) - Style.polish(panel, true) - reset_confirm.add_child(panel) - var column := VBoxContainer.new() - column.add_theme_constant_override("separation", 16) - panel.add_child(column) - column.add_child(Style.label("RESET ALL SCORES?", 28)) - column.add_child(Style.label("This deletes the top ten and cannot be undone.", 18)) - var keep := Style.button("Keep scores", 46) - keep.name = "KeepScoresButton" - keep.focus_entered.connect(_focus_sound) - keep.mouse_entered.connect(_focus_sound) - keep.pressed.connect(_close_reset_confirm) - column.add_child(keep) - var do_reset := Style.button("Reset", 46) - do_reset.name = "ResetConfirmButton" - do_reset.focus_entered.connect(_focus_sound) - do_reset.mouse_entered.connect(_focus_sound) - do_reset.pressed.connect(_confirm_reset) - column.add_child(do_reset) - confirm_status = Style.label("", 16, Color("ff7185")) - confirm_status.name = "StatusLabel" - confirm_status.visible = false - column.add_child(confirm_status) - # Focus wraps between Keep and Reset in all directions. - keep.focus_neighbor_bottom = keep.get_path_to(do_reset) - keep.focus_next = keep.get_path_to(do_reset) - keep.focus_neighbor_top = keep.get_path_to(do_reset) - keep.focus_previous = keep.get_path_to(do_reset) - keep.focus_neighbor_left = keep.get_path_to(do_reset) - keep.focus_neighbor_right = keep.get_path_to(do_reset) - do_reset.focus_neighbor_top = do_reset.get_path_to(keep) - do_reset.focus_previous = do_reset.get_path_to(keep) - do_reset.focus_neighbor_bottom = do_reset.get_path_to(keep) - do_reset.focus_next = do_reset.get_path_to(keep) - do_reset.focus_neighbor_left = do_reset.get_path_to(keep) - do_reset.focus_neighbor_right = do_reset.get_path_to(keep) - keep.grab_focus() - _process(0.0) - -func _close_reset_confirm() -> void: - if not reset_confirm: - return - reset_confirm.queue_free() - reset_confirm = null - confirm_status = null - if is_instance_valid(reset_btn): - reset_btn.disabled = false - if is_instance_valid(close_btn): - close_btn.disabled = false - if is_instance_valid(reset_btn): - reset_btn.grab_focus() - audio_service.play_ui(1) - -func _confirm_reset() -> void: - if router.busy: - return - var error := Leaderboard.clear(leaderboard_path_at_open) - if error == OK: - reset_confirm.queue_free() - reset_confirm = null - confirm_status = null - var entries := Leaderboard.load_entries(leaderboard_path_at_open) - _build_board_rows(entries) - if is_instance_valid(reset_btn): - reset_btn.disabled = true - if is_instance_valid(close_btn): - close_btn.disabled = false - close_btn.grab_focus() - audio_service.play_ui(1) - else: - # clear() may have written an empty primary before the .bak/.tmp removal - # failed — reload the rows so the displayed board matches actual disk state. - var entries_after := Leaderboard.load_entries(leaderboard_path_at_open) - _build_board_rows(entries_after) - if is_instance_valid(reset_btn): - reset_btn.disabled = entries_after.is_empty() - if confirm_status != null: - confirm_status.text = "Could not reset scores." - confirm_status.visible = true - var keep_btn := reset_confirm.find_child("KeepScoresButton", true, false) as Button - if keep_btn != null: - keep_btn.grab_focus() - -func _unhandled_input(event: InputEvent) -> void: - if event.is_action_pressed("ui_cancel") and not router.busy: - if reset_confirm: - _close_reset_confirm() - elif modal: - _close_leaderboard() - else: - _route("hub") - get_viewport().set_input_as_handled() - -static func rank_marker(index: int, occupied: bool) -> Control: - if occupied and index < 3: - return Style.icon(&"medal", [Palette.CREAM.lerp(Palette.ORANGE, 0.35), Palette.SLATE.lerp(Palette.CREAM, 0.65), Palette.ORANGE.lerp(Palette.NAVY_2, 0.3)][index], Vector2(24,24)) - var spacer := Control.new() - spacer.custom_minimum_size = Vector2(24,24) - spacer.mouse_filter = Control.MOUSE_FILTER_IGNORE - return spacer diff --git a/hoppys-adventure-arcade/scenes/runner/runner_menu.gd.uid b/hoppys-adventure-arcade/scenes/runner/runner_menu.gd.uid deleted file mode 100644 index 666083f9..00000000 --- a/hoppys-adventure-arcade/scenes/runner/runner_menu.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://ci65vndk6pamy diff --git a/hoppys-adventure-arcade/scenes/runner/runner_menu.tscn b/hoppys-adventure-arcade/scenes/runner/runner_menu.tscn deleted file mode 100644 index 6fbfd563..00000000 --- a/hoppys-adventure-arcade/scenes/runner/runner_menu.tscn +++ /dev/null @@ -1,24 +0,0 @@ -[gd_scene load_steps=4 format=3] - -[ext_resource type="Script" path="res://scenes/runner/runner_menu.gd" id="1"] -[ext_resource type="PackedScene" path="res://scenes/runner/environment/corridor.tscn" id="2"] -[ext_resource type="PackedScene" path="res://scenes/runner/player/hoppy_runner_visual.tscn" id="3"] - -[node name="RunnerMenu" type="Node3D"] -script = ExtResource("1") - -[node name="Backdrop" type="Node3D" parent="."] - -[node name="Corridor" parent="Backdrop" instance=ExtResource("2")] - -[node name="Hoppy" parent="Backdrop" instance=ExtResource("3")] -position = Vector3(0.7, 0, -0.3) - -[node name="Camera" type="Camera3D" parent="Backdrop"] -position = Vector3(2.6, 1.9, 3.4) -current = true -fov = 55.0 -near = 0.15 -far = 200.0 - -[node name="Interface" type="CanvasLayer" parent="."] diff --git a/hoppys-adventure-arcade/scenes/runner/systems/debug_overlay.gd b/hoppys-adventure-arcade/scenes/runner/systems/debug_overlay.gd index 82aaea93..db82b769 100644 --- a/hoppys-adventure-arcade/scenes/runner/systems/debug_overlay.gd +++ b/hoppys-adventure-arcade/scenes/runner/systems/debug_overlay.gd @@ -1,6 +1,6 @@ extends CanvasLayer ## F3 debug readout plus the developer shortcuts (systems spec §2). -## F3 toggle, F5 retry, F6 runner menu, F7 autopilot, F8 random power-up. +## F3 toggle, F5 retry, F6 main menu, F7 autopilot, F8 random power-up. ## Every shortcut that changes the run — F5, F6, F7, F8 — is gated on OS.is_debug_build() and does ## nothing at all in an exported build, so a player cannot restart or leave a run by pressing a ## function key. F3 is a read-only readout toggle and stays available everywhere. diff --git a/hoppys-adventure-arcade/scenes/runner/systems/runner_leaderboard.gd b/hoppys-adventure-arcade/scenes/runner/systems/runner_leaderboard.gd index 5d2db79d..b7d3abfe 100644 --- a/hoppys-adventure-arcade/scenes/runner/systems/runner_leaderboard.gd +++ b/hoppys-adventure-arcade/scenes/runner/systems/runner_leaderboard.gd @@ -1,5 +1,5 @@ extends RefCounted -## Local top-10 persistence for the Endless Runner (systems spec §7). Static only: the runner menu +## Local top-10 persistence for the Endless Runner (systems spec §7). Static only: the leaderboard panel ## reads the board without a game instance. const DEFAULT_PATH := "user://leaderboard.cfg" diff --git a/hoppys-adventure-arcade/scenes/runner/ui/dev/capture_a7.gd b/hoppys-adventure-arcade/scenes/runner/ui/dev/capture_a7.gd index 7454f25d..5e18b46f 100644 --- a/hoppys-adventure-arcade/scenes/runner/ui/dev/capture_a7.gd +++ b/hoppys-adventure-arcade/scenes/runner/ui/dev/capture_a7.gd @@ -103,15 +103,11 @@ func run() -> void: fixture.state = &"running" fixture.pause() if not await shot("pause"): return - fixture.free() - fixture = null - await process_frame - menu = load("res://scenes/runner/runner_menu.tscn").instantiate() as Node - root.add_child(menu) - await create_timer(0.3).timeout - if not await shot("menu"): return - menu._toggle_leaderboard() - if not await shot("leaderboard"): return + var pause_menu := fixture.get_node_or_null("Overlays/PauseMenu") + if pause_menu != null and pause_menu.has_method("_open_leaderboard"): + pause_menu._open_leaderboard() + await create_timer(0.3).timeout + if not await shot("leaderboard"): return await shutdown(0) func shutdown(code: int) -> void: diff --git a/hoppys-adventure-arcade/scenes/runner/ui/game_over.gd b/hoppys-adventure-arcade/scenes/runner/ui/game_over.gd index 6bb1c5be..6258369b 100644 --- a/hoppys-adventure-arcade/scenes/runner/ui/game_over.gd +++ b/hoppys-adventure-arcade/scenes/runner/ui/game_over.gd @@ -87,7 +87,7 @@ func _ready() -> void: retry_boss_button = Style.button("Retry Boss") retry_boss_button.name = "RetryBoss" retry_button = Style.button("Retry") - menu_button = Style.button("Runner Menu") + menu_button = Style.button("Main Menu") for button in [retry_boss_button, retry_button, menu_button]: button.custom_minimum_size.x = 280 actions.add_child(button) diff --git a/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd b/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd new file mode 100644 index 00000000..6640db08 --- /dev/null +++ b/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd @@ -0,0 +1,227 @@ +extends Control +## The Endless Runner's local top ten with its Reset scores flow, opened from the runner's pause +## menu. It processes while the run is paused (its parent is the always-processing pause menu). +## `ui_cancel` or `pause` closes the confirmation first, then the panel, and never reaches the run. +## Reset asks twice; a failed reset reloads the rows from disk and reports it. + +signal closed + +const Style = preload("res://scenes/runner/ui/hud_style.gd") +const Palette = preload("res://scenes/runner/environment/runner_palette.gd") +const Leaderboard = preload("res://scenes/runner/systems/runner_leaderboard.gd") + +var leaderboard_path := Leaderboard.DEFAULT_PATH +## The path the open board read, so Reset clears what the player is looking at. +var leaderboard_path_at_open := Leaderboard.DEFAULT_PATH +var board: VBoxContainer +var reset_btn: Button +var close_btn: Button +var reset_confirm: Control +var confirm_status: Label +@onready var audio_service: Node = get_node("/root/AudioService") +@onready var router: Node = get_node("/root/AppRouter") + +func _init() -> void: + name = "Leaderboard" + set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + mouse_filter = Control.MOUSE_FILTER_STOP + +func _ready() -> void: + theme = Style.theme() + var dim := ColorRect.new() + dim.color = Color(0.01, 0.02, 0.04, 0.9) + dim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + dim.mouse_filter = Control.MOUSE_FILTER_IGNORE + add_child(dim) + var center := CenterContainer.new() + center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + center.mouse_filter = Control.MOUSE_FILTER_IGNORE + add_child(center) + var panel := PanelContainer.new() + panel.custom_minimum_size = Vector2(720, 0) + panel.add_theme_stylebox_override("panel", _panel_style()) + Style.polish(panel, true) + center.add_child(panel) + var column := VBoxContainer.new() + column.add_theme_constant_override("separation", 14) + panel.add_child(column) + column.add_child(Style.label("LOCAL LEADERBOARD", 28)) + column.add_child(Style.label("RANK NAME SCORE TIME", 18, Style.MINT)) + board = VBoxContainer.new() + board.add_theme_constant_override("separation", 8) + column.add_child(board) + leaderboard_path_at_open = leaderboard_path + var entries := Leaderboard.load_entries(leaderboard_path_at_open) + _build_board_rows(entries) + var button_row := HBoxContainer.new() + button_row.add_theme_constant_override("separation", 12) + column.add_child(button_row) + reset_btn = Style.button("Reset scores", 46) + reset_btn.name = "ResetScoresButton" + reset_btn.disabled = entries.is_empty() + reset_btn.focus_entered.connect(_focus_sound) + reset_btn.mouse_entered.connect(_focus_sound) + reset_btn.pressed.connect(_open_reset_confirm) + button_row.add_child(reset_btn) + close_btn = Style.button("Close", 46) + close_btn.name = "CloseButton" + close_btn.focus_entered.connect(_focus_sound) + close_btn.mouse_entered.connect(_focus_sound) + close_btn.pressed.connect(close) + button_row.add_child(close_btn) + _wrap_pair(reset_btn, close_btn) + close_btn.grab_focus() + +func _panel_style() -> StyleBoxFlat: + var box := Style.panel(Style.MINT, 0.96) + box.content_margin_left = 24 + box.content_margin_right = 24 + box.content_margin_top = 20 + box.content_margin_bottom = 20 + return box + +## Focus wraps between two buttons in every direction. +static func _wrap_pair(a: Button, b: Button) -> void: + for pair in [[a, b], [b, a]]: + var from: Button = pair[0] + var to: NodePath = from.get_path_to(pair[1]) + from.focus_neighbor_left = to + from.focus_neighbor_right = to + from.focus_neighbor_top = to + from.focus_neighbor_bottom = to + from.focus_next = to + from.focus_previous = to + +func _focus_sound() -> void: + if not router.busy: + audio_service.play_ui(0) + +func _build_board_rows(entries: Array[Dictionary]) -> void: + for child in board.get_children(): + child.queue_free() + for i in 10: + var text := "%02d --- --- ---" % (i + 1) + if i < entries.size(): + var entry: Dictionary = entries[i] + var seconds := maxi(0, int(entry.duration)) + text = "%02d %-16s %8d %02d:%02d" % [i + 1, entry.name, entry.score, seconds / 60, seconds % 60] + var row := HBoxContainer.new() + row.add_child(rank_marker(i, i < entries.size())) + row.add_child(Style.label(text, 18)) + board.add_child(row) + +func close() -> void: + if router.busy: + return + audio_service.play_ui(1) + closed.emit() + queue_free() + +func _open_reset_confirm() -> void: + if reset_confirm or router.busy: + return + audio_service.play_ui(1) + reset_btn.disabled = true + close_btn.disabled = true + reset_confirm = Control.new() + reset_confirm.name = "ResetConfirm" + reset_confirm.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + add_child(reset_confirm) + var dim := ColorRect.new() + dim.color = Color(0.01, 0.02, 0.04, 0.9) + dim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + reset_confirm.add_child(dim) + var center := CenterContainer.new() + center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) + center.mouse_filter = Control.MOUSE_FILTER_IGNORE + reset_confirm.add_child(center) + var panel := PanelContainer.new() + panel.custom_minimum_size = Vector2(620, 0) + panel.add_theme_stylebox_override("panel", _panel_style()) + Style.polish(panel, true) + center.add_child(panel) + var column := VBoxContainer.new() + column.add_theme_constant_override("separation", 16) + panel.add_child(column) + column.add_child(Style.label("RESET ALL SCORES?", 28)) + column.add_child(Style.label("This deletes the top ten and cannot be undone.", 18)) + var keep := Style.button("Keep scores", 46) + keep.name = "KeepScoresButton" + keep.focus_entered.connect(_focus_sound) + keep.mouse_entered.connect(_focus_sound) + keep.pressed.connect(_close_reset_confirm) + column.add_child(keep) + var do_reset := Style.button("Reset", 46) + do_reset.name = "ResetConfirmButton" + do_reset.focus_entered.connect(_focus_sound) + do_reset.mouse_entered.connect(_focus_sound) + do_reset.pressed.connect(_confirm_reset) + column.add_child(do_reset) + confirm_status = Style.label("", 16, Color("ff7185")) + confirm_status.name = "StatusLabel" + confirm_status.visible = false + column.add_child(confirm_status) + _wrap_pair(keep, do_reset) + keep.grab_focus() + +func _close_reset_confirm() -> void: + if not reset_confirm: + return + reset_confirm.queue_free() + reset_confirm = null + confirm_status = null + if is_instance_valid(reset_btn): + reset_btn.disabled = false + reset_btn.grab_focus() + if is_instance_valid(close_btn): + close_btn.disabled = false + audio_service.play_ui(1) + +func _confirm_reset() -> void: + if router.busy: + return + var error := Leaderboard.clear(leaderboard_path_at_open) + if error == OK: + reset_confirm.queue_free() + reset_confirm = null + confirm_status = null + _build_board_rows(Leaderboard.load_entries(leaderboard_path_at_open)) + if is_instance_valid(reset_btn): + reset_btn.disabled = true + if is_instance_valid(close_btn): + close_btn.disabled = false + close_btn.grab_focus() + audio_service.play_ui(1) + else: + # clear() may have written an empty primary before the .bak/.tmp removal failed: reload + # the rows so the board matches what is on disk. + var entries_after := Leaderboard.load_entries(leaderboard_path_at_open) + _build_board_rows(entries_after) + if is_instance_valid(reset_btn): + reset_btn.disabled = entries_after.is_empty() + if confirm_status != null: + confirm_status.text = "Could not reset scores." + confirm_status.visible = true + var keep_btn := reset_confirm.find_child("KeepScoresButton", true, false) as Button + if keep_btn != null: + keep_btn.grab_focus() + +## Back (Esc, B) or Start closes the confirmation first, then the board. Handled in _input so the +## press never also reaches the runner's pause toggle. +func _input(event: InputEvent) -> void: + if not visible or router.busy: + return + if event.is_action_pressed("ui_cancel") or event.is_action_pressed("pause"): + if reset_confirm: + _close_reset_confirm() + else: + close() + get_viewport().set_input_as_handled() + +static func rank_marker(index: int, occupied: bool) -> Control: + if occupied and index < 3: + return Style.icon(&"medal", [Palette.CREAM.lerp(Palette.ORANGE, 0.35), Palette.SLATE.lerp(Palette.CREAM, 0.65), Palette.ORANGE.lerp(Palette.NAVY_2, 0.3)][index], Vector2(24, 24)) + var spacer := Control.new() + spacer.custom_minimum_size = Vector2(24, 24) + spacer.mouse_filter = Control.MOUSE_FILTER_IGNORE + return spacer diff --git a/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd.uid b/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd.uid new file mode 100644 index 00000000..4d9526a6 --- /dev/null +++ b/hoppys-adventure-arcade/scenes/runner/ui/leaderboard_panel.gd.uid @@ -0,0 +1 @@ +uid://c3nb0467pn5w6 diff --git a/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.gd b/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.gd index 9cd5c9c6..9b8c811d 100644 --- a/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.gd +++ b/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.gd @@ -1,81 +1,60 @@ -extends CanvasLayer -## Pause display only. The facade owns pause state and input. -## It deliberately does NOT bind ui_cancel: RunnerGame owns the `pause` action. +extends "res://app/pause_menu.gd" +## The runner's pause menu: the shared menu (app/pause_menu.gd) plus a Leaderboard button that +## opens the local top ten with its Reset scores flow over the paused run. Display only: the facade +## owns pause state and input, and this menu binds neither `pause` nor `ui_cancel`. -const Style = preload("res://scenes/runner/ui/hud_style.gd") -const Prompts := preload("res://app/controller_prompts.gd") -const HowToPlay := preload("res://app/how_to_play.gd") +const LeaderboardPanel := preload("res://scenes/runner/ui/leaderboard_panel.gd") var game: Node -var resume_button: Button -var how_to_play_button: Button - -func _ready() -> void: - var ui := Control.new() - ui.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - ui.theme = Style.theme() - add_child(ui) - var dim := ColorRect.new() - dim.color = Color(0.01, 0.02, 0.04, 0.88) - dim.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - ui.add_child(dim) - var center := CenterContainer.new() - center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - ui.add_child(center) - var panel := PanelContainer.new() - var box := Style.panel(Style.MINT) - box.content_margin_left = 28 - box.content_margin_right = 28 - box.content_margin_top = 24 - box.content_margin_bottom = 24 - panel.add_theme_stylebox_override("panel", box) - Style.polish(panel, false) - center.add_child(panel) - var column := VBoxContainer.new() - column.add_theme_constant_override("separation", 18) - panel.add_child(column) - column.add_child(Style.label("PAUSED", 46)) - var buttons: Array[Button] = [] - resume_button = Style.button("Resume") - column.add_child(resume_button) - buttons.append(resume_button) - resume_button.pressed.connect(func() -> void: _call_game(&"resume")) - how_to_play_button = Style.button("How to Play", 52) - column.add_child(how_to_play_button) - buttons.append(how_to_play_button) - how_to_play_button.pressed.connect(_show_how_to_play) - var restart := Style.button("Restart", 52) - column.add_child(restart) - buttons.append(restart) - restart.pressed.connect(func() -> void: _call_game(&"retry")) - var menu := Style.button("Runner Menu", 52) - column.add_child(menu) - buttons.append(menu) - menu.pressed.connect(func() -> void: _call_game(&"go_to_menu")) - var resume_hint := Style.label("", 20, Style.MINT) - Prompts.track(resume_hint, func() -> String: - return "%s resume" % Prompts.either("ESC", &"pause", true)) - column.add_child(resume_hint) - for i in buttons.size(): - buttons[i].focus_neighbor_top = buttons[i].get_path_to(buttons[(i - 1 + buttons.size()) % buttons.size()]) - buttons[i].focus_neighbor_bottom = buttons[i].get_path_to(buttons[(i + 1) % buttons.size()]) - buttons[i].focus_next = buttons[i].focus_neighbor_bottom - buttons[i].focus_previous = buttons[i].focus_neighbor_top +var leaderboard_button: Button +## The open leaderboard panel, or null. +var leaderboard: Control func bind(runner: Node) -> void: game = runner + setup("runner_game", + func() -> void: _call_game(&"resume"), + func() -> void: _call_game(&"retry"), + func() -> void: _call_game(&"go_to_menu")) + leaderboard_button = add_button("Leaderboard", _open_leaderboard) runner.paused_changed.connect(_on_paused_changed) _on_paused_changed(runner.paused) func _on_paused_changed(is_paused: bool) -> void: - visible = is_paused if is_paused: - resume_button.grab_focus() + open() + else: + close() + +## Closing the menu (resume, pad reconnect, a route change) takes the leaderboard with it. +func close() -> void: + if is_instance_valid(leaderboard): + leaderboard.closed.disconnect(_on_leaderboard_closed) + leaderboard.queue_free() + leaderboard = null + _set_menu_enabled(true) + super.close() -## Opens the runner's how-to-play card over this menu; the run stays paused under it. -func _show_how_to_play() -> void: +func _open_leaderboard() -> void: + if leaderboard != null or game == null: + return + _set_menu_enabled(false) + leaderboard = LeaderboardPanel.new() + leaderboard.leaderboard_path = game.leaderboard_path + leaderboard.closed.connect(_on_leaderboard_closed) + ui.add_child(leaderboard) + +func _on_leaderboard_closed() -> void: + leaderboard = null + _set_menu_enabled(true) if visible: - HowToPlay.open(get_tree(), "runner_game", HowToPlay.Mode.PAUSE, how_to_play_button) + leaderboard_button.grab_focus() + +## The board owns the screen while it is up: the menu's own buttons can't be reached. +func _set_menu_enabled(enabled: bool) -> void: + for button in buttons: + button.disabled = not enabled or locked + button.focus_mode = Control.FOCUS_ALL if enabled else Control.FOCUS_NONE func _call_game(method: StringName) -> void: if game != null and game.has_method(method): diff --git a/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.tscn b/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.tscn index e34a6eb9..47874dfa 100644 --- a/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.tscn +++ b/hoppys-adventure-arcade/scenes/runner/ui/pause_menu.tscn @@ -3,7 +3,5 @@ [ext_resource type="Script" path="res://scenes/runner/ui/pause_menu.gd" id="1"] [node name="PauseMenu" type="CanvasLayer"] -process_mode = 3 -layer = 21 visible = false script = ExtResource("1") diff --git a/hoppys-adventure-arcade/scenes/runner/warmup/gpu_warmup.gd b/hoppys-adventure-arcade/scenes/runner/warmup/gpu_warmup.gd index ba326f1d..3d4f4661 100644 --- a/hoppys-adventure-arcade/scenes/runner/warmup/gpu_warmup.gd +++ b/hoppys-adventure-arcade/scenes/runner/warmup/gpu_warmup.gd @@ -7,7 +7,7 @@ extends Node3D ## light), and draws each batch with RenderingServer.force_draw(false) under the live lights, then ## again with a corridor-wide omni light: same viewport, environment, scaling and scene as play, ## but the frames are never presented. It runs from _ready() while the route veil is opaque, once -## in the runner menu and once in the first game (the menu's lights and Hoppy are not the game's), +## in the hub's background pass and once in the first game (the hub's lights are not the game's), ## so nothing flashes even on a directly launched scene. Only public scene paths and visual hooks ## (contract §5, §11.5-§11.8) are used, the way the backend mounts them. const PowerUpDefs = preload("res://scenes/runner/powerups/power_up_defs.gd") @@ -54,7 +54,7 @@ const TRACK_DEPTHS: Array[float] = [0.0, 9.0, 55.0] const LIT_RANGE := 150.0 ## Process-lifetime state lives on the Engine singleton: nothing else references this script once -## the runner menu is freed, and an unloaded script would drop its statics (the guard and the +## the warm-up host is freed, and an unloaded script would drop its statics (the guard and the ## retained materials) before the game's first frame. const STATE_KEY := &"runner_gpu_warmup" ## True once the game context has been warmed (the one that matters for play). @@ -86,7 +86,7 @@ var _light: OmniLight3D var _focus := Vector3.ZERO var _slots := {} -## Once per process per context (runner menu, runner game). `host` owns the transient stage; +## Once per process per context (hub warm-up, runner game). `host` owns the transient stage; ## `camera` defaults to the viewport camera. Returns false when skipped (already warmed, or the ## headless dummy renderer compiles nothing). static func run(host: Node, camera: Camera3D = null) -> bool: diff --git a/hoppys-adventure-arcade/tests/assets/a7_check.gd b/hoppys-adventure-arcade/tests/assets/a7_check.gd index 80ff17b6..91c3e068 100644 --- a/hoppys-adventure-arcade/tests/assets/a7_check.gd +++ b/hoppys-adventure-arcade/tests/assets/a7_check.gd @@ -237,42 +237,33 @@ func run() -> void: check(closeup.size == Vector2(840,392) and Rect2(0,0,1280,720).encloses(closeup), "B4 closeup fits frame") mock.free() await frames() - var menu := load("res://scenes/runner/runner_menu.tscn").instantiate() as Node - root.add_child(menu) + # The leaderboard panel the runner's pause menu opens: shared font, ten rows, podium medals. + var board := load("res://scenes/runner/ui/leaderboard_panel.gd").new() as Control + board.leaderboard_path = OS.get_temp_dir().path_join("a7_check_leaderboard_%d.cfg" % OS.get_process_id()) + root.add_child(board) await frames() - check(menu.ui.get_theme_default_font() == Style.theme().default_font, "R4 runner menu shared font") - check(menu.buttons.size() == 4, "menu buttons preserved") - var menu_legend: Node = menu.ui.find_child("TeachingLegend", true, false) - check(menu_legend != null, "menu teaching legend exists") - check_legend(menu_legend, true) - menu._toggle_leaderboard() - await frames() - check(menu.modal != null and menu.board.get_child_count() == 10, "leaderboard rows and medals") - for label: Label in menu.ui.find_children("*", "Label", true, false): - check(label.get_theme_font_size("font_size") >= 18, "menu font >=18") - check(label.get_theme_constant("outline_size") >= 6, "menu outline >=6") + check(board.get_theme_default_font() == Style.theme().default_font, "R4 leaderboard shared font") + check(board.board.get_child_count() == 10, "leaderboard rows and medals") + check(board.close_btn.has_focus(), "leaderboard focuses Close") + for label: Label in board.find_children("*", "Label", true, false): + check(label.get_theme_font_size("font_size") >= 18, "leaderboard font >=18") + check(label.get_theme_constant("outline_size") >= 6, "leaderboard outline >=6") var rect := label.get_global_rect() - check(rect.position.x >= 0 and rect.position.y >= 0 and rect.end.x <= 1280 and rect.end.y <= 720, "menu label fits viewport: " + label.text) + check(rect.position.x >= 0 and rect.position.y >= 0 and rect.end.x <= 1280 and rect.end.y <= 720, "leaderboard label fits viewport: " + label.text) var backing := label.get_parent() while backing != null and not backing is PanelContainer: backing = backing.get_parent() - check(backing != null, "menu panel backing") + check(backing != null, "leaderboard panel backing") for i in 10: - var marker: Control = menu.board.get_child(i).get_child(0) - var row_text: String = menu.board.get_child(i).get_child(1).text + var marker: Control = board.board.get_child(i).get_child(0) + var row_text: String = board.board.get_child(i).get_child(1).text if i >= 3 or row_text.contains("---"): check(not "kind" in marker, "R5 no medal for empty/nonpodium row") for i in 3: - var marker: Control = menu.rank_marker(i,true) + var marker: Control = board.rank_marker(i,true) check(marker.tint == [Palette.CREAM.lerp(Palette.ORANGE,0.35),Palette.SLATE.lerp(Palette.CREAM,0.65),Palette.ORANGE.lerp(Palette.NAVY_2,0.3)][i], "R5 populated podium tint") marker.free() - for label: Label in menu.ui.find_children("*", "Label", true, false): - if label.text == "KEEP THE BUILD MOVING": check(label.get_theme_font_size("font_size") == 26, "R5 menu heading scale") - if label.text.begins_with("A / D"): check(label.get_theme_font_size("font_size") == 22, "R5 menu controls scale") - if label.text.begins_with("Two hits"): check(label.get_theme_font_size("font_size") == 18, "R5 menu caption scale") - check_panel_decorations(menu.ui) - menu._close_leaderboard() - check(menu.buttons[1].has_focus(), "leaderboard returns focus") - menu.free() + check_panel_decorations(board) + board.free() await frames() for player in root.find_children("*", "AudioStreamPlayer", true, false): player.stop() diff --git a/hoppys-adventure-arcade/tests/beatemup_knockout.gd b/hoppys-adventure-arcade/tests/beatemup_knockout.gd index 833c04f3..3dfc70b8 100644 --- a/hoppys-adventure-arcade/tests/beatemup_knockout.gd +++ b/hoppys-adventure-arcade/tests/beatemup_knockout.gd @@ -640,7 +640,7 @@ func reload_scene() -> void: check(false, tag("AppRouter finishes routing within 5 s")) return await process_frame - check(current_scene!=null and current_scene.name=="BeatemMenu", tag("leave still routes to the Beat'em Up menu")) + check(current_scene!=null and current_scene.name=="MainMenu", tag("leave routes to the hub")) change_scene_to_file(scene_path) await process_frame await process_frame @@ -1416,7 +1416,7 @@ func check_hud_real() -> void: return check(not leaked, tag("no HUD or minimap node is visible from the throw to the card")) do_pause() - check(game.state=="paused" and game.overlay.visible, tag("pausing during the card still shows the pause overlay")) + check(game.state=="paused" and game.pause_menu.is_open(), tag("pausing during the card still shows the pause menu")) game.resume() check(game.state=="knockout", tag("resume returns to the knockout")) for n in nodes: diff --git a/hoppys-adventure-arcade/tests/beatemup_story.gd b/hoppys-adventure-arcade/tests/beatemup_story.gd index c257dd9c..7fbd2c5c 100644 --- a/hoppys-adventure-arcade/tests/beatemup_story.gd +++ b/hoppys-adventure-arcade/tests/beatemup_story.gd @@ -451,8 +451,8 @@ func run_city_hands_free(hold: float) -> void: func check_return_to_menu() -> void: reopen_city() - var back := action_button("Return to Beat'em Up menu") - check(back != null and back.get_parent() == game.story.actions, "Return to the Beat'em Up menu lives in the story actions") + var back := action_button("Main Menu") + check(back != null and back.get_parent() == game.story.actions, "Main Menu lives in the story actions") if back == null: return var guard := 0 while game.story.bars_shown() < 1.0 and guard < 90: @@ -469,10 +469,10 @@ func check_return_to_menu() -> void: while Time.get_ticks_msec() < deadline: await process_frame var router := root.get_node("AppRouter") - if is_instance_valid(current_scene) and current_scene.scene_file_path.ends_with("beatem_menu.tscn") and not router.busy: + if is_instance_valid(current_scene) and current_scene.scene_file_path.ends_with("main_menu.tscn") and not router.busy: arrived = true break - check(arrived, "Return changes scene to the Beat'em Up menu") + check(arrived, "Main Menu changes scene to the hub") func check_hvv(hold: float) -> void: await load_mode("res://scenes/beatem_up/reinvent/heroes_vs_villains.tscn") diff --git a/hoppys-adventure-arcade/tests/booth_mode.gd b/hoppys-adventure-arcade/tests/booth_mode.gd index 1f2b1318..0c2ccde7 100644 --- a/hoppys-adventure-arcade/tests/booth_mode.gd +++ b/hoppys-adventure-arcade/tests/booth_mode.gd @@ -58,7 +58,7 @@ func run() -> void: % router.ROUTES["heroes_vs_villains"] check(kiosk.log.contains(opened), "Launching with --route opens that route's scene") - router.go("platformer") + router.go("bay_area_blitz") await settle_route() await wait(0.5) check(not on_hub(), "Without booth mode an idle game stays put") diff --git a/hoppys-adventure-arcade/tests/booth_routing.gd b/hoppys-adventure-arcade/tests/booth_routing.gd index 525f33fb..59f7f5ef 100644 --- a/hoppys-adventure-arcade/tests/booth_routing.gd +++ b/hoppys-adventure-arcade/tests/booth_routing.gd @@ -1,7 +1,7 @@ extends SceneTree -## Booth routing: --attract picks the menu where idle and finished players go; a game over in booth -## mode sends the player on once their --retries are used, with a next-player card, and ends their -## session as game_over; outside booth mode every game's own retry screen is unchanged. Each game +## Booth routing: idle and finished players go back to the hub (the legacy --attract flag only +## warns); a game over in booth mode sends the player on once their --retries are used, with a +## next-player card, and ends their session as game_over; outside booth mode every game's own retry screen is unchanged. Each game ## (Heroes vs. Villains, Code City Brawl, a platformer level, the runner) is driven through its ## real game-over path. Run headless with --script res://tests/booth_routing.gd. const ChildGame := preload("res://tests/support/child_game.gd") @@ -93,23 +93,19 @@ func run() -> void: router = root.get_node("AppRouter") clean() await wait(0.3) - check(router.attract_route(PackedStringArray()) == "hub", "The hub is the default attract route") - check(router.attract_route(PackedStringArray(["--attract=beatem_up"])) == "beatem_up" - and router.attract_route(PackedStringArray(["--attract=runner"])) == "runner", - "--attract picks one of the attract menus") - check(router.attract_route(PackedStringArray(["--attract=heroes_vs_villains"])) == "hub" - and router.attract_route(PackedStringArray(["--attract=platformer"])) == "hub" - and router.attract_route(PackedStringArray(["--attract=nowhere"])) == "hub", - "A game, a menu without its own music, or an unknown name falls back to the hub") + check(router.ATTRACT_ROUTE == "hub" and router.ROUTES.has("hub"), "The hub is the only attract route") + for name in ["platformer", "runner", "beatem_up"]: + check(not router.ROUTES.has(name), "The %s genre menu route is gone" % name) check(router.retry_count(PackedStringArray()) == 0, "Booth players get no retries by default") check(router.retry_count(PackedStringArray(["--retries=2"])) == 2, "--retries sets the retries") check(router.retry_count(PackedStringArray(["--retries=-1"])) == 0 and router.retry_count(PackedStringArray(["--retries=lots"])) == 0, "A bad --retries means none") var kiosk: Dictionary = await launch(["--booth", "--attract=beatem_up", "--retries=1"]) - check(kiosk.code == 0 - and kiosk.log.contains("AppRouter: booth attract route beatem_up, 1 retries per player"), + check(kiosk.code == 0 and kiosk.log.contains("AppRouter: booth mode, 1 retries per player"), "The launch flags reach the router (exit %d)" % kiosk.code) + check(kiosk.log.contains("--attract=beatem_up does nothing any more"), + "A legacy --attract flag warns and is otherwise ignored") # Outside booth mode nothing changes: the game shows its own retry screen. await visit("heroes_vs_villains") @@ -122,7 +118,6 @@ func run() -> void: router.start_session_log(LOG_DIR) router.set_booth(true) router.retry_limit = 1 - router.attract = "beatem_up" await visit("heroes_vs_villains") current_scene.game_over() await process_frame @@ -138,8 +133,8 @@ func run() -> void: check(router.next_player_left > router.NEXT_PLAYER_SECONDS - 1.0, "The card starts its countdown from six seconds") await finish_card() - check(on("beatem_up") and not card_up() and router.game_overs == 0, - "After the countdown the attract route opens for the next player") + check(on("hub") and not card_up() and router.game_overs == 0, + "After the countdown the hub opens for the next player") router.retry_limit = 0 await visit("code_city_brawl") @@ -148,7 +143,7 @@ func run() -> void: check(not current_scene.overlay.visible and card_up(), "Code City Brawl hands its game over to the booth") await finish_card() - check(on("beatem_up"), "Code City Brawl's next player starts at the attract route") + check(on("hub"), "Code City Brawl's next player starts at the hub") await visit("bay_area_blitz") var level := current_scene @@ -156,7 +151,7 @@ func run() -> void: check(await card_within(10.0) and not level.overlay.visible, "A platformer level hands its game over to the booth after the knockout") await finish_card() - check(on("beatem_up") and not paused, "The platformer's next player starts unpaused") + check(on("hub") and not paused, "The platformer's next player starts unpaused") # The real runner: its game-over screen hears run_finished and hands off. await visit("runner_game") @@ -171,11 +166,11 @@ func run() -> void: and router.next_player.summary.text.begins_with("SCORE "), "The runner's game-over screen hands off to the booth with its score") await finish_card() - check(on("beatem_up"), "The runner's next player starts at the attract route") + check(on("hub"), "The runner's next player starts at the hub") # A game over while a route change is already under way leaves it to that change. await visit("code_city_brawl") - router.go("beatem_up") + router.go("hub") check(not router.booth_game_over(), "No takeover while a route change is under way") await settle_route() @@ -185,17 +180,16 @@ func run() -> void: check(await card_within(10.0), "The card is up before booth mode is turned off") router.set_booth(false) await settle_route() - check(not card_up() and on("beatem_up") and not paused, - "Leaving booth mode mid-countdown clears the card and opens the attract route") + check(not card_up() and on("hub") and not paused, + "Leaving booth mode mid-countdown clears the card and opens the hub") router.set_booth(true) router.retry_limit = 0 - router.attract = "runner" await visit("orbital_ops") router.idle_limit = 0.4 await wait(0.8) await settle_route() - check(on("runner"), "An idle game returns to the attract route") + check(on("hub"), "An idle game returns to the hub") router.idle_limit = router.IDLE_SECONDS var records := ends() @@ -206,7 +200,6 @@ func run() -> void: "The session counts both of the player's losses, the retried one included") router.set_booth(false) - router.attract = "hub" router.retry_limit = 0 clean() await root.get_node("AudioService").settle() diff --git a/hoppys-adventure-arcade/tests/booth_session_log.gd b/hoppys-adventure-arcade/tests/booth_session_log.gd index 68d06d2f..ddbbf4e5 100644 --- a/hoppys-adventure-arcade/tests/booth_session_log.gd +++ b/hoppys-adventure-arcade/tests/booth_session_log.gd @@ -201,7 +201,7 @@ func run() -> void: router.start_session_log(LOG_DIR) await visit("bay_area_blitz") await visit("bay_area_blitz") - await visit("platformer") + await visit("hub") await visit("heroes_vs_villains") router.set_booth(true) router.idle_limit = 0.5 @@ -224,11 +224,11 @@ func run() -> void: check(entries.size() > 0 and entries[0].event == "launch", "The log opens with a launch line") check(starts.map(func(record: Dictionary) -> String: return record.game) == ["bay_area_blitz", "heroes_vs_villains", "code_city_brawl"], - "Each game visit starts one session; menus and the hub start none") + "Each game visit starts one session; the hub starts none") check(ends.size() == 3, "Every session ends") if ends.size() == 3 and starts.size() == 3: check(ends[0].ended_by == "menu" and int(ends[0].retries) == 1, - "Re-entering a game is a retry; leaving for a menu ends the session") + "Re-entering a game is a retry; leaving for the hub ends the session") check(ends[1].ended_by == "idle", "Booth mode's idle return ends a session as idle") check(ends[2].ended_by == "quit", "Quitting ends a session as quit") var numbered := true diff --git a/hoppys-adventure-arcade/tests/booth_soak.gd b/hoppys-adventure-arcade/tests/booth_soak.gd index 615e3661..ab9baa3b 100644 --- a/hoppys-adventure-arcade/tests/booth_soak.gd +++ b/hoppys-adventure-arcade/tests/booth_soak.gd @@ -1,8 +1,8 @@ extends SceneTree ## Soak test (app/booth_soak.gd): --soak parsing, the frame-time math and the leak check on fixed ## numbers, then short real soaks in child processes: one over every route must write CSV samples -## and a summary with a frame-rate row per route and exit 0; one over the hub and the platformer -## menu must judge its hub visits steady; the same next to a script that leaks nodes must judge them +## and a summary with a frame-rate row per route and exit 0; one over the hub and Bay Area Blitz +## must judge its hub visits steady; the same next to a script that leaks nodes must judge them ## growing and exit 1. ## Run headless with --script res://tests/booth_soak.gd. const BoothSoak := preload("res://app/booth_soak.gd") @@ -14,7 +14,7 @@ const LEAK_FOLDER := "user://test_soak_leak" ## runs: the in-game deadline is far beyond CHILD_SECONDS, which is the hard bound. const FULL := ["--soak=60", "--soak-cycles=1", "--soak-dwell=0.6"] ## Three passes over two light routes: exactly three settled hub visits. -const SHORT := ["--soak=60", "--soak-cycles=3", "--soak-dwell=0.6", "--soak-routes=hub,platformer"] +const SHORT := ["--soak=60", "--soak-cycles=3", "--soak-dwell=0.6", "--soak-routes=hub,bay_area_blitz"] const CHILD_SECONDS := 300.0 var failures := 0 diff --git a/hoppys-adventure-arcade/tests/code_city_celebration.gd b/hoppys-adventure-arcade/tests/code_city_celebration.gd index 5b532be8..3e18db4c 100644 --- a/hoppys-adventure-arcade/tests/code_city_celebration.gd +++ b/hoppys-adventure-arcade/tests/code_city_celebration.gd @@ -822,7 +822,7 @@ func check_real_game() -> void: if game.state!="celebration": break if game.state=="celebration" and guard==120: game.pause("x") - check(game.state=="paused" and game.overlay.visible, "pause during the real celebration shows the overlay") + check(game.state=="paused" and game.pause_menu.is_open(), "pause during the real celebration shows the pause menu") var frozen: float = game.party.clock for _i in 30: real_step() check(is_equal_approx(game.party.clock, frozen), "the party clock is frozen while the real game is paused") diff --git a/hoppys-adventure-arcade/tests/code_city_smoke.gd b/hoppys-adventure-arcade/tests/code_city_smoke.gd index 5d4a9f43..17059c63 100644 --- a/hoppys-adventure-arcade/tests/code_city_smoke.gd +++ b/hoppys-adventure-arcade/tests/code_city_smoke.gd @@ -28,9 +28,8 @@ func run() -> void: # A rendered start is still adding the autoloads' nodes to root for its first frames, and a # scene change then fails ("Parent node is busy setting up children"). Let it settle. await create_timer(.5).timeout - change_scene_to_file("res://scenes/beatem_up/beatem_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await process_frame;await process_frame - await capture("menu") change_scene_to_file("res://scenes/beatem_up/code_city_brawl.tscn") await process_frame;await process_frame # A rendered start can take longer than two frames to build the stage; wait on the scene itself. @@ -176,9 +175,9 @@ func run() -> void: Engine.physics_ticks_per_second = 60 print("Simulation steps: ",elapsed_steps,"; rooms: ",rooms.size(),"; state: ",game.state,"; enemies: ",game.living_enemies()) if is_instance_valid(game.boss): print("Boss HP ",game.boss.hp," phase ",game.boss.phase) - change_scene_to_file("res://scenes/beatem_up/beatem_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await process_frame;await process_frame - check(not paused and current_scene.name=="BeatemMenu","Completion returns cleanly to the mode menu") + check(not paused and current_scene.name=="MainMenu","Completion returns cleanly to the hub") current_scene.queue_free() await root.get_node("AudioService").settle() quit(1 if failures else 0) diff --git a/hoppys-adventure-arcade/tests/controller_service.gd b/hoppys-adventure-arcade/tests/controller_service.gd index a5576668..a28606b0 100644 --- a/hoppys-adventure-arcade/tests/controller_service.gd +++ b/hoppys-adventure-arcade/tests/controller_service.gd @@ -151,10 +151,10 @@ func platformer_pauses_and_resumes() -> void: await plug(0, XBOX) await frames(5) await unplug(0) - check(paused and level.overlay.visible, "A disconnect pauses the platformer through its pause menu") + check(paused and level.pause_menu.is_open(), "A disconnect pauses the platformer through its pause menu") check(service.is_paused_for_controller() and service.banner.visible, "The banner asks for the controller") await plug(4, XBOX) # The same pad returns under a new id. - check(not paused and not level.overlay.visible, "Reconnecting resumes the platformer") + check(not paused and not level.pause_menu.is_open(), "Reconnecting resumes the platformer") check(not service.banner.visible and service.family == "xbox", "Banner hidden, prompts back") await frames(5) # A game the player paused stays paused through a disconnect and reconnect. @@ -162,7 +162,7 @@ func platformer_pauses_and_resumes() -> void: await unplug(4) check(paused and not service.is_paused_for_controller(), "A player-paused game is left alone") await plug(5, XBOX) - check(paused and level.overlay.visible, "Reconnecting does not resume a game the player paused") + check(paused and level.pause_menu.is_open(), "Reconnecting does not resume a game the player paused") level._resume() await frames(5) diff --git a/hoppys-adventure-arcade/tests/enchanted_boundaries.gd b/hoppys-adventure-arcade/tests/enchanted_boundaries.gd index 30badf1b..6911da2d 100644 --- a/hoppys-adventure-arcade/tests/enchanted_boundaries.gd +++ b/hoppys-adventure-arcade/tests/enchanted_boundaries.gd @@ -78,7 +78,7 @@ func run() -> void: change_scene_to_file("res://scenes/platformer/enchanted_repo.tscn") await frames(8) check(current_scene.boss.hp==12 and current_scene.boss.armor_stage==0,"Actor state never mutates shared SpriteFrames") - change_scene_to_file("res://scenes/platformer/platformer_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await frames(3) await root.get_node("AudioService").settle() quit(failures) diff --git a/hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd b/hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd index f20feff7..177856d5 100644 --- a/hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd +++ b/hoppys-adventure-arcade/tests/enchanted_repo_smoke.gd @@ -270,19 +270,19 @@ func run() -> void: place(Vector2(1150,870)) await frames(3) check(level.finished and player.hp==0,"Pit fall produces retry result") - root.get_node("AppRouter").go("platformer") + root.get_node("AppRouter").go("hub") await create_timer(.75).timeout - check(not paused and not root.get_node("AudioService").music.stream_paused,"Returning to menu restores audio and pause state") - current_scene._select() + check(not paused and not root.get_node("AudioService").music.stream_paused,"Returning to the hub restores audio and pause state") + check(current_scene.name=="MainMenu","Main Menu lands on the hub") await frames(3) - await capture("/tmp/enchanted-level-select.png") + await capture("/tmp/enchanted-return-hub.png") print("ENCHANTED REPO: ","PASS" if failures==0 else "FAIL"," (",failures," failures)") await shutdown() func shutdown() -> void: release() paused=false - change_scene_to_file("res://scenes/platformer/platformer_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await frames(2) await root.get_node("AudioService").settle() quit(failures) diff --git a/hoppys-adventure-arcade/tests/exit_leak.gd b/hoppys-adventure-arcade/tests/exit_leak.gd index b7b785a2..64428111 100644 --- a/hoppys-adventure-arcade/tests/exit_leak.gd +++ b/hoppys-adventure-arcade/tests/exit_leak.gd @@ -14,7 +14,6 @@ const MID_ROUTE := ["route_leaving", "route_arriving"] const HUB := "res://scenes/main_menu/main_menu.tscn" const CODE_CITY := "res://scenes/beatem_up/code_city_brawl.tscn" const HEROES := "res://scenes/beatem_up/reinvent/heroes_vs_villains.tscn" -const RUNNER_MENU := "res://scenes/runner/runner_menu.tscn" const RUNNER := "res://scenes/runner/runner_game.tscn" ## Wall-clock seconds the screen plays before the quit, with its music and effects running. const HOLD := 1.5 @@ -49,7 +48,7 @@ func wait_until(test: Callable, seconds: float) -> bool: await process_frame return true -## Takes `route` through the router as the menus do, and adopts the scene it lands on. +## Takes `route` through the router as the hub does, and adopts the scene it lands on. func route(name: String, path: String) -> bool: if not await wait_until(func() -> bool: return not router().busy, 10.0): return false router().go(name) @@ -148,7 +147,6 @@ func reach() -> bool: return await wait_until(func() -> bool: return game.overlay.visible and not game.results_reveal.is_running(), 6.0) return game.knockout.active "runner_intro": - if not await route("runner", RUNNER_MENU): return false if not await route("runner_game", RUNNER): return false if bool(game.paused): game.resume() return await wait_until(func() -> bool: return game.run_intro_mode != &"", 5.0) diff --git a/hoppys-adventure-arcade/tests/heroes_villains_logic.gd b/hoppys-adventure-arcade/tests/heroes_villains_logic.gd index 026ee75a..acf1b790 100644 --- a/hoppys-adventure-arcade/tests/heroes_villains_logic.gd +++ b/hoppys-adventure-arcade/tests/heroes_villains_logic.gd @@ -415,10 +415,8 @@ func run() -> void: game.exit_stage() steps(240,func(): return game.flow.phase=="fade_out" and game.flow.clock>.1) press_pause() - var back: Button = null - for child in game.panel.get_children(): - if child is Button and child.text=="Return to Beat'em Up menu": back=child - check(back!=null and paused and game.state=="paused","Pause overlay offers Return during stage_exit") + var back: Button = game.pause_menu.menu_button if game.pause_menu.is_open() else null + check(back!=null and paused and game.state=="paused","Pause menu offers Main Menu during stage_exit") if back==null: quit(1) return @@ -433,9 +431,9 @@ func run() -> void: check(not paused and game.leaving and game.state=="leaving" and held,"Leave through the pause overlay cancels the flow and changes no stage") check(game.shake==8,"A leaving owner returns early from _physics_process (shake, which decays unconditionally otherwise, stays frozen)") var disabled := true - for child in game.panel.get_children(): - if child is BaseButton and not child.disabled: disabled=false - check(disabled and back.disabled,"Overlay buttons are disabled while leaving") + for child in game.pause_menu.buttons: + if not child.disabled: disabled=false + check(disabled and back.disabled,"Pause menu buttons are disabled while leaving") await reload_game() auto_win() game._physics_process(1.0/60.0) diff --git a/hoppys-adventure-arcade/tests/heroes_villains_smoke.gd b/hoppys-adventure-arcade/tests/heroes_villains_smoke.gd index c3921a33..d650a6bf 100644 --- a/hoppys-adventure-arcade/tests/heroes_villains_smoke.gd +++ b/hoppys-adventure-arcade/tests/heroes_villains_smoke.gd @@ -26,11 +26,8 @@ func capture(name: String) -> void: func card_settled() -> bool: return game.state=="cards" and game.card_clock>(3.0 if game.card.has_method("advance") else .35) func run() -> void: - change_scene_to_file("res://scenes/beatem_up/beatem_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await process_frame;await process_frame - current_scene.find_child("HeroesButton",true,false).grab_focus() - await capture("mode_select") - check(current_scene.selected_mode==1 and current_scene.description.text.contains("FOUR VILLAINS"),"Mode select previews Heroes vs. Villains") root.get_node("AppRouter").go("heroes_vs_villains") # The router fades on a clock; rendered frames can be far shorter than 1/60 s. var deadline: int=Time.get_ticks_msec()+5000 @@ -165,8 +162,8 @@ func run() -> void: deadline=Time.get_ticks_msec()+5000 while Time.get_ticks_msec() void: check(card() == null and not paused, "Esc skips the card and the game plays") await visit("bay_area_blitz") check(card() == null, "A retry skips the card") - await visit("platformer") + await visit("orbital_ops") + await close_with(KEY_ESCAPE) await visit("bay_area_blitz") - check(card() == null, "Coming back from the platformer menu skips the card") + check(card() == null, "Coming back from another game skips the card") await visit("hub") await visit("bay_area_blitz") check(card() != null, "A new visitor (the hub opened) sees the card again") @@ -426,7 +427,7 @@ func booth_idle_still_counts() -> void: router.idle_limit = 0.4 await wait(0.8) await settle_route() - check(on("hub") and card() == null and not paused, "Booth idle returns to the attract route from under the card") + check(on("hub") and card() == null and not paused, "Booth idle returns to the hub from under the card") router.idle_limit = router.IDLE_SECONDS router.set_booth(false) @@ -508,18 +509,18 @@ func pause_menus_reopen_it() -> void: await visit("bay_area_blitz") var level := current_scene level._pause() - await reopen(level.how_to_play_button, "bay_area_blitz") + await reopen(level.pause_menu.how_to_play_button, "bay_area_blitz") level._resume() await visit("code_city_brawl") current_scene.pause("test") await process_frame - await reopen(find_button(current_scene.panel, "How to Play"), "code_city_brawl") + await reopen(current_scene.pause_menu.how_to_play_button, "code_city_brawl") check(current_scene.is_player_paused(), "code_city_brawl: still in its pause menu") await visit("heroes_vs_villains") current_scene.state = "combat" tap(KEY_ESCAPE) await process_frame - await reopen(find_button(current_scene.panel, "How to Play"), "heroes_vs_villains") + await reopen(current_scene.pause_menu.how_to_play_button, "heroes_vs_villains") check(current_scene.is_player_paused(), "heroes_vs_villains: still in its pause menu") current_scene.resume() await visit("runner_game") @@ -533,7 +534,7 @@ func pause_menus_reopen_it() -> void: await wait(0.2) runner.pause() await process_frame - await reopen(find_button(root, "How to Play"), "runner_game") + await reopen(runner.get_node("Overlays/PauseMenu").how_to_play_button, "runner_game") check(runner.is_player_paused(), "runner_game: still paused") runner.resume() router.how_to_play_enabled = true diff --git a/hoppys-adventure-arcade/tests/menu_return_layout.gd b/hoppys-adventure-arcade/tests/menu_return_layout.gd index 945ccdd2..922d8847 100644 --- a/hoppys-adventure-arcade/tests/menu_return_layout.gd +++ b/hoppys-adventure-arcade/tests/menu_return_layout.gd @@ -25,12 +25,9 @@ func open_level() -> Node: level._resume() await wait(0.2) return level -## The pause/results column's children by their old positions (title, detail, Resume, Retry, -## Platformer Menu, Arcade), skipping the pause-only How to Play button. +## The results column's children by position (title, detail, Retry, Main Menu). func overlay_button(level: Node, index: int) -> Button: - var children: Array = level.resume_button.get_parent().get_children().filter( - func(child: Node) -> bool: return child != level.how_to_play_button) - return children[index] + return level.retry_button.get_parent().get_child(index) func check_menu(label: String) -> void: var menu = current_scene check(menu.name == "MainMenu", label + ": back on the main menu") @@ -60,17 +57,17 @@ func run() -> void: router = root.get_node("AppRouter") change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await wait(0.5) - # 1. Pause -> Return to Arcade. + # 1. Pause -> Main Menu. var level := await open_level() level._pause() park_mouse_on(1) - overlay_button(level, 5).pressed.emit() + level.pause_menu.menu_button.pressed.emit() await settle() await check_menu("pause-return") # 2. Escape pressed during the fade-out re-pauses the dying level. level = await open_level() level._pause() - overlay_button(level, 5).pressed.emit() + level.pause_menu.menu_button.pressed.emit() await wait(0.1) var escape := InputEventAction.new() escape.action = "pause" @@ -81,32 +78,31 @@ func run() -> void: # 3. Focus loss during the fade-out. level = await open_level() level._pause() - overlay_button(level, 5).pressed.emit() + level.pause_menu.menu_button.pressed.emit() await wait(0.1) level.notification(Node.NOTIFICATION_APPLICATION_FOCUS_OUT) await wait(1.5) await check_menu("focus-loss-during-fade") - # 4. Death -> results -> Return to Arcade, with the mouse over a menu button. + # 4. Death -> results -> Main Menu, with the mouse over a menu button. level = await open_level() level.player.position.y = 900 await wait(0.3) check(level.finished, "Falling ends the run") park_mouse_on(2) - overlay_button(level, 5).pressed.emit() + check(overlay_button(level, 3).text == "Main Menu", "The results' last button is Main Menu") + overlay_button(level, 3).pressed.emit() await settle() await check_menu("death-return") - # 5. Retry -> Platformer menu -> hub. + # 5. Restart -> Main Menu. level = await open_level() level._pause() - overlay_button(level, 3).pressed.emit() + level.pause_menu.restart_button.pressed.emit() await settle() - check(current_scene.name == "BayAreaBlitz", "Retry reloads the level") + check(current_scene.name == "BayAreaBlitz", "Restart reloads the level") current_scene._pause() - overlay_button(current_scene, 4).pressed.emit() - await settle() - router.go("hub") + current_scene.pause_menu.menu_button.pressed.emit() await settle() - await check_menu("retry-platformer-hub") + await check_menu("restart-main-menu") print("MENU RETURN: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures)") await root.get_node("AudioService").settle() quit(failures) diff --git a/hoppys-adventure-arcade/tests/menu_smoke.gd b/hoppys-adventure-arcade/tests/menu_smoke.gd index 53f2ef8b..1daddfa2 100644 --- a/hoppys-adventure-arcade/tests/menu_smoke.gd +++ b/hoppys-adventure-arcade/tests/menu_smoke.gd @@ -119,7 +119,7 @@ func run() -> void: for i in GameCatalog.GAMES.size(): var route: String = GameCatalog.GAMES[i].route current_scene.buttons[i].pressed.emit() - router.go("runner") + router.go("hub") for frame in 300: if not router.busy: break await process_frame diff --git a/hoppys-adventure-arcade/tests/orbital_ops_smoke.gd b/hoppys-adventure-arcade/tests/orbital_ops_smoke.gd index 735741aa..6d2b642c 100644 --- a/hoppys-adventure-arcade/tests/orbital_ops_smoke.gd +++ b/hoppys-adventure-arcade/tests/orbital_ops_smoke.gd @@ -273,18 +273,18 @@ func run() -> void: place(Vector2(2700,870)) await frames(3) check(level.finished and player.hp==0,"Falling out of station produces retry result") - root.get_node("AppRouter").go("platformer") + root.get_node("AppRouter").go("hub") await create_timer(.75).timeout - check(not paused and not root.get_node("AudioService").music.stream_paused,"Return to platformer menu restores app audio and pause state") - current_scene._select() + check(not paused and not root.get_node("AudioService").music.stream_paused,"Returning to the hub restores audio and pause state") + check(current_scene.name=="MainMenu","Main Menu lands on the hub") await frames(3) - await capture("/tmp/orbital-level-select.png") + await capture("/tmp/orbital-return-hub.png") print("ORBITAL OPS: ","PASS" if failures==0 else "FAIL"," (",failures," failures)") await shutdown() func shutdown() -> void: paused=false - change_scene_to_file("res://scenes/platformer/platformer_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await frames(2) await root.get_node("AudioService").settle() quit(failures) diff --git a/hoppys-adventure-arcade/tests/pause_menu.gd b/hoppys-adventure-arcade/tests/pause_menu.gd new file mode 100644 index 00000000..a0ee8b7d --- /dev/null +++ b/hoppys-adventure-arcade/tests/pause_menu.gd @@ -0,0 +1,284 @@ +extends SceneTree +## The shared pause menu (app/pause_menu.gd) in all six games: the `pause` action opens it with +## Resume focused and the same buttons everywhere; Resume, a second `pause` press and a mouse click +## resume; Restart reloads the game's own route; Main Menu lands on the hub, unpaused, with the hub +## music back; How to Play reopens the card in PAUSE mode and gives focus back; the runner's +## Leaderboard button opens the top ten with its Reset scores flow and closes without resuming. +## Run headless with --script res://tests/pause_menu.gd. +const PauseMenu := preload("res://app/pause_menu.gd") +const HowToPlay := preload("res://app/how_to_play.gd") +const HeroesCatalog := preload("res://modes/beatem_up/reinvent/catalog.gd") +const Pointer := preload("res://tests/support/pointer.gd") +const RunnerLeaderboard := preload("res://scenes/runner/systems/runner_leaderboard.gd") +const ROUTES: Array[String] = ["bay_area_blitz", "orbital_ops", "enchanted_repo", "runner_game", "code_city_brawl", "heroes_vs_villains"] +var RUNNER_SCORES := "user://test_pause_menu_leaderboard_%d.cfg" % OS.get_process_id() +var failures := 0 +var router: Node +var audio: Node + +func _initialize() -> void: + run.call_deferred() + +func check(ok: bool, message: String) -> void: + if ok: + print("PASS: ", message) + else: + failures += 1 + push_error("FAIL: " + message) + +func wait(seconds: float) -> void: + await create_timer(seconds, true).timeout + +## Waits for the router to finish, on a wall clock: a rendered runner load can take seconds. +func settle_route() -> void: + var deadline := Time.get_ticks_msec() + 20000 + while router.busy and Time.get_ticks_msec() < deadline: + await process_frame + for i in 3: + await process_frame + +func on(route: String) -> bool: + return current_scene != null and current_scene.scene_file_path == router.ROUTES[route] + +## A real `pause` press and release through Input, as a key or Start would send. +func press_pause() -> void: + var press := InputEventAction.new() + press.action = "pause" + press.pressed = true + Input.parse_input_event(press) + var release := press.duplicate() as InputEventAction + release.pressed = false + Input.parse_input_event(release) + Input.flush_buffered_events() + for i in 2: + await process_frame + +func action(name: StringName) -> void: + var press := InputEventAction.new() + press.action = name + press.pressed = true + Input.parse_input_event(press) + var release := press.duplicate() as InputEventAction + release.pressed = false + Input.parse_input_event(release) + Input.flush_buffered_events() + await process_frame + +func key(code: Key, pressed := true) -> void: + var event := InputEventKey.new() + event.physical_keycode = code + event.keycode = code + event.pressed = pressed + Input.parse_input_event(event) + Input.flush_buffered_events() + +func click(control: Control) -> void: + Pointer.hover(control) + var point := control.get_global_transform_with_canvas() * (control.size * 0.5) + for pressed in [true, false]: + var event := InputEventMouseButton.new() + event.button_index = MOUSE_BUTTON_LEFT + event.pressed = pressed + event.position = point + event.global_position = point + control.get_viewport().push_input(event, true) + await process_frame + +## A rendered run saves the screen to /tmp for layout review; headless runs draw nothing. +func capture(name: String) -> void: + if DisplayServer.get_name() == "headless": + return + await RenderingServer.frame_post_draw + root.get_texture().get_image().save_png("/tmp/pause-menu-%s.png" % name) + +func card() -> Node: + for i in range(root.get_child_count() - 1, -1, -1): + var child := root.get_child(i) + if child.get_script() == HowToPlay and not child.is_queued_for_deletion() and child.visible: + return child + return null + +## The scene's shared pause menu, wherever the game keeps it. +func menu_of(scene: Node) -> CanvasLayer: + if scene.has_node("Overlays/PauseMenu"): + return scene.get_node("Overlays/PauseMenu") + return scene.get("pause_menu") + +## Opens `route` and brings it to a state the player could pause. +func enter(route: String) -> Node: + router.go(route) + await settle_route() + check(on(route), "%s opens" % route) + var scene := current_scene + match route: + "runner_game": + scene.leaderboard_path = RUNNER_SCORES + # Autopilot keeps Hoppy alive while the menu is driven at a rendered run's real speed. + scene.set_autopilot(true) + scene.skip_run_intro() + for i in 600: + if scene.state == &"running" and not scene.can_skip_run_intro(): + break + await process_frame + "heroes_vs_villains": + scene.state = "combat" + # A rendered window that never had focus pauses the game on its own; start from play. + await wait(0.3) + if scene.is_player_paused(): + if scene.has_method("_resume"): + scene._resume() + else: + scene.resume() + await wait(0.1) + return scene + +func run() -> void: + router = root.get_node("AppRouter") + audio = root.get_node("AudioService") + HeroesCatalog.install_input() + check(audio.sfx.process_mode == Node.PROCESS_MODE_ALWAYS, "UI blips process while a game is paused") + await wait(0.3) + for route in ROUTES: + await check_route(route) + await check_runner_leaderboard() + router.go("hub") + await settle_route() + for suffix in ["", ".tmp", ".bak"]: + if FileAccess.file_exists(RUNNER_SCORES + suffix): + DirAccess.remove_absolute(RUNNER_SCORES + suffix) + print("PAUSE MENU: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures)") + await audio.settle() + quit(1 if failures else 0) + +func check_route(route: String) -> void: + var scene := await enter(route) + var menu := menu_of(scene) + check(menu != null and not menu.is_open(), "%s: the pause menu exists and starts closed" % route) + if menu == null: + return + check(menu.layer == PauseMenu.LAYER and menu.process_mode == Node.PROCESS_MODE_ALWAYS, + "%s: the menu sits on the shared layer and keeps processing while paused" % route) + # Open with a real pause press. + await press_pause() + check(paused and menu.is_open() and scene.is_player_paused(), "%s: pause opens the menu and pauses the game" % route) + check(menu.resume_button.has_focus(), "%s: Resume takes focus" % route) + var expected: Array[String] = ["Resume", "Restart", "How to Play", "Main Menu"] + if route == "runner_game": + expected.insert(3, "Leaderboard") + var texts: Array[String] = [] + for button in menu.buttons: + texts.append(button.text) + check(texts == expected, "%s: buttons are %s (got %s)" % [route, expected, texts]) + check(menu.eyebrow.visible and not menu.eyebrow.text.is_empty() and menu.title_label.text == "PAUSED", "%s: the card names the game under PAUSED" % route) + await capture(route) + for label: Label in menu.ui.find_children("*", "Label", true, false): + check(label.get_theme_font_size("font_size") >= 18 and label.get_theme_constant("outline_size") >= 6, + "%s: legible label '%s'" % [route, label.text]) + # Focus wraps in both directions (D-pad and stick ride ui_up / ui_down). + await action(&"ui_up") + check(menu.buttons[menu.buttons.size() - 1].has_focus(), "%s: up from Resume wraps to Main Menu" % route) + await action(&"ui_down") + check(menu.resume_button.has_focus(), "%s: down from Main Menu wraps to Resume" % route) + # Mouse hover focuses; a click on Resume resumes. + Pointer.hover(menu.restart_button) + await process_frame + check(menu.restart_button.has_focus(), "%s: hovering a button focuses it" % route) + await click(menu.resume_button) + check(not paused and not menu.is_open() and not scene.is_player_paused(), "%s: clicking Resume resumes" % route) + # A second pause press resumes too. + await press_pause() + check(paused and menu.is_open(), "%s: pause reopens the menu" % route) + await press_pause() + check(not paused and not menu.is_open(), "%s: pause again resumes" % route) + # Confirm on the focused Resume (keyboard / pad A) resumes. + await press_pause() + await action(&"ui_accept") + check(not paused and not menu.is_open(), "%s: Enter on Resume resumes" % route) + # How to Play opens the card over the menu, the game stays paused, focus comes back. + await press_pause() + router.how_to_play_enabled = true + menu.how_to_play_button.grab_focus() + menu.how_to_play_button.pressed.emit() + var shown := card() + check(shown != null and shown.mode == HowToPlay.Mode.PAUSE and shown.route == route, "%s: How to Play opens the card in pause mode" % route) + check(paused and menu.is_open(), "%s: the game stays paused under the card" % route) + if shown != null: + shown.age = HowToPlay.ARM_SECONDS + key(KEY_ESCAPE) + key(KEY_ESCAPE, false) + for i in 10: + await physics_frame + await process_frame + check(card() == null and paused and menu.is_open(), "%s: Esc closes the card and leaves the menu up" % route) + check(menu.how_to_play_button.has_focus(), "%s: focus returns to How to Play" % route) + router.how_to_play_enabled = false + # Restart reloads the same route as a fresh scene, unpaused, and locks the menu meanwhile. + var old: WeakRef = weakref(scene) + menu.restart_button.pressed.emit() + check(menu.locked and menu.menu_button.disabled, "%s: a press locks the menu until the route lands" % route) + await settle_route() + check(on(route) and old.get_ref() == null and not paused, "%s: Restart reloads the game unpaused" % route) + check(card() == null, "%s: Restart shows no how-to-play card" % route) + scene = await enter(route) + menu = menu_of(scene) + # Main Menu lands on the hub, unpaused, with the hub music back. + await press_pause() + check(paused and menu.is_open(), "%s: paused before Main Menu" % route) + menu.menu_button.pressed.emit() + await settle_route() + check(current_scene != null and current_scene.name == "MainMenu" and not paused, "%s: Main Menu lands on the hub, unpaused" % route) + check(audio.music.stream == audio.default_track and audio.music.playing and not audio.music.stream_paused, + "%s: the hub music is back" % route) + check(audio.music.process_mode == Node.PROCESS_MODE_INHERIT, "%s: the hub music pauses with the tree again" % route) + await wait(0.2) + +func check_runner_leaderboard() -> void: + for i in 3: + RunnerLeaderboard.submit({"run_id": "seed-%d" % i, "name": "Tester", "score": 100 + i * 10, + "duration": 60.0, "seed": 1, "submitted_at": 1700000000}, RUNNER_SCORES) + var scene := await enter("runner_game") + var menu := menu_of(scene) + await press_pause() + check(paused and menu.is_open(), "runner: paused for the leaderboard") + menu.leaderboard_button.grab_focus() + menu.leaderboard_button.pressed.emit() + await process_frame + var board: Control = menu.leaderboard + check(board != null and board.board.get_child_count() == 10 and board.close_btn.has_focus(), "runner: Leaderboard opens the top ten with Close focused") + if board == null: + return + check(board.leaderboard_path_at_open == RUNNER_SCORES and not board.reset_btn.disabled, "runner: the panel reads the game's board and offers Reset") + await capture("runner-leaderboard") + for button in menu.buttons: + check(button.disabled, "runner: the menu's %s is blocked under the board" % button.text) + # Start closes the board, not the run's pause. + await press_pause() + check(menu.leaderboard == null and paused and menu.is_open() and menu.leaderboard_button.has_focus(), + "runner: Start closes the board, keeps the run paused and refocuses Leaderboard") + # Reset asks first; Keep scores cancels; Reset clears. + menu.leaderboard_button.pressed.emit() + await process_frame + board = menu.leaderboard + var entries_before := RunnerLeaderboard.load_entries(RUNNER_SCORES).size() + board.reset_btn.pressed.emit() + await process_frame + var keep: Button = board.reset_confirm.find_child("KeepScoresButton", true, false) as Button if board.reset_confirm else null + check(keep != null and keep.has_focus(), "runner: Reset asks, with Keep scores focused") + if keep: + keep.pressed.emit() + await process_frame + check(board.reset_confirm == null and RunnerLeaderboard.load_entries(RUNNER_SCORES).size() == entries_before, "runner: Keep scores keeps them") + board.reset_btn.pressed.emit() + await process_frame + var confirm: Button = board.reset_confirm.find_child("ResetConfirmButton", true, false) as Button if board.reset_confirm else null + if confirm: + confirm.pressed.emit() + await process_frame + check(RunnerLeaderboard.load_entries(RUNNER_SCORES).is_empty() and board.reset_btn.disabled and board.close_btn.has_focus(), + "runner: Reset clears the board and disables itself") + board.close_btn.pressed.emit() + await process_frame + check(menu.leaderboard == null and paused, "runner: Close shuts the board; the run is still paused") + menu.menu_button.pressed.emit() + await settle_route() + check(current_scene != null and current_scene.name == "MainMenu" and not paused, "runner: Main Menu after the leaderboard lands on the hub") diff --git a/hoppys-adventure-arcade/tests/pause_menu.gd.uid b/hoppys-adventure-arcade/tests/pause_menu.gd.uid new file mode 100644 index 00000000..a02e8d29 --- /dev/null +++ b/hoppys-adventure-arcade/tests/pause_menu.gd.uid @@ -0,0 +1 @@ +uid://dacfmqb4p88vs diff --git a/hoppys-adventure-arcade/tests/platformer_boss.gd b/hoppys-adventure-arcade/tests/platformer_boss.gd index 69e0a8c1..45931fdc 100644 --- a/hoppys-adventure-arcade/tests/platformer_boss.gd +++ b/hoppys-adventure-arcade/tests/platformer_boss.gd @@ -133,7 +133,7 @@ func run() -> void: await frames(30) check(not level.finished, "Landing on locked MERGE does not complete level") print("BOSS TEST: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures)") - change_scene_to_file("res://scenes/platformer/platformer_menu.tscn") + change_scene_to_file("res://scenes/main_menu/main_menu.tscn") await frames(2) await root.get_node("AudioService").settle() quit(failures) diff --git a/hoppys-adventure-arcade/tests/platformer_knockout.gd b/hoppys-adventure-arcade/tests/platformer_knockout.gd index 15635a84..ea3cfd2a 100644 --- a/hoppys-adventure-arcade/tests/platformer_knockout.gd +++ b/hoppys-adventure-arcade/tests/platformer_knockout.gd @@ -103,9 +103,9 @@ func run() -> void: game.knockout.tick(seconds) var old_cutaway: WeakRef = weakref(game.knockout) var old_music: WeakRef = weakref(game.music) - root.get_node("AppRouter").go("platformer") + root.get_node("AppRouter").go("hub") await create_timer(1.3).timeout check(old_cutaway.get_ref() == null and old_music.get_ref() == null, "Exit frees cutaway and music at %.1f seconds" % seconds) - check(not paused and not root.get_node("AudioService").music.stream_paused, "Exit restores menu audio and tree") + check(not paused and not root.get_node("AudioService").music.stream_paused, "Exit restores hub audio and tree") print("PLATFORMER KNOCKOUT: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures)") quit(0 if failures == 0 else 1) diff --git a/hoppys-adventure-arcade/tests/platformer_smoke.gd b/hoppys-adventure-arcade/tests/platformer_smoke.gd index 39a216f2..ce6dd04f 100644 --- a/hoppys-adventure-arcade/tests/platformer_smoke.gd +++ b/hoppys-adventure-arcade/tests/platformer_smoke.gd @@ -205,32 +205,34 @@ func run() -> void: check(level.overlay.visible and is_equal_approx(level.overlay.modulate.a, 1.0), "Results menu fades fully in") check(level.overlay_card.position.y == 0 and retry.has_focus(), "Results menu settles with Retry focused") await capture("/tmp/hoppy-death-results.png") - paused = false - root.get_node("AppRouter").go("platformer") - await create_timer(0.7).timeout - check(current_scene.column.get_child(1).text == "LEVEL SELECT", "Platformer opens straight on Level Select") + # The results offer Retry and Main Menu; Main Menu lands on the hub with its music back. + var leave: Button = level.retry_button.get_parent().get_child(level.retry_button.get_index() + 1) + check(leave.text == "Main Menu", "The results offer Main Menu after Retry") + leave.pressed.emit() + check(await settles_on("res://scenes/main_menu/main_menu.tscn"), "Main Menu on the results returns to the hub") await frames(3) - await capture("/tmp/hoppy-level-select.png") + check(not paused, "The hub is unpaused after the results") check(not root.get_node("AudioService").music.stream_paused, "Menu music restored") check(root.get_node("AudioService").music.process_mode == Node.PROCESS_MODE_INHERIT, "The hub music pauses with the tree again outside the level") - # Both ways back from Level Select land on the hub. - var back: Button = current_scene.column.get_child(current_scene.column.get_child_count() - 1) - check(back.text == "← Main Menu", "Level Select offers the way back to the hub") - back.pressed.emit() - check(await settles_on("res://scenes/main_menu/main_menu.tscn"), "← Main Menu returns to the hub") - check(await root.get_node("AppRouter").go("platformer") and await settles_on("res://scenes/platformer/platformer_menu.tscn"), "Platformer reopens on Level Select") - if current_scene.scene_file_path != "res://scenes/platformer/platformer_menu.tscn": + # The pause menu's Main Menu lands on the hub too, through real input for the pause itself. + check(await root.get_node("AppRouter").go("bay_area_blitz") and await settles_on("res://scenes/platformer/bay_area_blitz.tscn"), "The level reopens from the hub") + if current_scene.scene_file_path != "res://scenes/platformer/bay_area_blitz.tscn": quit(failures) return - var cancel := InputEventAction.new() - cancel.action = "ui_cancel" - cancel.pressed = true - # Real input dispatch, so a focused control that swallowed ui_cancel would fail this check. - Input.parse_input_event(cancel) - var release := cancel.duplicate() as InputEventAction + current_scene._resume() + var pause_press := InputEventAction.new() + pause_press.action = "pause" + pause_press.pressed = true + # Real input dispatch, so a focused control that swallowed the press would fail this check. + Input.parse_input_event(pause_press) + var release := pause_press.duplicate() as InputEventAction release.pressed = false Input.parse_input_event(release) - check(await settles_on("res://scenes/main_menu/main_menu.tscn"), "ui_cancel on Level Select returns to the hub") + await frames(2) + check(paused and current_scene.pause_menu.is_open() and current_scene.is_player_paused(), "Esc opens the pause menu") + check(current_scene.pause_menu.menu_button.text == "Main Menu", "The pause menu offers Main Menu") + current_scene.pause_menu.menu_button.pressed.emit() + check(await settles_on("res://scenes/main_menu/main_menu.tscn"), "Main Menu on the pause menu returns to the hub") print("PLATFORMER SMOKE: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures)") await frames(35) await root.get_node("AudioService").settle() diff --git a/hoppys-adventure-arcade/tests/platformer_stage_clear.gd b/hoppys-adventure-arcade/tests/platformer_stage_clear.gd index 7e03dc5b..f98ea05a 100644 --- a/hoppys-adventure-arcade/tests/platformer_stage_clear.gd +++ b/hoppys-adventure-arcade/tests/platformer_stage_clear.gd @@ -43,7 +43,7 @@ func run() -> void: var rest := await watch(game.stage_clear, stream.get_length()) check(early.starts + rest.starts == 1 and not game.stage_clear.playing, route + ": the stage-clear stinger starts once and stops after one playback (%d starts)" % (early.starts + rest.starts)) - var leave := game.find_children("*", "Button", true, false).filter(func(b: Button) -> bool: return b.text == "Return to Platformer Menu") + var leave := game.find_children("*", "Button", true, false).filter(func(b: Button) -> bool: return b.text == "Main Menu") check(not leave.is_empty(), route + ": the results offer a way out") if not leave.is_empty(): game.stage_clear.play() diff --git a/hoppys-adventure-arcade/tests/runner_logic.gd b/hoppys-adventure-arcade/tests/runner_logic.gd index de7af293..dac99d7b 100644 --- a/hoppys-adventure-arcade/tests/runner_logic.gd +++ b/hoppys-adventure-arcade/tests/runner_logic.gd @@ -2203,13 +2203,13 @@ func _test_boss_checkpoint() -> void: _free_rig(rig) runner_game_script.set(&"pending_boss_checkpoint", {}) - # --- the first route wins: Esc then Retry Boss never leaks a checkpoint into the menu's Play --- + # --- the first route wins: Esc then Retry Boss never leaks a checkpoint into the next run --- rig = _checkpoint_rig(false) game = rig["game"] game.boss_checkpoint = {"stage_index": 2, "seed": seed} game.go_to_menu() game.retry_boss() - check(game.routes == ["runner"], "24b route: only the menu route is taken, got %s" % [game.routes]) + check(game.routes == ["hub"], "24b route: only the hub route is taken, got %s" % [game.routes]) check(_pending_checkpoint().is_empty(), "24b route: Retry Boss after Esc leaves no pending checkpoint") _free_rig(rig) diff --git a/hoppys-adventure-arcade/tests/runner_perf_probe.gd b/hoppys-adventure-arcade/tests/runner_perf_probe.gd index da2fb49a..9bdec83d 100644 --- a/hoppys-adventure-arcade/tests/runner_perf_probe.gd +++ b/hoppys-adventure-arcade/tests/runner_perf_probe.gd @@ -4,7 +4,7 @@ extends SceneTree ## Add -- boss_cinematic=true for the opt-in full intro and defeat capture across stages 1-3. ## Add -- run_intro=true to open the run on the full run intro (contract 2.7 §11.15) instead of ## opting out, and report its frames apart from gameplay, with each beat and the GO hand-over named. -## Plays an autopilot run from the runner menu's Play route and attributes every slow frame to what +## Plays an autopilot run from the hub's runner tile and attributes every slow frame to what ## happened on it (pickup, chunk spawn, boss, stage). Writes a throwaway leaderboard only. const HITCH_MS := 25.0 const BOSS_DRAW_BUDGET := 40 diff --git a/hoppys-adventure-arcade/tests/runner_pickup_hitch.gd b/hoppys-adventure-arcade/tests/runner_pickup_hitch.gd index 22547f63..dfe39d38 100644 --- a/hoppys-adventure-arcade/tests/runner_pickup_hitch.gd +++ b/hoppys-adventure-arcade/tests/runner_pickup_hitch.gd @@ -1,25 +1,20 @@ extends SceneTree ## Gate: grabbing an item must never stall a frame. Rendered runs only (headless does not draw, so ## shader compiles and uploads would not show): -## Godot --always-on-top --path hoppys-adventure-arcade --script res://tests/runner_pickup_hitch.gd [-- via_menu=1] +## Godot --always-on-top --path hoppys-adventure-arcade --script res://tests/runner_pickup_hitch.gd ## Fresh process, nothing warmed by hand: every power-up kind is placed in Hoppy's lane during a live ## autopilot run and grabbed for the FIRST time. For each kind it records the worst frame from the ## pickup appearing to COLLECT_FRAMES after the grab. Fails if any frame exceeds LIMIT_MS. -## via_menu=1 first shows the runner menu for MENU_SECONDS (the normal route into a run). const PowerUpDefs = preload("res://scenes/runner/powerups/power_up_defs.gd") const LIMIT_MS := 25.0 const COLLECT_FRAMES := 20 -const MENU_SECONDS := 4.0 const PLACE_Z := -9.0 const ATTEMPT_SECONDS := 4.0 var game: Node var failures := 0 var last := 0 -var via_menu := false func _initialize() -> void: - for arg in OS.get_cmdline_user_args(): - if arg == "via_menu=1": via_menu = true # A window close or app quit request reaches AppRouter, which quits with code 0 a second later: # the run would end silently and look like a pass to anything reading only the exit code. root.close_requested.connect(func(): @@ -56,14 +51,6 @@ func run() -> void: return root.size = Vector2i(1280, 720) last = Time.get_ticks_usec() - if via_menu: - var menu := (load("res://scenes/runner/runner_menu.tscn") as PackedScene).instantiate() - root.add_child(menu) - var until := Time.get_ticks_msec() + int(MENU_SECONDS * 1000) - while Time.get_ticks_msec() < until: - await frame() - menu.queue_free() - await frame() game = (load("res://scenes/runner/runner_game.tscn") as PackedScene).instantiate() game.autostart = false game.leaderboard_path = OS.get_temp_dir().path_join("runner_pickup_hitch_leaderboard.cfg") @@ -90,7 +77,7 @@ func run() -> void: if not ok: failures += 1 print("PICKUP HITCH %-16s worst frame %6.1f ms %s" % [kind, result, "ok" if ok else "OVER %.0f ms" % LIMIT_MS]) - print("PICKUP HITCH: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures, worst %.1f ms, limit %.0f ms, via_menu=%s)" % [worst_overall, LIMIT_MS, via_menu]) + print("PICKUP HITCH: ", "PASS" if failures == 0 else "FAIL", " (", failures, " failures, worst %.1f ms, limit %.0f ms)" % [worst_overall, LIMIT_MS]) game.queue_free() await create_timer(0.3).timeout quit(failures) diff --git a/hoppys-adventure-arcade/tests/runner_scaffold_check.gd b/hoppys-adventure-arcade/tests/runner_scaffold_check.gd index d55a35bf..db5601d3 100644 --- a/hoppys-adventure-arcade/tests/runner_scaffold_check.gd +++ b/hoppys-adventure-arcade/tests/runner_scaffold_check.gd @@ -1,6 +1,6 @@ extends SceneTree -## Contract scaffold check: runner_game.tscn and runner_menu.tscn load, the contract §3 tree is -## complete and the contract §4 facade exists. +## Contract scaffold check: runner_game.tscn loads, the contract §3 tree is complete, the contract +## §4 facade exists and the pause menu carries the leaderboard. ## Run with --path --script res://tests/runner_scaffold_check.gd. const HazardDefs = preload("res://scenes/runner/hazards/hazard_defs.gd") @@ -244,22 +244,12 @@ func run() -> void: await process_frame check(not paused, "freeing RunnerGame must leave the tree unpaused") - var menu := _instantiate("res://scenes/runner/runner_menu.tscn") - if menu != null: - root.add_child(menu) - for i in 3: - await process_frame - check(menu.name == "RunnerMenu", "runner_menu.tscn root is not named RunnerMenu") - check(menu.buttons.size() == 4, - "runner menu should offer Play / Leaderboard / Return to Main Menu / Quit Game (contract §2)") - menu.free() - await process_frame _check_hazards() _check_power_ups() # Routing: runner_game resolves, the tree is never handed over paused, and the facade's - # go_to_menu() lands back on the runner menu. + # go_to_menu() lands back on the hub. router.go("runner_game") var routed := await _wait_router_idle(router) check(routed, "AppRouter.go(\"runner_game\") never went idle") @@ -275,8 +265,8 @@ func run() -> void: current_scene.go_to_menu() var returned := await _wait_router_idle(router) check(returned, "go_to_menu() left AppRouter busy") - check(current_scene.scene_file_path == router.ROUTES["runner"], - "go_to_menu() did not return to the runner menu") + check(current_scene.scene_file_path == router.ROUTES["hub"], + "go_to_menu() did not return to the hub") check(not router.busy, "AppRouter stayed busy after routing") await _report() diff --git a/hoppys-adventure-arcade/tests/runner_smoke.gd b/hoppys-adventure-arcade/tests/runner_smoke.gd index 6d38f209..6863969f 100644 --- a/hoppys-adventure-arcade/tests/runner_smoke.gd +++ b/hoppys-adventure-arcade/tests/runner_smoke.gd @@ -766,10 +766,6 @@ func _routing_phase() -> void: check(current_scene != null and current_scene.scene_file_path == router.ROUTES["runner_game"], "pass %d did not land on runner_game.tscn" % (i + 1)) check(not paused, "pass %d left the tree paused" % (i + 1)) - router.go("runner") - await _wait_until(func() -> bool: return not router.busy, 10.0) - check(current_scene != null and current_scene.scene_file_path == router.ROUTES["runner"], - "the runner menu did not load") router.go("hub") await _wait_until(func() -> bool: return not router.busy, 10.0) check(current_scene != null and current_scene.name == "MainMenu", "the hub did not load") diff --git a/hoppys-adventure-arcade/tests/runner_synth_threads.gd b/hoppys-adventure-arcade/tests/runner_synth_threads.gd index c8ee801b..f83a6341 100644 --- a/hoppys-adventure-arcade/tests/runner_synth_threads.gd +++ b/hoppys-adventure-arcade/tests/runner_synth_threads.gd @@ -1,5 +1,5 @@ extends SceneTree -## The runner menu's prewarm renders every cue at once on WorkerThreadPool, one task per recipe +## The runner's prewarm renders every cue at once on WorkerThreadPool, one task per recipe ## (environment/hifi/prewarm.gd). Godot 4.7's VM caches an untyped operator's evaluator in the ## shared bytecode the first time that instruction runs (gdscript_vm.cpp OPCODE_OPERATOR). It ## stores the signature, then the function pointer, with no synchronisation, so a thread arriving diff --git a/hoppys-adventure-arcade/tests/runner_visual_smoke.gd b/hoppys-adventure-arcade/tests/runner_visual_smoke.gd index 477a59af..a795ee31 100644 --- a/hoppys-adventure-arcade/tests/runner_visual_smoke.gd +++ b/hoppys-adventure-arcade/tests/runner_visual_smoke.gd @@ -720,7 +720,7 @@ func check_runner_ui() -> void: var pause_menu: CanvasLayer = mock.pause_menu var over: CanvasLayer = mock.game_over check(hud.get_ready.visible and not pause_menu.visible and not over.visible, "UI initial state") - check(hud.layer == 10 and pause_menu.layer == 21 and over.layer == 22, "overlay layers") + check(hud.layer == 10 and pause_menu.layer == pause_menu.LAYER and over.layer == 22, "overlay layers") var seen_actions: Array[StringName] = [] var seen_chunks: Array = [] var cleared: Array = [] @@ -1267,36 +1267,37 @@ func check_runner_full_loop() -> void: var router := root.get_node("AppRouter") var audio := root.get_node("AudioService") node_added.connect(_isolate_routed_game) - router.go("runner") + router.go("runner_game") await _wait_for(func() -> bool: return not router.busy, 5, "runner route completes") - check(current_scene != null and current_scene.name == &"RunnerMenu", "runner route is RunnerMenu") - var menu := current_scene - check(menu is Node3D and menu.buttons[0].has_focus(), "menu root and initial Play focus") - check(menu.get_node("Backdrop/Camera").fov == 55, "menu camera FOV") - check(menu.get_node("Backdrop/Hoppy").anim_state == &"run", "menu Hoppy jogs") - check(audio.music.stream == menu.Music and audio.music.volume_db == -12.0, "menu music") - menu.buttons[1].pressed.emit() + var game := current_scene + check(game != null and game.name == &"RunnerGame" and game.state == &"running", "runner_game is running") + check(game.leaderboard_path == loop_board_path and game.autopilot.enabled, "first routed run isolated with autopilot") + # The pause menu carries the leaderboard: open it over the paused run, then close it both ways. + var menu: CanvasLayer = game.get_node("Overlays/PauseMenu") + game.pause() + await frames() + check(game.paused and menu.is_open() and menu.resume_button.has_focus(), "pause opens the menu with Resume focused") + check(menu.buttons.map(func(b: Button) -> String: return b.text) == ["Resume", "Restart", "How to Play", "Leaderboard", "Main Menu"], "pause menu buttons") + menu.leaderboard_button.pressed.emit() await frames() - check(menu.modal != null and menu.board.get_child_count() == 10, "leaderboard has ten rows") - check(root.gui_get_focus_owner().text == "Close", "leaderboard focuses Close") - for i in [0, 2, 3]: - check(menu.buttons[i].disabled and menu.buttons[i].focus_mode == Control.FOCUS_NONE, "modal blocks other menu action %d" % i) - check(not menu.buttons[1].disabled and menu.buttons[1].focus_mode == Control.FOCUS_ALL, "leaderboard toggle remains enabled and focusable") + check(menu.leaderboard != null and menu.leaderboard.board.get_child_count() == 10, "leaderboard has ten rows") + check(root.gui_get_focus_owner() != null and root.gui_get_focus_owner().text == "Close", "leaderboard focuses Close") + for button in menu.buttons: + check(button.disabled and button.focus_mode == Control.FOCUS_NONE, "board blocks menu action %s" % button.text) var cancel := InputEventAction.new() cancel.action = &"ui_cancel" cancel.pressed = true - menu._unhandled_input(cancel) - check(menu.modal == null and menu.buttons[1].has_focus() and not router.busy, "cancel closes board and restores focus before routing") - menu.buttons[1].pressed.emit() - menu.buttons[1].pressed.emit() - check(menu.modal == null and menu.buttons[1].has_focus(), "leaderboard button toggles closed and restores focus") - var track: AudioStream = audio.music.stream - menu.buttons[0].pressed.emit() - await _wait_for(func() -> bool: return not router.busy, 5, "Play routes to game") - var game := current_scene - check(game != null and game.name == &"RunnerGame" and game.state == &"running", "runner_game is running") - check(game.leaderboard_path == loop_board_path and game.autopilot.enabled, "first routed run isolated with autopilot") - check(audio.music.stream == track, "menu to game keeps runner track") + menu.leaderboard._input(cancel) + await frames() + check(menu.leaderboard == null and menu.leaderboard_button.has_focus() and not router.busy and game.paused, "cancel closes the board, restores focus and keeps the run paused") + menu.leaderboard_button.pressed.emit() + await frames() + check(menu.leaderboard != null, "Leaderboard reopens") + menu.leaderboard.close_btn.pressed.emit() + await frames() + check(menu.leaderboard == null and menu.leaderboard_button.has_focus(), "Close shuts the board and restores focus") + game.resume() + check(not game.paused and not menu.is_open(), "resume closes the pause menu") var events := {"pursuit": 0, "recovery": [], "caught": 0, "finished": 0} game.pursuit_started.connect(func(_seconds: float) -> void: events.pursuit += 1) game.pursuit_recovered.connect(func(reason: StringName) -> void: events.recovery.append(reason)) @@ -1318,6 +1319,7 @@ func check_runner_full_loop() -> void: check(not over.visible and events.finished == 0, "game over waits for run_finished") await _wait_for(func() -> bool: return events.finished > 0, 5, "catch emits run_finished") check(game.state == &"finished" and events.finished == 1 and over.visible, "finished shows game over exactly once") + check(over.menu_button.text == "Main Menu", "game over offers Main Menu") check(game.submit_name("Codex"), "Codex name persists") var entries: Array = game.get_leaderboard() check(entries.size() == 1 and entries[0].name == "Codex", "temporary board contains saved run") @@ -1328,15 +1330,11 @@ func check_runner_full_loop() -> void: check(game.leaderboard_path == loop_board_path and game.autopilot.enabled, "retry is isolated before start_run") game.go_to_menu() await _wait_for(func() -> bool: return not router.busy, 5, "go_to_menu completes") - check(current_scene.name == &"RunnerMenu" and not paused, "facade returns to RunnerMenu unpaused") - # Exercise the menu's actual cancel route, which calls AppRouter.go("hub"). - current_scene._unhandled_input(cancel) - await _wait_for(func() -> bool: return not router.busy, 5, "hub route completes") - check(current_scene.name == &"MainMenu", "hub is MainMenu") + check(current_scene.name == &"MainMenu" and not paused, "facade returns to the hub unpaused") check(audio.music.stream == audio.default_track and audio.music.playing, "hub restores default music") node_added.disconnect(_isolate_routed_game) _remove_temporary_leaderboard(loop_board_path) - print("RUNNER FULL LOOP: ", "PASS" if before == failures else "FAIL", " (menu, play, hit, pursuit, %ss timer recovery, hit, hit, caught, finished, game over, Codex, retry, menu, hub, default music; isolated board removed)" % recovery_seconds) + print("RUNNER FULL LOOP: ", "PASS" if before == failures else "FAIL", " (play, pause, leaderboard, hit, pursuit, %ss timer recovery, hit, hit, caught, finished, game over, Codex, retry, hub, default music; isolated board removed)" % recovery_seconds) current_scene.free() await frames() @@ -1353,72 +1351,82 @@ func check_runner_menu_reset() -> void: }, reset_board_path) var router := root.get_node("AppRouter") - router.go("runner") + if not node_added.is_connected(_isolate_routed_game): + node_added.connect(_isolate_routed_game) + router.go("runner_game") await _wait_for(func() -> bool: return not router.busy, 5, "reset test: runner route completes") - var menu := current_scene - check(menu != null and menu.name == &"RunnerMenu", "reset test: at RunnerMenu") - menu.leaderboard_path = reset_board_path + node_added.disconnect(_isolate_routed_game) + var game := current_scene + check(game != null and game.name == &"RunnerGame" and game.state == &"running", "reset test: at a running RunnerGame") + game.leaderboard_path = reset_board_path + var menu: CanvasLayer = game.get_node("Overlays/PauseMenu") + game.pause() + await frames() # Open leaderboard. Check initial state: Reset enabled, Close focused. - menu.buttons[1].pressed.emit() + menu.leaderboard_button.pressed.emit() await frames() - check(menu.modal != null and menu.board != null, "reset test: leaderboard panel open") - check(is_instance_valid(menu.reset_btn) and not menu.reset_btn.disabled, "reset test: Reset scores enabled for non-empty board") - check(is_instance_valid(menu.close_btn) and root.gui_get_focus_owner() == menu.close_btn, "reset test: Close has initial focus") + var board: Control = menu.leaderboard + check(board != null and board.board != null, "reset test: leaderboard panel open") + check(board != null and board.leaderboard_path_at_open == reset_board_path, "reset test: the panel reads the game's board") + if board == null: + return + check(is_instance_valid(board.reset_btn) and not board.reset_btn.disabled, "reset test: Reset scores enabled for non-empty board") + check(is_instance_valid(board.close_btn) and root.gui_get_focus_owner() == board.close_btn, "reset test: Close has initial focus") # Cancel via button: bytes unchanged, no routing, focus restored to Reset. var bytes_before := FileAccess.get_file_as_bytes(reset_board_path) - menu.reset_btn.pressed.emit() + board.reset_btn.pressed.emit() await frames() - check(menu.reset_confirm != null, "reset test: confirmation modal opens") - var keep_btn := menu.reset_confirm.find_child("KeepScoresButton", true, false) as Button if menu.reset_confirm != null else null + check(board.reset_confirm != null, "reset test: confirmation modal opens") + var keep_btn := board.reset_confirm.find_child("KeepScoresButton", true, false) as Button if board.reset_confirm != null else null check(keep_btn != null and root.gui_get_focus_owner() == keep_btn, "reset test: safe action focused on confirm open") if keep_btn != null: keep_btn.pressed.emit() await frames() - check(menu.reset_confirm == null, "reset test: button cancel closes confirmation") + check(board.reset_confirm == null, "reset test: button cancel closes confirmation") check(FileAccess.get_file_as_bytes(reset_board_path) == bytes_before, "reset test: cancel leaves board bytes unchanged") check(not router.busy, "reset test: cancel does not route") - check(is_instance_valid(menu.reset_btn) and root.gui_get_focus_owner() == menu.reset_btn, "reset test: cancel restores focus to Reset scores") + check(is_instance_valid(board.reset_btn) and root.gui_get_focus_owner() == board.reset_btn, "reset test: cancel restores focus to Reset scores") - # Cancel via ui_cancel: same guarantees. - menu.reset_btn.pressed.emit() + # Cancel via ui_cancel: same guarantees, and the press never reaches the run's pause toggle. + board.reset_btn.pressed.emit() await frames() var cancel_event := InputEventAction.new() cancel_event.action = &"ui_cancel" cancel_event.pressed = true - menu._unhandled_input(cancel_event) + board._input(cancel_event) await frames() - check(menu.reset_confirm == null, "reset test: ui_cancel closes confirmation") - check(menu.modal != null, "reset test: ui_cancel does not close leaderboard") + check(board.reset_confirm == null, "reset test: ui_cancel closes confirmation") + check(menu.leaderboard == board and game.paused, "reset test: ui_cancel does not close leaderboard or resume the run") check(FileAccess.get_file_as_bytes(reset_board_path) == bytes_before, "reset test: ui_cancel cancel leaves bytes unchanged") - check(is_instance_valid(menu.reset_btn) and root.gui_get_focus_owner() == menu.reset_btn, "reset test: ui_cancel restores focus to Reset scores") + check(is_instance_valid(board.reset_btn) and root.gui_get_focus_owner() == board.reset_btn, "reset test: ui_cancel restores focus to Reset scores") # Confirm reset: placeholder rows, zero entries, companions purged, Reset disabled, Close focused. - menu.reset_btn.pressed.emit() + board.reset_btn.pressed.emit() await frames() - var confirm_btn := menu.reset_confirm.find_child("ResetConfirmButton", true, false) as Button if menu.reset_confirm != null else null + var confirm_btn := board.reset_confirm.find_child("ResetConfirmButton", true, false) as Button if board.reset_confirm != null else null check(confirm_btn != null, "reset test: ResetConfirmButton found") if confirm_btn != null: confirm_btn.pressed.emit() await frames() - check(menu.reset_confirm == null, "reset test: confirm closes modal") + check(board.reset_confirm == null, "reset test: confirm closes modal") var reloaded: Array = RunnerLeaderboard.load_entries(reset_board_path) check(reloaded.is_empty(), "reset test: board has zero entries after reset") check(not FileAccess.file_exists(reset_board_path + ".bak"), "reset test: .bak removed after reset") check(not FileAccess.file_exists(reset_board_path + ".tmp"), "reset test: .tmp absent after reset") - check(is_instance_valid(menu.reset_btn) and menu.reset_btn.disabled, "reset test: Reset scores disabled after successful reset") - check(is_instance_valid(menu.close_btn) and root.gui_get_focus_owner() == menu.close_btn, "reset test: Close focused after successful reset") - if menu.board != null: - for row in menu.board.get_children(): + check(is_instance_valid(board.reset_btn) and board.reset_btn.disabled, "reset test: Reset scores disabled after successful reset") + check(is_instance_valid(board.close_btn) and root.gui_get_focus_owner() == board.close_btn, "reset test: Close focused after successful reset") + if board.board != null: + for row in board.board.get_children(): check(row.get_child_count() >= 2, "reset test: row has children") var lbl := row.get_child(1) as Label if row.get_child_count() >= 2 else null check(lbl != null and "---" in lbl.text, "reset test: row shows placeholder after reset") # Close the leaderboard before the failure-path test. - menu.close_btn.pressed.emit() + board.close_btn.pressed.emit() await frames() - check(menu.modal == null, "reset test: leaderboard closed") + check(menu.leaderboard == null and menu.leaderboard_button.has_focus(), "reset test: leaderboard closed") # Failure path: blocker file stands where the board directory would be. var blocker := "user://test_runner_menu_reset_blocker_%d" % OS.get_process_id() @@ -1428,40 +1436,47 @@ func check_runner_menu_reset() -> void: blocker_file.close() var blocked_path := blocker + "/leaderboard.cfg" # The blocked path can't be seeded (it can't be written), so open the seeded scratch board, then - # point the board the menu captured at open time at the blocked path before confirming. + # point the board the panel captured at open time at the blocked path before confirming. RunnerLeaderboard.submit({ "run_id": "fail-seed", "name": "Fail", "score": 50, "duration": 30.0, "seed": 1, "submitted_at": 1700000000 }, reset_board_path) - menu.leaderboard_path = reset_board_path - menu.buttons[1].pressed.emit() + menu.leaderboard_button.pressed.emit() await frames() - check(menu.modal != null, "reset test: failure-path leaderboard open") + board = menu.leaderboard + check(board != null, "reset test: failure-path leaderboard open") + if board == null: + return # _confirm_reset() clears leaderboard_path_at_open (snapshotted when the board opened), so # changing leaderboard_path here would not reach it. Redirect the snapshot instead. - menu.leaderboard_path_at_open = blocked_path - menu.reset_btn.pressed.emit() + board.leaderboard_path_at_open = blocked_path + board.reset_btn.pressed.emit() await frames() - var fail_confirm_btn := menu.reset_confirm.find_child("ResetConfirmButton", true, false) as Button if menu.reset_confirm != null else null + var fail_confirm_btn := board.reset_confirm.find_child("ResetConfirmButton", true, false) as Button if board.reset_confirm != null else null if fail_confirm_btn != null: fail_confirm_btn.pressed.emit() await frames() - check(menu.reset_confirm != null, "reset test: failure keeps confirmation open") - var status: Label = menu.confirm_status + check(board.reset_confirm != null, "reset test: failure keeps confirmation open") + var status: Label = board.confirm_status check(status != null and status.visible, "reset test: error status visible on failure") - var safe_btn := menu.reset_confirm.find_child("KeepScoresButton", true, false) as Button + var safe_btn := board.reset_confirm.find_child("KeepScoresButton", true, false) as Button check(safe_btn != null and root.gui_get_focus_owner() == safe_btn, "reset test: safe action focused on failure") else: check(false, "reset test: failure-path ResetConfirmButton not found") - # Cleanup. - menu._close_leaderboard() + # Cleanup: Start closes the confirmation, then the board, then resumes; Main Menu lands on the hub. + var pause_event := InputEventAction.new() + pause_event.action = &"pause" + pause_event.pressed = true + board._input(pause_event) + await frames() + check(board.reset_confirm == null and menu.leaderboard == board and game.paused, "reset test: Start closes the confirmation first") + board._input(pause_event) await frames() - var cancel_ev := InputEventAction.new() - cancel_ev.action = &"ui_cancel" - cancel_ev.pressed = true - menu._unhandled_input(cancel_ev) + check(menu.leaderboard == null and game.paused and menu.is_open(), "reset test: Start then closes the board and leaves the run paused") + menu.menu_button.pressed.emit() await _wait_for(func() -> bool: return not router.busy, 5, "reset test: hub route completes") + check(current_scene.name == &"MainMenu" and not paused, "reset test: Main Menu lands on the hub") if FileAccess.file_exists(blocker): DirAccess.remove_absolute(blocker) for suffix in ["", ".tmp", ".bak"]: @@ -1469,7 +1484,7 @@ func check_runner_menu_reset() -> void: if FileAccess.file_exists(p): check(DirAccess.remove_absolute(p) == OK, "reset test: scratch board cleanup %s" % suffix) check(not FileAccess.file_exists(reset_board_path), "reset test: scratch board removed") - print("RUNNER MENU RESET: ", "PASS" if before == failures else "FAIL") + print("RUNNER LEADERBOARD RESET: ", "PASS" if before == failures else "FAIL") func check_hud_legibility() -> void: var before := failures diff --git a/hoppys-adventure-arcade/tests/stage_flow.gd b/hoppys-adventure-arcade/tests/stage_flow.gd index 50ea84f7..50c77456 100644 --- a/hoppys-adventure-arcade/tests/stage_flow.gd +++ b/hoppys-adventure-arcade/tests/stage_flow.gd @@ -429,7 +429,7 @@ func steady(label: String, want: String) -> void: if game.flow.phase!="" or game.flow.veil.color.a>0.0 or game.state!=want or game.playing: held = false if want=="leaving" and game.music.playing: held = false check(held and is_equal_approx(game.flow.music_db, 0.0), label) -## Leave routes away; wait for the router, confirm the menu, then load a fresh Code City. +## Leave routes away; wait for the router, confirm the hub, then load a fresh Code City. func reload() -> void: # The router fades on a clock; a stuck route must fail the suite, not hang it. var deadline: int = Time.get_ticks_msec()+5000 @@ -439,7 +439,7 @@ func reload() -> void: quit(1) return await process_frame - check(current_scene.name=="BeatemMenu", "Leave still routes to the Beat'em Up menu") + check(current_scene.name=="MainMenu", "Leave routes to the hub") change_scene_to_file("res://scenes/beatem_up/code_city_brawl.tscn") await process_frame await process_frame @@ -471,15 +471,13 @@ func check_terminal_paths() -> void: at = "%s (stage %d)" % [phase, game.stage_index+1] if via_menu: game.pause("x") - var back: Button = null - for child in game.panel.get_children(): - if child is Button and child.text=="Return to Beat'em Up menu": back = child - if back == null: - check(false, "The pause menu offers Return during %s" % at) + var back: Button = game.pause_menu.menu_button + if back == null or not game.pause_menu.is_open(): + check(false, "The pause menu offers Main Menu during %s" % at) quit(1) return back.pressed.emit() - check(back.disabled, "The pause menu's Return disables the menu during the router fade") + check(back.disabled, "The pause menu's Main Menu disables the menu during the router fade") else: game.leave() check(not paused and not game.flow.active() and not game.music.playing, "%s during %s cancels the flow and stops music" % ["Pause-menu Return" if via_menu else "Leave", at]) steady("%s during %s: no rebuild, music restart, veil or combat for 3 s" % ["Pause-menu Return" if via_menu else "Leave", at], "leaving") diff --git a/tools/booth/macos/setup.sh b/tools/booth/macos/setup.sh index e21365df..2bf7badb 100755 --- a/tools/booth/macos/setup.sh +++ b/tools/booth/macos/setup.sh @@ -13,7 +13,7 @@ # lists what to restore by hand. # # Anything after "--" goes to the game after --booth, for example -# ... --route heroes_vs_villains -- --retries=1 --attract=beatem_up +# ... --route heroes_vs_villains -- --retries=1 --session-log=user://playtest # # --apply does this: # - copies tools/booth/watchdog.sh to ~/Library/Application Support/HoppyBooth/, and records the diff --git a/tools/booth/test_macos_setup.py b/tools/booth/test_macos_setup.py index 580a4209..d3c5d81d 100644 --- a/tools/booth/test_macos_setup.py +++ b/tools/booth/test_macos_setup.py @@ -104,9 +104,9 @@ def test_agent_runs_the_watchdog_and_the_game_in_booth_mode(self) -> None: def test_arguments_after_the_separator_go_to_the_game(self) -> None: result = self.setup("--app", str(self.app), "--route", "heroes_vs_villains", "--", "--retries=1", - "--attract=beatem_up") + "--session-log=user://playtest") self.assertEqual(self.agent(result.stdout)["ProgramArguments"][-5:], - ["--", "--booth", "--route=heroes_vs_villains", "--retries=1", "--attract=beatem_up"]) + ["--", "--booth", "--route=heroes_vs_villains", "--retries=1", "--session-log=user://playtest"]) def test_route_is_optional(self) -> None: agent = self.agent(self.setup("--app", str(self.app)).stdout)