create-aura3d 3.0.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-skills.d.ts +38 -0
  3. package/dist/agent-skills.d.ts.map +1 -0
  4. package/dist/agent-skills.js +103 -0
  5. package/dist/agent-skills.js.map +1 -0
  6. package/dist/cli.js +32 -5
  7. package/dist/cli.js.map +1 -1
  8. package/dist/index.d.ts +32 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +52 -10
  11. package/dist/index.js.map +1 -1
  12. package/dist/showcase-spec-artifacts.d.ts +1 -1
  13. package/dist/showcase-spec-game-geometry-extractor.js +8 -11
  14. package/dist/showcase-spec-game-geometry-extractor.js.map +1 -1
  15. package/dist/template-hdri.d.ts +12 -0
  16. package/dist/template-hdri.d.ts.map +1 -0
  17. package/dist/template-hdri.js +49 -0
  18. package/dist/template-hdri.js.map +1 -0
  19. package/hdri/ATTRIBUTION.md +8 -0
  20. package/hdri/autumn_field_puresky_1k.hdr +0 -0
  21. package/hdri/kloppenheim_06_puresky_1k.hdr +0 -0
  22. package/hdri/night-2k.hdr +0 -0
  23. package/hdri/studio_small_08_1k.hdr +0 -0
  24. package/package.json +14 -10
  25. package/skills/agent-files/AGENTS.md +3 -0
  26. package/skills/aura3d-animation-studio/SKILL.md +153 -0
  27. package/skills/aura3d-animation-studio/references/shot-looks.md +26 -0
  28. package/skills/aura3d-art-direction/SKILL.md +84 -0
  29. package/skills/aura3d-art-direction/references/failure-gallery.md +64 -0
  30. package/skills/aura3d-art-direction/references/framing-and-shots.md +45 -0
  31. package/skills/aura3d-art-direction/references/look-recipes.md +32 -0
  32. package/skills/aura3d-art-direction/references/quality-bar.md +103 -0
  33. package/skills/aura3d-art-direction/references/reference-frames.md +82 -0
  34. package/skills/aura3d-assets/SKILL.md +132 -0
  35. package/skills/aura3d-assets/references/preview-under-look.md +26 -0
  36. package/skills/aura3d-browser-game/SKILL.md +127 -0
  37. package/skills/aura3d-browser-game/references/genre-looks.md +52 -0
  38. package/skills/aura3d-character-animation/SKILL.md +129 -0
  39. package/skills/aura3d-character-animation/references/stage-and-lighting.md +31 -0
  40. package/skills/aura3d-core/SKILL.md +121 -0
  41. package/skills/aura3d-core/references/boundaries.md +91 -0
  42. package/skills/aura3d-evidence-review/SKILL.md +106 -0
  43. package/skills/aura3d-game-art/SKILL.md +118 -0
  44. package/skills/aura3d-game-art/references/sheet-check.mjs +58 -0
  45. package/skills/aura3d-game-art/references/sprite-palettes.md +25 -0
  46. package/skills/aura3d-materials-environments/SKILL.md +139 -0
  47. package/skills/aura3d-performance/SKILL.md +97 -0
  48. package/skills/aura3d-retexture/SKILL.md +115 -0
  49. package/skills/aura3d-retexture/references/geometry-hash.mjs +89 -0
  50. package/skills/aura3d-scene-authoring/SKILL.md +132 -0
  51. package/skills/aura3d-scene-authoring/references/look-by-family.md +28 -0
  52. package/skills/aura3d-threejs-migration/SKILL.md +125 -0
  53. package/skills/aura3d-threejs-migration/references/look-mapping.md +27 -0
  54. package/skills/llms.txt +117 -0
  55. package/skills/manifest.json +163 -0
  56. package/skills/meshy-cli/SKILL.md +133 -0
  57. package/templates/animation-channel/.claude/CLAUDE.md +3 -0
  58. package/templates/animation-channel/.github/workflows/aura3d-lookdev.yml +67 -0
  59. package/templates/animation-channel/AGENTS.md +3 -0
  60. package/templates/animation-channel/package.json +4 -3
  61. package/templates/animation-channel/src/main.ts +5 -6
  62. package/templates/animation-channel/src/render-plan.ts +5 -3
  63. package/templates/animation-channel/tests/look-floor.ts +270 -0
  64. package/templates/animation-channel/tests/route-health.spec.ts +13 -0
  65. package/templates/animation-channel/tests/screenshot.spec.ts +10 -5
  66. package/templates/animation-channel/vite.config.ts +7 -0
  67. package/templates/animation-studio/.claude/CLAUDE.md +3 -0
  68. package/templates/animation-studio/.github/workflows/aura3d-lookdev.yml +67 -0
  69. package/templates/animation-studio/AGENTS.md +2 -70
  70. package/templates/animation-studio/package.json +5 -4
  71. package/templates/animation-studio/public/aura-assets/luma.thumb.svg +1 -1
  72. package/templates/animation-studio/public/aura-assets/miko.thumb.svg +1 -1
  73. package/templates/{falling-blocks-starter/public/aura-assets/showcaseBlockfallCabinet.thumb.svg → animation-studio/public/aura-assets/moonGarden.thumb.svg} +1 -1
  74. package/templates/animation-studio/scripts/build-clip-library.ts +6 -5
  75. package/templates/animation-studio/scripts/resolve-asset.ts +7 -4
  76. package/templates/animation-studio/src/asset-contract.ts +19 -0
  77. package/templates/animation-studio/src/aura-assets.ts +651 -54
  78. package/templates/animation-studio/src/scene-player.ts +6 -6
  79. package/templates/animation-studio/src/set-templates.ts +13 -9
  80. package/templates/animation-studio/tests/look-floor.ts +270 -0
  81. package/templates/animation-studio/tests/route-health.spec.ts +2 -2
  82. package/templates/animation-studio/tests/screenshot.spec.ts +18 -10
  83. package/templates/animation-studio/vite.config.ts +2 -0
  84. package/templates/architecture-interior/.claude/CLAUDE.md +3 -0
  85. package/templates/architecture-interior/.github/workflows/aura3d-lookdev.yml +67 -0
  86. package/templates/architecture-interior/AGENTS.md +3 -0
  87. package/templates/architecture-interior/README.md +16 -0
  88. package/templates/architecture-interior/aura.assets.json +24 -0
  89. package/templates/architecture-interior/package.json +24 -0
  90. package/templates/architecture-interior/public/aura-assets/kenneyModularDungeonRoomSmall.a7e74a5f.glb +0 -0
  91. package/templates/architecture-interior/src/aura-assets.ts +16 -0
  92. package/templates/architecture-interior/src/main.ts +23 -0
  93. package/templates/architecture-interior/tests/look-floor.ts +270 -0
  94. package/templates/{three-compat-architecture-interior → architecture-interior}/tests/route-health.spec.ts +3 -3
  95. package/templates/architecture-interior/tests/screenshot.spec.ts +21 -0
  96. package/templates/architecture-interior/vite.config.ts +7 -0
  97. package/templates/arena-shooter/.claude/CLAUDE.md +3 -0
  98. package/templates/arena-shooter/.github/workflows/aura3d-lookdev.yml +67 -0
  99. package/templates/arena-shooter/AGENTS.md +3 -0
  100. package/templates/arena-shooter/README.md +45 -0
  101. package/templates/arena-shooter/aura.assets.json +62 -0
  102. package/templates/arena-shooter/index.html +32 -0
  103. package/templates/arena-shooter/package.json +23 -0
  104. package/templates/arena-shooter/playwright.config.ts +15 -0
  105. package/templates/arena-shooter/public/aura-assets/craft_miner.de323205.glb +0 -0
  106. package/templates/arena-shooter/public/aura-assets/craft_racer.bce8cb3d.glb +0 -0
  107. package/templates/arena-shooter/public/aura-assets/meteor_detailed.f30379ab.glb +0 -0
  108. package/templates/arena-shooter/src/aura-assets.ts +56 -0
  109. package/templates/arena-shooter/src/main.ts +616 -0
  110. package/templates/arena-shooter/tests/look-floor.ts +270 -0
  111. package/templates/arena-shooter/tests/playable.spec.ts +56 -0
  112. package/templates/arena-shooter/tests/route-health.spec.ts +87 -0
  113. package/templates/arena-shooter/tests/screenshot.spec.ts +22 -0
  114. package/templates/arena-shooter/tsconfig.json +15 -0
  115. package/templates/arena-shooter/vite.config.ts +7 -0
  116. package/templates/asset-inspector/.claude/CLAUDE.md +3 -0
  117. package/templates/asset-inspector/.github/workflows/aura3d-lookdev.yml +67 -0
  118. package/templates/asset-inspector/AGENTS.md +3 -0
  119. package/templates/asset-inspector/README.md +13 -0
  120. package/templates/asset-inspector/aura.assets.json +24 -0
  121. package/templates/{three-compat-custom-threejs-migration → asset-inspector}/package.json +6 -4
  122. package/templates/asset-inspector/public/aura-assets/kenneyCarKitSedanSports.2889c428.glb +0 -0
  123. package/templates/asset-inspector/src/aura-assets.ts +16 -0
  124. package/templates/asset-inspector/src/main.ts +23 -0
  125. package/templates/asset-inspector/tests/look-floor.ts +270 -0
  126. package/templates/{three-compat-character-viewer → asset-inspector}/tests/route-health.spec.ts +3 -3
  127. package/templates/asset-inspector/tests/screenshot.spec.ts +21 -0
  128. package/templates/asset-inspector/vite.config.ts +7 -0
  129. package/templates/character-controller/.claude/CLAUDE.md +3 -0
  130. package/templates/character-controller/.github/workflows/aura3d-lookdev.yml +67 -0
  131. package/templates/character-controller/AGENTS.md +3 -0
  132. package/templates/character-controller/README.md +7 -1
  133. package/templates/character-controller/aura.assets.json +29 -22
  134. package/templates/character-controller/index.html +4 -5
  135. package/templates/character-controller/package.json +6 -5
  136. package/templates/character-controller/playwright.config.ts +1 -0
  137. package/templates/character-controller/public/aura-assets/auraclash-player-rig.glb +0 -0
  138. package/templates/character-controller/src/aura-assets.ts +25 -7
  139. package/templates/character-controller/src/main.ts +190 -47
  140. package/templates/character-controller/tests/certified-rig.spec.ts +2 -2
  141. package/templates/character-controller/tests/look-floor.ts +270 -0
  142. package/templates/character-controller/tests/route-health.spec.ts +49 -4
  143. package/templates/character-controller/tests/screenshot.spec.ts +17 -5
  144. package/templates/character-controller/vite.config.ts +7 -0
  145. package/templates/character-viewer/.claude/CLAUDE.md +3 -0
  146. package/templates/character-viewer/.github/workflows/aura3d-lookdev.yml +67 -0
  147. package/templates/character-viewer/AGENTS.md +3 -0
  148. package/templates/character-viewer/README.md +13 -0
  149. package/templates/character-viewer/aura.assets.json +24 -0
  150. package/templates/{three-compat-asset-inspector → character-viewer}/package.json +6 -4
  151. package/templates/character-viewer/public/aura-assets/kenneyMiniForestCharacterArcher.0fd0f92e.glb +0 -0
  152. package/templates/character-viewer/src/aura-assets.ts +16 -0
  153. package/templates/character-viewer/src/main.ts +21 -0
  154. package/templates/character-viewer/tests/look-floor.ts +270 -0
  155. package/templates/{three-compat-custom-threejs-migration → character-viewer}/tests/route-health.spec.ts +3 -3
  156. package/templates/character-viewer/tests/screenshot.spec.ts +21 -0
  157. package/templates/character-viewer/vite.config.ts +7 -0
  158. package/templates/cinematic-scene/.claude/CLAUDE.md +3 -0
  159. package/templates/cinematic-scene/.github/workflows/aura3d-lookdev.yml +67 -0
  160. package/templates/cinematic-scene/AGENTS.md +3 -0
  161. package/templates/cinematic-scene/README.md +11 -2
  162. package/templates/cinematic-scene/package.json +4 -3
  163. package/templates/cinematic-scene/src/main.ts +46 -11
  164. package/templates/cinematic-scene/tests/look-floor.ts +270 -0
  165. package/templates/cinematic-scene/tests/route-health.spec.ts +31 -3
  166. package/templates/cinematic-scene/tests/screenshot.spec.ts +34 -45
  167. package/templates/cinematic-scene/vite.config.ts +7 -0
  168. package/templates/custom-scene/.claude/CLAUDE.md +3 -0
  169. package/templates/custom-scene/.github/workflows/aura3d-lookdev.yml +67 -0
  170. package/templates/custom-scene/AGENTS.md +3 -0
  171. package/templates/custom-scene/README.md +13 -0
  172. package/templates/custom-scene/aura.assets.json +24 -0
  173. package/templates/{three-compat-character-viewer → custom-scene}/package.json +6 -4
  174. package/templates/custom-scene/public/aura-assets/kenneyPirateKitShipMedium.279ea019.glb +0 -0
  175. package/templates/custom-scene/src/aura-assets.ts +16 -0
  176. package/templates/custom-scene/src/main.ts +23 -0
  177. package/templates/custom-scene/tests/look-floor.ts +270 -0
  178. package/templates/{three-compat-asset-inspector → custom-scene}/tests/route-health.spec.ts +3 -3
  179. package/templates/custom-scene/tests/screenshot.spec.ts +21 -0
  180. package/templates/custom-scene/vite.config.ts +7 -0
  181. package/templates/episode-builder/.claude/CLAUDE.md +3 -0
  182. package/templates/episode-builder/.github/workflows/aura3d-lookdev.yml +67 -0
  183. package/templates/episode-builder/AGENTS.md +3 -0
  184. package/templates/episode-builder/package.json +4 -3
  185. package/templates/episode-builder/src/main.ts +5 -3
  186. package/templates/episode-builder/src/render-plan.ts +5 -3
  187. package/templates/episode-builder/tests/look-floor.ts +270 -0
  188. package/templates/episode-builder/tests/route-health.spec.ts +11 -0
  189. package/templates/episode-builder/tests/screenshot.spec.ts +10 -4
  190. package/templates/episode-builder/vite.config.ts +7 -0
  191. package/templates/falling-blocks-starter/.claude/CLAUDE.md +3 -0
  192. package/templates/falling-blocks-starter/.github/workflows/aura3d-lookdev.yml +67 -0
  193. package/templates/falling-blocks-starter/AGENTS.md +3 -0
  194. package/templates/falling-blocks-starter/README.md +10 -1
  195. package/templates/falling-blocks-starter/aura.assets.json +40 -23
  196. package/templates/falling-blocks-starter/package.json +4 -3
  197. package/templates/falling-blocks-starter/public/aura-assets/quaternius-cube-crate.glb +0 -0
  198. package/templates/falling-blocks-starter/public/aura-assets/quaternius-wall-modular.glb +0 -0
  199. package/templates/falling-blocks-starter/src/aura-assets.ts +33 -10
  200. package/templates/falling-blocks-starter/src/main.ts +317 -96
  201. package/templates/falling-blocks-starter/tests/look-floor.ts +270 -0
  202. package/templates/falling-blocks-starter/tests/playable.spec.ts +51 -18
  203. package/templates/falling-blocks-starter/tests/route-health.spec.ts +17 -7
  204. package/templates/falling-blocks-starter/tests/screenshot.spec.ts +21 -0
  205. package/templates/falling-blocks-starter/vite.config.ts +7 -0
  206. package/templates/fighting-game/.claude/CLAUDE.md +3 -0
  207. package/templates/fighting-game/.github/workflows/aura3d-lookdev.yml +67 -0
  208. package/templates/fighting-game/AGENTS.md +3 -0
  209. package/templates/fighting-game/README.md +2 -0
  210. package/templates/fighting-game/aura.assets.json +56 -46
  211. package/templates/fighting-game/package.json +5 -3
  212. package/templates/fighting-game/public/aura-assets/auraclash-player-rig.glb +0 -0
  213. package/templates/fighting-game/public/aura-assets/auraclash-rival-rig.glb +0 -0
  214. package/templates/fighting-game/src/aura-assets.ts +54 -20
  215. package/templates/fighting-game/src/game/fighters.ts +57 -12
  216. package/templates/fighting-game/src/main.ts +135 -53
  217. package/templates/fighting-game/tests/certified-rig.spec.ts +1 -1
  218. package/templates/fighting-game/tests/gameplay-smoke.spec.ts +25 -33
  219. package/templates/fighting-game/tests/look-floor.ts +270 -0
  220. package/templates/fighting-game/tests/route-health.spec.ts +23 -4
  221. package/templates/fighting-game/tests/screenshot.spec.ts +10 -4
  222. package/templates/fighting-game/vite.config.ts +7 -0
  223. package/templates/large-scene/.claude/CLAUDE.md +3 -0
  224. package/templates/large-scene/.github/workflows/aura3d-lookdev.yml +67 -0
  225. package/templates/large-scene/AGENTS.md +3 -0
  226. package/templates/large-scene/README.md +13 -0
  227. package/templates/large-scene/aura.assets.json +40 -0
  228. package/templates/{three-compat-architecture-interior → large-scene}/package.json +6 -4
  229. package/templates/large-scene/public/aura-assets/kenneyMiniForestRocksHigh.226728a0.glb +0 -0
  230. package/templates/large-scene/public/aura-assets/kenneyMiniForestTree.0075d505.glb +0 -0
  231. package/templates/large-scene/src/aura-assets.ts +28 -0
  232. package/templates/large-scene/src/main.ts +43 -0
  233. package/templates/large-scene/tests/look-floor.ts +270 -0
  234. package/templates/large-scene/tests/route-health.spec.ts +16 -0
  235. package/templates/large-scene/tests/screenshot.spec.ts +21 -0
  236. package/templates/large-scene/vite.config.ts +7 -0
  237. package/templates/material-authoring/.claude/CLAUDE.md +3 -0
  238. package/templates/material-authoring/.github/workflows/aura3d-lookdev.yml +67 -0
  239. package/templates/material-authoring/AGENTS.md +3 -0
  240. package/templates/material-authoring/README.md +15 -0
  241. package/templates/material-authoring/aura.assets.json +24 -0
  242. package/templates/material-authoring/package.json +24 -0
  243. package/templates/material-authoring/public/aura-assets/kenneyCarKitSedanSports.2889c428.glb +0 -0
  244. package/templates/material-authoring/src/aura-assets.ts +16 -0
  245. package/templates/material-authoring/src/main.ts +78 -0
  246. package/templates/material-authoring/tests/look-floor.ts +270 -0
  247. package/templates/material-authoring/tests/route-health.spec.ts +16 -0
  248. package/templates/material-authoring/tests/screenshot.spec.ts +21 -0
  249. package/templates/material-authoring/vite.config.ts +7 -0
  250. package/templates/mini-game/.claude/CLAUDE.md +3 -0
  251. package/templates/mini-game/.github/workflows/aura3d-lookdev.yml +67 -0
  252. package/templates/mini-game/AGENTS.md +3 -0
  253. package/templates/mini-game/README.md +9 -6
  254. package/templates/mini-game/aura.assets.json +177 -36
  255. package/templates/mini-game/package.json +4 -2
  256. package/templates/mini-game/public/aura-assets/kaykit-barbarian.glb +0 -0
  257. package/templates/mini-game/public/aura-assets/kenneyPlatformerKitKey.2e930961.glb +0 -0
  258. package/templates/mini-game/public/aura-assets/kenneyPlatformerKitStar.a102a1b9.glb +0 -0
  259. package/templates/mini-game/public/aura-assets/quaternius-crate.glb +0 -0
  260. package/templates/mini-game/public/aura-assets/quaternius-cube-crate.glb +0 -0
  261. package/templates/mini-game/src/aura-assets.ts +140 -32
  262. package/templates/mini-game/src/main.ts +204 -71
  263. package/templates/mini-game/tests/certified-rig.spec.ts +2 -2
  264. package/templates/mini-game/tests/look-floor.ts +270 -0
  265. package/templates/mini-game/tests/playable.spec.ts +23 -2
  266. package/templates/mini-game/tests/route-health.spec.ts +2 -2
  267. package/templates/mini-game/tests/screenshot.spec.ts +44 -53
  268. package/templates/mini-game/vite.config.ts +7 -0
  269. package/templates/postprocess-scene/.claude/CLAUDE.md +3 -0
  270. package/templates/postprocess-scene/.github/workflows/aura3d-lookdev.yml +67 -0
  271. package/templates/postprocess-scene/AGENTS.md +3 -0
  272. package/templates/postprocess-scene/README.md +17 -0
  273. package/templates/postprocess-scene/aura.assets.json +38 -0
  274. package/templates/postprocess-scene/package.json +24 -0
  275. package/templates/postprocess-scene/public/aura-assets/showcaseLuma.ef389217.glb +0 -0
  276. package/templates/postprocess-scene/public/aura-assets/showcaseMiko.fcdc2b75.glb +0 -0
  277. package/templates/postprocess-scene/src/aura-assets.ts +28 -0
  278. package/templates/postprocess-scene/src/main.ts +29 -0
  279. package/templates/postprocess-scene/tests/look-floor.ts +270 -0
  280. package/templates/postprocess-scene/tests/route-health.spec.ts +16 -0
  281. package/templates/postprocess-scene/tests/screenshot.spec.ts +21 -0
  282. package/templates/postprocess-scene/vite.config.ts +7 -0
  283. package/templates/premium-product-viewer/.claude/CLAUDE.md +3 -0
  284. package/templates/premium-product-viewer/.github/workflows/aura3d-lookdev.yml +67 -0
  285. package/templates/premium-product-viewer/AGENTS.md +3 -0
  286. package/templates/premium-product-viewer/README.md +18 -0
  287. package/templates/premium-product-viewer/aura.assets.json +24 -0
  288. package/templates/premium-product-viewer/package.json +24 -0
  289. package/templates/premium-product-viewer/public/aura-assets/khronosToyCar.01a60862.glb +0 -0
  290. package/templates/premium-product-viewer/src/aura-assets.ts +16 -0
  291. package/templates/premium-product-viewer/src/main.ts +33 -0
  292. package/templates/premium-product-viewer/tests/look-floor.ts +270 -0
  293. package/templates/premium-product-viewer/tests/route-health.spec.ts +16 -0
  294. package/templates/premium-product-viewer/tests/screenshot.spec.ts +21 -0
  295. package/templates/premium-product-viewer/vite.config.ts +7 -0
  296. package/templates/product-viewer/.claude/CLAUDE.md +3 -0
  297. package/templates/product-viewer/.github/workflows/aura3d-lookdev.yml +67 -0
  298. package/templates/product-viewer/AGENTS.md +3 -0
  299. package/templates/product-viewer/README.md +10 -8
  300. package/templates/product-viewer/package.json +4 -2
  301. package/templates/product-viewer/src/aura-assets.ts +1 -1
  302. package/templates/product-viewer/src/main.ts +78 -19
  303. package/templates/product-viewer/tests/look-floor.ts +270 -0
  304. package/templates/product-viewer/tests/route-health.spec.ts +19 -1
  305. package/templates/product-viewer/tests/screenshot.spec.ts +35 -41
  306. package/templates/product-viewer/vite.config.ts +7 -0
  307. package/templates/prompt-animation-channel/.claude/CLAUDE.md +3 -0
  308. package/templates/prompt-animation-channel/.github/workflows/aura3d-lookdev.yml +67 -0
  309. package/templates/prompt-animation-channel/AGENTS.md +3 -0
  310. package/templates/prompt-animation-channel/package.json +4 -3
  311. package/templates/prompt-animation-channel/src/main.ts +5 -3
  312. package/templates/prompt-animation-channel/src/render-plan.ts +5 -3
  313. package/templates/prompt-animation-channel/tests/look-floor.ts +270 -0
  314. package/templates/prompt-animation-channel/tests/route-health.spec.ts +12 -1
  315. package/templates/prompt-animation-channel/tests/screenshot.spec.ts +10 -4
  316. package/templates/prompt-animation-channel/tests/storyboard-playback.spec.ts +1 -1
  317. package/templates/prompt-animation-channel/vite.config.ts +7 -0
  318. package/templates/racing-starter/.claude/CLAUDE.md +3 -0
  319. package/templates/racing-starter/.github/workflows/aura3d-lookdev.yml +67 -0
  320. package/templates/racing-starter/AGENTS.md +3 -0
  321. package/templates/racing-starter/README.md +8 -6
  322. package/templates/racing-starter/package.json +4 -3
  323. package/templates/racing-starter/src/main.ts +169 -123
  324. package/templates/racing-starter/tests/geometry-certification.json +34 -0
  325. package/templates/racing-starter/tests/look-floor.ts +270 -0
  326. package/templates/racing-starter/tests/playable.spec.ts +63 -80
  327. package/templates/racing-starter/tests/route-health.spec.ts +14 -12
  328. package/templates/racing-starter/tests/screenshot.spec.ts +21 -0
  329. package/templates/racing-starter/vite.config.ts +7 -0
  330. package/templates/character-controller/public/aura-assets/showcaseWalkAnimatedGirl.93872fc2.glb +0 -0
  331. package/templates/character-controller/public/aura-assets/showcaseWalkAnimatedGirl.thumb.svg +0 -1
  332. package/templates/falling-blocks-starter/public/aura-assets/showcaseBlockfallCabinet.679d52fe.glb +0 -0
  333. package/templates/fighting-game/public/aura-assets/showcaseRunnerRobot.252b3a16.glb +0 -0
  334. package/templates/fighting-game/public/aura-assets/showcaseRunnerRobot.thumb.svg +0 -1
  335. package/templates/fighting-game/public/aura-assets/showcaseWalkAnimatedGirl.93872fc2.glb +0 -0
  336. package/templates/fighting-game/public/aura-assets/showcaseWalkAnimatedGirl.thumb.svg +0 -1
  337. package/templates/mini-game/public/aura-assets/showcaseKenneyOobiPlatformerHero.3f821141.glb +0 -0
  338. package/templates/mini-game/public/aura-assets/showcaseKenneyOobiPlatformerHero.thumb.svg +0 -1
  339. package/templates/three-compat-architecture-interior/aura.assets.json +0 -7
  340. package/templates/three-compat-architecture-interior/src/aura-assets.ts +0 -3
  341. package/templates/three-compat-architecture-interior/src/main.ts +0 -27
  342. package/templates/three-compat-architecture-interior/tests/screenshot.spec.ts +0 -15
  343. package/templates/three-compat-asset-inspector/aura.assets.json +0 -7
  344. package/templates/three-compat-asset-inspector/src/aura-assets.ts +0 -3
  345. package/templates/three-compat-asset-inspector/src/main.ts +0 -17
  346. package/templates/three-compat-asset-inspector/tests/screenshot.spec.ts +0 -15
  347. package/templates/three-compat-character-viewer/aura.assets.json +0 -7
  348. package/templates/three-compat-character-viewer/src/aura-assets.ts +0 -3
  349. package/templates/three-compat-character-viewer/src/main.ts +0 -17
  350. package/templates/three-compat-character-viewer/tests/screenshot.spec.ts +0 -15
  351. package/templates/three-compat-custom-threejs-migration/aura.assets.json +0 -7
  352. package/templates/three-compat-custom-threejs-migration/src/aura-assets.ts +0 -3
  353. package/templates/three-compat-custom-threejs-migration/src/main.ts +0 -16
  354. package/templates/three-compat-custom-threejs-migration/tests/screenshot.spec.ts +0 -15
  355. package/templates/three-compat-large-scene/aura.assets.json +0 -7
  356. package/templates/three-compat-large-scene/package.json +0 -22
  357. package/templates/three-compat-large-scene/src/aura-assets.ts +0 -3
  358. package/templates/three-compat-large-scene/src/main.ts +0 -31
  359. package/templates/three-compat-large-scene/tests/route-health.spec.ts +0 -16
  360. package/templates/three-compat-large-scene/tests/screenshot.spec.ts +0 -15
  361. package/templates/three-compat-material-authoring/aura.assets.json +0 -7
  362. package/templates/three-compat-material-authoring/package.json +0 -22
  363. package/templates/three-compat-material-authoring/src/aura-assets.ts +0 -3
  364. package/templates/three-compat-material-authoring/src/main.ts +0 -33
  365. package/templates/three-compat-material-authoring/tests/route-health.spec.ts +0 -16
  366. package/templates/three-compat-material-authoring/tests/screenshot.spec.ts +0 -15
  367. package/templates/three-compat-postprocess-scene/aura.assets.json +0 -7
  368. package/templates/three-compat-postprocess-scene/package.json +0 -22
  369. package/templates/three-compat-postprocess-scene/src/aura-assets.ts +0 -3
  370. package/templates/three-compat-postprocess-scene/src/main.ts +0 -17
  371. package/templates/three-compat-postprocess-scene/tests/route-health.spec.ts +0 -16
  372. package/templates/three-compat-postprocess-scene/tests/screenshot.spec.ts +0 -15
  373. package/templates/three-compat-premium-product-viewer/aura.assets.json +0 -7
  374. package/templates/three-compat-premium-product-viewer/package.json +0 -22
  375. package/templates/three-compat-premium-product-viewer/src/aura-assets.ts +0 -3
  376. package/templates/three-compat-premium-product-viewer/src/main.ts +0 -18
  377. package/templates/three-compat-premium-product-viewer/tests/route-health.spec.ts +0 -16
  378. package/templates/three-compat-premium-product-viewer/tests/screenshot.spec.ts +0 -15
  379. /package/templates/{three-compat-architecture-interior → architecture-interior}/index.html +0 -0
  380. /package/templates/{three-compat-architecture-interior → architecture-interior}/playwright.config.ts +0 -0
  381. /package/templates/{three-compat-architecture-interior → architecture-interior}/tsconfig.json +0 -0
  382. /package/templates/{three-compat-asset-inspector → asset-inspector}/index.html +0 -0
  383. /package/templates/{three-compat-asset-inspector → asset-inspector}/playwright.config.ts +0 -0
  384. /package/templates/{three-compat-asset-inspector → asset-inspector}/tsconfig.json +0 -0
  385. /package/templates/{three-compat-character-viewer → character-viewer}/index.html +0 -0
  386. /package/templates/{three-compat-character-viewer → character-viewer}/playwright.config.ts +0 -0
  387. /package/templates/{three-compat-character-viewer → character-viewer}/tsconfig.json +0 -0
  388. /package/templates/{three-compat-custom-threejs-migration → custom-scene}/index.html +0 -0
  389. /package/templates/{three-compat-custom-threejs-migration → custom-scene}/playwright.config.ts +0 -0
  390. /package/templates/{three-compat-custom-threejs-migration → custom-scene}/tsconfig.json +0 -0
  391. /package/templates/{three-compat-large-scene → large-scene}/index.html +0 -0
  392. /package/templates/{three-compat-large-scene → large-scene}/playwright.config.ts +0 -0
  393. /package/templates/{three-compat-large-scene → large-scene}/tsconfig.json +0 -0
  394. /package/templates/{three-compat-material-authoring → material-authoring}/index.html +0 -0
  395. /package/templates/{three-compat-material-authoring → material-authoring}/playwright.config.ts +0 -0
  396. /package/templates/{three-compat-material-authoring → material-authoring}/tsconfig.json +0 -0
  397. /package/templates/{three-compat-postprocess-scene → postprocess-scene}/index.html +0 -0
  398. /package/templates/{three-compat-postprocess-scene → postprocess-scene}/playwright.config.ts +0 -0
  399. /package/templates/{three-compat-postprocess-scene → postprocess-scene}/tsconfig.json +0 -0
  400. /package/templates/{three-compat-premium-product-viewer → premium-product-viewer}/index.html +0 -0
  401. /package/templates/{three-compat-premium-product-viewer → premium-product-viewer}/playwright.config.ts +0 -0
  402. /package/templates/{three-compat-premium-product-viewer → premium-product-viewer}/tsconfig.json +0 -0
