|
| 1 | + |
| 2 | +# BUILD_PR_LEVEL_10_22_TEMPLATE_BEZEL_BACKGROUND_CONVENTION_FOUNDATION |
| 3 | + |
| 4 | +## Purpose |
| 5 | +Standardize bezel + background behavior across all games and align `games/_template` with Asteroids conventions. |
| 6 | + |
| 7 | +## Scope |
| 8 | + |
| 9 | +### A. Template alignment |
| 10 | +- Ensure `games/_template` includes: |
| 11 | + - assets/images/background.png (optional) |
| 12 | + - assets/images/bezel.png (optional) |
| 13 | + - assets/images/bezel.stretch.override.json (auto-created behavior defined) |
| 14 | + |
| 15 | +### B. Background convention |
| 16 | +- `backgroundImage` |
| 17 | + - canvas-rendered |
| 18 | + - draws after clear |
| 19 | + - draws before all world/gameplay layers |
| 20 | + - gameplay-only (not attract/menu/etc) |
| 21 | + |
| 22 | +### C. Bezel convention |
| 23 | +- `fullscreenBezel` |
| 24 | + - HTML overlay |
| 25 | + - fullscreen-only |
| 26 | + - uses transparency window fit |
| 27 | + - uses shared stretch override |
| 28 | + |
| 29 | +### D. Override behavior |
| 30 | +- file: `assets/images/bezel.stretch.override.json` |
| 31 | +- auto-created at startup if bezel exists and file missing |
| 32 | +- never overwritten |
| 33 | + |
| 34 | +### E. Cross-game rule |
| 35 | +- behavior must be consistent across all games |
| 36 | +- no Asteroids-specific logic in shared pipeline |
| 37 | + |
| 38 | +## Validation |
| 39 | +- template contains correct structure |
| 40 | +- new games inherit behavior automatically |
| 41 | +- existing games not broken |
| 42 | + |
| 43 | +## Packaging |
| 44 | +`<project folder>/tmp/BUILD_PR_LEVEL_10_22_TEMPLATE_BEZEL_BACKGROUND_CONVENTION_FOUNDATION.zip` |
| 45 | + |
| 46 | +## Implementation Delta |
| 47 | +- Added shared resolver `resolveBezelStretchOverridePath` in `src/engine/runtime/gameImageConvention.js` so bezel override-path derivation remains centralized and game-agnostic. |
| 48 | +- Updated `src/engine/runtime/fullscreenBezel.js` to use that shared resolver (no Asteroids-specific path assumptions). |
| 49 | +- Aligned `_template` asset conventions by adding `games/_template/assets/tools.manifest.json` as the template asset-manifest foundation. |
| 50 | +- Strengthened template contract validation in `scripts/validate-games-template-contract.mjs` to require `assets/tools.manifest.json`. |
| 51 | +- Extended focused runtime tests in `tests/core/BackgroundImageAndFullscreenBezel.test.mjs` to validate: |
| 52 | + - Asteroids + `_template` game-agnostic image/bezel convention paths |
| 53 | + - startup/detection-based auto-create for `bezel.stretch.override.json` when missing |
| 54 | + - non-overwrite behavior when the override file already exists |
| 55 | + |
| 56 | +## Validation Evidence (2026-04-14) |
| 57 | +- `node --check src/engine/runtime/gameImageConvention.js` PASS |
| 58 | +- `node --check src/engine/runtime/fullscreenBezel.js` PASS |
| 59 | +- `node --check tests/core/BackgroundImageAndFullscreenBezel.test.mjs` PASS |
| 60 | +- `node --check scripts/validate-games-template-contract.mjs` PASS |
| 61 | +- `BackgroundImageAndFullscreenBezel` focused test PASS |
| 62 | +- `GamesTemplateContractEnforcement` focused test PASS |
| 63 | +- `AsteroidsPresentation` focused regression test PASS |
0 commit comments