@@ -15,10 +15,11 @@ import AsteroidsHighScoreService from '../systems/AsteroidsHighScoreService.js';
1515import AsteroidsInitialsEntry from '../systems/AsteroidsInitialsEntry.js' ;
1616import { createAsteroidGeometryProfilesFromObjectVectorAssets } from './asteroidObjectGeometry.js' ;
1717import {
18- ASTEROID_SIZE_RUNTIME_OBJECT_KEYS ,
19- runtimeObjectTagOptions ,
20- validateAsteroidsRuntimeObjectTags
21- } from './asteroidsObjectTags.js' ;
18+ ASTEROIDS_OBJECT_GEOMETRY_IDS ,
19+ ASTEROIDS_ASTEROID_SIZE_OBJECT_IDS ,
20+ ASTEROIDS_UFO_TYPE_OBJECT_IDS ,
21+ validateAsteroidsRuntimeObjectIds
22+ } from './asteroidsObjectGeometryManifest.js' ;
2223import {
2324 ASTEROIDS_GAME_OVER_AUTO_EXIT_SECONDS , ASTEROIDS_GAME_OVER_RETURN_MODE
2425} from "../rules/flowRules.js" ;
@@ -89,16 +90,16 @@ export default class AsteroidsGameScene extends Scene {
8990 this . objectVectorAssets = options . objectVectorAssets || null ;
9091 this . objectVectorRuntime = options . objectVectorRuntime || null ;
9192 this . objectGeometry = options . objectGeometry || null ;
92- if ( ! this . objectGeometry ?. objectsById || ! this . objectGeometry ?. objectsByKey ) {
93+ if ( ! this . objectGeometry ?. objectsById ) {
9394 const message = 'Asteroids Object Vector manifest validation failed: object geometry was not loaded from game.manifest.json.' ;
9495 console . error ( message ) ;
9596 throw new Error ( message ) ;
9697 }
9798 this . objectVectorRuntimeObjectValidation = this . objectVectorAssets
98- ? validateAsteroidsRuntimeObjectTags ( [ ... this . objectVectorAssets . objectsById . values ( ) ] , {
99+ ? validateAsteroidsRuntimeObjectIds ( this . objectVectorAssets . objectsById , {
99100 logger : this . objectVectorRuntime ,
100101 } )
101- : { errors : [ ] , objectsByKey : { } , ok : false , warnings : [ ] } ;
102+ : { errors : [ ] , objectIds : [ ] , ok : false , warnings : [ ] } ;
102103 if ( this . objectVectorAssets && ! this . objectVectorRuntimeObjectValidation . ok ) {
103104 const message = validationFailureMessage ( this . objectVectorRuntimeObjectValidation ) ;
104105 this . objectVectorRuntime ?. log ?. ( 'FAIL' , message , {
@@ -737,12 +738,11 @@ export default class AsteroidsGameScene extends Scene {
737738 }
738739
739740 this . world . asteroids . forEach ( ( asteroid ) => {
740- const objectKey = ASTEROID_SIZE_RUNTIME_OBJECT_KEYS [ asteroid . size ] ;
741+ const objectId = ASTEROIDS_ASTEROID_SIZE_OBJECT_IDS [ asteroid . size ] || "" ;
741742 this . drawObjectVectorAsset ( renderer , "asteroids" , {
742- ...this . objectVectorTagOptions ( objectKey ) ,
743743 elapsedMs : this . objectVectorPlaybackMs ,
744744 fps : 12 ,
745- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey [ objectKey ] ?. id || "" ,
745+ objectId,
746746 requireManifestBinding : true ,
747747 rotation : asteroid . angle ,
748748 stateId : "active" ,
@@ -752,12 +752,11 @@ export default class AsteroidsGameScene extends Scene {
752752 } ) ;
753753
754754 if ( this . world . ufo ) {
755- const objectKey = this . world . ufo . type === "small" ? "ufoSmall" : " ufoLarge" ;
755+ const objectId = ASTEROIDS_UFO_TYPE_OBJECT_IDS [ this . world . ufo . type ] || ASTEROIDS_OBJECT_GEOMETRY_IDS . ufoLarge ;
756756 this . drawObjectVectorAsset ( renderer , "ufo" , {
757- ...this . objectVectorTagOptions ( objectKey ) ,
758757 elapsedMs : this . objectVectorPlaybackMs ,
759758 fps : 12 ,
760- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey [ objectKey ] ?. id || "" ,
759+ objectId,
761760 requireManifestBinding : true ,
762761 stateId : "active" ,
763762 x : this . world . ufo . x ,
@@ -767,8 +766,7 @@ export default class AsteroidsGameScene extends Scene {
767766
768767 this . world . bullets . forEach ( ( bullet ) => {
769768 this . drawObjectVectorAsset ( renderer , "bullet" , {
770- ...this . objectVectorTagOptions ( "bullet" ) ,
771- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey . bullet ?. id || "" ,
769+ objectId : ASTEROIDS_OBJECT_GEOMETRY_IDS . bullet ,
772770 requireManifestBinding : true ,
773771 rotation : bullet . angle ,
774772 stateId : "active" ,
@@ -779,8 +777,7 @@ export default class AsteroidsGameScene extends Scene {
779777
780778 this . world . ufoBullets . forEach ( ( bullet ) => {
781779 this . drawObjectVectorAsset ( renderer , "bullet" , {
782- ...this . objectVectorTagOptions ( "bullet" ) ,
783- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey . bullet ?. id || "" ,
780+ objectId : ASTEROIDS_OBJECT_GEOMETRY_IDS . bullet ,
784781 requireManifestBinding : true ,
785782 rotation : bullet . angle ,
786783 stateId : "active" ,
@@ -793,10 +790,9 @@ export default class AsteroidsGameScene extends Scene {
793790
794791 if ( this . world . shipActive && ! this . session . isTurnIntroActive ( ) && this . session . mode !== 'menu' ) {
795792 this . drawObjectVectorAsset ( renderer , "ship" , {
796- ...this . objectVectorTagOptions ( "ship" ) ,
797793 elapsedMs : this . objectVectorPlaybackMs ,
798794 fps : 12 ,
799- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey . ship ?. id || "" ,
795+ objectId : ASTEROIDS_OBJECT_GEOMETRY_IDS . ship ,
800796 requireManifestBinding : true ,
801797 rotation : this . world . ship . angle ,
802798 stateId : this . world . ship . thrusting && this . session . mode === 'playing' ? "move" : "idle" ,
@@ -872,10 +868,6 @@ export default class AsteroidsGameScene extends Scene {
872868 this . publishObjectVectorRuntimeDiagnostics ( ) ;
873869 }
874870
875- objectVectorTagOptions ( objectKey ) {
876- return runtimeObjectTagOptions ( objectKey ) ;
877- }
878-
879871 drawLives ( renderer , centerX , y , lives ) {
880872 if ( ! lives ) {
881873 return ;
@@ -884,10 +876,9 @@ export default class AsteroidsGameScene extends Scene {
884876 const startX = centerX - ( ( lives - 1 ) * LIFE_SPACING ) / 2 ;
885877 Array . from ( { length : lives } ) . forEach ( ( _ , index ) => {
886878 this . drawObjectVectorAsset ( renderer , "shipLife" , {
887- ...this . objectVectorTagOptions ( "ship" ) ,
888879 elapsedMs : this . objectVectorPlaybackMs ,
889880 fps : 12 ,
890- objectId : this . objectVectorRuntimeObjectValidation . objectsByKey . ship ?. id || "" ,
881+ objectId : ASTEROIDS_OBJECT_GEOMETRY_IDS . ship ,
891882 requireManifestBinding : true ,
892883 rotation : - Math . PI / 2 ,
893884 scale : 1.05 ,
@@ -900,12 +891,12 @@ export default class AsteroidsGameScene extends Scene {
900891
901892 drawObjectVectorAsset ( renderer , renderKey , options ) {
902893 if ( ! this . objectVectorRuntime || ! this . objectVectorAssets ) {
903- this . recordObjectVectorRenderFailure ( renderKey , options . assetId || options . objectId || options . runtimeRole , "validated Object Vector runtime assets are not loaded" ) ;
894+ this . recordObjectVectorRenderFailure ( renderKey , options . assetId || options . objectId , "validated Object Vector runtime assets are not loaded" ) ;
904895 return false ;
905896 }
906897 const result = this . objectVectorRuntime . renderObject ( renderer , this . objectVectorAssets , options ) ;
907898 if ( ! result . ok ) {
908- this . recordObjectVectorRenderFailure ( renderKey , options . assetId || options . objectId || options . runtimeRole , "runtime render returned failed result" ) ;
899+ this . recordObjectVectorRenderFailure ( renderKey , options . assetId || options . objectId , "runtime render returned failed result" ) ;
909900 return false ;
910901 }
911902 this . objectVectorRenderCounts [ renderKey ] = ( this . objectVectorRenderCounts [ renderKey ] || 0 ) + 1 ;
0 commit comments