@auraindustry/aurajs 0.0.7 → 0.1.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 (334) hide show
  1. package/README.md +98 -2
  2. package/benchmarks/perf-thresholds.json +54 -0
  3. package/package.json +4 -7
  4. package/src/asset-pack.mjs +5 -1
  5. package/src/authored-project.mjs +1449 -0
  6. package/src/authored-runtime.mjs +2016 -0
  7. package/src/authoring/avatar-animation-graph.mjs +648 -0
  8. package/src/bin-integrity.mjs +272 -0
  9. package/src/build-contract/assets.mjs +130 -0
  10. package/src/build-contract/capabilities.mjs +116 -0
  11. package/src/build-contract/constants.mjs +6 -0
  12. package/src/build-contract/helpers.mjs +44 -0
  13. package/src/build-contract/web-templates.mjs +5993 -0
  14. package/src/build-contract.mjs +27 -2910
  15. package/src/bundler.mjs +188 -55
  16. package/src/cli.mjs +4825 -1512
  17. package/src/commands/project-authoring.mjs +434 -0
  18. package/src/config.mjs +27 -0
  19. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
  20. package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
  21. package/src/conformance/cases/index.mjs +11 -0
  22. package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
  23. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
  24. package/src/conformance/shared.mjs +27 -0
  25. package/src/conformance-runner.mjs +25 -13
  26. package/src/conformance.mjs +619 -4020
  27. package/src/cutscene.mjs +362 -5
  28. package/src/dev-cli-action.mjs +249 -0
  29. package/src/dev-cli-inspect.mjs +92 -0
  30. package/src/dev-cli-state.mjs +80 -0
  31. package/src/external-asset-cache.mjs +587 -0
  32. package/src/external-asset-policy.mjs +217 -0
  33. package/src/external-package-surface.mjs +206 -0
  34. package/src/game-action-runtime.mjs +869 -0
  35. package/src/game-state-runtime.mjs +206 -6
  36. package/src/headless-action.mjs +186 -0
  37. package/src/headless-test/runtime-animation.mjs +1173 -0
  38. package/src/headless-test/runtime-coordinator.mjs +1514 -0
  39. package/src/headless-test/runtime-primitives.mjs +320 -0
  40. package/src/headless-test/runtime-world.mjs +2253 -0
  41. package/src/headless-test.mjs +392 -4298
  42. package/src/host-binary.mjs +342 -14
  43. package/src/icon-discovery.mjs +64 -0
  44. package/src/make-catalog.mjs +109 -0
  45. package/src/make.mjs +197 -0
  46. package/src/package-integrity.mjs +586 -0
  47. package/src/perf-benchmark.mjs +353 -0
  48. package/src/postinstall.mjs +5 -5
  49. package/src/prefabs/index.mjs +34 -0
  50. package/src/prefabs/scene-serialization.mjs +184 -0
  51. package/src/project-importer.mjs +620 -0
  52. package/src/project-registry.mjs +24 -0
  53. package/src/publish-command.mjs +195 -0
  54. package/src/publish-env-example.mjs +83 -0
  55. package/src/publish-validation.mjs +708 -0
  56. package/src/retro/assets/compile.mjs +232 -0
  57. package/src/retro/backend-gba/authoring.mjs +1029 -0
  58. package/src/retro/backend-gba/rom.mjs +363 -0
  59. package/src/retro/backend-gbc/rom.mjs +85 -0
  60. package/src/retro/build.mjs +278 -0
  61. package/src/retro/cli/commands.mjs +292 -0
  62. package/src/retro/cli/templates.mjs +84 -0
  63. package/src/retro/diagnostics/catalog.mjs +110 -0
  64. package/src/retro/diagnostics/emit.mjs +72 -0
  65. package/src/retro/emulator/case-overlay.mjs +64 -0
  66. package/src/retro/emulator/discovery.mjs +158 -0
  67. package/src/retro/emulator/macos-case-overlay.swift +220 -0
  68. package/src/retro/emulator/profiles.mjs +146 -0
  69. package/src/retro/emulator/runner.mjs +289 -0
  70. package/src/retro/frontend/load-project.mjs +98 -0
  71. package/src/retro/index.mjs +30 -0
  72. package/src/retro/ir/build-ir.mjs +108 -0
  73. package/src/retro/runtime-gba/contract.mjs +151 -0
  74. package/src/retro/runtime-gbc/contract.mjs +117 -0
  75. package/src/retro/shared/span.mjs +26 -0
  76. package/src/retro/shared/targets.mjs +64 -0
  77. package/src/retro/validator/check-project.mjs +114 -0
  78. package/src/runtime-hotspot-audit.mjs +707 -0
  79. package/src/scaffold/config.mjs +1000 -0
  80. package/src/scaffold/fs.mjs +56 -0
  81. package/src/scaffold/layout.mjs +318 -0
  82. package/src/scaffold/project-docs.mjs +438 -0
  83. package/src/scaffold.mjs +93 -596
  84. package/src/scene-composition/index.mjs +326 -0
  85. package/src/scene-composition/runtime.mjs +751 -0
  86. package/src/self-hosted-assets.mjs +604 -0
  87. package/src/session-client.mjs +750 -0
  88. package/src/session-native-launcher.mjs +74 -0
  89. package/src/session-protocol.mjs +75 -0
  90. package/src/session-runtime.mjs +321 -0
  91. package/src/session-server.mjs +360 -0
  92. package/src/shader-kits/index.mjs +773 -0
  93. package/src/starter-content-registry.mjs +292 -0
  94. package/src/state-artifacts.mjs +662 -24
  95. package/src/state-dev-reload.mjs +99 -2
  96. package/src/terminal-ui.mjs +245 -0
  97. package/src/web-conformance.mjs +219 -0
  98. package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
  99. package/templates/create/2d/content/gameplay/waves.json +26 -0
  100. package/templates/create/2d/content/registries/.gitkeep +1 -0
  101. package/templates/create/2d/docs/design/.gitkeep +1 -0
  102. package/templates/create/2d/docs/design/loop.md +5 -0
  103. package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
  104. package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
  105. package/templates/create/2d/prefabs/player.prefab.js +36 -0
  106. package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
  107. package/templates/create/2d/scenes/boot.scene.js +12 -0
  108. package/templates/create/2d/scenes/gameplay.scene.js +230 -0
  109. package/templates/create/2d/scenes/menu.scene.js +9 -0
  110. package/templates/create/2d/src/main.js +6 -185
  111. package/templates/create/2d/src/runtime/app.js +49 -0
  112. package/templates/create/2d/src/runtime/capabilities.js +35 -0
  113. package/templates/create/2d/ui/hud.screen.js +40 -0
  114. package/templates/create/2d/ui/pause.screen.js +149 -0
  115. package/templates/create/2d/ui/settings.screen.js +347 -0
  116. package/templates/create/2d/ui/title.screen.js +13 -0
  117. package/templates/create/2d-adventure/aura.config.json +28 -0
  118. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
  119. package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
  120. package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
  121. package/templates/create/2d-adventure/docs/design/loop.md +5 -0
  122. package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
  123. package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
  124. package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
  125. package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
  126. package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
  127. package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
  128. package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
  129. package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
  130. package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
  131. package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
  132. package/templates/create/2d-survivor/docs/design/loop.md +5 -0
  133. package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
  134. package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
  135. package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
  136. package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
  137. package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
  138. package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
  139. package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
  140. package/templates/create/2d-survivor/src/main.js +5 -332
  141. package/templates/create/2d-survivor/src/runtime/app.js +49 -0
  142. package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
  143. package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
  144. package/templates/create/2d-survivor/ui/title.screen.js +13 -0
  145. package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
  146. package/templates/create/3d/config/gameplay/.gitkeep +1 -0
  147. package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
  148. package/templates/create/3d/content/gameplay/course.js +40 -0
  149. package/templates/create/3d/content/registries/.gitkeep +1 -0
  150. package/templates/create/3d/docs/design/.gitkeep +1 -0
  151. package/templates/create/3d/docs/design/loop.md +5 -0
  152. package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
  153. package/templates/create/3d/prefabs/player.prefab.js +204 -0
  154. package/templates/create/3d/prefabs/world.prefab.js +112 -0
  155. package/templates/create/3d/scenes/boot.scene.js +12 -0
  156. package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
  157. package/templates/create/3d/scenes/gameplay.scene.js +292 -0
  158. package/templates/create/3d/src/main.js +6 -295
  159. package/templates/create/3d/src/runtime/app.js +49 -0
  160. package/templates/create/3d/src/runtime/capabilities.js +53 -0
  161. package/templates/create/3d/src/runtime/materials.js +34 -0
  162. package/templates/create/3d/src/runtime/state.js +39 -0
  163. package/templates/create/3d/ui/hud.screen.js +75 -0
  164. package/templates/create/3d/ui/pause.screen.js +166 -0
  165. package/templates/create/3d/ui/settings.screen.js +387 -0
  166. package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
  167. package/templates/create/3d-adventure/aura.config.json +28 -0
  168. package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
  169. package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
  170. package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
  171. package/templates/create/3d-adventure/docs/design/loop.md +5 -0
  172. package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
  173. package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
  174. package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
  175. package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
  176. package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
  177. package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
  178. package/templates/create/3d-adventure/src/runtime/state.js +31 -0
  179. package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
  180. package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
  181. package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
  182. package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
  183. package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
  184. package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
  185. package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
  186. package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
  187. package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
  188. package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
  189. package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
  190. package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
  191. package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
  192. package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
  193. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
  194. package/templates/create/3d-collectathon/src/main.js +5 -355
  195. package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
  196. package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
  197. package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
  198. package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
  199. package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
  200. package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
  201. package/templates/create/blank/config/gameplay/.gitkeep +1 -0
  202. package/templates/create/blank/content/gameplay/.gitkeep +1 -0
  203. package/templates/create/blank/content/registries/.gitkeep +1 -0
  204. package/templates/create/blank/docs/design/.gitkeep +1 -0
  205. package/templates/create/blank/docs/design/loop.md +5 -0
  206. package/templates/create/blank/prefabs/.gitkeep +1 -0
  207. package/templates/create/blank/scenes/.gitkeep +1 -0
  208. package/templates/create/blank/src/runtime/.gitkeep +1 -0
  209. package/templates/create/blank/ui/.gitkeep +1 -0
  210. package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
  211. package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
  212. package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
  213. package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
  214. package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
  215. package/templates/create/deckbuilder-2d/aura.config.json +28 -0
  216. package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
  217. package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
  218. package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
  219. package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
  220. package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
  221. package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
  222. package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
  223. package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
  224. package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
  225. package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
  226. package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
  227. package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
  228. package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
  229. package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
  230. package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
  231. package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
  232. package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
  233. package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
  234. package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
  235. package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
  236. package/templates/create/deckbuilder-2d/src/main.js +17 -0
  237. package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
  238. package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
  239. package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
  240. package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
  241. package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
  242. package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
  243. package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
  244. package/templates/create/local-multiplayer/aura.config.json +40 -0
  245. package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
  246. package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
  247. package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
  248. package/templates/create/local-multiplayer/docs/design/loop.md +14 -0
  249. package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
  250. package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
  251. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +443 -0
  252. package/templates/create/local-multiplayer/src/main.js +17 -0
  253. package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
  254. package/templates/create/local-multiplayer/ui/hud.screen.js +60 -0
  255. package/templates/create/shared/src/runtime/project-inspector.js +105 -0
  256. package/templates/create/shared/src/runtime/scene-flow.js +290 -0
  257. package/templates/create/shared/src/runtime/screen-shell.js +222 -0
  258. package/templates/create/shared/src/runtime/ui-forms.js +209 -0
  259. package/templates/create/shared/src/runtime/ui-settings.js +237 -0
  260. package/templates/create/shared/src/runtime/ui-theme.js +352 -0
  261. package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
  262. package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
  263. package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
  264. package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
  265. package/templates/create/shared/src/starter-utils/core.js +39 -3
  266. package/templates/create/shared/src/starter-utils/index.js +8 -2
  267. package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
  268. package/templates/create/shared/src/starter-utils/triggers.js +662 -0
  269. package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
  270. package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
  271. package/templates/create/video-cutscene/aura.config.json +28 -0
  272. package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
  273. package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
  274. package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
  275. package/templates/create/video-cutscene/docs/design/loop.md +22 -0
  276. package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
  277. package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
  278. package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
  279. package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
  280. package/templates/create/video-cutscene/src/main.js +17 -0
  281. package/templates/create/video-cutscene/src/runtime/app.js +52 -0
  282. package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
  283. package/templates/create/video-cutscene/src/runtime/state.js +13 -0
  284. package/templates/create/video-cutscene/ui/.gitkeep +0 -0
  285. package/templates/create-bin/play.js +1187 -0
  286. package/templates/make/README.md +46 -0
  287. package/templates/make/catalog.json +51 -0
  288. package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
  289. package/templates/make/component/manifest.json +9 -0
  290. package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
  291. package/templates/make/data/manifest.json +9 -0
  292. package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
  293. package/templates/make/material/manifest.json +9 -0
  294. package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
  295. package/templates/make/prefab/manifest.json +9 -0
  296. package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
  297. package/templates/make/scene/manifest.json +9 -0
  298. package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
  299. package/templates/make/shader/manifest.json +9 -0
  300. package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
  301. package/templates/make/system/manifest.json +9 -0
  302. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
  303. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
  304. package/templates/make/ui-screen/manifest.json +10 -0
  305. package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
  306. package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
  307. package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
  308. package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
  309. package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
  310. package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
  311. package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
  312. package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
  313. package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
  314. package/templates/retro/platformer/README.md +10 -0
  315. package/templates/retro/platformer/assets/retro/assets.json +91 -0
  316. package/templates/retro/platformer/aura.config.json +7 -0
  317. package/templates/retro/platformer/package.json +5 -0
  318. package/templates/retro/platformer/src/main.js +40 -0
  319. package/templates/retro/puzzle-grid/README.md +10 -0
  320. package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
  321. package/templates/retro/puzzle-grid/aura.config.json +7 -0
  322. package/templates/retro/puzzle-grid/package.json +5 -0
  323. package/templates/retro/puzzle-grid/src/main.js +29 -0
  324. package/templates/retro/tactics-grid/README.md +10 -0
  325. package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
  326. package/templates/retro/tactics-grid/aura.config.json +7 -0
  327. package/templates/retro/tactics-grid/package.json +5 -0
  328. package/templates/retro/tactics-grid/src/main.js +35 -0
  329. package/templates/retro/topdown-adventure/README.md +10 -0
  330. package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
  331. package/templates/retro/topdown-adventure/aura.config.json +7 -0
  332. package/templates/retro/topdown-adventure/package.json +5 -0
  333. package/templates/retro/topdown-adventure/src/main.js +29 -0
  334. package/templates/skills/aurajs/SKILL.md +61 -5
