Skip to content

Commit 287a3e3

Browse files
author
DavidQ
committed
Level 18.5 overlay configuration externalization.
Move stack definitions to config-driven model.
1 parent f4c3dfb commit 287a3e3

11 files changed

Lines changed: 131 additions & 66 deletions

docs/dev/CODEX_COMMANDS.md

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

44
COMMAND:
5-
Optimize overlay performance:
6-
- Minimize redundant render calls
7-
- Ensure efficient cycling transitions
8-
- Maintain current behavior
5+
Externalize overlay configuration:
6+
- Create config for overlay stacks per sample
7+
- Refactor runtime to consume config
8+
- Ensure no behavior change
99

1010
Package ZIP to <project folder>/tmp/

docs/dev/COMMIT_COMMENT.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Level 18.4 overlay performance optimization.
2-
Improve rendering efficiency and cycle responsiveness.
1+
Level 18.5 overlay configuration externalization.
2+
Move stack definitions to config-driven model.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ ] No lag during rapid cycling
2-
[ ] Stable FPS
3-
[ ] No redundant renders observed
1+
[ ] Config file defines stacks
2+
[ ] Runtime reads config
43
[ ] Behavior unchanged
4+
[ ] Per-sample mapping preserved

docs/pr/BUILD_PR.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
# BUILD_PR_LEVEL_18_4_OVERLAY_PERFORMANCE_OPTIMIZATION
1+
# BUILD_PR_LEVEL_18_5_OVERLAY_CONFIGURATION_EXTERNALIZATION
22

33
## PLAN
44

55
### Purpose
6-
Optimize overlay rendering and cycling performance under frequent updates and rapid input.
6+
Externalize overlay stack definitions and configuration to remove hardcoded mappings and improve maintainability.
77

88
### Goals
9-
- Reduce unnecessary re-renders
10-
- Ensure smooth cycling under load
11-
- Maintain stable FPS
9+
- Move overlay stack definitions to config
10+
- Allow per-sample configuration
11+
- Reduce hardcoded logic
1212

1313
---
1414

1515
## BUILD
1616

1717
### Scope
18-
- Optimize overlay render paths
19-
- Avoid redundant DOM/canvas updates
20-
- Ensure efficient cycle transitions
21-
- No behavior changes
18+
- Define external config structure for overlay stacks
19+
- Refactor runtime to read from config
20+
- Preserve existing behavior exactly
21+
- No UI or feature changes
2222

2323
### Test Steps
24-
1. Rapidly cycle overlays
25-
2. Monitor frame stability
26-
3. Switch samples quickly
27-
4. Confirm no lag or stutter
24+
1. Load samples
25+
2. Verify overlays match previous stacks
26+
3. Modify config and confirm behavior updates
2827

2928
### Expected
30-
- Smooth overlay transitions
31-
- No visible performance degradation
29+
- Same behavior as before
30+
- Config-driven overlay stacks

samples/phase-17/1708/RealGameplayMiniGameScene.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ import {
3636
OVERLAY_MISSION_FEED,
3737
OVERLAY_MISSION_READY,
3838
OVERLAY_UI_LAYER,
39-
createMiniGameOverlayCycleMap,
4039
} from '/samples/phase-17/shared/miniGameOverlayStack.js';
40+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
4141

4242
const theme = new Theme(ThemeTokens);
4343

4444
const READY_STATE = 'ready';
4545
const RUNNING_STATE = 'running';
4646
const WON_STATE = 'won';
4747
const LOST_STATE = 'lost';
48-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1708:overlay-index';
48+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1708');
4949

5050
function clamp(value, min, max) {
5151
return Math.max(min, Math.min(max, value));
@@ -93,9 +93,9 @@ export default class RealGameplayMiniGameScene extends Scene {
9393
this.resetMatch({ toReady: true });
9494

9595
this.tabDebugOverlays = createTabDebugOverlayController();
96-
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MINI_GAME_DEBUG_CYCLE_KEY);
97-
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
98-
this.setDebugOverlayCycleMap(createMiniGameOverlayCycleMap(), OVERLAY_UI_LAYER);
96+
setTabDebugOverlayCycleKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.cycleKey || MINI_GAME_DEBUG_CYCLE_KEY);
97+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.persistenceKey);
98+
this.setDebugOverlayCycleMap(DEBUG_OVERLAY_CONFIG.overlays, DEBUG_OVERLAY_CONFIG.initialOverlayId);
9999
}
100100

