Skip to content

Commit 3671194

Browse files
author
DavidQ
committed
Level 18.2 input system consolidation.
Unify runtime and test input mappings for overlay cycle key.
1 parent 7cbeff3 commit 3671194

16 files changed

Lines changed: 114 additions & 65 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-
Implement runtime hardening for overlay system:
6-
- Ensure stable cycling under rapid input
7-
- Validate bottom-right anchoring under resize
8-
- Prevent flicker during sample switching
9-
- Do not change feature behavior
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
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.1 overlay runtime hardening.
2-
Improve stability for input, resize, and sample switching.
1+
Level 18.2 input system consolidation.
2+
Unify runtime and test input mappings for overlay cycle key.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ ] Rapid cycle stable
2-
[ ] No flicker on sample switch
3-
[ ] Resize keeps bottom-right anchor
4-
[ ] No stack reorder issues
1+
[ ] Runtime uses shared input mapping
2+
[ ] Tests use shared mapping
3+
[ ] No hardcoded keys remain
4+
[ ] Cycle behavior unchanged

docs/pr/BUILD_PR.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,30 @@
1-
# BUILD_PR_LEVEL_18_1_OVERLAY_RUNTIME_HARDENING
1+
# BUILD_PR_LEVEL_18_2_INPUT_SYSTEM_CONSOLIDATION
22

33
## PLAN
44

55
### Purpose
6-
Harden overlay runtime behavior after Level 17 baseline promotion to ensure stability under rapid input, resizing, and multi-sample switching.
6+
Consolidate input handling for overlay cycling and test inputs to ensure a single authoritative key mapping across runtime and tests.
77

88
### Goals
9-
- Ensure cycle key stability under rapid input
10-
- Prevent overlay flicker during sample switching
11-
- Lock bottom-right anchoring under resize
12-
- Validate overlay layering does not reorder unexpectedly
9+
- Eliminate duplicate key mappings
10+
- Ensure tests and runtime use same input source
11+
- Prevent future drift (like Tab issue)
1312

1413
---
1514

1615
## BUILD
1716

1817
### Scope
19-
- Overlay runtime stabilization (no feature expansion)
20-
- Input debounce/throttle validation
21-
- Resize handling validation
22-
- Sample switching consistency
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
2322

2423
### Test Steps
25-
1. Rapidly cycle overlays
26-
2. Switch between samples quickly
27-
3. Resize viewport
28-
4. Validate overlays remain stable and anchored
24+
1. Verify cycle key works in runtime
25+
2. Verify tests use shared mapping
26+
3. Confirm no hardcoded keys remain
2927

3028
### Expected
31-
- No flicker
32-
- No misalignment
33-
- No cycle skips
29+
- Single source of truth for cycle key
30+
- No drift between runtime and tests

samples/phase-17/1712/GameplayMetricsTelemetryScene.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ 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';
910
const OVERLAY_UI_LAYER = 'ui-layer';
1011
const OVERLAY_MISSION_FEED = 'mission-feed';
1112
const OVERLAY_MISSION_READY = 'mission-ready';
1213
const OVERLAY_TELEMETRY = 'telemetry';
13-
const DEBUG_CYCLE_KEY = 'KeyG';
1414