@@ -0,0 +1,292 @@
1
+ import {
2
+ axisFromKeys,
3
+ createInteractionPromptState,
4
+ createGoalZone,
5
+ createProximityTrigger3D,
6
+ createTriggerTracker,
7
+ distanceSquared3D,
8
+ isGoalReached,
9
+ respawnAtCheckpoint,
10
+ setAvatarInput3D,
11
+ spawnCharacterAvatar3D,
12
+ stepVolumeTriggers3D,
13
+ stepMovingPlatform3D,
14
+ tickCharacterAvatar3D,
15
+ updateInteractionPromptState,
16
+ updateCheckpointProgress,
17
+ } from '../src/starter-utils/index.js';
18
+ import {
19
+ GOAL_ZONE,
20
+ HUD_TARGET_PICKUPS,
21
+ WORLD_LIMIT,
22
+ } from '../content/gameplay/course.js';
23
+ import { bindPlayerAvatarVisual, drawPlatformerActors, loadPlayerAvatarVisual } from '../prefabs/player.prefab.js';
24
+ import { drawPlatformerCourse, syncPlatformerCharacterObstacles } from '../prefabs/world.prefab.js';
25
+ import { createPlatformerMaterials } from '../src/runtime/materials.js';
26
+ import { advancePickupState, createPlatformerRunState } from '../src/runtime/state.js';
27
+
28
+ function createPlatformerSessionSeed() {
29
+ return {
30
+ runsStarted: 0,
31
+ bestScore: 0,
32
+ lastOutcome: 'idle',
33
+ lastSceneId: 'gameplay',
34
+ };
35
+ }
36
+
37
+ function ensurePlatformerSession(context, appState) {
38
+ if (typeof context.ensureSessionState === 'function') {
39
+ return context.ensureSessionState('platformer', createPlatformerSessionSeed());
40
+ }
41
+ if (!appState.session || typeof appState.session !== 'object' || Array.isArray(appState.session)) {
42
+ appState.session = {};
43
+ }
44
+ if (!appState.session.platformer || typeof appState.session.platformer !== 'object' || Array.isArray(appState.session.platformer)) {
45
+ appState.session.platformer = createPlatformerSessionSeed();
46
+ }
47
+ return appState.session.platformer;
48
+ }
49
+
50
+ function createPlatformerUiStateSeed() {
51
+ return {
52
+ showControlsHint: true,
53
+ };
54
+ }
55
+
56
+ function ensurePlatformerUiState(context, appState) {
57
+ if (typeof context.ensureUiState === 'function') {
58
+ return context.ensureUiState('platformerHud', createPlatformerUiStateSeed());
59
+ }
60
+ if (!appState.ui || typeof appState.ui !== 'object' || Array.isArray(appState.ui)) {
61
+ appState.ui = {};
62
+ }
63
+ if (!appState.ui.platformerHud || typeof appState.ui.platformerHud !== 'object' || Array.isArray(appState.ui.platformerHud)) {
64
+ appState.ui.platformerHud = createPlatformerUiStateSeed();
65
+ }
66
+ return appState.ui.platformerHud;
67
+ }
68
+
69
+ export function createGameplayScene(context = {}) {
70
+ const appState = context.appState || {};
71
+ const platformerSession = ensurePlatformerSession(context, appState);
72
+ const platformerUiState = ensurePlatformerUiState(context, appState);
73
+ const projectTitle = context.projectTitle || 'AuraJS Game';
74
+ const goalZone = createGoalZone(GOAL_ZONE);
75
+ const promptState = createInteractionPromptState();
76
+ const triggerTracker = createTriggerTracker({
77
+ subjectId: 'player',
78
+ dimension: '3d',
79
+ });
80
+ let boxMesh = null;
81
+ let materials = null;
82
+ let playerVisual = null;
83
+ let sceneState = createPlatformerRunState();
84
+
85
+ function syncSessionState() {
86
+ platformerSession.lastSceneId = 'gameplay';
87
+ platformerSession.bestScore = Math.max(Number(platformerSession.bestScore || 0), sceneState.score);
88
+ platformerSession.lastScore = sceneState.score;
89
+ platformerSession.lastOutcome = sceneState.levelComplete ? 'level-complete' : 'running';
90
+ }
91
+
92
+ function isPauseOpen() {
93
+ const shellState = context.getScreenShellState?.();
94
+ return Array.isArray(shellState?.modals) && shellState.modals.some((entry) => entry.screenId === 'pause');
95
+ }
96
+
97
+ function syncHud() {
98
+ context.setHudScreen?.('hud', {
99
+ score: sceneState.score,
100
+ levelComplete: sceneState.levelComplete,
101
+ promptText: promptState.promptText || '',
102
+ paused: isPauseOpen(),
103
+ showControlsHint: platformerUiState.showControlsHint !== false,
104
+ });
105
+ }
106
+
107
+ function buildPromptTriggers() {
108
+ const nextCheckpointIndex = Math.min(
109
+ sceneState.checkpointSystem.activeIndex + 1,
110
+ sceneState.checkpointSystem.checkpoints.length - 1,
111
+ );
112
+ const nextCheckpoint = sceneState.checkpointSystem.checkpoints[nextCheckpointIndex] || null;
113
+ const triggers = [];
114
+
115
+ if (nextCheckpoint && nextCheckpointIndex > sceneState.checkpointSystem.activeIndex) {
116
+ triggers.push(createProximityTrigger3D(
117
+ `checkpoint-${nextCheckpointIndex}`,
118
+ nextCheckpoint.x,
119
+ nextCheckpoint.y,
120
+ nextCheckpoint.z,
121
+ nextCheckpoint.radius + 0.35,
122
+ {
123
+ role: 'checkpoint',
124
+ priority: 2,
125
+ promptText: 'Checkpoint nearby',
126
+ },
127
+ ));
128
+ }
129
+
130
+ if (sceneState.score >= HUD_TARGET_PICKUPS) {
131
+ triggers.push(createProximityTrigger3D('goal-zone', GOAL_ZONE.x, GOAL_ZONE.y, GOAL_ZONE.z, GOAL_ZONE.radius + 0.4, {
132
+ role: 'objective',
133
+ priority: 5,
134
+ promptText: 'Goal ready. Reach the finish.',
135
+ }));
136
+ } else {
137
+ triggers.push(createProximityTrigger3D('pickup-shard', sceneState.pickup.x, sceneState.pickup.y, sceneState.pickup.z, 1.1, {
138
+ role: 'objective',
139
+ priority: 4,
140
+ promptText: 'Collect the relic shard',
141
+ }));
142
+ }
143
+
144
+ return triggers;
145
+ }
146
+
147
+ function updatePromptState() {
148
+ const triggerStep = stepVolumeTriggers3D(triggerTracker, sceneState.player.position, buildPromptTriggers());
149
+ updateInteractionPromptState(promptState, triggerStep, {
150
+ interactPressed: false,
151
+ });
152
+ }
153
+
154
+ function syncPauseModal() {
155
+ if (!aura.input.isKeyPressed('escape')) return false;
156
+
157
+ const shellState = context.getScreenShellState?.();
158
+ const topModal = shellState?.modals?.[shellState.modals.length - 1] || null;
159
+ if (topModal) {
160
+ context.popModalScreen?.({
161
+ resumeReason: 'resume',
162
+ });
163
+ return true;
164
+ }
165
+
166
+ const pauseData = {
167
+ score: sceneState.score,
168
+ levelComplete: sceneState.levelComplete,
169
+ };
170
+ context.pushModalScreen?.('pause', pauseData);
171
+ return true;
172
+ }
173
+
174
+ function resetRun() {
175
+ sceneState = createPlatformerRunState(sceneState?.player ?? null);
176
+ if (!playerVisual) return;
177
+ bindPlayerAvatarVisual(sceneState.player, playerVisual);
178
+ syncPlatformerCharacterObstacles(sceneState.movingPlatform);
179
+ spawnCharacterAvatar3D(aura, sceneState.player, { position: sceneState.player.position });
180
+ updatePromptState();
181
+ platformerSession.runsStarted += 1;
182
+ syncSessionState();
183
+ syncHud();
184
+ }
185
+
186
+ function updateMovement(dt) {
187
+ const moveX = axisFromKeys(aura.input, ['arrowleft', 'a'], ['arrowright', 'd']);
188
+ const moveZ = axisFromKeys(aura.input, ['arrowup', 'w'], ['arrowdown', 's']);
189
+ const jumpedThisFrame = aura.input.isKeyPressed('space');
190
+ const runningThisFrame = aura.input.isKeyDown('shift') || aura.input.isKeyDown('shiftleft') || aura.input.isKeyDown('shiftright');
191
+ if (platformerUiState.showControlsHint && (moveX !== 0 || moveZ !== 0 || jumpedThisFrame || runningThisFrame)) {
192
+ platformerUiState.showControlsHint = false;
193
+ }
194
+ setAvatarInput3D(sceneState.player, {
195
+ moveX,
196
+ moveZ,
197
+ jump: jumpedThisFrame,
198
+ run: runningThisFrame,
199
+ });
200
+ tickCharacterAvatar3D(aura, sceneState.player, dt);
201
+ sceneState.player.position.x = Math.max(-WORLD_LIMIT, Math.min(WORLD_LIMIT, sceneState.player.position.x));
202
+ sceneState.player.position.z = Math.max(-WORLD_LIMIT, Math.min(WORLD_LIMIT, sceneState.player.position.z));
203
+ spawnCharacterAvatar3D(aura, sceneState.player, { position: sceneState.player.position });
204
+ }
205
+
206
+ function updateProgress() {
207
+ if (sceneState.player.position.y < -10) {
208
+ if (!respawnAtCheckpoint(sceneState.checkpointSystem, sceneState.player)) {
209
+ resetRun();
210
+ return false;
211
+ }
212
+ spawnCharacterAvatar3D(aura, sceneState.player, { position: sceneState.player.position });
213
+ }
214
+
215
+ if (distanceSquared3D(sceneState.player, sceneState.pickup) <= 0.8) {
216
+ advancePickupState(sceneState);
217
+ }
218
+
219
+ updateCheckpointProgress(sceneState.checkpointSystem, sceneState.player);
220
+ if (sceneState.score >= HUD_TARGET_PICKUPS && isGoalReached(goalZone, sceneState.player)) {
221
+ sceneState.levelComplete = true;
222
+ syncSessionState();
223
+ }
224
+ return true;
225
+ }
226
+
227
+ return {
228
+ setup() {
229
+ boxMesh = aura.mesh.createBox();
230
+ materials = createPlatformerMaterials();
231
+ playerVisual = loadPlayerAvatarVisual();
232
+
233
+ aura.light.ambient({ r: 1, g: 1, b: 1 }, 0.22);
234
+ aura.light.directional({ x: 0.6, y: -1.0, z: -0.4 }, { r: 1, g: 1, b: 1 }, 1.0);
235
+ aura.camera3d.perspective(62, 0.1, 140);
236
+
237
+ resetRun();
238
+ syncHud();
239
+ console.log(`${projectTitle} started (3D platformer template)`);
240
+ },
241
+ update(dt) {
242
+ if (syncPauseModal()) {
243
+ syncHud();
244
+ return;
245
+ }
246
+ if (isPauseOpen()) {
247
+ syncHud();
248
+ return;
249
+ }
250
+
251
+ sceneState.elapsed += dt;
252
+ stepMovingPlatform3D(sceneState.movingPlatform, dt);
253
+ syncPlatformerCharacterObstacles(sceneState.movingPlatform);
254
+
255
+ if (sceneState.levelComplete) {
256
+ if (aura.input.isKeyPressed('enter')) {
257
+ resetRun();
258
+ }
259
+ syncHud();
260
+ return;
261
+ }
262
+
263
+ updateMovement(dt);
264
+ if (!updateProgress()) return;
265
+ updatePromptState();
266
+ syncSessionState();
267
+ syncHud();
268
+ },
269
+ onResume() {
270
+ syncHud();
271
+ },
272
+ onExit() {
273
+ context.clearHudScreen?.();
274
+ },
275
+ draw() {
276
+ aura.draw3d.clear3d({ r: 0.06, g: 0.08, b: 0.12 });
277
+ drawPlatformerCourse({
278
+ mesh: boxMesh,
279
+ floorMaterial: materials.floor,
280
+ platformMaterial: materials.platform,
281
+ movingPlatform: sceneState.movingPlatform,
282
+ });
283
+ drawPlatformerActors({
284
+ mesh: boxMesh,
285
+ materials,
286
+ state: sceneState,
287
+ goalZone,
288
+ });
289
+ aura.scene3d.submitRenderBindings();
290
+ },
291
+ };
292
+ }
@@ -1,306 +1,17 @@
1
- // {{PROJECT_TITLE}} AuraJS 3D platformer starter
1
+ // {{PROJECT_TITLE}} - AuraJS 3D platformer starter
2
2
 