101101
addEvent(text) {

samples/phase-17/1709/MovementModelsLabScene.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import {
1616
stepTabDebugOverlayController,
1717
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
1818
import {
19-
createMovementOverlayCycleMap,
2019
MOVEMENT_DEBUG_CYCLE_KEY,
2120
OVERLAY_MOVEMENT_HUD,
2221
OVERLAY_MOVEMENT_RUNTIME,
2322
} from '/samples/phase-17/shared/movementOverlayStack.js';
23+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
2424
import {
2525
applyPhase16CameraMode,
2626
createPhase16ViewState,
@@ -45,7 +45,7 @@ const MODE_ORDER = Object.freeze([
4545
MOVEMENT_MODES.TANK,
4646
MOVEMENT_MODES.WEIGHTED,
4747
]);
48-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1709:overlay-index';
48+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1709');
4949

5050
function clamp(value, min, max) {
5151
return Math.max(min, Math.min(max, value));
@@ -103,11 +103,11 @@ export default class MovementModelsLabScene extends Scene {
103103
this.lastInputSummary = '';
104104
this.lastSpeed = 0;
105105
this.tabDebugOverlays = createTabDebugOverlayController({
106-
overlays: createMovementOverlayCycleMap(),
107-
initialOverlayId: OVERLAY_MOVEMENT_RUNTIME,
106+
overlays: DEBUG_OVERLAY_CONFIG.overlays,
107+
initialOverlayId: DEBUG_OVERLAY_CONFIG.initialOverlayId || OVERLAY_MOVEMENT_RUNTIME,
108108
});
109-
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MOVEMENT_DEBUG_CYCLE_KEY);
110-
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
109+
setTabDebugOverlayCycleKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.cycleKey || MOVEMENT_DEBUG_CYCLE_KEY);
110+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.persistenceKey);
111111
}
112112

113113
setCamera3D(camera3D) {

samples/phase-17/1710/RealGameplayMiniGameScene.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ import {
3636
OVERLAY_MISSION_FEED,
3737
OVERLAY_MISSION_READY,
3838
OVERLAY_UI_LAYER,
39-
createMiniGameOverlayCycleMap,
4039
} from '/samples/phase-17/shared/miniGameOverlayStack.js';
40+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
4141

4242
const theme = new Theme(ThemeTokens);
4343

4444
const READY_STATE = 'ready';
4545
const RUNNING_STATE = 'running';
4646
const WON_STATE = 'won';
4747
const LOST_STATE = 'lost';
48-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1710:overlay-index';
48+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1710');
4949

5050
function clamp(value, min, max) {
5151
return Math.max(min, Math.min(max, value));
@@ -93,9 +93,9 @@ export default class RealGameplayMiniGameScene extends Scene {
9393
this.resetMatch({ toReady: true });
9494

9595
this.tabDebugOverlays = createTabDebugOverlayController();
96-
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MINI_GAME_DEBUG_CYCLE_KEY);
97-
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
98-
this.setDebugOverlayCycleMap(createMiniGameOverlayCycleMap(), OVERLAY_UI_LAYER);
96+
setTabDebugOverlayCycleKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.cycleKey || MINI_GAME_DEBUG_CYCLE_KEY);
97+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.persistenceKey);
98+
this.setDebugOverlayCycleMap(DEBUG_OVERLAY_CONFIG.overlays, DEBUG_OVERLAY_CONFIG.initialOverlayId);
9999
}
100100

