Skip to content

Commit 4fd6002

Browse files
author
DavidQ
committed
PR_08_02_GAMES_BOUNDARY_NORMALIZATION
1 parent 3f401c6 commit 4fd6002

11 files changed

Lines changed: 107 additions & 23 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
MODEL: GPT-5.4
22
REASONING: medium
3-
COMMAND: Implement PR_08_01_GAMES_FLOW_STANDARDIZATION
3+
COMMAND: Implement PR_08_02_GAMES_BOUNDARY_NORMALIZATION

docs/dev/COMMIT_COMMENT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PR_08_01_GAMES_FLOW_STANDARDIZATION
1+
PR_08_02_GAMES_BOUNDARY_NORMALIZATION
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PR: PR_08_02_GAMES_BOUNDARY_NORMALIZATION
2+
3+
Boundary Model (Asteroids-targeted normalization)
4+
5+
Gameplay Layer
6+
- games/Asteroids/game/*
7+
- Owns runtime orchestration and mode transitions.
8+
- Consumes rules constants from games/Asteroids/rules/gameFlowRules.js.
9+
10+
Entities Layer
11+
- games/Asteroids/entities/*
12+
- Owns simulation objects (ship, asteroid, bullet, ufo).
13+
14+
Levels Layer
15+
- games/Asteroids/levels/*
16+
- Reserved for stage/layout definitions.
17+
18+
Rules Layer
19+
- games/Asteroids/rules/gameFlowRules.js
20+
- Owns game-flow constants and flow contract primitives shared by flow + gameplay.
21+
22+
Assets Layer
23+
- games/Asteroids/assets/* and games/Asteroids/platform/assets/*
24+
- Owns game-local media and authored content only.
25+
26+
Shared vs Game-specific Utilities
27+
- Shared (cross-game/engine): /src/engine/* and src/shared/*.
28+
- Game-specific: games/Asteroids/systems/* and games/Asteroids/utils/*.
29+
- Normalization applied: game-flow constants moved from gameplay/flow duplication into rules surface.
30+
31+
Applied normalization
32+
- Added rules module: games/Asteroids/rules/gameFlowRules.js.
33+
- flow/attract.js, flow/intro.js, flow/highscore.js now read rule constants from rules layer.
34+
- game/AsteroidsGameScene.js now reads return/auto-exit values from rules layer.
35+
- index.js flow map now includes highscore flow as a first-class boundary member.
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
PR: PR_08_01_GAMES_FLOW_STANDARDIZATION
1+
PR: PR_08_02_GAMES_BOUNDARY_NORMALIZATION
22

33
Validation Commands
4+
- node --check games/Asteroids/rules/gameFlowRules.js
45
- node --check games/Asteroids/flow/attract.js
56
- node --check games/Asteroids/flow/intro.js
67
- node --check games/Asteroids/flow/highscore.js
8+
- node --check games/Asteroids/game/AsteroidsGameScene.js
9+
- node --check games/Asteroids/index.js
10+
- node tests/runtime/LaunchSmokeAllEntries.test.mjs
711

8-
Transition Validation
9-
- attract.nextFlowId => intro (exists)
10-
- intro.nextFlowId => highscore (exists)
11-
- highscore.nextFlowId => attract (exists)
12+
Checks
13+
- no engine files modified
14+
- no feature behavior intentionally changed
15+
- flow/rules/gameplay boundaries now reference rules constants from one source
16+
- highscore flow included in normalized game flow map
1217

1318
Result
1419
- PASS
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# PR_08_02_GAMES_BOUNDARY_NORMALIZATION
2+
3+
## Purpose
4+
Normalize boundaries between gameplay, entities, levels, rules, and assets.
5+
6+
## Scope
7+
- no engine changes
8+
- no feature additions
9+
10+
## Tasks
11+
- define boundaries for games layer
12+
- separate gameplay vs entities vs levels vs rules
13+
- enforce asset ownership rules
14+
- identify shared vs game-specific utilities
15+
16+
## Deliverables
17+
- boundary_model.txt
18+
- validation_checklist.txt
19+
20+
## Output
21+
<project folder>/tmp/PR_08_02_GAMES_BOUNDARY_NORMALIZATION.zip

games/Asteroids/flow/attract.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { createAsteroidsShowcaseDebugPlugin } from "../debug/asteroidsShowcaseDebug.js";
2+
import {
3+
ASTEROIDS_FLOW_CONTRACT_VERSION,
4+
ASTEROIDS_GAME_OVER_RETURN_MODE,
5+
ASTEROIDS_GAME_OVER_RETURN_RESET_IDLE
6+
} from "../rules/gameFlowRules.js";
27

3-
export const ASTEROIDS_NEW_GAME_OVER_RETURN_MODE = "menu";
4-
export const ASTEROIDS_NEW_GAME_OVER_RETURN_RESET_IDLE = true;
5-
export const ASTEROIDS_FLOW_CONTRACT_VERSION = "1";
8+
export const ASTEROIDS_NEW_GAME_OVER_RETURN_MODE = ASTEROIDS_GAME_OVER_RETURN_MODE;
9+
export const ASTEROIDS_NEW_GAME_OVER_RETURN_RESET_IDLE = ASTEROIDS_GAME_OVER_RETURN_RESET_IDLE;
610
export const ASTEROIDS_ATTRACT_FLOW_NEXT_ID = "intro";
711

812
export const attractFlow = Object.freeze({

games/Asteroids/flow/highscore.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { createAsteroidsShowcaseDebugPlugin } from "../debug/asteroidsShowcaseDebug.js";
2+
import {
3+
ASTEROIDS_FLOW_CONTRACT_VERSION,
4+
ASTEROIDS_HIGHSCORE_AUTO_EXIT_SECONDS,
5+
ASTEROIDS_HIGHSCORE_STATUS
6+
} from "../rules/gameFlowRules.js";
27

3-
export const ASTEROIDS_FLOW_CONTRACT_VERSION = "1";
48
export const ASTEROIDS_HIGHSCORE_FLOW_NEXT_ID = "attract";
5-
export const ASTEROIDS_HIGHSCORE_AUTO_EXIT_SECONDS = 12;
6-
export const ASTEROIDS_HIGHSCORE_STATUS = "High scores";
79

810
export const highscoreFlow = Object.freeze({
911
id: "highscore",

games/Asteroids/flow/intro.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { createAsteroidsShowcaseDebugPlugin } from "../debug/asteroidsShowcaseDebug.js";
2+
import {
3+
ASTEROIDS_FLOW_CONTRACT_VERSION,
4+
ASTEROIDS_GAME_OVER_AUTO_EXIT_SECONDS,
5+
ASTEROIDS_GAME_OVER_RETURN_STATUS
6+
} from "../rules/gameFlowRules.js";
27

3-
export const ASTEROIDS_NEW_GAME_OVER_AUTO_EXIT_SECONDS = 30;
4-
export const ASTEROIDS_NEW_GAME_OVER_RETURN_STATUS = "Press 1 for one player or 2 for two players.";
5-
export const ASTEROIDS_FLOW_CONTRACT_VERSION = "1";
8+
export const ASTEROIDS_NEW_GAME_OVER_AUTO_EXIT_SECONDS = ASTEROIDS_GAME_OVER_AUTO_EXIT_SECONDS;
9+
export const ASTEROIDS_NEW_GAME_OVER_RETURN_STATUS = ASTEROIDS_GAME_OVER_RETURN_STATUS;
610
export const ASTEROIDS_INTRO_FLOW_NEXT_ID = "highscore";
711

812
export const introFlow = Object.freeze({

games/Asteroids/game/AsteroidsGameScene.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import ShipDebrisSystem from '../systems/ShipDebrisSystem.js';
1313
import AsteroidsAttractAdapter from './AsteroidsAttractAdapter.js';
1414
import AsteroidsHighScoreService from '../systems/AsteroidsHighScoreService.js';
1515
import AsteroidsInitialsEntry from '../systems/AsteroidsInitialsEntry.js';
16+
import {
17+
ASTEROIDS_GAME_OVER_AUTO_EXIT_SECONDS,
18+
ASTEROIDS_GAME_OVER_RETURN_MODE,
19+
ASTEROIDS_GAME_OVER_RETURN_STATUS
20+
} from '../rules/gameFlowRules.js';
1621

1722
const HUD_FONT = '"Vector Battle", monospace';
1823
const SCORE_ONE_X = 136;
@@ -21,9 +26,6 @@ const SCORE_TWO_X = 824;
2126
const LIFE_SPACING = 22;
2227
const PAUSE_OVERLAY_COLOR = 'rgba(2, 6, 23, 0.58)';
2328
const INITIALS_OVERLAY_COLOR = 'rgba(1, 6, 19, 0.62)';
24-
const GAME_OVER_AUTO_EXIT_SECONDS_DEFAULT = 30;
25-
const GAME_OVER_RETURN_MODE = 'menu';
26-
const GAME_OVER_RETURN_STATUS = 'Press 1 for one player or 2 for two players.';
2729
const LIFE_ICON_POINTS = [
2830
[14, 0],
2931
[-10, -8],
@@ -118,7 +120,7 @@ export default class AsteroidsGameScene extends Scene {
118120
1,
119121
Math.floor(
120122
Number(this.session.getGameOverAutoExitSeconds?.())
121-
|| GAME_OVER_AUTO_EXIT_SECONDS_DEFAULT,
123+
|| ASTEROIDS_GAME_OVER_AUTO_EXIT_SECONDS,
122124
),
123125
);
124126
this.gameOverAutoExitRemainingSeconds = 0;
@@ -214,8 +216,8 @@ export default class AsteroidsGameScene extends Scene {
214216
}
215217

216218
returnToIntroAttract() {
217-
this.session.mode = GAME_OVER_RETURN_MODE;
218-
this.session.status = GAME_OVER_RETURN_STATUS;
219+
this.session.mode = ASTEROIDS_GAME_OVER_RETURN_MODE;
220+
this.session.status = ASTEROIDS_GAME_OVER_RETURN_STATUS;
219221
this.attractController.resetIdle();
220222
this.resetGameOverAutoExitTimer();
221223
}

games/Asteroids/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { attractFlow } from "./flow/attract.js";
22
import { introFlow } from "./flow/intro.js";
3+
import { highscoreFlow } from "./flow/highscore.js";
34
import { createAsteroidsShowcaseDebugPlugin } from "./debug/asteroidsShowcaseDebug.js";
45
import Engine from "/src/engine/core/Engine.js";
56
import { InputService } from "/src/engine/input/index.js";
@@ -10,7 +11,8 @@ import AsteroidsGameScene from "./game/AsteroidsGameScene.js";
1011

1112
export const asteroidFlow = Object.freeze({
1213
attract: attractFlow,
13-
intro: introFlow
14+
intro: introFlow,
15+
highscore: highscoreFlow
1416
});
1517
const theme = new Theme(ThemeTokens);
1618
const BOOT_TRACE_PREFIX = "Asteroids";

0 commit comments

Comments
 (0)