Skip to content

Commit 08a2404

Browse files
author
DavidQ
committed
Complete Asteroids manifest geometry and remove vector map fallback defaults - PR_26133_114-asteroids-manifest-geometry-completion
1 parent eba085d commit 08a2404

13 files changed

Lines changed: 481 additions & 69 deletions
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# PR_26133_114 Asteroids Manifest Geometry Completion Report
2+
3+
## Summary
4+
- Read `docs/dev/PROJECT_INSTRUCTIONS.md` before implementation.
5+
- Used current `HEAD` (`PR_26133_113`) and `docs/dev/reports/PR_26133_113-manifest-vector-map-migration_report.md` as prior reference; `tmp/PR_26133_113-manifest-vector-map-migration_delta.zip` was not present locally.
6+
- Restored missing Asteroids Object Vector manifest geometry from known-good history, including `object.asteroids.medium-asteroid-2` and the historical ship hull/thrust geometry.
7+
- Added manifest-owned `vector.asteroids.bullet` geometry and required it during Asteroids vector-map manifest validation.
8+
- Routed Bullet collision/rendering through manifest-loaded vector-map geometry only.
9+
- Routed attract Ship, Small Asteroid, and UFO rendering through manifest Object Vector role bindings.
10+
- Kept runtime missing-map behavior visible/actionable: required vector maps fail validation, and runtime Bullet creation requires manifest-loaded polygon points.
11+
12+
## Changed Files
13+
- `games/Asteroids/game.manifest.json`
14+
- `games/Asteroids/entities/Bullet.js`
15+
- `games/Asteroids/entities/Ufo.js`
16+
- `games/Asteroids/game/AsteroidsAttractAdapter.js`
17+
- `games/Asteroids/game/AsteroidsGameScene.js`
18+
- `games/Asteroids/game/AsteroidsWorld.js`
19+
- `games/Asteroids/game/asteroidsVectorMaps.js`
20+
- `tests/games/AsteroidsAssetReferenceAdoption.test.mjs`
21+
- `tests/games/AsteroidsPresentation.test.mjs`
22+
- `tests/games/AsteroidsValidation.test.mjs`
23+
- `tests/games/AsteroidsVectorTransforms.test.mjs`
24+
- `tests/playwright/tools/WorkspaceManagerV2.spec.mjs`
25+
- `docs/dev/reports/PR_26133_114-asteroids-manifest-geometry-completion_report.md`
26+
27+
## Validation
28+
- PASS: `node --check games/Asteroids/game/asteroidsVectorMaps.js`
29+
- PASS: `node --check games/Asteroids/game/AsteroidsWorld.js`
30+
- PASS: `node --check games/Asteroids/entities/Bullet.js`
31+
- PASS: `node --check games/Asteroids/entities/Ufo.js`
32+
- PASS: `node --check games/Asteroids/game/AsteroidsGameScene.js`
33+
- PASS: `node --check games/Asteroids/game/AsteroidsAttractAdapter.js`
34+
- PASS: `node -e "JSON.parse(require('fs').readFileSync('games/Asteroids/game.manifest.json','utf8')); console.log('manifest json ok')"`
35+
- PASS: targeted Asteroids manifest geometry validation covered restored ship hull/thrust geometry, restored `object.asteroids.medium-asteroid-2`, and manifest-owned Bullet vector geometry.
36+
- PASS: targeted attract screen manifest-object validation covered Object Vector runtime rendering for Ship, Small Asteroid, and UFO from manifest role bindings.
37+
- PASS: targeted Bullet vector map validation covered Bullet collision polygon transforms and gameplay Bullet rendering through `vector.asteroids.bullet`.
38+
- PASS: targeted missing-vector-map failure validation rejects a manifest missing `vector.asteroids.bullet` with an actionable error containing the missing vector id.
39+
- PASS: targeted Asteroids tests:
40+
- `AsteroidsValidation`
41+
- `AsteroidsPresentation`
42+
- `AsteroidsVectorTransforms`
43+
- `AsteroidsAssetReferenceAdoption`
44+
- `AsteroidsPlatformDemo`
45+
- `AsteroidsHardening`
46+
- `AsteroidsCollisionTimingStress`
47+
- PASS: `git diff --check` (line-ending warnings only)
48+
- PASS: targeted rerun of Object Vector Studio interaction tests after an earlier flaky full-suite run:
49+
- `creates Object Vector Studio V2 shapes with canvas drawing and snap modes`
50+
- `edits Object Vector Studio V2 preview shapes with mouse actions and tile delete controls`
51+
- PASS: `npm run test:workspace-v2` final run (56 passed)
52+
53+
## Playwright
54+
- Playwright impacted: Yes.
55+
- Validated Workspace Manager V2 Asteroids manifest loading, 7 Object Vector assets, 9 vector maps, manifest Bullet vector persistence, attract Object Vector runtime rendering, gameplay Bullet vector rendering, and manifest save/status counts.
56+
- Expected pass behavior: Asteroids loads all required vector maps from `game.manifest.json`, attract objects render from manifest Object Vector roles, Bullet geometry comes from the manifest, and missing required vector maps fail validation.
57+
- Expected fail behavior: tests fail if Bullet geometry is hardcoded again, attract objects bypass manifest Object Vector roles, a required vector map can be missing silently, or Workspace V2 manifest counts drift.
58+
59+
## Full Samples Smoke
60+
- Skipped full samples smoke test by request.
61+
- Reason: this PR is limited to Asteroids manifest geometry completion and manifest-only vector-map loading; shared sample loader/framework behavior was not changed.
62+
63+
## Manual Validation
64+
1. Open Workspace Manager V2 and select Asteroids.
65+
2. Confirm Object Vector Studio V2 loads 7 Asteroids objects and Vector Map Editor loads 9 vectors.
66+
3. Launch Asteroids and wait for attract mode.
67+
4. Expected: attract mode renders Ship, Small Asteroid, and UFO from manifest Object Vector roles with no vector-map fallback code.
68+
5. Start gameplay and fire bullets.
69+
6. Expected: bullets render and collide using `vector.asteroids.bullet` from the manifest.
70+
7. Temporarily remove `vector.asteroids.bullet` from `games/Asteroids/game.manifest.json`.
71+
8. Expected: Asteroids vector-map validation fails visibly with the missing Bullet vector id named.
72+
73+
## ZIP
74+
- Output path: `tmp/PR_26133_114-asteroids-manifest-geometry-completion_delta.zip`