101101
addEvent(text) {

samples/phase-17/1711/MovementModelsLabScene.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import {
1616
stepTabDebugOverlayController,
1717
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
1818
import {
19-
createMovementOverlayCycleMap,
2019
MOVEMENT_DEBUG_CYCLE_KEY,
2120
OVERLAY_MOVEMENT_HUD,
2221
OVERLAY_MOVEMENT_RUNTIME,
2322
} from '/samples/phase-17/shared/movementOverlayStack.js';
23+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
2424
import {
2525
applyPhase16CameraMode,
2626
createPhase16ViewState,
@@ -45,7 +45,7 @@ const MODE_ORDER = Object.freeze([
4545
MOVEMENT_MODES.TANK,
4646
MOVEMENT_MODES.WEIGHTED,
4747
]);
48-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1711:overlay-index';
48+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1711');
4949

5050
function clamp(value, min, max) {
5151
return Math.max(min, Math.min(max, value));
@@ -103,11 +103,11 @@ export default class MovementModelsLabScene extends Scene {
103103
this.lastInputSummary = '';
104104
this.lastSpeed = 0;
105105
this.tabDebugOverlays = createTabDebugOverlayController({
106-
overlays: createMovementOverlayCycleMap(),
107-
initialOverlayId: OVERLAY_MOVEMENT_RUNTIME,
106+
overlays: DEBUG_OVERLAY_CONFIG.overlays,
107+
initialOverlayId: DEBUG_OVERLAY_CONFIG.initialOverlayId || OVERLAY_MOVEMENT_RUNTIME,
108108
});
109-
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MOVEMENT_DEBUG_CYCLE_KEY);
110-
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
109+
setTabDebugOverlayCycleKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.cycleKey || MOVEMENT_DEBUG_CYCLE_KEY);
110+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_CONFIG.persistenceKey);
111111
}
112112

113113
setCamera3D(camera3D) {

samples/phase-17/1712/GameplayMetricsTelemetryScene.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ GameplayMetricsTelemetryScene.js
66
*/
77
import { createBottomRightDebugPanelStack, drawStackedDebugPanel } from '/src/engine/debug/index.js';
88
import RealGameplayMiniGameScene from '/samples/phase-17/1708/RealGameplayMiniGameScene.js';
9-
import { LEVEL17_OVERLAY_CYCLE_KEY } from '/samples/phase-17/shared/overlayCycleInput.js';
9+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
1010
const OVERLAY_UI_LAYER = 'ui-layer';
1111
const OVERLAY_MISSION_FEED = 'mission-feed';
1212
const OVERLAY_MISSION_READY = 'mission-ready';
1313
const OVERLAY_TELEMETRY = 'telemetry';
14-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1712:overlay-index';
14+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1712');
1515

1616
function pushSample(history, value, limit = 48) {
1717
history.push(Number.isFinite(value) ? Number(value) : 0);
@@ -57,14 +57,9 @@ export default class GameplayMetricsTelemetryScene extends RealGameplayMiniGameS
5757
fpsHistory: [],
5858
collisionHistory: [],
5959
};
60-
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
61-
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_PERSISTENCE_KEY);
62-
this.setDebugOverlayCycleMap([
63-
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
64-
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },
65-
{ id: OVERLAY_MISSION_READY, label: 'MISSION READY' },
66-
{ id: OVERLAY_TELEMETRY, label: 'Telemetry Overlay' },
67-
], OVERLAY_UI_LAYER);
60+
this.setDebugOverlayCycleKey(DEBUG_OVERLAY_CONFIG.cycleKey);
61+
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_CONFIG.persistenceKey);
62+
this.setDebugOverlayCycleMap(DEBUG_OVERLAY_CONFIG.overlays, DEBUG_OVERLAY_CONFIG.initialOverlayId || OVERLAY_UI_LAYER);
6863
}
6964

7065
step3DPhysics(dtSeconds, engine) {

samples/phase-17/1713/FinalReferenceGameScene.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ FinalReferenceGameScene.js
66
*/
77
import { createBottomRightDebugPanelStack, drawStackedDebugPanel } from '/src/engine/debug/index.js';
88
import GameplayMetricsTelemetryScene from '/samples/phase-17/1712/GameplayMetricsTelemetryScene.js';
9-
import { LEVEL17_OVERLAY_CYCLE_KEY } from '/samples/phase-17/shared/overlayCycleInput.js';
9+
import { getRequiredLevel17OverlayStackConfig } from '/samples/phase-17/shared/overlayStackBySampleConfig.js';
1010
const OVERLAY_UI_LAYER = 'ui-layer';
1111
const OVERLAY_MISSION_FEED = 'mission-feed';
1212
const OVERLAY_MISSION_READY = 'mission-ready';
1313
const OVERLAY_FINAL_REFERENCE_RUNTIME = 'final-reference-runtime';
14-
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1713:overlay-index';
14+
const DEBUG_OVERLAY_CONFIG = getRequiredLevel17OverlayStackConfig('1713');
1515

1616
function clamp(value, min, max) {
1717
return Math.max(min, Math.min(max, value));
@@ -63,14 +63,9 @@ export default class FinalReferenceGameScene extends GameplayMetricsTelemetrySce
6363
completionBonus: 0,
6464
phase: 'briefing',
6565
};
66-
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
67-
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_PERSISTENCE_KEY);
68-
this.setDebugOverlayCycleMap([
69-
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
70-
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },
71-
{ id: OVERLAY_MISSION_READY, label: 'MISSION READY' },
72-
{ id: OVERLAY_FINAL_REFERENCE_RUNTIME, label: 'Final Reference Runtime' },
73-
], OVERLAY_UI_LAYER);
66+
this.setDebugOverlayCycleKey(DEBUG_OVERLAY_CONFIG.cycleKey);
67+
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_CONFIG.persistenceKey);
68+
this.setDebugOverlayCycleMap(DEBUG_OVERLAY_CONFIG.overlays, DEBUG_OVERLAY_CONFIG.initialOverlayId || OVERLAY_UI_LAYER);
7469
}
7570

7671
step3DPhysics(dtSeconds, engine) {

0 commit comments

Comments
 (0)