3
- import { activeCheckpoint, axisFromKeys, clamp, createCheckpointSystem, createGoalZone, createMovingPlatform3D, distanceSquared3D, isGoalReached, respawnAtCheckpoint, stepVerticalMotion, stepMovingPlatform3D, tryJump, updateCheckpointProgress } from './starter-utils/index.js';
3
+ import { createApp } from './runtime/app.js';
4
4
 
5
- const PLAYER_HALF = { x: 0.45, y: 0.55, z: 0.45 };
6
- const MOVE_SPEED = 5.3;
7
- const JUMP_SPEED = 8.2;
8
- const GRAVITY = 20.0;
9
- const WORLD_LIMIT = 9.0;
10
-
11
- const STATIC_PLATFORMS = [
12
- { x: -3.2, y: 1.2, z: -2.4, sx: 3.0, sy: 0.5, sz: 2.2 },
13
- { x: 1.4, y: 2.4, z: -0.8, sx: 2.8, sy: 0.5, sz: 2.0 },
14
- { x: 4.4, y: 3.8, z: -3.0, sx: 3.4, sy: 0.5, sz: 2.0 },
15
- ];
16
- const CHECKPOINTS = [
17
- { x: 0, y: 1.1, z: 5.5, radius: 1.4 },
18
- { x: -3.2, y: 2.0, z: -2.4, radius: 1.25 },
19
- { x: 1.4, y: 3.2, z: -0.8, radius: 1.25 },
20
- { x: 4.4, y: 4.6, z: -3.0, radius: 1.3 },
21
- ];
22
-
23
- let boxMesh;
24
- let floorMat;
25
- let platformMat;
26
- let playerMat;
27
- let pickupMat;
28
- let checkpointMat;
29
- let goalMat;
30
-
31
- let player = { x: 0, y: 1.1, z: 5.5, vy: 0, onGround: false };
32
- let pickup = { x: 4.4, y: 4.6, z: -3.0 };
33
- let score = 0;
34
- let elapsed = 0;
35
- let levelComplete = false;
36
- let checkpointSystem = createCheckpointSystem({ checkpoints: CHECKPOINTS });
37
- let movingPlatform = createMovingPlatform3D({
38
- from: { x: -0.2, y: 1.8, z: 2.2 },
39
- to: { x: 3.1, y: 3.0, z: 0.8 },
40
- size: { x: 2.4, y: 0.4, z: 2.0 },
41
- periodSeconds: 3.2,
42
- });
43
- const goalZone = createGoalZone({ x: 4.4, y: 4.8, z: -3.0, radius: 1.15 });
44
-
45
- function hasMethod(obj, method) {
46
- return Boolean(obj) && typeof obj[method] === 'function';
47
- }
48
-
49
- function failWithReason(reasonCode, message) {
50
- throw new Error(`[3d-platformer-template] ${message} [reason:${reasonCode}]`);
51
- }
52
-
53
- function assertRuntimeCapabilities() {
54
- const missing = [];
55
- if (!hasMethod(aura.mesh, 'createBox')) missing.push('aura.mesh.createBox');
56
- if (!hasMethod(aura.material, 'create')) missing.push('aura.material.create');
57
- if (!hasMethod(aura.light, 'ambient')) missing.push('aura.light.ambient');
58
- if (!hasMethod(aura.light, 'directional')) missing.push('aura.light.directional');
59
- if (!hasMethod(aura.camera3d, 'perspective')) missing.push('aura.camera3d.perspective');
60
- if (!hasMethod(aura.camera3d, 'setPosition')) missing.push('aura.camera3d.setPosition');
61
- if (!hasMethod(aura.camera3d, 'lookAt')) missing.push('aura.camera3d.lookAt');
62
- if (!hasMethod(aura.input, 'isKeyDown')) missing.push('aura.input.isKeyDown');
63
- if (!hasMethod(aura.input, 'isKeyPressed')) missing.push('aura.input.isKeyPressed');
64
- if (!hasMethod(aura.draw3d, 'clear3d')) missing.push('aura.draw3d.clear3d');
65
- if (!hasMethod(aura.draw3d, 'drawMesh')) missing.push('aura.draw3d.drawMesh');
66
- if (!hasMethod(aura.draw2d, 'text')) missing.push('aura.draw2d.text');
67
- if (!hasMethod(aura.draw2d, 'measureText')) missing.push('aura.draw2d.measureText');
68
- if (typeof aura.rgb !== 'function') missing.push('aura.rgb');
69
- if (!aura.Color || !aura.Color.WHITE) missing.push('aura.Color.WHITE');
70
-
71
- if (missing.length > 0) {
72
- failWithReason('missing_runtime_api', `runtime missing required APIs: ${missing.join(', ')}`);
73
- }
74
-
75
- const small = aura.draw2d.measureText('Probe', { size: 8 });
76
- const large = aura.draw2d.measureText('Probe', { size: 24 });
77
- if (!Number.isFinite(Number(small?.width)) || !Number.isFinite(Number(large?.width)) || Number(large.width) <= Number(small.width)) {
78
- failWithReason(
79
- 'placeholder_runtime_behavior',
80
- 'draw2d.measureText appears to be placeholder behavior (size does not affect width).',
81
- );
82
- }
83
- }
84
-
85
- function resetRun() {
86
- player = { x: 0, y: 1.1, z: 5.5, vy: 0, onGround: false };
87
- pickup = { x: 4.4, y: 4.6, z: -3.0 };
88
- score = 0;
89
- elapsed = 0;
90
- levelComplete = false;
91
- checkpointSystem = createCheckpointSystem({ checkpoints: CHECKPOINTS });
92
- movingPlatform = createMovingPlatform3D({
93
- from: { x: -0.2, y: 1.8, z: 2.2 },
94
- to: { x: 3.1, y: 3.0, z: 0.8 },
95
- size: { x: 2.4, y: 0.4, z: 2.0 },
96
- periodSeconds: 3.2,
97
- });
98
- }
99
-
100
- function findSupportTop(x, z) {
101
- let top = 0;
102
-
103
- const includePlatform = (platform) => {
104
- const hx = platform.sx * 0.5;
105
- const hz = platform.sz * 0.5;
106
- if (Math.abs(x - platform.x) > hx || Math.abs(z - platform.z) > hz) return;
107
- top = Math.max(top, platform.y + (platform.sy * 0.5));
108
- };
109
-
110
- for (const platform of STATIC_PLATFORMS) {
111
- includePlatform(platform);
112
- }
113
-
114
- includePlatform({
115
- x: movingPlatform.position.x,
116
- y: movingPlatform.position.y,
117
- z: movingPlatform.position.z,
118
- sx: movingPlatform.size.x,
119
- sy: movingPlatform.size.y,
120
- sz: movingPlatform.size.z,
121
- });
122
-
123
- return top;
124
- }
125
-
126
- function collectPickup() {
127
- if (levelComplete) return;
128
- if (distanceSquared3D(player, pickup) > 0.8) return;
129
-
130
- score += 1;
131
- if (score % 3 === 0) {
132
- pickup = { x: 0, y: 3.0, z: -4.0 };
133
- } else if (score % 2 === 0) {
134
- pickup = { x: -3.2, y: 2.0, z: -2.4 };
135
- } else {
136
- pickup = { x: 1.4, y: 3.2, z: -0.8 };
137
- }
138
- }
5
+ const app = createApp();
139
6
 
