Skip to content

Commit 54e3bc1

Browse files
author
DavidQ
committed
Level 18.3 overlay state persistence.
Preserve selected overlay across reloads and navigation.
1 parent 3671194 commit 54e3bc1

17 files changed

Lines changed: 189 additions & 25 deletions

docs/dev/CODEX_COMMANDS.md

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

44
COMMAND:
5-
Consolidate input system for overlay cycling:
6-
- Introduce shared cycle key definition
7-
- Refactor runtime to use shared input mapping
8-
- Refactor tests to use shared mapping (remove hardcoded keys)
9-
- Do not change behavior
5+
Implement overlay state persistence:
6+
- Store current overlay index
7+
- Restore on sample load
8+
- Keep implementation lightweight
9+
- Do not change cycle behavior
1010

1111
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.2 input system consolidation.
2-
Unify runtime and test input mappings for overlay cycle key.
1+
Level 18.3 overlay state persistence.
2+
Preserve selected overlay across reloads and navigation.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ ] Runtime uses shared input mapping
2-
[ ] Tests use shared mapping
3-
[ ] No hardcoded keys remain
4-
[ ] Cycle behavior unchanged
1+
[ ] Overlay index persists
2+
[ ] Restored on reload
3+
[ ] Works across samples
4+
[ ] No cycle regression

docs/pr/BUILD_PR.md

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

33
## PLAN
44

55
### Purpose
6-
Consolidate input handling for overlay cycling and test inputs to ensure a single authoritative key mapping across runtime and tests.
6+
Introduce overlay state persistence so selected overlay and cycle position are maintained across sample reloads and navigation.
77

88
### Goals
9-
- Eliminate duplicate key mappings
10-
- Ensure tests and runtime use same input source
11-
- Prevent future drift (like Tab issue)
9+
- Persist current overlay index
10+
- Restore state on reload
11+
- Maintain consistency across samples
1212

1313
---
1414

1515
## BUILD
1616

1717
### Scope
18-
- Centralize overlay cycle key definition
19-
- Update runtime references to use shared source
20-
- Update tests to reference shared input mapping
21-
- No behavior change
18+
- Store overlay state (in-memory or lightweight persistence)
19+
- Restore on sample load
20+
- No UI changes
21+
- No behavior change to cycle logic
2222

2323
### Test Steps
24-
1. Verify cycle key works in runtime
25-
2. Verify tests use shared mapping
26-
3. Confirm no hardcoded keys remain
24+
1. Select overlay
25+
2. Reload sample
26+
3. Confirm overlay restored
27+
4. Switch samples and return
2728

2829
### Expected
29-
- Single source of truth for cycle key
30-
- No drift between runtime and tests
30+
- Overlay state preserved
31+
- No regression in cycling

samples/phase-17/1708/RealGameplayMiniGameScene.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
isTabDebugOverlayActive,
2727
setTabDebugOverlayCycleKey,
2828
setTabDebugOverlayMap,
29+
setTabDebugOverlayPersistenceKey,
2930
stepTabDebugOverlayController,
3031
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
3132
import {
@@ -43,6 +44,7 @@ const READY_STATE = 'ready';
4344
const RUNNING_STATE = 'running';
4445
const WON_STATE = 'won';
4546
const LOST_STATE = 'lost';
47+
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1708:overlay-index';
4648

4749
function clamp(value, min, max) {
4850
return Math.max(min, Math.min(max, value));
@@ -91,6 +93,7 @@ export default class RealGameplayMiniGameScene extends Scene {
9193

9294
this.tabDebugOverlays = createTabDebugOverlayController();
9395
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MINI_GAME_DEBUG_CYCLE_KEY);
96+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
9497
this.setDebugOverlayCycleMap(createMiniGameOverlayCycleMap(), OVERLAY_UI_LAYER);
9598
}
9699

@@ -183,6 +186,10 @@ export default class RealGameplayMiniGameScene extends Scene {
183186
setTabDebugOverlayCycleKey(this.tabDebugOverlays, cycleKey);
184187
}
185188

189+
setDebugOverlayPersistenceKey(persistenceKey) {
190+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, persistenceKey);
191+
}
192+
186193
isDebugOverlayActive(overlayId) {
187194
return isTabDebugOverlayActive(this.tabDebugOverlays, overlayId);
188195
}