games/Asteroids/entities/Bullet.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,28 @@ David Quesenberry
55
Bullet.js
66
*/
77
import { wrap } from '../utils/math.js';
8+
import { transformPoints } from '../../../src/engine/rendering/index.js';
9+
10+
function normalizePoints(points) {
11+
return Array.isArray(points)
12+
? points.map((point) => ({
13+
x: Number(point?.x ?? 0),
14+
y: Number(point?.y ?? 0),
15+
})).filter((point) => Number.isFinite(point.x) && Number.isFinite(point.y))
16+
: [];
17+
}
818

919
export default class Bullet {
10-
constructor(x, y, vx, vy, life = 1.1) {
20+
constructor(x, y, vx, vy, life = 1.1, { collisionPoints = [] } = {}) {
1121
this.x = x;
1222
this.y = y;
1323
this.vx = vx;
1424
this.vy = vy;
1525
this.life = life;
16-
this.radius = 2;
26+
this.collisionPoints = normalizePoints(collisionPoints);
27+
if (this.collisionPoints.length < 3) {
28+
throw new Error('Asteroids Bullet requires manifest-loaded bullet vector map geometry.');
29+
}
1730
}
1831

1932
update(dtSeconds, bounds) {
@@ -27,11 +40,9 @@ export default class Bullet {
2740
}
2841

2942
getCollisionPolygon() {
30-
return [
31-
{ x: this.x - this.radius, y: this.y - this.radius },
32-
{ x: this.x + this.radius, y: this.y - this.radius },
33-
{ x: this.x + this.radius, y: this.y + this.radius },
34-
{ x: this.x - this.radius, y: this.y + this.radius },
35-
];
43+
return transformPoints(this.collisionPoints, {
44+
x: this.x,
45+
y: this.y,
46+
});
3647
}
3748
}

games/Asteroids/entities/Ufo.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ function normalizePoints(points) {
3636
}
3737

3838
export default class Ufo {
39-
constructor(bounds, type = 'large', level = 1, rng = Math.random, { collisionPoints = [] } = {}) {
39+
constructor(bounds, type = 'large', level = 1, rng = Math.random, { bulletCollisionPoints = [], collisionPoints = [] } = {}) {
4040
this.bounds = bounds;
4141
this.rng = typeof rng === 'function' ? rng : Math.random;
4242
this.type = UFO_PROFILES[type] ? type : 'large';
4343
this.profile = UFO_PROFILES[this.type];
44+
this.bulletCollisionPoints = normalizePoints(bulletCollisionPoints);
4445
this.collisionPoints = normalizePoints(collisionPoints);
4546
this.direction = this.rng() > 0.5 ? 1 : -1;
4647
this.x = this.direction > 0 ? -48 : bounds.width + 48;
@@ -97,6 +98,9 @@ export default class Ufo {
9798
Math.cos(aimAngle) * shotSpeed,
9899
Math.sin(aimAngle) * shotSpeed,
99100
fullScreenLife,
101+
{
102+
collisionPoints: this.bulletCollisionPoints,
103+
}
100104
);
101105
}
102106

games/Asteroids/game.manifest.json

Lines changed: 123 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,30 @@
325325
}
326326
]
327327
},
328+
{
329+
"id": "vector.asteroids.bullet",
330+
"label": "Bullet",
331+
"kind": "polygon",
332+
"usage": ["gameplay", "collision", "projectile"],
333+
"points": [
334+
{
335+
"x": -2,
336+
"y": -2
337+
},
338+
{
339+
"x": 2,
340+
"y": -2
341+
},
342+
{
343+
"x": 2,
344+
"y": 2
345+
},
346+
{
347+
"x": -2,
348+
"y": 2
349+
}
350+
]
351+
},
328352
{
329353
"id": "vector.asteroids.ufo.small.collision",
330354
"label": "Small UFO Collision",
@@ -588,12 +612,12 @@
588612
"locked": false,
589613
"geometry": {
590614
"point1": {
591-
"x": -3,
592-
"y": 7
615+
"x": -6,
616+
"y": 14
593617
},
594618
"point2": {
595619
"x": 0,
596-
"y": 9
620+
"y": 6
597621
}
598622
},
599623
"style": {
@@ -618,12 +642,12 @@
618642
"locked": false,
619643
"geometry": {
620644
"point1": {
621-
"x": 3,
622-
"y": 7
645+
"x": 6,
646+
"y": 14
623647
},
624648
"point2": {
625649
"x": 0,
626-
"y": 9
650+
"y": 6
627651
}
628652
},
629653
"style": {
@@ -650,19 +674,19 @@
650674
"points": [
651675
{
652676
"x": 0,
653-
"y": -16
677+
"y": -18
654678
},
655679
{
656-
"x": 9,
657-
"y": 10
680+
"x": 14,
681+
"y": 16
658682
},
659683
{
660684
"x": 0,
661-
"y": 5
685+
"y": 8
662686
},
663687
{
664-
"x": -9,
665-
"y": 10
688+
"x": -14,
689+
"y": 16
666690
}
667691
]
668692
},
@@ -697,12 +721,12 @@
697721
"locked": false,
698722
"geometry": {
699723
"point1": {
700-
"x": 0,
701-
"y": 10
724+
"x": -6,
725+
"y": 14
702726
},
703727
"point2": {
704-
"x": -3,
705-
"y": 7
728+
"x": 0,
729+
"y": 6
706730
}
707731
},
708732
"style": {
@@ -727,12 +751,12 @@
727751
"locked": false,
728752
"geometry": {
729753
"point1": {
730-
"x": 3,
731-
"y": 7
754+
"x": 6,
755+
"y": 14
732756
},
733757
"point2": {
734758
"x": 0,
735-
"y": 10
759+
"y": 6
736760
}
737761
},
738762
"style": {
@@ -1403,6 +1427,86 @@
14031427
"x": 0,
14041428
"y": 0
14051429
}
1430+
},
1431+
{
1432+
"id": "object.asteroids.medium-asteroid-2",
1433+
"name": "Medium Asteroid 2",
1434+
"shapes": [
1435+
{
1436+
"tool": "polygon",
1437+
"order": 0,
1438+
"visible": true,
1439+
"locked": false,
1440+
"geometry": {
1441+
"points": [
1442+
{
1443+
"x": -16,
1444+
"y": -10
1445+
},
1446+
{
1447+
"x": -2,
1448+
"y": -18
1449+
},
1450+
{
1451+
"x": 16,
1452+
"y": -14
1453+
},
1454+
{
1455+
"x": 20,
1456+
"y": 2
1457+
},
1458+
{
1459+
"x": 8,
1460+
"y": 18
1461+
},
1462+
{
1463+
"x": -10,
1464+
"y": 16
1465+
},
1466+
{
1467+
"x": -20,
1468+
"y": 4
1469+
}
1470+
]
1471+
},
1472+
"style": {
1473+
"fill": "transparent",
1474+
"stroke": "#CBD5E1",
1475+
"strokeWidth": 2,
1476+
"fillOpacity": 1,
1477+
"strokeOpacity": 1
1478+
},
1479+
"transform": {
1480+
"x": 0,
1481+
"y": 0,
1482+
"rotation": 0,
1483+
"scaleX": 1,
1484+
"scaleY": 1
1485+
}
1486+
}
1487+
],
1488+
"states": [
1489+
{
1490+
"id": "active",
1491+
"name": "Active",
1492+
"frames": [
1493+
{
1494+
"id": "frame-1",
1495+
"order": 0,
1496+
"durationFrames": 1,
1497+
"shapeOverrides": []
1498+
}
1499+
]
1500+
}
1501+
],
1502+
"tags": [
1503+
"asteroid",
1504+
"medium"
1505+
],
1506+
"objectOrigin": {
1507+
"x": 0,
1508+
"y": 0
1509+
}
14061510
}
14071511
]
14081512
},

0 commit comments

Comments
 (0)