140
7
  aura.setup = function () {
141
- assertRuntimeCapabilities();
142
- boxMesh = aura.mesh.createBox();
143
-
144
- floorMat = aura.material.create({
145
- color: { r: 0.18, g: 0.28, b: 0.2, a: 1.0 },
146
- metallic: 0.05,
147
- roughness: 0.95,
148
- });
149
-
150
- platformMat = aura.material.create({
151
- color: { r: 0.42, g: 0.56, b: 0.78, a: 1.0 },
152
- metallic: 0.1,
153
- roughness: 0.6,
154
- });
155
-
156
- playerMat = aura.material.create({
157
- color: { r: 0.98, g: 0.52, b: 0.26, a: 1.0 },
158
- metallic: 0.25,
159
- roughness: 0.35,
160
- });
161
-
162
- pickupMat = aura.material.create({
163
- color: { r: 0.95, g: 0.9, b: 0.3, a: 1.0 },
164
- metallic: 0.65,
165
- roughness: 0.25,
166
- });
167
-
168
- checkpointMat = aura.material.create({
169
- color: { r: 0.36, g: 0.9, b: 1.0, a: 1.0 },
170
- metallic: 0.45,
171
- roughness: 0.28,
172
- });
173
-
174
- goalMat = aura.material.create({
175
- color: { r: 0.5, g: 1.0, b: 0.64, a: 1.0 },
176
- metallic: 0.35,
177
- roughness: 0.35,
178
- });
179
-
180
- aura.light.ambient({ r: 1, g: 1, b: 1 }, 0.22);
181
- aura.light.directional({ x: 0.6, y: -1.0, z: -0.4 }, { r: 1, g: 1, b: 1 }, 1.0);
182
- aura.camera3d.perspective(62, 0.1, 140);
183
-
184
- resetRun();
185
- console.log('{{PROJECT_TITLE}} started (3D platformer template)');
8
+ app.setup();
186
9
  };