samples/phase-17/1709/MovementModelsLabScene.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
getTabDebugOverlayStatusLabel,
1313
isTabDebugOverlayActive,
1414
setTabDebugOverlayCycleKey,
15+
setTabDebugOverlayPersistenceKey,
1516
stepTabDebugOverlayController,
1617
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
1718
import {
@@ -44,6 +45,7 @@ const MODE_ORDER = Object.freeze([
4445
MOVEMENT_MODES.TANK,
4546
MOVEMENT_MODES.WEIGHTED,
4647
]);
48+
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1709:overlay-index';
4749

4850
function clamp(value, min, max) {
4951
return Math.max(min, Math.min(max, value));
@@ -105,6 +107,7 @@ export default class MovementModelsLabScene extends Scene {
105107
initialOverlayId: OVERLAY_MOVEMENT_RUNTIME,
106108
});
107109
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MOVEMENT_DEBUG_CYCLE_KEY);
110+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
108111
}
109112

110113
setCamera3D(camera3D) {

samples/phase-17/1710/RealGameplayMiniGameScene.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
isTabDebugOverlayActive,
2727
setTabDebugOverlayCycleKey,
2828
setTabDebugOverlayMap,
29+
setTabDebugOverlayPersistenceKey,
2930
stepTabDebugOverlayController,
3031
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
3132
import {
@@ -43,6 +44,7 @@ const READY_STATE = 'ready';
4344
const RUNNING_STATE = 'running';
4445
const WON_STATE = 'won';
4546
const LOST_STATE = 'lost';
47+
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1710:overlay-index';
4648

4749
function clamp(value, min, max) {
4850
return Math.max(min, Math.min(max, value));
@@ -91,6 +93,7 @@ export default class RealGameplayMiniGameScene extends Scene {
9193

9294
this.tabDebugOverlays = createTabDebugOverlayController();
9395
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MINI_GAME_DEBUG_CYCLE_KEY);
96+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
9497
this.setDebugOverlayCycleMap(createMiniGameOverlayCycleMap(), OVERLAY_UI_LAYER);
9598
}
9699

@@ -183,6 +186,10 @@ export default class RealGameplayMiniGameScene extends Scene {
183186
setTabDebugOverlayCycleKey(this.tabDebugOverlays, cycleKey);
184187
}
185188

189+
setDebugOverlayPersistenceKey(persistenceKey) {
190+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, persistenceKey);
191+
}
192+
186193
isDebugOverlayActive(overlayId) {
187194
return isTabDebugOverlayActive(this.tabDebugOverlays, overlayId);
188195
}

samples/phase-17/1711/MovementModelsLabScene.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
getTabDebugOverlayStatusLabel,
1313
isTabDebugOverlayActive,
1414
setTabDebugOverlayCycleKey,
15+
setTabDebugOverlayPersistenceKey,
1516
stepTabDebugOverlayController,
1617
} from '/samples/phase-17/shared/tabDebugOverlayCycle.js';
1718
import {
@@ -44,6 +45,7 @@ const MODE_ORDER = Object.freeze([
4445
MOVEMENT_MODES.TANK,
4546
MOVEMENT_MODES.WEIGHTED,
4647
]);
48+
const DEBUG_OVERLAY_PERSISTENCE_KEY = 'phase17:1711:overlay-index';
4749

4850
function clamp(value, min, max) {
4951
return Math.max(min, Math.min(max, value));
@@ -105,6 +107,7 @@ export default class MovementModelsLabScene extends Scene {
105107
initialOverlayId: OVERLAY_MOVEMENT_RUNTIME,
106108
});
107109
setTabDebugOverlayCycleKey(this.tabDebugOverlays, MOVEMENT_DEBUG_CYCLE_KEY);
110+
setTabDebugOverlayPersistenceKey(this.tabDebugOverlays, DEBUG_OVERLAY_PERSISTENCE_KEY);
108111
}
109112

110113
setCamera3D(camera3D) {

samples/phase-17/1712/GameplayMetricsTelemetryScene.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ 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';
1415

1516
function pushSample(history, value, limit = 48) {
1617
history.push(Number.isFinite(value) ? Number(value) : 0);
@@ -57,6 +58,7 @@ export default class GameplayMetricsTelemetryScene extends RealGameplayMiniGameS
5758
collisionHistory: [],
5859
};
5960
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
61+
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_PERSISTENCE_KEY);
6062
this.setDebugOverlayCycleMap([
6163
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
6264
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },

samples/phase-17/1713/FinalReferenceGameScene.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ 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';
1415

1516
function clamp(value, min, max) {
1617
return Math.max(min, Math.min(max, value));
@@ -63,6 +64,7 @@ export default class FinalReferenceGameScene extends GameplayMetricsTelemetrySce
6364
phase: 'briefing',
6465
};
6566
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
67+
this.setDebugOverlayPersistenceKey(DEBUG_OVERLAY_PERSISTENCE_KEY);
6668
this.setDebugOverlayCycleMap([
6769
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
6870
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },

0 commit comments

Comments
 (0)