@@ -0,0 +1,616 @@
1
+ // Arena shooter: WASD moves the ship on the deck plane, Space fires bolts at
2
+ // the aim direction (last movement direction; up-screen by default). Waves of
3
+ // drones spawn on a 1.8 s cadence and converge on the ship — contact costs one
4
+ // shield (shield 5, brief invulnerability between hits). Bolts are pooled
5
+ // primitives; drones are pooled typed GLB models toggled by the wave spawner,
6
+ // because runtime nodes must exist at scene-build time.
7
+ import {
8
+ camera,
9
+ game,
10
+ instances,
11
+ lights,
12
+ looks,
13
+ material,
14
+ model,
15
+ primitives,
16
+ scene,
17
+ ui,
18
+ type AuraRuntimeNodeHandle
19
+ } from "@aura3d/engine";
20
+ import { createGame } from "@aura3d/engine/contracts";
21
+ import { assets } from "./aura-assets";
22
+
23
+ declare global {
24
+ interface Window {
25
+ __AURA3D_ARENA_SHOOTER__?: ArenaShooterEvidence;
26
+ __AURA3D_GAME_SOURCE__?: unknown;
27
+ __AURA3D_ROUTE_READY__?: unknown;
28
+ }
29
+ }
30
+
31
+ interface ArenaShooterEvidence {
32
+ readonly status: "playing" | "paused" | "game-over" | "wave-cleared";
33
+ readonly frame: number;
34
+ readonly score: number;
35
+ readonly wave: number;
36
+ readonly shield: number;
37
+ readonly kills: number;
38
+ readonly dronesAlive: number;
39
+ readonly dronesQueued: number;
40
+ readonly boltsLive: number;
41
+ readonly ship: {
42
+ readonly assetId: string;
43
+ readonly url: string;
44
+ readonly metres: readonly [number, number, number];
45
+ readonly position: readonly [number, number, number];
46
+ readonly aim: readonly [number, number];
47
+ };
48
+ readonly assets: {
49
+ readonly drone: { readonly assetId: string; readonly url: string };
50
+ readonly planet: { readonly assetId: string; readonly url: string };
51
+ readonly typedAssets: number;
52
+ };
53
+ readonly waves: {
54
+ readonly spawnIntervalSeconds: number;
55
+ readonly shieldMax: number;
56
+ readonly invulnSeconds: number;
57
+ };
58
+ readonly look: { readonly id: string; readonly category: string };
59
+ readonly camera: { readonly rig: string; readonly pitchDegrees: number; readonly presented: boolean };
60
+ readonly events: readonly string[];
61
+ readonly evidence: { readonly entry: string };
62
+ }
63
+
64
+ // The look supplies the space backdrop (#000 background exception), hard key
65
+ // light and contrast grade; the scene adds deck, props, actors and an accent
66
+ // rim — no ambient/fill overrides. Genre row (aura3d-browser-game):
67
+ // arena-shooter → space.
68
+ const LOOK_ID = "space" as const;
69
+
70
+ const ARENA = {
71
+ minX: -7,
72
+ maxX: 7,
73
+ minZ: -4.5,
74
+ maxZ: 4.5,
75
+ shipY: 0.45
76
+ } as const;
77
+
78
+ const TUNING = {
79
+ shipSpeed: 5.6,
80
+ boltSpeed: 18,
81
+ boltTtlSeconds: 1.1,
82
+ fireCooldownSeconds: 0.22,
83
+ spawnIntervalSeconds: 1.8,
84
+ waveDroneBase: 2,
85
+ droneSpeedBase: 2.2,
86
+ droneSpeedPerWave: 0.18,
87
+ shieldMax: 5,
88
+ invulnSeconds: 0.8,
89
+ contactRadius: 0.95,
90
+ boltHitRadius: 0.85,
91
+ scorePerKill: 100,
92
+ scorePerWave: 250
93
+ } as const;
94
+
95
+ const DRONE_POOL = 16;
96
+ const BOLT_POOL = 14;
97
+ const STAR_COUNT = 140;
98
+
99
+ // Top-down at a 60° pitch: the camera sits 60° above the deck plane behind
100
+ // the ship, so offset = (0, sin60, cos60) * distance.
101
+ const CAMERA = {
102
+ distance: 5.4,
103
+ pitchRadians: Math.PI / 3,
104
+ targetLeadZ: -1.4,
105
+ fov: 50
106
+ } as const;
107
+ const cameraYOffset = CAMERA.distance * Math.sin(CAMERA.pitchRadians); // ≈4.68
108
+ const cameraZOffset = CAMERA.distance * Math.cos(CAMERA.pitchRadians); // ≈2.7
109
+
110
+ const input = game.input({
111
+ actions: {
112
+ left: ["KeyA", "ArrowLeft"],
113
+ right: ["KeyD", "ArrowRight"],
114
+ up: ["KeyW", "ArrowUp"],
115
+ down: ["KeyS", "ArrowDown"],
116
+ fire: ["Space", "KeyJ"],
117
+ pause: ["Escape"],
118
+ reset: ["KeyR"]
119
+ },
120
+ axes: {
121
+ moveX: { negative: "left", positive: "right" },
122
+ moveZ: { negative: "up", positive: "down" }
123
+ },
124
+ bufferMs: 120,
125
+ gamepad: true
126
+ });
127
+ const routeEvents = game.eventLog({ label: "arena shooter events", maxEvents: 18 });
128
+ const hudBindings = game.hud.bindings([
129
+ game.hud.score({ valuePath: "appState.score" }),
130
+ game.hud.objective({ valuePath: "appState.objective" }),
131
+ game.hud.eventLog({ valuePath: "appState.events" }),
132
+ game.hud.health({ actorId: "ship", label: "Shield", a11yLabel: "ship shield" }),
133
+ game.hud.round({ label: "Wave", valuePath: "appState.wave", a11yLabel: "wave index" })
134
+ ]);
135
+ const runtimeEffects = game.effects({ poolSize: 64 });
136
+
137
+ interface DroneState { alive: boolean; x: number; z: number }
138
+ interface BoltState { live: boolean; x: number; z: number; dx: number; dz: number; ttl: number }
139
+
140
+ // Declared before createGame: the engine calls `scene: buildScene` eagerly
141
+ // inside createGame(), and buildScene maps these pools into nodes — leaving
142
+ // them below the call site throws a TDZ error before the app mounts.
143
+ const drones: DroneState[] = Array.from({ length: DRONE_POOL }, () => ({ alive: false, x: 0, z: 0 }));
144
+ const bolts: BoltState[] = Array.from({ length: BOLT_POOL }, () => ({ live: false, x: 0, z: 0, dx: 0, dz: 0, ttl: 0 }));
145
+
146
+ const auraGame = createGame({
147
+ id: "arena-shooter",
148
+ target: document.querySelector<HTMLElement>("#app")!,
149
+ scene: buildScene,
150
+ qualityRebuild: { flags: [] }
151
+ });
152
+ const app = auraGame.app;
153
+ auraGame.start();
154
+
155
+ const shipNode = app.nodes.require("player-ship");
156
+ const droneNodes = Array.from({ length: DRONE_POOL }, (_, i) => app.nodes.require(`drone-${i}`));
157
+ const boltNodes = Array.from({ length: BOLT_POOL }, (_, i) => app.nodes.require(`bolt-${i}`));
158
+
159
+ // Mount the C-22 camera surface once (fromSpec pins the presented pose); the
160
+ // per-frame setPose below keeps it tracking the ship at the fixed 60° pitch.
161
+ app.camera?.use(
162
+ camera.rigs.fromSpec({
163
+ position: [0, cameraYOffset, cameraZOffset],
164
+ target: [0, ARENA.shipY, CAMERA.targetLeadZ],
165
+ fov: CAMERA.fov
166
+ })
167
+ );
168
+
169
+ ui.html(
170
+ "#hud",
171
+ `
172
+ <section class="hud__panel hud__panel--status" aria-label="Arena status">
173
+ <p>Aura3D game runtime starter</p>
174
+ <h1>Arena Shooter</h1>
175
+ <div class="hud__bars" aria-label="Ship status">
176
+ <span class="hud__bar"><b>Score</b><span id="hud-score">0</span></span>
177
+ <span class="hud__bar"><b>Shield</b><span id="hud-shield">█████</span></span>
178
+ <span class="hud__bar"><b>Wave</b><span id="hud-wave">1</span></span>
179
+ <span class="hud__bar"><b>Drones</b><span id="hud-drones">0</span></span>
180
+ </div>
181
+ </section>
182
+ <section class="hud__panel hud__panel--meta" aria-label="Runtime evidence">
183
+ <span id="hud-status">Wave 1 inbound</span>
184
+ <span id="hud-kills">Kills 0</span>
185
+ <span id="hud-frame">Frame 0</span>
186
+ <span id="hud-camera">Camera 60° top-down</span>
187
+ <span id="hud-assets">Typed assets 3/3</span>
188
+ </section>
189
+ <section id="hud-controls" class="hud__panel hud__panel--controls" aria-label="Controls">
190
+ <button id="hud-pause-button" type="button" aria-pressed="false">Pause</button>
191
+ <span class="hud__help">Move WASD/arrows — fire Space/J — pause Esc — reset R</span>
192
+ </section>
193
+ `
194
+ );
195
+ const hudScore = ui.text("#hud-score");
196
+ const hudShield = ui.text("#hud-shield");
197
+ const hudWave = ui.text("#hud-wave");
198
+ const hudDrones = ui.text("#hud-drones");
199
+ const hudStatus = ui.text("#hud-status");
200
+ const hudKills = ui.text("#hud-kills");
201
+ const hudFrame = ui.text("#hud-frame");
202
+ const hudCamera = ui.text("#hud-camera");
203
+ const hudAssets = ui.text("#hud-assets");
204
+ const pauseButton = ui.button("#hud-pause-button");
205
+
206
+ let shipX = 0;
207
+ let shipZ = 1.6;
208
+ let aimX = 0;
209
+ let aimZ = -1;
210
+ let score = 0;
211
+ let wave = 0;
212
+ let shield = TUNING.shieldMax;
213
+ let kills = 0;
214
+ let invuln = 0;
215
+ let fireCooldown = 0;
216
+ let spawnTimer = 0;
217
+ let dronesQueued = 0;
218
+ let paused = false;
219
+ let gameOver = false;
220
+ let frame = 0;
221
+ let status: ArenaShooterEvidence["status"] = "playing";
222
+ let objective = "Survive the waves. Move WASD/arrows, fire Space.";
223
+
224
+ const spawnAngleFor = (index: number) => (index * 2.39996 + wave * 0.731) % (Math.PI * 2);
225
+
226
+ function startWave(next: number): void {
227
+ wave = next;
228
+ dronesQueued = TUNING.waveDroneBase + next;
229
+ spawnTimer = 0.2; // first drone lands quickly, then every 1.8 s
230
+ routeEvents.push({ type: "wave", label: `wave ${wave} spawn x${dronesQueued}`, frame: wave });
231
+ objective = `Wave ${wave}: clear ${dronesQueued} drones`;
232
+ }
233
+
234
+ function spawnDrone(): void {
235
+ const slot = drones.findIndex((d) => !d.alive);
236
+ if (slot < 0) return;
237
+ const angle = spawnAngleFor(slot + dronesQueued);
238
+ drones[slot] = {
239
+ alive: true,
240
+ x: Math.cos(angle) * (ARENA.maxX + 1.5),
241
+ z: Math.sin(angle) * (ARENA.maxZ + 1.5)
242
+ };
243
+ }
244
+
245
+ function fireBolt(): void {
246
+ const slot = bolts.findIndex((b) => !b.live);
247
+ if (slot < 0) return;
248
+ bolts[slot] = {
249
+ live: true,
250
+ x: shipX + aimX * 1.1,
251
+ z: shipZ + aimZ * 1.1,
252
+ dx: aimX,
253
+ dz: aimZ,
254
+ ttl: TUNING.boltTtlSeconds
255
+ };
256
+ }
257
+
258
+ function resetGame(): void {
259
+ score = 0;
260
+ kills = 0;
261
+ shield = TUNING.shieldMax;
262
+ invuln = 0;
263
+ gameOver = false;
264
+ shipX = 0;
265
+ shipZ = 1.6;
266
+ aimX = 0;
267
+ aimZ = -1;
268
+ for (const d of drones) d.alive = false;
269
+ for (const b of bolts) b.live = false;
270
+ shipNode.setVisible(true);
271
+ routeEvents.push({ type: "reset", label: "route reset" });
272
+ objective = "Survive the waves. Move WASD/arrows, fire Space.";
273
+ startWave(1);
274
+ }
275
+
276
+ ui.onClick(pauseButton, () => setPaused(!paused));
277
+
278
+ startWave(1);
279
+ publishEvidence(0);
280
+
281
+ app.onFrame(({ dt }) => {
282
+ input.update(dt);
283
+ const seconds = Math.min(0.05, Math.max(0, dt));
284
+ frame += 1;
285
+
286
+ if (input.pressed("pause")) setPaused(!paused);
287
+ if (input.pressed("reset")) resetGame();
288
+
289
+ if (!paused && !gameOver) {
290
+ // Move: ship stays inside the arena; aim tracks the last move direction.
291
+ const moveX = input.axis("moveX");
292
+ const moveZ = input.axis("moveZ");
293
+ if (Math.abs(moveX) > 0.05 || Math.abs(moveZ) > 0.05) {
294
+ const len = Math.hypot(moveX, moveZ) || 1;
295
+ shipX += (moveX / len) * TUNING.shipSpeed * seconds;
296
+ shipZ += (moveZ / len) * TUNING.shipSpeed * seconds;
297
+ shipX = Math.max(ARENA.minX, Math.min(ARENA.maxX, shipX));
298
+ shipZ = Math.max(ARENA.minZ, Math.min(ARENA.maxZ, shipZ));
299
+ aimX = moveX / len;
300
+ aimZ = moveZ / len;
301
+ }
302
+
303
+ // Fire: bolts travel the aim direction; cooldown caps the rate.
304
+ fireCooldown -= seconds;
305
+ if (input.held("fire") && fireCooldown <= 0) {
306
+ fireCooldown = TUNING.fireCooldownSeconds;
307
+ fireBolt();
308
+ }
309
+
310
+ // Wave spawner: a drone lands every 1.8 s while the wave has queued ships.
311
+ if (dronesQueued > 0) {
312
+ spawnTimer -= seconds;
313
+ if (spawnTimer <= 0) {
314
+ spawnTimer = TUNING.spawnIntervalSeconds;
315
+ dronesQueued -= 1;
316
+ spawnDrone();
317
+ }
318
+ }
319
+
320
+ // Drones chase the ship; bolts kill on contact; drones cost a shield on
321
+ // contact with the ship (brief invulnerability between hits).
322
+ invuln = Math.max(0, invuln - seconds);
323
+ const droneSpeed = TUNING.droneSpeedBase + (wave - 1) * TUNING.droneSpeedPerWave;
324
+ for (let i = 0; i < drones.length; i += 1) {
325
+ const drone = drones[i];
326
+ if (!drone.alive) continue;
327
+ const toX = shipX - drone.x;
328
+ const toZ = shipZ - drone.z;
329
+ const dist = Math.hypot(toX, toZ);
330
+ if (dist > 0.001) {
331
+ drone.x += (toX / dist) * droneSpeed * seconds;
332
+ drone.z += (toZ / dist) * droneSpeed * seconds;
333
+ }
334
+ if (dist < TUNING.contactRadius && invuln <= 0) {
335
+ shield -= 1;
336
+ invuln = TUNING.invulnSeconds;
337
+ drone.alive = false;
338
+ runtimeEffects.hitSpark([shipX, ARENA.shipY + 0.3, shipZ], { ownerId: `drone-${i}`, intensity: 1.2 });
339
+ routeEvents.push({ type: "hit", label: `shield ${shield}`, severity: "warning" });
340
+ if (shield <= 0) {
341
+ gameOver = true;
342
+ shipNode.setVisible(false);
343
+ runtimeEffects.auraBurst([shipX, ARENA.shipY + 0.4, shipZ], { ownerId: "player-ship", intensity: 1.6 });
344
+ routeEvents.push({ type: "game-over", label: "ship destroyed", severity: "error" });
345
+ objective = "Ship destroyed. Press R to restart.";
346
+ }
347
+ }
348
+ }
349
+
350
+ for (const bolt of bolts) {
351
+ if (!bolt.live) continue;
352
+ bolt.x += bolt.dx * TUNING.boltSpeed * seconds;
353
+ bolt.z += bolt.dz * TUNING.boltSpeed * seconds;
354
+ bolt.ttl -= seconds;
355
+ if (bolt.ttl <= 0 || bolt.x < ARENA.minX - 2 || bolt.x > ARENA.maxX + 2 || bolt.z < ARENA.minZ - 2 || bolt.z > ARENA.maxZ + 2) {
356
+ bolt.live = false;
357
+ continue;
358
+ }
359
+ for (let i = 0; i < drones.length; i += 1) {
360
+ const drone = drones[i];
361
+ if (!drone.alive) continue;
362
+ if (Math.hypot(drone.x - bolt.x, drone.z - bolt.z) < TUNING.boltHitRadius) {
363
+ bolt.live = false;
364
+ drone.alive = false;
365
+ kills += 1;
366
+ score += TUNING.scorePerKill;
367
+ runtimeEffects.hitSpark([drone.x, ARENA.shipY + 0.3, drone.z], { ownerId: `drone-${i}`, intensity: 0.9 });
368
+ routeEvents.push({ type: "kill", label: `drone ${kills}`, severity: "success" });
369
+ break;
370
+ }
371
+ }
372
+ }
373
+
374
+ if (dronesQueued === 0 && drones.every((d) => !d.alive)) {
375
+ score += TUNING.scorePerWave * wave;
376
+ routeEvents.push({ type: "clear", label: `wave ${wave} +${TUNING.scorePerWave * wave}`, severity: "success" });
377
+ startWave(wave + 1);
378
+ }
379
+ }
380
+
381
+ // Present the actors: ship yaw tracks aim, banked into lateral movement.
382
+ const shipYaw = Math.atan2(aimX, aimZ);
383
+ const strafe = input.axis("moveX");
384
+ shipNode
385
+ .setPosition(shipX, ARENA.shipY, shipZ)
386
+ .setRotation(0, shipYaw, -strafe * 0.32);
387
+ for (let i = 0; i < drones.length; i += 1) {
388
+ const drone = drones[i];
389
+ const node = droneNodes[i];
390
+ node.setVisible(drone.alive);
391
+ if (drone.alive) {
392
+ const yaw = Math.atan2(shipX - drone.x, shipZ - drone.z);
393
+ node.setPosition(drone.x, ARENA.shipY, drone.z).setRotation(0, yaw, 0);
394
+ }
395
+ }
396
+ for (let i = 0; i < bolts.length; i += 1) {
397
+ const bolt = bolts[i];
398
+ const node = boltNodes[i];
399
+ node.setVisible(bolt.live).setScale(bolt.live ? 1 : 0);
400
+ if (bolt.live) node.setPosition(bolt.x, ARENA.shipY, bolt.z).setRotation(0, Math.atan2(bolt.dx, bolt.dz), 0);
401
+ }
402
+
403
+ // 60° top-down camera: behind-above the ship, aimed just ahead of it.
404
+ app.camera?.setPose(
405
+ {
406
+ position: [shipX * 0.7, cameraYOffset, shipZ + cameraZOffset],
407
+ target: [shipX, ARENA.shipY, shipZ + CAMERA.targetLeadZ],
408
+ fov: CAMERA.fov
409
+ },
410
+ { cut: true }
411
+ );
412
+
413
+ runtimeEffects.update(seconds);
414
+ status = gameOver ? "game-over" : paused ? "paused" : drones.every((d) => !d.alive) && dronesQueued === 0 ? "wave-cleared" : "playing";
415
+ renderHud();
416
+ publishEvidence(frame);
417
+ });
418
+
419
+ void auraGame.ready().then(() => {
420
+ const diagnostics = app.diagnostics();
421
+ document.body.dataset.aura3dReady = "true";
422
+ document.body.dataset.aura3dRuntimeBackend = diagnostics.backend;
423
+ document.body.dataset.aura3dDrawCalls = String(diagnostics.drawCalls);
424
+ window.__AURA3D_ROUTE_READY__ = { ready: true, diagnostics };
425
+ }).catch((error: unknown) => {
426
+ document.body.dataset.aura3dError = error instanceof Error ? error.message : String(error);
427
+ });
428
+
429
+ function buildScene() {
430
+ // Stars: one instanced sphere draw — 140 tiny emissive points on a backdrop
431
+ // dome behind the arena (the space look keeps a solid #000 background).
432
+ const starTransforms = Array.from({ length: STAR_COUNT }, (_, i) => {
433
+ const a = i * 2.39996;
434
+ const r = 18 + (i % 9) * 2.4;
435
+ return {
436
+ position: [Math.cos(a) * r, 2 + ((i * 7) % 17) * 1.1, -14 - (i % 5) * 3] as readonly [number, number, number],
437
+ scale: 0.05 + ((i * 13) % 5) * 0.018
438
+ };
439
+ });
440
+ const starColors = Array.from({ length: STAR_COUNT }, (_, i) =>
441
+ ["#dfe8ff", "#9db8ff", "#fff3d6", "#ffd6ec"][i % 4]
442
+ );
443
+
444
+ return scene()
445
+ .add(looks.preset(LOOK_ID))
446
+ // Deck plate: dark gloss so the key light and emissive bolts read; rim
447
+ // rails carry the space-look accent.
448
+ .add(
449
+ primitives.box({
450
+ name: "arena deck",
451
+ size: [ARENA.maxX - ARENA.minX + 4, 0.1, ARENA.maxZ - ARENA.minZ + 4],
452
+ position: [0, -0.06, 0],
453
+ material: material.pbr({ color: "#101524", roughness: 0.38, metalness: 0.55 }),
454
+ receiveShadow: true
455
+ })
456
+ )
457
+ .addMany([
458
+ primitives.box({
459
+ name: "rim north",
460
+ size: [ARENA.maxX - ARENA.minX + 4.4, 0.16, 0.14],
461
+ position: [0, 0.02, ARENA.minZ - 2.07],
462
+ material: material.emissive({ color: "#9db8ff", emissive: "#9db8ff", emissiveIntensity: 1.4, roughness: 0.4 })
463
+ }),
464
+ primitives.box({
465
+ name: "rim south",
466
+ size: [ARENA.maxX - ARENA.minX + 4.4, 0.16, 0.14],
467
+ position: [0, 0.02, ARENA.maxZ + 2.07],
468
+ material: material.emissive({ color: "#9db8ff", emissive: "#9db8ff", emissiveIntensity: 1.4, roughness: 0.4 })
469
+ }),
470
+ primitives.box({
471
+ name: "rim west",
472
+ size: [0.14, 0.16, ARENA.maxZ - ARENA.minZ + 4.4],
473
+ position: [ARENA.minX - 2.07, 0.02, 0],
474
+ material: material.emissive({ color: "#9db8ff", emissive: "#9db8ff", emissiveIntensity: 1.4, roughness: 0.4 })
475
+ }),
476
+ primitives.box({
477
+ name: "rim east",
478
+ size: [0.14, 0.16, ARENA.maxZ - ARENA.minZ + 4.4],
479
+ position: [ARENA.maxX + 2.07, 0.02, 0],
480
+ material: material.emissive({ color: "#9db8ff", emissive: "#9db8ff", emissiveIntensity: 1.4, roughness: 0.4 })
481
+ }),
482
+ instances.sphere({
483
+ name: "starfield",
484
+ size: 1,
485
+ transforms: starTransforms,
486
+ colors: starColors,
487
+ material: material.emissive({ color: "#ffffff", emissive: "#ffffff", emissiveIntensity: 1.1 })
488
+ })
489
+ ])
490
+ // Planet setpiece: the detailed meteor GLB scaled into a cratered body
491
+ // hanging over the arena's far edge.
492
+ .add(
493
+ model(assets.planet, { name: "cratered planet", castShadow: false, receiveShadow: false })
494
+ .position(-16, 9, -30)
495
+ .scale(26)
496
+ )
497
+ // Player ship: typed craft_racer GLB, metre scale, feet-origin — it hovers
498
+ // at ARENA.shipY so its own y offset lands the hull mid-air.
499
+ .add(
500
+ model(assets.ship, { name: "player ship", castShadow: true })
501
+ .position(0, ARENA.shipY, 1.6)
502
+ .scale(1)
503
+ .runtime(game.runtimeNode("player-ship", { tags: ["player", "ship"] }))
504
+ )
505
+ // Drone + bolt pools (visibility-toggled at runtime).
506
+ .addMany(
507
+ drones.map((_, i) =>
508
+ model(assets.drone, { name: `drone ${i}`, castShadow: true, visible: false })
509
+ .position(0, ARENA.shipY, 0)
510
+ .runtime(game.runtimeNode(`drone-${i}`, { tags: ["drone", "enemy"] }))
511
+ )
512
+ )
513
+ .addMany(
514
+ bolts.map((_, i) =>
515
+ // scale-0 parked bolt: AuraPrimitiveOptions has no mount-time
516
+ // `visible`, so bolts park collapsed and the runtime handle's
517
+ // setVisible/setScale brings them live on the first frame they fly.
518
+ primitives.box({
519
+ name: `bolt ${i}`,
520
+ size: [0.07, 0.07, 0.62],
521
+ position: [0, ARENA.shipY, 0],
522
+ scale: 0,
523
+ material: material.emissive({ color: "#9db8ff", emissive: "#9db8ff", emissiveIntensity: 3.2, roughness: 0.3 })
524
+ }).runtime(game.runtimeNode(`bolt-${i}`, { tags: ["bolt", "projectile"] }))
525
+ )
526
+ )
527
+ .add(lights.directional({ name: "accent rim", color: "#9db8ff", intensity: 0.9 }).position(-6, 5, 8))
528
+ .camera(
529
+ camera.perspective({
530
+ position: [0, cameraYOffset, cameraZOffset],
531
+ target: [0, ARENA.shipY, CAMERA.targetLeadZ],
532
+ fov: CAMERA.fov
533
+ })
534
+ );
535
+ }
536
+
537
+ function setPaused(next: boolean): void {
538
+ paused = next;
539
+ ui.setPressed(pauseButton, paused);
540
+ ui.setText(pauseButton, paused ? "Resume" : "Pause");
541
+ if (paused) auraGame.session.pause();
542
+ else auraGame.session.resume();
543
+ }
544
+
545
+ function renderHud(): void {
546
+ const alive = drones.reduce((acc, d) => acc + (d.alive ? 1 : 0), 0);
547
+ ui.setText(hudScore, `${score}`);
548
+ ui.setText(hudShield, "█".repeat(Math.max(0, shield)) + "░".repeat(TUNING.shieldMax - Math.max(0, shield)));
549
+ ui.setText(hudWave, `${wave}`);
550
+ ui.setText(hudDrones, `${alive} live / ${dronesQueued} queued`);
551
+ ui.setText(hudStatus, gameOver ? "Game over — press R" : paused ? "Paused" : objective);
552
+ ui.setText(hudKills, `Kills ${kills}`);
553
+ ui.setText(hudFrame, `Frame ${app.runtime.frame}`);
554
+ ui.setText(hudCamera, `Camera ${Math.round((CAMERA.pitchRadians * 180) / Math.PI)}° top-down`);
555
+ ui.setText(hudAssets, `Typed assets ${Object.keys(assets).length}/3 — ${missingAssetNames() || "all mounted"}`);
556
+ }
557
+
558
+ function missingAssetNames(): string {
559
+ return Object.entries(assets)
560
+ .filter(([, asset]) => !asset.url)
561
+ .map(([key]) => key)
562
+ .join(", ");
563
+ }
564
+
565
+ function publishEvidence(currentFrame: number): void {
566
+ const alive = drones.reduce((acc, d) => acc + (d.alive ? 1 : 0), 0);
567
+ const boltsLive = bolts.reduce((acc, b) => acc + (b.live ? 1 : 0), 0);
568
+ window.__AURA3D_ARENA_SHOOTER__ = {
569
+ status,
570
+ frame: currentFrame,
571
+ score,
572
+ wave,
573
+ shield,
574
+ kills,
575
+ dronesAlive: alive,
576
+ dronesQueued,
577
+ boltsLive,
578
+ ship: {
579
+ assetId: assets.ship.id,
580
+ url: assets.ship.url,
581
+ metres: assets.ship.bounds,
582
+ position: [Number(shipX.toFixed(3)), ARENA.shipY, Number(shipZ.toFixed(3))],
583
+ aim: [Number(aimX.toFixed(3)), Number(aimZ.toFixed(3))]
584
+ },
585
+ assets: {
586
+ drone: { assetId: assets.drone.id, url: assets.drone.url },
587
+ planet: { assetId: assets.planet.id, url: assets.planet.url },
588
+ typedAssets: Object.keys(assets).length
589
+ },
590
+ waves: {
591
+ spawnIntervalSeconds: TUNING.spawnIntervalSeconds,
592
+ shieldMax: TUNING.shieldMax,
593
+ invulnSeconds: TUNING.invulnSeconds
594
+ },
595
+ look: { id: LOOK_ID, category: looks.describe(LOOK_ID).category },
596
+ camera: {
597
+ rig: app.camera?.rig.id ?? "scene-perspective",
598
+ pitchDegrees: Math.round((CAMERA.pitchRadians * 180) / Math.PI),
599
+ presented: Boolean(app.camera?.presented())
600
+ },
601
+ events: routeEvents.snapshot().events.map((event) => `${event.type}:${event.label}`),
602
+ evidence: { entry: "@aura3d/engine + @aura3d/engine/contracts createGame" }
603
+ };
604
+ window.__AURA3D_GAME_SOURCE__ = {
605
+ route: window.location.pathname,
606
+ template: "arena-shooter",
607
+ package: "create-aura3d",
608
+ publicEngineApi: true,
609
+ look: { id: LOOK_ID, category: "space", biome: "space" },
610
+ lifecycle: { kind: "createGame", usesCreateGame: true, runtimeEvidenceGlobal: "__AURA3D_ARENA_SHOOTER__" },
611
+ typedAssetPattern: "src/aura-assets.ts",
612
+ typedAssetKeys: ["ship", "drone", "planet"],
613
+ pools: { drones: DRONE_POOL, bolts: BOLT_POOL, stars: STAR_COUNT },
614
+ hud: hudBindings
615
+ };
616
+ }