|
| 1 | +# PR 11.88 — Engine-Owned Game Chrome and Layering Fix |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Fix the Asteroids/engine boundary so engine-provided systems are not bypassed by game-specific rendering. |
| 5 | + |
| 6 | +## Scope |
| 7 | +This PR fixes all currently identified issues in one targeted pass: |
| 8 | + |
| 9 | +1. `game.manifest.json` is the only source of truth for bezel/background chrome assets. |
| 10 | +2. `image.*.bezel` entries own bezel-specific `stretchOverride.uniformEdgeStretchPx`. |
| 11 | +3. `asset-browser.assets.bezel` must not contain bezel stretch metadata. |
| 12 | +4. Manifest-declared background images draw in every game state, including menu, attract, title, pause, and gameplay. |
| 13 | +5. If a manifest background exists, game/scene code must not perform an opaque clear/fill that hides it. |
| 14 | +6. Asteroids must stop suppressing or visually covering engine-managed background/chrome layers. |
| 15 | +7. Any remaining hardcoded `/assets/images/bezel.png`, `/assets/images/background.png`, `bezel1.png`, or `deluxe.png` loading outside the manifest path must be removed or routed through manifest lookup. |
| 16 | + |
| 17 | +## Architecture Rule |
| 18 | +Engine owns environment/chrome: |
| 19 | + |
| 20 | +- render loop |
| 21 | +- scene lifecycle |
| 22 | +- manifest asset loading |
| 23 | +- background layer |
| 24 | +- bezel/chrome layer |
| 25 | +- canvas clear policy for manifest backgrounds |
| 26 | + |
| 27 | +Game owns gameplay: |
| 28 | + |
| 29 | +- player objects |
| 30 | +- enemies/asteroids |
| 31 | +- bullets/projectiles |
| 32 | +- scoring/HUD text |
| 33 | +- gameplay-specific overlays that do not hide engine background |
| 34 | + |
| 35 | +## Required Changes |
| 36 | + |
| 37 | +### 1. Asteroids manifest |
| 38 | +Update `games/Asteroids/game.manifest.json` so Asteroids declares: |
| 39 | + |
| 40 | +```json |
| 41 | +"image.asteroids.bezel": { |
| 42 | + "path": "/games/Asteroids/assets/images/bezel1.png", |
| 43 | + "kind": "image", |
| 44 | + "source": "workspace-manager", |
| 45 | + "stretchOverride": { |
| 46 | + "uniformEdgeStretchPx": 10 |
| 47 | + } |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +Also ensure Asteroids background is declared as: |
| 52 | + |
| 53 | +```json |
| 54 | +"image.asteroids.background": { |
| 55 | + "path": "/games/Asteroids/assets/images/deluxe.png", |
| 56 | + "kind": "image", |
| 57 | + "source": "workspace-manager" |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +Do not add this stretch override under `asset-browser.assets.bezel`. |
| 62 | + |
| 63 | +### 2. Manifest-only chrome loading |
| 64 | +Find and remove/deprecate any code that guesses these paths: |
| 65 | + |
| 66 | +- `/games/<Game>/assets/images/bezel.png` |
| 67 | +- `/games/<Game>/assets/images/background.png` |
| 68 | +- `/assets/images/bezel.png` |
| 69 | +- `/assets/images/background.png` |
| 70 | + |
| 71 | +The loader may only request background or bezel images if a matching manifest image asset exists. |
| 72 | + |
| 73 | +### 3. Background rendering |
| 74 | +Update the background layer so a manifest-declared background is drawn regardless of game/session mode. |
| 75 | + |
| 76 | +Do not gate background drawing to gameplay-only states. |
| 77 | + |
| 78 | +The background layer should safely no-op only when no manifest background asset exists. |
| 79 | + |
| 80 | +### 4. Clear/fill policy |
| 81 | +When a manifest background exists and is loaded: |
| 82 | + |
| 83 | +- do not clear with an opaque color that hides the background |
| 84 | +- do not draw an opaque full-screen game fill before the background is visible |
| 85 | +- if a game wants mood/dimming, use transparent or semi-transparent overlays only after the engine background draw |
| 86 | + |
| 87 | +### 5. Asteroids attract/menu overlay |
| 88 | +Review `games/Asteroids` rendering paths, especially: |
| 89 | + |
| 90 | +- `AsteroidsGameScene.js` |
| 91 | +- `AsteroidsAttractAdapter.js` |
| 92 | +- any background image helper/layer such as `backgroundImage.js` |
| 93 | + |
| 94 | +Remove full-screen opaque fills that hide manifest background in menu/attract/pause/title states. |
| 95 | +Replace them with transparent or semi-transparent overlays only where visually required. |
| 96 | + |
| 97 | +### 6. Regression scan |
| 98 | +After changes, run a literal search for guessed chrome paths and stale engine-utils references: |
| 99 | + |
| 100 | +- `assets/images/bezel.png` |
| 101 | +- `assets/images/background.png` |
| 102 | +- `/src/engine/utils/` |
| 103 | +- `src/engine/utils/` |
| 104 | + |
| 105 | +Fix any active source references found. Do not modify reports or generated output unless the PR regenerates them intentionally. |
| 106 | + |
| 107 | +## Acceptance Criteria |
| 108 | + |
| 109 | +- Asteroids loads bezel from `bezel1.png` via `game.manifest.json` only. |
| 110 | +- Asteroids loads background from `deluxe.png` via `game.manifest.json` only. |
| 111 | +- `image.asteroids.bezel` contains `stretchOverride.uniformEdgeStretchPx = 10`. |
| 112 | +- No `asset-browser.assets.bezel.stretchOverride` remains. |
| 113 | +- SolarSystem and other games with no declared background/bezel do not 404 guessed chrome paths. |
| 114 | +- Manifest-declared background is visible in menu, attract, pause, title, and gameplay states. |
| 115 | +- Asteroids does not opaque-fill over the engine background. |
| 116 | +- No active source reference remains to `src/engine/utils/`. |
| 117 | + |
| 118 | +## Testing |
| 119 | +Targeted only. Do not run the full sample suite. |
| 120 | + |
| 121 | +Run: |
| 122 | + |
| 123 | +1. Open Workspace Manager. |
| 124 | +2. Launch Asteroids. |
| 125 | +3. Verify background visible on menu/attract and gameplay. |
| 126 | +4. Verify bezel uses `bezel1.png` and edge stretch applies. |
| 127 | +5. Launch SolarSystem. |
| 128 | +6. Verify no 404 for `bezel.png` or `background.png`. |
| 129 | +7. Check browser console for missing module/asset errors. |
| 130 | +8. Run literal source searches listed above. |
| 131 | + |
| 132 | +## Full sample suite |
| 133 | +Skipped. This PR touches game chrome/render layering and manifest loading only. Targeted game launch validation is sufficient. |
0 commit comments