Skip to content

Commit d6f2bee

Browse files
author
DavidQ
committed
Add Object Vector Studio V2 reusable asset library and inheritance foundation - PR_26132_016-object-vector-asset-library-and-inheritance
1 parent e484513 commit d6f2bee

13 files changed

Lines changed: 1028 additions & 41 deletions

File tree

docs/dev/reports/playwright_v8_coverage.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Exercised tool entry points detected:
2020
(0%) Workspace Manager - not exercised by this Playwright run
2121

2222
Changed runtime JS files covered:
23-
(80%) tools/object-vector-studio-v2/js/bootstrap.js - executed lines 91/91; executed functions 4/5
24-
(92%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 2595/2595; executed functions 295/319
25-
(93%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - executed lines 307/307; executed functions 37/40
26-
(99%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - executed lines 752/752; executed functions 88/89
23+
(80%) tools/object-vector-studio-v2/js/bootstrap.js - executed lines 100/100; executed functions 4/5
24+
(92%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 2805/2805; executed functions 327/355
25+
(95%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - executed lines 406/406; executed functions 52/55
26+
(98%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - executed lines 919/919; executed functions 105/107
2727
(100%) src/engine/rendering/index.js - executed lines 12/12; executed functions 1/1
2828

2929
Files with executed line/function counts where available:
@@ -101,7 +101,7 @@ Files with executed line/function counts where available:
101101
(47%) src/engine/input/InputService.js - executed lines 185/185; executed functions 14/30
102102
(47%) src/engine/runtime/backgroundImage.js - executed lines 205/205; executed functions 8/17
103103
(47%) src/engine/runtime/RuntimeMonitoringHooks.js - executed lines 191/191; executed functions 8/17
104-
(50%) games/Asteroids/index.js - executed lines 206/206; executed functions 6/12
104+
(50%) games/Asteroids/index.js - executed lines 207/207; executed functions 6/12
105105
(50%) src/engine/camera/ZoneCameraSystem.js - executed lines 26/26; executed functions 1/2
106106
(50%) src/engine/collision/aabb.js - executed lines 14/14; executed functions 1/2
107107
(50%) src/engine/config/ConfigStore.js - executed lines 46/46; executed functions 3/6
@@ -117,7 +117,7 @@ Files with executed line/function counts where available:
117117
(50%) src/shared/utils/stringifyValueUtils.js - executed lines 8/8; executed functions 1/2
118118
(50%) tools/common/PaletteUsageService.js - executed lines 5/5; executed functions 1/2
119119
(50%) tools/world-vector-studio-v2/js/ToolStarterApp.js - executed lines 98/98; executed functions 8/16
120-
(52%) games/Asteroids/game/AsteroidsGameScene.js - executed lines 845/845; executed functions 25/48
120+
(52%) games/Asteroids/game/AsteroidsGameScene.js - executed lines 846/846; executed functions 25/48
121121
(54%) src/engine/audio/MediaTrackService.js - executed lines 139/139; executed functions 7/13
122122
(54%) tools/preview-generator-v2/PreviewGeneratorV2Capture.js - executed lines 497/497; executed functions 14/26
123123
(55%) tools/palette-manager-v2/modules/PaletteManagerApp.js - executed lines 975/975; executed functions 63/115
@@ -170,7 +170,7 @@ Files with executed line/function counts where available:
170170
(80%) src/engine/persistence/StorageService.js - executed lines 49/49; executed functions 4/5
171171
(80%) tools/asset-manager-v2/js/controls/AccordionSection.js - executed lines 27/27; executed functions 4/5
172172
(80%) tools/asset-manager-v2/js/controls/AssetFormControl.js - executed lines 563/563; executed functions 49/61
173-
(80%) tools/object-vector-studio-v2/js/bootstrap.js - executed lines 91/91; executed functions 4/5
173+
(80%) tools/object-vector-studio-v2/js/bootstrap.js - executed lines 100/100; executed functions 4/5
174174
(80%) tools/palette-manager-v2/modules/PaletteHistoryStack.js - executed lines 54/54; executed functions 8/10
175175
(80%) tools/preview-generator-v2/controls/AccordionSection.js - executed lines 31/31; executed functions 4/5
176176
(80%) tools/preview-generator-v2/PreviewGeneratorV2Logger.js - executed lines 19/19; executed functions 4/5
@@ -203,17 +203,17 @@ Files with executed line/function counts where available:
203203
(91%) tools/toolRegistry.js - executed lines 526/526; executed functions 10/11
204204
(91%) tools/workspace-manager-v2/js/services/WorkspaceManagerV2ContextService.js - executed lines 1598/1598; executed functions 145/159
205205
(92%) tools/object-vector-studio-v2/js/controls/ToolStarterShellControl.js - executed lines 112/112; executed functions 11/12
206-
(92%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 2595/2595; executed functions 295/319
206+
(92%) tools/object-vector-studio-v2/js/ToolStarterApp.js - executed lines 2805/2805; executed functions 327/355
207207
(93%) tools/asset-manager-v2/js/services/WorkspaceBridge.js - executed lines 305/305; executed functions 25/27
208-
(93%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - executed lines 307/307; executed functions 37/40
209208
(93%) tools/session-inspector-v2/js/SessionInspectorV2App.js - executed lines 337/337; executed functions 42/45
210209
(93%) tools/text2speech-V2/js/controls/QueueControl.js - executed lines 122/122; executed functions 26/28
211210
(93%) tools/workspace-manager-v2/js/controls/GameSelectorControl.js - executed lines 59/59; executed functions 13/14
212211
(93%) tools/workspace-manager-v2/js/controls/ToolTilesControl.js - executed lines 137/137; executed functions 14/15
213212
(94%) games/shared/workspaceGameMetadataHydrator.js - executed lines 106/106; executed functions 16/17
214213
(94%) tools/common/PaletteSortService.js - executed lines 103/103; executed functions 17/18
214+
(95%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - executed lines 406/406; executed functions 52/55
215215
(95%) tools/session-inspector-v2/js/services/SessionInspectorV2StorageService.js - executed lines 142/142; executed functions 18/19
216-
(99%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - executed lines 752/752; executed functions 88/89
216+
(98%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - executed lines 919/919; executed functions 105/107
217217
(100%) games/Asteroids/entities/Asteroid.js - executed lines 72/72; executed functions 11/11
218218
(100%) games/Asteroids/flow/attract.js - executed lines 17/17; executed functions 1/1
219219
(100%) games/Asteroids/flow/highscore.js - executed lines 16/16; executed functions 1/1
@@ -300,6 +300,6 @@ Changed JS files considered:
300300
(52%) games/Asteroids/game/AsteroidsGameScene.js - changed JS file with browser V8 coverage
301301
(80%) tools/object-vector-studio-v2/js/bootstrap.js - changed JS file with browser V8 coverage
302302
(92%) tools/object-vector-studio-v2/js/ToolStarterApp.js - changed JS file with browser V8 coverage
303-
(93%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - changed JS file with browser V8 coverage
304-
(99%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - changed JS file with browser V8 coverage
303+
(95%) tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js - changed JS file with browser V8 coverage
304+
(98%) src/engine/rendering/ObjectVectorRuntimeAssetService.js - changed JS file with browser V8 coverage
305305
(100%) src/engine/rendering/index.js - changed JS file with browser V8 coverage
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# PR_26132_016-object-vector-asset-library-and-inheritance
2+
3+
## Scope
4+
5+
Adds the Object Vector Studio V2 reusable asset library and inheritance foundation, then wires Asteroids runtime rendering to resolve assets through library entries. Palette remains a workspace/session runtime resource and is not embedded in Object Vector JSON.
6+
7+
## Changes
8+
9+
- Added durable `assetLibrary.assets` schema support with category, tags, and object references.
10+
- Added object-level inheritance metadata through `baseObjectId`.
11+
- Added strict validation for duplicate object ids, duplicate asset ids, missing base objects, missing library object references, circular inheritance chains, and inherited shape/frame references.
12+
- Added Object Vector Studio V2 library browser UI, asset category/tag controls, library asset creation, usage reporting, dependency graph display, readonly inherited-field indicators, and Duplicate As Local workflow.
13+
- Added runtime inherited object resolution, inherited render-payload cache, asset-id resolution, dependency logging, and cache hit/miss diagnostics.
14+
- Registered Asteroids ship, asteroid, and UFO object vectors through reusable `asset.asteroids.*` library entries.
15+
- Updated Asteroids gameplay rendering to resolve ship, asteroid, and UFO vectors through asset ids instead of direct object ids.
16+
17+
## Validation
18+
19+
Playwright impacted: Yes.
20+
21+
Commands run:
22+
23+
- `node --check src/engine/rendering/ObjectVectorRuntimeAssetService.js`
24+
- `node --check tools/object-vector-studio-v2/js/ToolStarterApp.js`
25+
- `node --check tools/object-vector-studio-v2/js/bootstrap.js`
26+
- `node --check tools/object-vector-studio-v2/js/services/ObjectVectorStudioV2SchemaService.js`
27+
- `node --check games/Asteroids/index.js`
28+
- `node --check games/Asteroids/game/AsteroidsGameScene.js`
29+
- `node --check tests/playwright/tools/WorkspaceManagerV2.spec.mjs`
30+
- Object Vector schema validation against `games/Asteroids/game.manifest.json`
31+
- `npx playwright test tests/playwright/tools/WorkspaceManagerV2.spec.mjs --project=playwright --workers=1 --reporter=list -g "asset library inheritance|loads Object Vector Studio V2 runtime|Object Vector Studio V2 animation"`
32+
- `npm run test:workspace-v2`
33+
- `git diff --check`
34+
35+
Result:
36+
37+
- Targeted Object Vector/Asteroids runtime validation passed: 3 passed.
38+
- Full Workspace Manager V2 suite passed: 45 passed.
39+
- Playwright V8 coverage generated at `docs/dev/reports/playwright_v8_coverage.txt`.
40+
- Full samples smoke test skipped per request.
41+
42+
## Playwright Coverage
43+
44+
Validates:
45+
46+
- Library asset creation.
47+
- Asset browser entries, category/tag metadata, usage report, and dependency graph.
48+
- Inherited asset rendering through runtime preview.
49+
- Duplicate As Local removes inheritance metadata from the local copy.
50+
- Circular inheritance rejection.
51+
- Missing dependency failure handling.
52+
- Asteroids runtime asset loading through reusable library asset ids.
53+
54+
Expected pass behavior:
55+
56+
- Valid library assets and inheritance chains validate, resolve, cache, and render through the runtime vector pipeline.
57+
58+
Expected fail behavior:
59+
60+
- Missing dependencies, circular inheritance, invalid references, and invalid runtime payloads fail visibly before render with actionable FAIL logs.
61+
62+
## Manual Validation
63+
64+
1. Open `tools/object-vector-studio-v2/index.html`.
65+
2. Import an Object Vector Studio V2 payload with `assetLibrary.assets` and at least one derived object using `baseObjectId`.
66+
3. Confirm the asset library browser, usage report, dependency graph, inherited-field indicators, Runtime Preview, and Duplicate As Local.
67+
4. Open Asteroids and start gameplay.
68+
5. Confirm the ship, asteroids, and UFOs render from `asset.asteroids.*` library entries.
69+
70+
Expected outcome:
71+
72+
- Valid assets render, inherited assets resolve through their base object, duplicate local copies no longer include `baseObjectId`, and invalid inheritance payloads are rejected before render.
73+
74+
## Out Of Scope
75+
76+
- No World Vector Studio V2 changes.
77+
- No sample JSON changes.
78+
- No full samples smoke test.

games/Asteroids/game.manifest.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,52 @@
212212
"version": 1,
213213
"toolId": "object-vector-studio-v2",
214214
"name": "Asteroids Object Vector Assets",
215+
"assetLibrary": {
216+
"assets": [
217+
{
218+
"id": "asset.asteroids.ship",
219+
"name": "Asteroids Ship",
220+
"objectId": "object.asteroids.ship",
221+
"category": "ship",
222+
"tags": ["asteroids", "player", "ship"]
223+
},
224+
{
225+
"id": "asset.asteroids.asteroid.large",
226+
"name": "Large Asteroid",
227+
"objectId": "object.asteroids.asteroid.large",
228+
"category": "object",
229+
"tags": ["asteroids", "asteroid", "large"]
230+
},
231+
{
232+
"id": "asset.asteroids.asteroid.medium",
233+
"name": "Medium Asteroid",
234+
"objectId": "object.asteroids.asteroid.medium",
235+
"category": "object",
236+
"tags": ["asteroids", "asteroid", "medium"]
237+
},
238+
{
239+
"id": "asset.asteroids.asteroid.small",
240+
"name": "Small Asteroid",
241+
"objectId": "object.asteroids.asteroid.small",
242+
"category": "object",
243+
"tags": ["asteroids", "asteroid", "small"]
244+
},
245+
{
246+
"id": "asset.asteroids.ufo.large",
247+
"name": "Large UFO",
248+
"objectId": "object.asteroids.ufo.large",
249+
"category": "enemy",
250+
"tags": ["asteroids", "ufo", "large"]
251+
},
252+
{
253+
"id": "asset.asteroids.ufo.small",
254+
"name": "Small UFO",
255+
"objectId": "object.asteroids.ufo.small",
256+
"category": "enemy",
257+
"tags": ["asteroids", "ufo", "small"]
258+
}
259+
]
260+
},
215261
"objects": [
216262
{
217263
"id": "object.asteroids.ship",

games/Asteroids/game/AsteroidsGameScene.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ const SCORE_TWO_X = 824;
2525
const LIFE_SPACING = 22;
2626
const PAUSE_OVERLAY_COLOR = 'rgba(2, 6, 23, 0.58)';
2727
const INITIALS_OVERLAY_COLOR = 'rgba(1, 6, 19, 0.62)';
28-
const ASTEROID_OBJECT_VECTOR_IDS = Object.freeze({
29-
1: "object.asteroids.asteroid.small",
30-
2: "object.asteroids.asteroid.medium",
31-
3: "object.asteroids.asteroid.large",
28+
const ASTEROID_OBJECT_VECTOR_ASSET_IDS = Object.freeze({
29+
1: "asset.asteroids.asteroid.small",
30+
2: "asset.asteroids.asteroid.medium",
31+
3: "asset.asteroids.asteroid.large",
3232
});
33-
const UFO_OBJECT_VECTOR_IDS = Object.freeze({
34-
large: "object.asteroids.ufo.large",
35-
small: "object.asteroids.ufo.small",
33+
const UFO_OBJECT_VECTOR_ASSET_IDS = Object.freeze({
34+
large: "asset.asteroids.ufo.large",
35+
small: "asset.asteroids.ufo.small",
3636
});
37-
const SHIP_OBJECT_VECTOR_ID = "object.asteroids.ship";
37+
const SHIP_OBJECT_VECTOR_ASSET_ID = "asset.asteroids.ship";
3838
const LIFE_ICON_POINTS = [
3939
[14, 0],
4040
[-10, -8],
@@ -735,7 +735,7 @@ export default class AsteroidsGameScene extends Scene {
735735
this.drawObjectVectorAsset(renderer, "asteroids", {
736736
elapsedMs: this.objectVectorPlaybackMs,
737737
fps: 12,
738-
objectId: ASTEROID_OBJECT_VECTOR_IDS[asteroid.size],
738+
assetId: ASTEROID_OBJECT_VECTOR_ASSET_IDS[asteroid.size],
739739
rotation: asteroid.angle,
740740
stateId: "active",
741741
x: asteroid.x,
@@ -747,7 +747,7 @@ export default class AsteroidsGameScene extends Scene {
747747
this.drawObjectVectorAsset(renderer, "ufo", {
748748
elapsedMs: this.objectVectorPlaybackMs,
749749
fps: 12,
750-
objectId: UFO_OBJECT_VECTOR_IDS[this.world.ufo.type],
750+
assetId: UFO_OBJECT_VECTOR_ASSET_IDS[this.world.ufo.type],
751751
stateId: "active",
752752
x: this.world.ufo.x,
753753
y: this.world.ufo.y,
@@ -768,7 +768,7 @@ export default class AsteroidsGameScene extends Scene {
768768
this.drawObjectVectorAsset(renderer, "ship", {
769769
elapsedMs: this.objectVectorPlaybackMs,
770770
fps: 12,
771-
objectId: SHIP_OBJECT_VECTOR_ID,
771+
assetId: SHIP_OBJECT_VECTOR_ASSET_ID,
772772
rotation: this.world.ship.angle + Math.PI / 2,
773773
stateId: this.world.ship.thrusting && this.session.mode === 'playing' ? "thrust" : "idle",
774774
x: this.world.ship.x,
@@ -845,12 +845,12 @@ export default class AsteroidsGameScene extends Scene {
845845

846846
drawObjectVectorAsset(renderer, renderKey, options) {
847847
if (!this.objectVectorRuntime || !this.objectVectorAssets) {
848-
this.recordObjectVectorRenderFailure(renderKey, options.objectId, "validated Object Vector runtime assets are not loaded");
848+
this.recordObjectVectorRenderFailure(renderKey, options.assetId || options.objectId, "validated Object Vector runtime assets are not loaded");
849849
return false;
850850
}
851851
const result = this.objectVectorRuntime.renderObject(renderer, this.objectVectorAssets, options);
852852
if (!result.ok) {
853-
this.recordObjectVectorRenderFailure(renderKey, options.objectId, "runtime render returned failed result");
853+
this.recordObjectVectorRenderFailure(renderKey, options.assetId || options.objectId, "runtime render returned failed result");
854854
return false;
855855
}
856856
this.objectVectorRenderCounts[renderKey] = (this.objectVectorRenderCounts[renderKey] || 0) + 1;
@@ -875,6 +875,7 @@ export default class AsteroidsGameScene extends Scene {
875875
try {
876876
globalThis.__asteroidsObjectVectorRuntime = {
877877
...(this.objectVectorRuntime?.getDiagnostics?.() || {}),
878+
assetCount: this.objectVectorAssets?.assetsById?.size || 0,
878879
loaded: Boolean(this.objectVectorAssets),
879880
objectCount: this.objectVectorAssets?.objectsById?.size || 0,
880881
renderCounts: { ...this.objectVectorRenderCounts },

games/Asteroids/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export async function bootAsteroidsNew({
146146
sourceLabel: "Asteroids game.manifest.json"
147147
});
148148
publishObjectVectorRuntimeDiagnostics(objectVectorRuntime, {
149+
assetCount: objectVectorAssets?.assetsById?.size || 0,
149150
loaded: Boolean(objectVectorAssets),
150151
objectCount: objectVectorAssets?.objectsById?.size || 0
151152
});

0 commit comments

Comments
 (0)