Skip to content

Commit 5941c2a

Browse files
author
DavidQ
committed
Install and wire debug system in asteroids_new and enable keybindings.
1 parent d842583 commit 5941c2a

7 files changed

Lines changed: 76 additions & 17 deletions

File tree

docs/dev/CODEX_COMMANDS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ MODEL: GPT-5.4-codex
22
REASONING: high
33

44
COMMAND:
5-
Execute exactly docs/pr/BUILD_PR_GAMES_102C_ASTEROIDS_NEW_GAME_OVER_SCREEN_TIMER.md.
6-
Modify only the exact target files listed in the PR doc.
5+
Execute exactly docs/pr/BUILD_PR_GAMES_103A_ASTEROIDS_NEW_DEBUG_INSTALL_AND_KEYBINDINGS.md.
6+
Modify only listed files.
77
Do not expand scope.
8-
Package the delta zip to:
9-
<project folder>/tmp/BUILD_PR_GAMES_102C_ASTEROIDS_NEW_GAME_OVER_SCREEN_TIMER_delta.zip
8+
Package:
9+
<project folder>/tmp/BUILD_PR_GAMES_103A_ASTEROIDS_NEW_DEBUG_INSTALL_AND_KEYBINDINGS_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Make the visible Game Over screen in asteroids_new trigger a 30-second auto-return using the exact same path as Enter.
1+
Install and wire debug system in asteroids_new and enable keybindings.

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
After commit, test at games/asteroids_new/index.html: press Enter on Game Over, then wait ~30 seconds on Game Over and confirm the same return occurs.
1+
Test Ctrl+Shift+` and Shift+` in asteroids_new.
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
- bind the timer to the visible Game Over screen, not a guessed internal state
2-
- make the timeout behave exactly like pressing Enter
3-
- keep scope to the current asteroids_new game files only
1+
Wire debug init + keybindings
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
- single PR purpose only
2-
- exact target files only
3-
- no original Asteroids file changes
4-
- no new files
5-
- Enter works on visible Game Over screen
6-
- 30 seconds on visible Game Over screen triggers same return path
1+
Debug visible + keys work
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# BUILD PR — Asteroids New Debug Install + Keybindings
2+
3+
## Purpose
4+
Ensure debug system is actually installed and keybindings work:
5+
6+
- Ctrl+Shift+`
7+
- Shift+`
8+
9+
Currently debug is not active even though game runs.
10+
11+
## Exact Target Files
12+
- `games/asteroids_new/index.html`
13+
- `games/asteroids_new/index.js`
14+
- `src/engine/debug/**` (READ ONLY for reference, do not modify)
15+
- `games/asteroids_new/debug/**` (only if wiring exists)
16+
17+
## Required Code Changes
18+
19+
1. Ensure debug system is initialized
20+
- locate how other working samples enable debug
21+
- replicate the same initialization pattern in asteroids_new
22+
23+
2. Ensure debug host is attached to DOM
24+
- debug UI/container must be created and appended
25+
- must run after DOM is ready
26+
27+
3. Ensure keybindings are registered
28+
- Ctrl+Shift+` → toggle debug
29+
- Shift+` → alternate debug view
30+
- verify event listeners are attached
31+
32+
4. Verify correct import paths
33+
- debug modules must import from:
34+
`/src/engine/debug/...`
35+
- no relative path drift
36+
37+
5. Do NOT modify debug engine implementation
38+
- only fix wiring/installation
39+
40+
## Hard Constraints
41+
- no engine changes
42+
- no new debug system
43+
- no widening beyond asteroids_new wiring
44+
- minimal changes only
45+
46+
## Validation Steps
47+
- load: games/asteroids_new/index.html
48+
- press Ctrl+Shift+`
49+
- press Shift+`
50+
- confirm debug UI appears
51+
- confirm no console errors
52+
- confirm gameplay unaffected
53+
54+
## Acceptance Criteria
55+
- debug system is visible and toggleable
56+
- keybindings work
57+
- no engine modifications

games/asteroids_new/index.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Engine from "/src/engine/core/Engine.js";
55
import { InputService } from "/src/engine/input/index.js";
66
import { Theme, ThemeTokens } from "/src/engine/theme/index.js";
77
import { resolveDebugConfig } from "../../src/shared/utils/debugConfigUtils.js";
8+
import { createSampleGameDevConsoleIntegration } from "../../tools/dev/devConsoleIntegration.js";
89
import AsteroidsGameScene from "./game/AsteroidsGameScene.js";
910

1011
export const asteroidFlow = Object.freeze({
@@ -89,7 +90,7 @@ export function bootAsteroidsNew({
8990
EngineClass = Engine,
9091
InputServiceClass = InputService,
9192
SceneClass = AsteroidsGameScene,
92-
createDevConsoleIntegration = null
93+
createDevConsoleIntegration = createSampleGameDevConsoleIntegration
9394
} = {}) {
9495
let stage = "entered";
9596
traceBoot(stage);
@@ -184,12 +185,20 @@ export function bootAsteroidsNew({
184185
}
185186
}
186187

187-
if (typeof document !== "undefined") {
188+
function tryAutoBoot() {
188189
try {
189190
void bootAsteroidsNew();
190191
} catch (error) {
191192
traceBootFailure("auto-boot", error);
192193
}
193194
}
194195

196+
if (typeof document !== "undefined") {
197+
if (document.readyState === "loading") {
198+
document.addEventListener("DOMContentLoaded", tryAutoBoot, { once: true });
199+
} else {
200+
tryAutoBoot();
201+
}
202+
}
203+
195204
export default asteroidFlow;

0 commit comments

Comments
 (0)