187
10
 
188
11
  aura.update = function (dt) {
189
- elapsed += dt;
190
- stepMovingPlatform3D(movingPlatform, dt);
191
-
192
- if (levelComplete) {
193
- if (aura.input.isKeyPressed('enter')) resetRun();
194
- return;
195
- }
196
-
197
- const moveX = axisFromKeys(aura.input, ['arrowleft', 'a'], ['arrowright', 'd']);
198
- const moveZ = axisFromKeys(aura.input, ['arrowup', 'w'], ['arrowdown', 's']);
199
-
200
- player.x += moveX * MOVE_SPEED * dt;
201
- player.z += moveZ * MOVE_SPEED * dt;
202
- player.x = clamp(player.x, -WORLD_LIMIT, WORLD_LIMIT);
203
- player.z = clamp(player.z, -WORLD_LIMIT, WORLD_LIMIT);
204
-
205
- if (aura.input.isKeyPressed('space')) {
206
- tryJump(player, JUMP_SPEED);
207
- }
208
-
209
- const supportTop = findSupportTop(player.x, player.z);
210
- const floorY = supportTop + PLAYER_HALF.y;
211
- stepVerticalMotion(player, dt, GRAVITY, floorY);
212
-
213
- if (player.y < -10) {
214
- if (!respawnAtCheckpoint(checkpointSystem, player)) {
215
- resetRun();
216
- }
217
- }
218
-
219
- collectPickup();
220
- updateCheckpointProgress(checkpointSystem, player);
221
- if (score >= 3 && isGoalReached(goalZone, player)) {
222
- levelComplete = true;
223
- }
224
-
225
- aura.camera3d.setPosition(player.x + 7.4, player.y + 6.0, player.z + 8.8);
226
- aura.camera3d.lookAt(player.x, player.y + 0.2, player.z);
12
+ app.update(dt);
227
13
  };
