Skip to content

Commit 7595b53

Browse files
author
DavidQ
committed
Stabilize asteroids_new runtime boot so the parallel lane becomes smoke-testable from its own index entry.
1 parent 41624db commit 7595b53

9 files changed

Lines changed: 167 additions & 28 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 3 additions & 3 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_96A_ASTEROIDS_NEW_FLATTEN_DUPLICATE_SUBFOLDERS.md.
6-
Modify only the exact target files/folders listed in the PR doc.
5+
Execute exactly docs/pr/BUILD_PR_GAMES_97A_ASTEROIDS_NEW_RUNTIME_SMOKE_STABILIZATION.md.
6+
Modify only the exact target files listed in the PR doc.
77
Do not expand scope.
88
Package the delta zip to:
9-
<project folder>/tmp/BUILD_PR_GAMES_96A_ASTEROIDS_NEW_FLATTEN_DUPLICATE_SUBFOLDERS_delta.zip
9+
<project folder>/tmp/BUILD_PR_GAMES_97A_ASTEROIDS_NEW_RUNTIME_SMOKE_STABILIZATION_delta.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Flatten duplicated nested asteroids_new subfolders and keep only the correct root-level copies.
1+
Stabilize asteroids_new runtime boot so the parallel lane becomes smoke-testable from its own index entry.

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
After commit, validate asteroids_new runtime/imports and then continue with the next testable vertical slice only.
1+
After commit, either add the next gameplay-critical slice in one testable chunk or run a stronger runtime validation pass before widening further.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
- fix duplicated nested folders created by the full-copy burst
2-
- keep only the intended root-level asteroids_new files
3-
- preserve the smoke-testable parallel lane
1+
- move asteroids_new from copied structure to smoke-testable runtime lane
2+
- allow only minimum runtime/import/path fixes across the existing parallel files
3+
- keep original Asteroids untouched

