|
| 1 | +# PR 11.92 — Asteroids Engine Render Override Closure |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Finish the Asteroids engine-ownership cleanup correctly. |
| 5 | + |
| 6 | +Asteroids must use the engine for engine-owned concerns and must not override: |
| 7 | +- canvas/background clearing |
| 8 | +- manifest background drawing |
| 9 | +- bezel/chrome drawing |
| 10 | +- manifest asset source-of-truth |
| 11 | +- font asset registration |
| 12 | + |
| 13 | +The game may still draw gameplay-specific vectors, HUD text, bullets, asteroids, ship, UFO, score, pause labels, and high-score initials UI. |
| 14 | + |
| 15 | +## Evidence from uploaded Asteroids.zip |
| 16 | +Remaining issues found in the uploaded Asteroids bundle: |
| 17 | + |
| 18 | +1. `games/Asteroids/game/AsteroidsGameScene.js` |
| 19 | + - `hasManifestBackgroundLayer(engine)` reads engine background state from the game. |
| 20 | + - `render()` draws a full-screen `renderer.drawRect(0, 0, this.world.bounds.width, this.world.bounds.height, ...)` before gameplay. |
| 21 | + - This is still a game-owned background/clear override. |
| 22 | + |
| 23 | +2. `games/Asteroids/game/AsteroidsAttractAdapter.js` |
| 24 | + - `render(renderer, options = {})` accepts `manifestBackgroundPresent`. |
| 25 | + - It draws full-screen `renderer.drawRect(0, 0, 960, 720, ...)`. |
| 26 | + - This is still an attract-mode overlay that can hide/dim the manifest background. |
| 27 | + |
| 28 | +3. `games/Asteroids/game/FullscreenBezelOverlay.js` |
| 29 | + - Asteroids still has local fullscreen bezel overlay code. |
| 30 | + - Bezel/chrome is engine-owned and manifest-driven. This file must not remain wired into Asteroids runtime. |
| 31 | + |
| 32 | +4. `games/Asteroids/game.manifest.json` |
| 33 | + - `image.asteroids.bezel` is correct and must stay `/games/Asteroids/assets/images/bezel.png`. |
| 34 | + - `image.asteroids.background` is correct and must stay `/games/Asteroids/assets/images/deluxe.png`. |
| 35 | + - `font.asteroids.vector-battle` is missing from `asset-browser.assets` even though `assets/fonts/vector_battle.ttf` exists and the game uses `Vector Battle`. |
| 36 | + |
| 37 | +## Required changes |
| 38 | + |
| 39 | +### A. Remove Asteroids game-owned background detection |
| 40 | +In `games/Asteroids/game/AsteroidsGameScene.js`: |
| 41 | +- Remove `hasManifestBackgroundLayer(engine)`. |
| 42 | +- Remove `manifestBackgroundPresent` from `render()`. |
| 43 | +- Remove the full-screen background `renderer.drawRect(...)` at the start of `render()`. |
| 44 | +- Do not replace it with another full-screen clear/fill. |
| 45 | + |
| 46 | +Allowed: keep starfield/gameplay vector drawing if it is intentional gameplay rendering. |
| 47 | + |
| 48 | +### B. Remove attract adapter full-screen background override |
| 49 | +In `games/Asteroids/game/AsteroidsAttractAdapter.js`: |
| 50 | +- Remove `options.manifestBackgroundPresent` logic. |
| 51 | +- Remove the full-screen `renderer.drawRect(0, 0, 960, 720, ...)` from `render()`. |
| 52 | +- Do not add a replacement full-screen opaque or darkening rect. |
| 53 | +- If text contrast is needed later, use small local text panels only, not full-screen fills. |
| 54 | + |
| 55 | +### C. Remove Asteroids-local bezel ownership |
| 56 | +Search Asteroids for `FullscreenBezelOverlay`. |
| 57 | +- Remove imports/usages from Asteroids runtime. |
| 58 | +- Delete `games/Asteroids/game/FullscreenBezelOverlay.js` only if no imports remain. |
| 59 | +- Do not add a shim or alias. |
| 60 | +- Do not move bezel ownership into another Asteroids-local file. |
| 61 | + |
| 62 | +### D. Keep canonical bezel filename |
| 63 | +Do not change the bezel filename. |
| 64 | + |
| 65 | +Required manifest entry: |
| 66 | + |
| 67 | +```json |
| 68 | +"image.asteroids.bezel": { |
| 69 | + "path": "/games/Asteroids/assets/images/bezel.png", |
| 70 | + "kind": "image", |
| 71 | + "source": "workspace-manager", |
| 72 | + "stretchOverride": { |
| 73 | + "uniformEdgeStretchPx": 10 |
| 74 | + } |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +Forbidden: |
| 79 | +- `bezel1.png` |
| 80 | +- alternate bezel filenames |
| 81 | +- `asset-browser.assets.bezel.stretchOverride` |
| 82 | + |
| 83 | +### E. Add font asset to manifest asset-browser assets |
| 84 | +In `games/Asteroids/game.manifest.json`, under `tools.asset-browser.assets`, add: |
| 85 | + |
| 86 | +```json |
| 87 | +"font.asteroids.vector-battle": { |
| 88 | + "path": "/games/Asteroids/assets/fonts/vector_battle.ttf", |
| 89 | + "kind": "font", |
| 90 | + "source": "workspace-manager" |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +Do not rename the font file. |
| 95 | + |
| 96 | +### F. Validation searches |
| 97 | +After edits, these must pass: |
| 98 | + |
| 99 | +```powershell |
| 100 | +Select-String -Path .\games\Asteroids\**\*.js -Pattern "hasManifestBackgroundLayer" |
| 101 | +Select-String -Path .\games\Asteroids\**\*.js -Pattern "manifestBackgroundPresent" |
| 102 | +Select-String -Path .\games\Asteroids\**\*.js -Pattern "FullscreenBezelOverlay" |
| 103 | +Select-String -Path .\games\Asteroids\**\*.js -Pattern "bezel1.png" |
| 104 | +``` |
| 105 | + |
| 106 | +Expected: no results. |
| 107 | + |
| 108 | +Also inspect remaining full-screen `drawRect` calls: |
| 109 | + |
| 110 | +```powershell |
| 111 | +Select-String -Path .\games\Asteroids\**\*.js -Pattern "drawRect\(0, 0" |
| 112 | +``` |
| 113 | + |
| 114 | +Allowed only for clearly modal/local overlays that are not background/chrome ownership. Pause and initials overlays may remain if they are gameplay UI states and intentionally translucent. They must not be used as background rendering. |
| 115 | + |
| 116 | +### G. Browser validation |
| 117 | +Open Asteroids and verify: |
| 118 | +- no 404s for `bezel.png`, `deluxe.png`, or `vector_battle.ttf` |
| 119 | +- background visible in menu |
| 120 | +- background visible in attract |
| 121 | +- background visible in gameplay |
| 122 | +- bezel visible in fullscreen/chrome layer |
| 123 | +- no `bezel1.png` request |
| 124 | +- no game-local bezel overlay behavior |
| 125 | + |
| 126 | +## Out of scope |
| 127 | +- Do not refactor gameplay systems. |
| 128 | +- Do not move audio to engine audio in this PR. |
| 129 | +- Do not change scoring, ship, asteroids, UFO, bullets, particles, or high-score behavior. |
| 130 | +- Do not rename assets. |
0 commit comments