228
14
 
229
15
  aura.draw = function () {
230
- aura.draw3d.clear3d({ r: 0.06, g: 0.08, b: 0.12 });
231
-
232
- aura.draw3d.drawMesh(boxMesh, floorMat, {
233
- position: { x: 0, y: -0.5, z: 0 },
234
- rotation: { x: 0, y: 0, z: 0 },
235
- scale: { x: 24, y: 1, z: 24 },
236
- });
237
-
238
- for (const platform of STATIC_PLATFORMS) {
239
- aura.draw3d.drawMesh(boxMesh, platformMat, {
240
- position: { x: platform.x, y: platform.y, z: platform.z },
241
- rotation: { x: 0, y: 0, z: 0 },
242
- scale: { x: platform.sx, y: platform.sy, z: platform.sz },
243
- });
244
- }
245
-
246
- aura.draw3d.drawMesh(boxMesh, platformMat, {
247
- position: { x: movingPlatform.position.x, y: movingPlatform.position.y, z: movingPlatform.position.z },
248
- rotation: { x: 0, y: 0, z: 0 },
249
- scale: { x: movingPlatform.size.x, y: movingPlatform.size.y, z: movingPlatform.size.z },
250
- });
251
-
252
- aura.draw3d.drawMesh(boxMesh, playerMat, {
253
- position: { x: player.x, y: player.y, z: player.z },
254
- rotation: { x: 0, y: elapsed * 1.2, z: 0 },
255
- scale: { x: PLAYER_HALF.x * 2, y: PLAYER_HALF.y * 2, z: PLAYER_HALF.z * 2 },
256
- });
257
-
258
- aura.draw3d.drawMesh(boxMesh, pickupMat, {
259
- position: { x: pickup.x, y: pickup.y + (Math.sin(elapsed * 2.5) * 0.2), z: pickup.z },
260
- rotation: { x: elapsed * 0.4, y: elapsed * 1.5, z: elapsed * 0.3 },
261
- scale: { x: 0.55, y: 0.55, z: 0.55 },
262
- });
263
-
264
- const checkpoint = activeCheckpoint(checkpointSystem);
265
- if (checkpoint) {
266
- aura.draw3d.drawMesh(boxMesh, checkpointMat, {
267
- position: { x: checkpoint.x, y: checkpoint.y - 0.4, z: checkpoint.z },
268
- rotation: { x: 0, y: elapsed * 0.7, z: 0 },
269
- scale: { x: 0.45, y: 0.45, z: 0.45 },
270
- });
271
- }
272
-
273
- aura.draw3d.drawMesh(boxMesh, goalMat, {
274
- position: { x: goalZone.x, y: goalZone.y, z: goalZone.z },
275
- rotation: { x: 0, y: elapsed * 0.9, z: 0 },
276
- scale: { x: goalZone.radius * 1.2, y: goalZone.radius * 1.2, z: goalZone.radius * 1.2 },
277
- });
278
-
279
- aura.draw2d.text('Move: Arrows/WASD Jump: Space', 12, 12, {
280
- color: aura.Color.WHITE,
281
- size: 14,
282
- align: 'left',
283
- });
284
- aura.draw2d.text(`Pickups ${score}/3`, 12, 34, {
285
- color: aura.Color.WHITE,
286
- size: 14,
287
- align: 'left',
288
- });
289
- aura.draw2d.text('Reach checkpoints. Goal unlocks at 3 pickups.', 12, 56, {
290
- color: aura.Color.WHITE,
291
- size: 13,
292
- align: 'left',
293
- });
294
- if (levelComplete) {
295
- aura.draw2d.text('GOAL REACHED', 12, 84, {
296
- color: aura.rgb(0.5, 1.0, 0.64),
297
- size: 24,
298
- align: 'left',
299
- });
300
- aura.draw2d.text('Press Enter to restart', 12, 112, {
301
- color: aura.Color.WHITE,
302
- size: 16,
303
- align: 'left',
304
- });
305
- }
16
+ app.draw();
306
17
  };