1515
function pushSample(history, value, limit = 48) {
1616
history.push(Number.isFinite(value) ? Number(value) : 0);
@@ -56,7 +56,7 @@ export default class GameplayMetricsTelemetryScene extends RealGameplayMiniGameS
5656
fpsHistory: [],
5757
collisionHistory: [],
5858
};
59-
this.setDebugOverlayCycleKey(DEBUG_CYCLE_KEY);
59+
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
6060
this.setDebugOverlayCycleMap([
6161
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
6262
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },

samples/phase-17/1713/FinalReferenceGameScene.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ 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';
910
const OVERLAY_UI_LAYER = 'ui-layer';
1011
const OVERLAY_MISSION_FEED = 'mission-feed';
1112
const OVERLAY_MISSION_READY = 'mission-ready';
1213
const OVERLAY_FINAL_REFERENCE_RUNTIME = 'final-reference-runtime';
13-
const DEBUG_CYCLE_KEY = 'KeyG';
1414

1515
function clamp(value, min, max) {
1616
return Math.max(min, Math.min(max, value));
@@ -62,7 +62,7 @@ export default class FinalReferenceGameScene extends GameplayMetricsTelemetrySce
6262
completionBonus: 0,
6363
phase: 'briefing',
6464
};
65-
this.setDebugOverlayCycleKey(DEBUG_CYCLE_KEY);
65+
this.setDebugOverlayCycleKey(LEVEL17_OVERLAY_CYCLE_KEY);
6666
this.setDebugOverlayCycleMap([
6767
{ id: OVERLAY_UI_LAYER, label: 'UI Layer' },
6868
{ id: OVERLAY_MISSION_FEED, label: 'Mission Feed' },

samples/phase-17/shared/miniGameOverlayStack.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ David Quesenberry
44
04/16/2026
55
miniGameOverlayStack.js
66
*/
7-
export const MINI_GAME_DEBUG_CYCLE_KEY = 'KeyG';
7+
import { LEVEL17_OVERLAY_CYCLE_KEY } from '/samples/phase-17/shared/overlayCycleInput.js';
8+
9+
export const MINI_GAME_DEBUG_CYCLE_KEY = LEVEL17_OVERLAY_CYCLE_KEY;
810
export const OVERLAY_UI_LAYER = 'ui-layer';
911
export const OVERLAY_MISSION_FEED = 'mission-feed';
1012
export const OVERLAY_MISSION_READY = 'mission-ready';

samples/phase-17/shared/movementOverlayStack.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ David Quesenberry
44
04/16/2026
55
movementOverlayStack.js
66
*/
7-
export const MOVEMENT_DEBUG_CYCLE_KEY = 'KeyG';
7+
import { LEVEL17_OVERLAY_CYCLE_KEY } from '/samples/phase-17/shared/overlayCycleInput.js';
8+
9+
export const MOVEMENT_DEBUG_CYCLE_KEY = LEVEL17_OVERLAY_CYCLE_KEY;
810
export const OVERLAY_MOVEMENT_RUNTIME = 'movement-runtime';
911
export const OVERLAY_MOVEMENT_HUD = 'movement-lab-hud';
1012

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
04/16/2026
5+
overlayCycleInput.js
6+
*/
7+
export const LEVEL17_OVERLAY_CYCLE_KEY = 'KeyG';
8+
export const LEVEL17_OVERLAY_REVERSE_MODIFIERS = Object.freeze(['ShiftLeft', 'ShiftRight']);
9+
export const LEVEL17_OVERLAY_CYCLE_LABEL = 'G/Shift+G';
10+
11+
export function isOverlayCycleReverseModifierActive(input) {
12+
for (let i = 0; i < LEVEL17_OVERLAY_REVERSE_MODIFIERS.length; i += 1) {
13+
if (input?.isDown(LEVEL17_OVERLAY_REVERSE_MODIFIERS[i]) === true) {
14+
return true;
15+
}
16+
}
17+
return false;
18+
}
19+
20+
export function getOverlayCycleInputCodes({ reverse = false } = {}) {
21+
if (!reverse) {
22+
return [LEVEL17_OVERLAY_CYCLE_KEY];
23+
}
24+
return [LEVEL17_OVERLAY_CYCLE_KEY, LEVEL17_OVERLAY_REVERSE_MODIFIERS[0]];
25+
}

samples/phase-17/shared/tabDebugOverlayCycle.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ David Quesenberry
44
04/16/2026
55
tabDebugOverlayCycle.js
66
*/
7+
import { isOverlayCycleReverseModifierActive } from '/samples/phase-17/shared/overlayCycleInput.js';
8+
79
function normalizeOverlayEntry(entry) {
810
const id = String(entry?.id ?? '').trim();
911
if (!id) {
@@ -13,10 +15,6 @@ function normalizeOverlayEntry(entry) {
1315
return { id, label };
1416
}
1517

16-
function hasShiftModifier(input) {
17-
return input?.isDown('ShiftLeft') === true || input?.isDown('ShiftRight') === true;
18-
}
19-
2018
function normalizeActiveIndex(controller) {
2119
if (!controller || !Array.isArray(controller.overlays) || controller.overlays.length === 0) {
2220
if (controller) {
@@ -144,7 +142,7 @@ export function stepTabDebugOverlayController(controller, input) {
144142
const cyclePressed = input?.isDown(cycleKey) === true;
145143
normalizeActiveIndex(controller);
146144
if (cyclePressed && controller.cycleLatch === false && controller.overlays.length > 1) {
147-
const delta = hasShiftModifier(input) ? -1 : 1;
145+
const delta = isOverlayCycleReverseModifierActive(input) ? -1 : 1;
148146
const count = controller.overlays.length;
149147
controller.activeIndex = (controller.activeIndex + delta + count) % count;
150148
}

0 commit comments

Comments
 (0)