docs/dev/reports/file_tree.txt

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
docs/pr/BUILD_PR_GAMES_96A_ASTEROIDS_NEW_FLATTEN_DUPLICATE_SUBFOLDERS.md
1+
docs/pr/BUILD_PR_GAMES_97A_ASTEROIDS_NEW_RUNTIME_SMOKE_STABILIZATION.md
22
docs/dev/codex_commands.md
33
docs/dev/commit_comment.txt
44
docs/dev/next_command.txt
55
docs/dev/reports/file_tree.txt
66
docs/dev/reports/change_summary.txt
77
docs/dev/reports/validation_checklist.txt
8-
games/asteroids_new/assets/assets/*
9-
games/asteroids_new/debug/debug/*
10-
games/asteroids_new/entities/entities/*
11-
games/asteroids_new/game/game/*
12-
games/asteroids_new/systems/systems/*
8+
games/asteroids_new/index.js
9+
games/asteroids_new/flow/attract.js
10+
games/asteroids_new/flow/intro.js
11+
games/asteroids_new/game/AsteroidsAttractAdapter.js
12+
games/asteroids_new/game/AsteroidsGameScene.js
13+
games/asteroids_new/game/AsteroidsSession.js
14+
games/asteroids_new/game/AsteroidsWorld.js
15+
games/asteroids_new/debug/asteroidsShowcaseDebug.js
16+
games/asteroids_new/entities/Asteroid.js
17+
games/asteroids_new/entities/Bullet.js
18+
games/asteroids_new/entities/Ship.js
19+
games/asteroids_new/entities/Ufo.js
20+
games/asteroids_new/systems/AsteroidsAudio.js
21+
games/asteroids_new/systems/AsteroidsHighScoreService.js
22+
games/asteroids_new/systems/AsteroidsInitialsEntry.js
23+
games/asteroids_new/systems/HighScoreStore.js
24+
games/asteroids_new/systems/ShipDebrisSystem.js
25+
games/asteroids_new/utils/math.js
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- single PR purpose only
2-
- exact folders/files only
2+
- exact target files only
33
- no original Asteroids file changes
4-
- no content changes to correct root-level files
5-
- duplicate nested folders removed
6-
- asteroids_new remains smoke-testable
4+
- minimum-fix stabilization only
5+
- asteroids_new index is used as the smoke-test entry point
6+
- touched asteroids_new files parse and resolve together
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# BUILD PR — Asteroids New Runtime Smoke Stabilization
2+
3+
## Purpose
4+
Now that `games/asteroids_new` has the intended folder structure and import smoke checks are passing, make the parallel lane actually runnable as a smoke-testable game entry with the minimum runtime fixes required.
5+
6+
## Exact Target Files
7+
- `games/asteroids_new/index.js`
8+
- `games/asteroids_new/flow/attract.js`
9+
- `games/asteroids_new/flow/intro.js`
10+
- `games/asteroids_new/game/AsteroidsAttractAdapter.js`
11+
- `games/asteroids_new/game/AsteroidsGameScene.js`
12+
- `games/asteroids_new/game/AsteroidsSession.js`
13+
- `games/asteroids_new/game/AsteroidsWorld.js`
14+
- `games/asteroids_new/debug/asteroidsShowcaseDebug.js`
15+
- `games/asteroids_new/entities/Asteroid.js`
16+
- `games/asteroids_new/entities/Bullet.js`
17+
- `games/asteroids_new/entities/Ship.js`
18+
- `games/asteroids_new/entities/Ufo.js`
19+
- `games/asteroids_new/systems/AsteroidsAudio.js`
20+
- `games/asteroids_new/systems/AsteroidsHighScoreService.js`
21+
- `games/asteroids_new/systems/AsteroidsInitialsEntry.js`
22+
- `games/asteroids_new/systems/HighScoreStore.js`
23+
- `games/asteroids_new/systems/ShipDebrisSystem.js`
24+
- `games/asteroids_new/utils/math.js`
25+
26+
## Required Code Changes
27+
1. Use `games/asteroids_new/index.js` as the smoke-test entry point.
28+
2. Make only the minimum runtime/import/path fixes required so the listed `games/asteroids_new` files can boot together as a parallel Asteroids lane.
29+
3. Remove any now-unused imports created by the earlier copy/flatten work.
30+
4. Keep behavior as close as possible to the copied original Asteroids implementation.
31+
32+
## Hard Constraints
33+
- exact files only
34+
- do not modify any original `games/Asteroids/*` files
35+
- do not widen into assets, platform data, config, levels, or ui in this PR
36+
- do not add new gameplay systems
37+
- do not refactor for style
38+
- do not broaden into repo-wide cleanup
39+
- minimum-fix stabilization only
40+
41+
## Validation Steps
42+
- syntax-check all touched `games/asteroids_new` JS files
43+
- perform import/runtime smoke checks using `games/asteroids_new/index.js`
44+
- confirm no original `games/Asteroids/*` files changed
45+
46+
## Acceptance Criteria
47+
- `games/asteroids_new/index.js` is a real smoke-test entry point
48+
- the listed `games/asteroids_new` runtime files parse and resolve together
49+
- the parallel Asteroids lane is runnable enough for a meaningful smoke test
50+
- original Asteroids files remain untouched

games/asteroids_new/index.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { attractFlow } from "./flow/attract.js";
22
import { introFlow } from "./flow/intro.js";
33
import { createAsteroidsShowcaseDebugPlugin } from "./debug/asteroidsShowcaseDebug.js";
4+
import Engine from "../../src/engine/core/Engine.js";
5+
import { InputService } from "../../src/engine/input/index.js";
6+
import { Theme, ThemeTokens } from "../../src/engine/theme/index.js";
7+
import { resolveDebugConfig } from "../../src/shared/utils/debugConfigUtils.js";
8+
import AsteroidsGameScene from "./game/AsteroidsGameScene.js";
49

510
export const asteroidFlow = Object.freeze({
611
attract: attractFlow,
712
intro: introFlow
813
});
14+
const theme = new Theme(ThemeTokens);
915

1016
export function loadAsteroidsWorldModule() {
1117
return import("./game/AsteroidsWorld.js");
@@ -51,4 +57,74 @@ export function createAsteroidsTemplateBoot(initialFlow = "attract") {
5157
});
5258
}
5359

60+
export function bootAsteroidsNew({
61+
documentRef = globalThis.document ?? null,
62+
EngineClass = Engine,
63+
InputServiceClass = InputService,
64+
SceneClass = AsteroidsGameScene,
65+
createDevConsoleIntegration = null
66+
} = {}) {
67+
if (!documentRef) {
68+
return null;
69+
}
70+
71+
if (documentRef === globalThis.document && documentRef.documentElement && documentRef.body) {
72+
theme.applyDocumentTheme();
73+
}
74+
75+
const canvas = documentRef.getElementById?.("game") ?? null;
76+
if (!canvas) {
77+
return null;
78+
}
79+
80+
const input = new InputServiceClass();
81+
const engine = new EngineClass({
82+
canvas,
83+
width: 960,
84+
height: 720,
85+
fixedStepMs: 1000 / 60,
86+
input
87+
});
88+
89+
const debugConfig = resolveDebugConfig(documentRef);
90+
const devConsoleIntegration = debugConfig.debugEnabled && typeof createDevConsoleIntegration === "function"
91+
? createDevConsoleIntegration({
92+
sampleId: "asteroids-new-showcase",
93+
debugMode: debugConfig.debugMode,
94+
activatePluginsOnInit: true,
95+
pluginFeatureFlags: {
96+
asteroidsShowcaseDebug: true
97+
},
98+
plugins: [
99+
createAsteroidsShowcaseDebugPlugin()
100+
]
101+
})
102+
: null;
103+
104+
const runtime = devConsoleIntegration?.getRuntime?.();
105+
runtime?.hideOverlay?.();
106+
runtime?.hideConsole?.();
107+
108+
engine.setScene(new SceneClass({
109+
devConsoleIntegration,
110+
debugConfig
111+
}));
112+
engine.start();
113+
114+
canvas.addEventListener?.("click", async () => {
115+
const fullscreenState = engine.fullscreen?.getState?.();
116+
if (!fullscreenState?.available || fullscreenState.active) {
117+
return;
118+
}
119+
120+
await engine.fullscreen.request();
121+
});
122+
123+
return engine;
124+
}
125+
126+
if (typeof document !== "undefined") {
127+
void bootAsteroidsNew();
128+
}
129+
54130
export default asteroidFlow;

games/asteroids_new/systems/AsteroidsAudio.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ export default class AsteroidsAudio {
2222
return;
2323
}
2424

25-
this.media.register('fire', { src: '/games/Asteroids/assets/fire.wav', volume: 0.55 });
26-
this.media.register('bangLarge', { src: '/games/Asteroids/assets/bangLarge.wav', volume: 0.65 });
27-
this.media.register('bangMedium', { src: '/games/Asteroids/assets/bangMedium.wav', volume: 0.6 });
28-
this.media.register('bangSmall', { src: '/games/Asteroids/assets/bangSmall.wav', volume: 0.55 });
29-
this.media.register('beat1', { src: '/games/Asteroids/assets/beat1.wav', volume: 0.45 });
30-
this.media.register('beat2', { src: '/games/Asteroids/assets/beat2.wav', volume: 0.45 });
31-
this.loopPlayer.register('extraShip', { src: '/games/Asteroids/assets/extraShip.wav', volume: 0.6, overlapSeconds: 0.035, fadeSeconds: 0.012 });
32-
this.loopPlayer.register('thrust', { src: '/games/Asteroids/assets/thrust.wav', volume: 0.35, overlapSeconds: 0.03, fadeSeconds: 0.01 });
33-
this.loopPlayer.register('saucerLarge', { src: '/games/Asteroids/assets/saucerBig.wav', volume: 0.35, overlapSeconds: 0.03, fadeSeconds: 0.01 });
34-
this.loopPlayer.register('saucerSmall', { src: '/games/Asteroids/assets/saucerSmall.wav', volume: 0.4, overlapSeconds: 0.03, fadeSeconds: 0.01 });
25+
this.media.register('fire', { src: '/games/asteroids_new/assets/fire.wav', volume: 0.55 });
26+
this.media.register('bangLarge', { src: '/games/asteroids_new/assets/bangLarge.wav', volume: 0.65 });
27+
this.media.register('bangMedium', { src: '/games/asteroids_new/assets/bangMedium.wav', volume: 0.6 });
28+
this.media.register('bangSmall', { src: '/games/asteroids_new/assets/bangSmall.wav', volume: 0.55 });
29+
this.media.register('beat1', { src: '/games/asteroids_new/assets/beat1.wav', volume: 0.45 });
30+
this.media.register('beat2', { src: '/games/asteroids_new/assets/beat2.wav', volume: 0.45 });
31+
this.loopPlayer.register('extraShip', { src: '/games/asteroids_new/assets/extraShip.wav', volume: 0.6, overlapSeconds: 0.035, fadeSeconds: 0.012 });
32+
this.loopPlayer.register('thrust', { src: '/games/asteroids_new/assets/thrust.wav', volume: 0.35, overlapSeconds: 0.03, fadeSeconds: 0.01 });
33+
this.loopPlayer.register('saucerLarge', { src: '/games/asteroids_new/assets/saucerBig.wav', volume: 0.35, overlapSeconds: 0.03, fadeSeconds: 0.01 });
34+
this.loopPlayer.register('saucerSmall', { src: '/games/asteroids_new/assets/saucerSmall.wav', volume: 0.4, overlapSeconds: 0.03, fadeSeconds: 0.01 });
3535
this.initialized = true;
3636
}
3737

0 commit comments

Comments
 (0)