@@ -0,0 +1,49 @@
1
+ import { createSceneRegistry } from './scene-registry.js';
2
+ import { createProjectInspector } from './project-inspector.js';
3
+ import { assertRuntimeCapabilities } from './capabilities.js';
4
+
5
+ export function createApp() {
6
+ const sceneRegistry = createSceneRegistry({
7
+ projectTitle: '{{PROJECT_TITLE}}',
8
+ });
9
+ const projectInspector = createProjectInspector();
10
+ let activeSceneId = sceneRegistry.defaultSceneId || Object.keys(sceneRegistry.scenes)[0] || null;
11
+
12
+ const activeScene = () => (activeSceneId ? sceneRegistry.scenes[activeSceneId] || null : null);
13
+
14
+ return {
15
+ get activeSceneId() {
16
+ return activeSceneId;
17
+ },
18
+ get sceneRegistry() {
19
+ return sceneRegistry;
20
+ },
21
+ get projectInspectorEnabled() {
22
+ return projectInspector.enabled;
23
+ },
24
+ getProjectInspectorState() {
25
+ return projectInspector.snapshot({ activeSceneId });
26
+ },
27
+ setup() {
28
+ assertRuntimeCapabilities();
29
+ activeScene()?.setup?.();
30
+ },
31
+ update(dt) {
32
+ projectInspector.syncInput(globalThis.aura?.input || null);
33
+ activeScene()?.update?.(dt);
34
+ },
35
+ draw() {
36
+ activeScene()?.draw?.();
37
+ projectInspector.draw({ activeSceneId });
38
+ },
39
+ toggleProjectInspector(nextEnabled) {
40
+ return projectInspector.toggle(nextEnabled);
41
+ },
42
+ swapScene(nextSceneId) {
43
+ if (!sceneRegistry.scenes[nextSceneId]) {
44
+ throw new Error(`Unknown scene "${nextSceneId}".`);
45
+ }
46
+ activeSceneId = nextSceneId;
47
+ },
48
+ };
49
+ }