create-threenative 0.2.17 → 0.2.20

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 (387) hide show
  1. package/agent-docs/kit-mcp.md +1 -1
  2. package/agent-docs/kit-router.md +1 -1
  3. package/agent-docs/references/assertion-reference.md +54 -110
  4. package/agent-docs/references/capability-reference.md +790 -24
  5. package/agent-docs/references/conventions.md +28 -0
  6. package/agent-docs/references/kit-racing.md +4 -2
  7. package/agent-docs/references/performance-basics.md +10 -5
  8. package/agent-docs/references/terrain-authoring.md +21 -7
  9. package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
  10. package/agent-files/.agents/skills/prd-creator/SKILL.md +24 -0
  11. package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +7 -4
  12. package/agent-files/.claude/hooks/discovery-gate.mjs +2 -2
  13. package/dist/index.d.ts +97 -6
  14. package/dist/index.js +1040 -529
  15. package/dist/quality.d.ts +5 -1
  16. package/dist/quality.js +75 -6
  17. package/dist/terrain-kit.js +1 -1
  18. package/dist/threenative.js +98 -17
  19. package/dist/web-engine-ccd-ik-solver.js +127 -0
  20. package/dist/web-engine-gltf-loader.js +52 -14
  21. package/dist/web-engine-post-effects.js +11 -10
  22. package/dist/web-engine-runtime.js +3638 -361
  23. package/package.json +8 -7
  24. package/template-assets/assets/floor-fern-0.glb +0 -0
  25. package/template-assets/assets/floor-litter-0.glb +0 -0
  26. package/template-assets/assets/floor-log-0.glb +0 -0
  27. package/template-assets/assets/floor-log-1.glb +0 -0
  28. package/template-assets/assets/floor-stump-0.glb +0 -0
  29. package/template-assets/assets/floor-twig-0.glb +0 -0
  30. package/template-assets/clearwater/README.md +1 -1
  31. package/template-assets/patches/manifest.json +18 -0
  32. package/template-assets/quality/eslint.config.js +1 -1
  33. package/templates/action-rpg/AGENTS.md +8 -4
  34. package/templates/action-rpg/CLAUDE.md +8 -4
  35. package/templates/action-rpg/package.json +7 -7
  36. package/templates/action-rpg/src/game.ts +1 -1
  37. package/templates/action-rpg/src/loot/drops.ts +3 -7
  38. package/templates/action-rpg/src/render/atmosphere.ts +6 -0
  39. package/templates/action-rpg/src/render/backlightControls.ts +10 -0
  40. package/templates/action-rpg/src/render/backlightMaterial.ts +4 -4
  41. package/templates/action-rpg/src/render/camera.ts +2 -2
  42. package/templates/action-rpg/src/render/clouds.ts +16 -1
  43. package/templates/action-rpg/src/render/materialLighting.ts +5 -5
  44. package/templates/action-rpg/src/render/materials.ts +3 -2
  45. package/templates/action-rpg/src/render/quality.ts +7 -32
  46. package/templates/action-rpg/src/render/touch-controls.ts +7 -6
  47. package/templates/action-rpg/src/scenes/Play.ts +5 -16
  48. package/templates/action-rpg/src/style.css +4 -0
  49. package/templates/action-rpg/vite.config.ts +2 -0
  50. package/templates/adventure/AGENTS.md +10 -5
  51. package/templates/adventure/CLAUDE.md +10 -5
  52. package/templates/adventure/kit.json +5 -1
  53. package/templates/adventure/native-playtests/survives.playtest.json +12 -0
  54. package/templates/adventure/native-playtests/woodland-floor.playtest.json +61 -0
  55. package/templates/adventure/package.json +7 -7
  56. package/templates/adventure/playtests/grass.playtest.json +61 -0
  57. package/templates/adventure/playtests/performance.playtest.json +1 -1
  58. package/templates/adventure/playtests/survives.playtest.json +2 -2
  59. package/templates/adventure/playtests/woodland-floor.playtest.json +61 -0
  60. package/templates/adventure/src/entities/LockOn.ts +42 -4
  61. package/templates/adventure/src/entities/Warden.ts +4 -1
  62. package/templates/adventure/src/game.ts +1 -1
  63. package/templates/adventure/src/level/Vale.ts +241 -16
  64. package/templates/adventure/src/render/camera.ts +2 -2
  65. package/templates/adventure/src/render/foliage.ts +64 -20
  66. package/templates/adventure/src/render/grass.ts +325 -0
  67. package/templates/adventure/src/render/materials.ts +3 -2
  68. package/templates/adventure/src/render/palette.ts +3 -0
  69. package/templates/adventure/src/render/touch-controls.ts +4 -1
  70. package/templates/adventure/src/scenes/Play.ts +96 -1
  71. package/templates/adventure/src/style.css +4 -0
  72. package/templates/adventure/tsconfig.json +1 -1
  73. package/templates/adventure/vite.config.ts +2 -0
  74. package/templates/collectathon/AGENTS.md +7 -2
  75. package/templates/collectathon/CLAUDE.md +7 -2
  76. package/templates/collectathon/package.json +7 -7
  77. package/templates/collectathon/src/game.ts +1 -1
  78. package/templates/collectathon/src/level/Course.ts +55 -14
  79. package/templates/collectathon/src/level/terrain.ts +29 -7
  80. package/templates/collectathon/src/main.ts +1 -0
  81. package/templates/collectathon/src/render/camera.ts +2 -2
  82. package/templates/collectathon/src/render/foliage.ts +359 -98
  83. package/templates/collectathon/src/render/ground.ts +4 -4
  84. package/templates/collectathon/src/render/hero.ts +1 -1
  85. package/templates/collectathon/src/render/materials.ts +0 -1
  86. package/templates/collectathon/src/render/sky.ts +80 -15
  87. package/templates/collectathon/src/render/water.ts +32 -10
  88. package/templates/collectathon/src/scenes/Play.ts +18 -5
  89. package/templates/collectathon/src/style.css +4 -0
  90. package/templates/collectathon/tsconfig.json +1 -1
  91. package/templates/collectathon/vite.config.ts +2 -0
  92. package/templates/kart/AGENTS.md +7 -2
  93. package/templates/kart/CLAUDE.md +7 -2
  94. package/templates/kart/package.json +6 -6
  95. package/templates/kart/src/entities/Kart.ts +2 -1
  96. package/templates/kart/src/game.ts +1 -1
  97. package/templates/kart/src/main.ts +1 -0
  98. package/templates/kart/src/render/course.ts +2 -1
  99. package/templates/kart/src/style.css +4 -0
  100. package/templates/kart/src/track/Course.ts +3 -1
  101. package/templates/kart/tsconfig.json +1 -1
  102. package/templates/kart/vite.config.ts +2 -0
  103. package/templates/minimal/AGENTS.md +8 -3
  104. package/templates/minimal/CLAUDE.md +8 -3
  105. package/templates/minimal/package.json +6 -6
  106. package/templates/minimal/playtests/stands-still.playtest.json +30 -0
  107. package/templates/minimal/src/game.ts +1 -1
  108. package/templates/minimal/src/render/atmosphere.ts +6 -0
  109. package/templates/minimal/src/render/backlightControls.ts +10 -0
  110. package/templates/minimal/src/render/backlightMaterial.ts +4 -4
  111. package/templates/minimal/src/render/camera.ts +14 -3
  112. package/templates/minimal/src/render/clouds.ts +16 -1
  113. package/templates/minimal/src/render/lighting.ts +4 -2
  114. package/templates/minimal/src/render/materialLighting.ts +5 -5
  115. package/templates/minimal/src/render/materials.ts +13 -2
  116. package/templates/minimal/src/render/quality.ts +7 -32
  117. package/templates/minimal/src/render/touch-controls.ts +7 -6
  118. package/templates/minimal/src/scenes/Play.ts +4 -1
  119. package/templates/minimal/vite.config.ts +7 -1
  120. package/templates/platformer/AGENTS.md +9 -4
  121. package/templates/platformer/CLAUDE.md +9 -4
  122. package/templates/platformer/index.html +1 -1
  123. package/templates/platformer/main.html +12 -0
  124. package/templates/platformer/package.json +7 -7
  125. package/templates/platformer/playtests/collect.playtest.json +4 -1
  126. package/templates/platformer/playtests/gamepad-idle.playtest.json +21 -0
  127. package/templates/platformer/playtests/gamepad.playtest.json +30 -0
  128. package/templates/platformer/src/entities/Fox.ts +21 -6
  129. package/templates/platformer/src/game.ts +1 -1
  130. package/templates/platformer/src/level/Stage.ts +2 -6
  131. package/templates/platformer/src/main.ts +1 -0
  132. package/templates/platformer/src/render/backlightControls.ts +10 -0
  133. package/templates/platformer/src/render/backlightMaterial.ts +4 -4
  134. package/templates/platformer/src/render/materialLighting.ts +5 -5
  135. package/templates/platformer/src/render/quality.ts +7 -32
  136. package/templates/platformer/src/scenes/Play.ts +4 -2
  137. package/templates/platformer/src/style.css +4 -0
  138. package/templates/platformer/src/worker-page.ts +29 -0
  139. package/templates/platformer/src/worker.ts +5 -0
  140. package/templates/platformer/tsconfig.json +1 -1
  141. package/templates/platformer/vite.config.ts +4 -0
  142. package/templates/puzzle/AGENTS.md +7 -2
  143. package/templates/puzzle/CLAUDE.md +7 -2
  144. package/templates/puzzle/package.json +7 -7
  145. package/templates/puzzle/src/entities/Warden.ts +3 -3
  146. package/templates/puzzle/src/game.ts +1 -1
  147. package/templates/puzzle/src/render/backlightControls.ts +10 -0
  148. package/templates/puzzle/src/render/backlightMaterial.ts +4 -4
  149. package/templates/puzzle/src/render/camera.ts +2 -2
  150. package/templates/puzzle/src/render/materialLighting.ts +5 -5
  151. package/templates/puzzle/src/render/quality.ts +7 -32
  152. package/templates/puzzle/src/render/touch-controls.ts +7 -6
  153. package/templates/puzzle/src/scenes/Play.ts +1 -1
  154. package/templates/puzzle/src/style.css +4 -0
  155. package/templates/puzzle/tsconfig.json +1 -1
  156. package/templates/puzzle/vite.config.ts +2 -0
  157. package/templates/racing/AGENTS.md +9 -4
  158. package/templates/racing/CLAUDE.md +9 -4
  159. package/templates/racing/CREDITS.md +29 -0
  160. package/templates/racing/assets/engine-loop.wav +0 -0
  161. package/templates/racing/assets/grass/Grass004_color.jpg +0 -0
  162. package/templates/racing/assets/grass/Grass004_normal.jpg +0 -0
  163. package/templates/racing/assets/grass/Grass004_roughness.jpg +0 -0
  164. package/templates/racing/assets/nitro-burst.wav +0 -0
  165. package/templates/racing/assets/tyre-squeal.wav +0 -0
  166. package/templates/racing/package.json +7 -7
  167. package/templates/racing/playtests/drift-natural.playtest.json +68 -0
  168. package/templates/racing/playtests/drift.playtest.json +100 -0
  169. package/templates/racing/playtests/hud.playtest.json +117 -0
  170. package/templates/racing/playtests/launch-pose.playtest.json +34 -0
  171. package/templates/racing/playtests/nitro.playtest.json +158 -0
  172. package/templates/racing/playtests/outcome.playtest.json +4 -4
  173. package/templates/racing/playtests/performance.playtest.json +1 -1
  174. package/templates/racing/playtests/steady-camera.playtest.json +88 -0
  175. package/templates/racing/src/audio/engine.ts +138 -0
  176. package/templates/racing/src/entities/CarBody.ts +83 -10
  177. package/templates/racing/src/entities/Drift.ts +243 -0
  178. package/templates/racing/src/entities/LineDriver.ts +2 -2
  179. package/templates/racing/src/entities/Nitro.ts +72 -0
  180. package/templates/racing/src/entities/RacingCar.ts +86 -21
  181. package/templates/racing/src/entities/Rival.ts +35 -21
  182. package/templates/racing/src/game.ts +7 -1
  183. package/templates/racing/src/gauges.ts +74 -0
  184. package/templates/racing/src/render/atmosphere.ts +6 -0
  185. package/templates/racing/src/render/backlightControls.ts +10 -0
  186. package/templates/racing/src/render/backlightMaterial.ts +4 -4
  187. package/templates/racing/src/render/camera.ts +29 -4
  188. package/templates/racing/src/render/clouds.ts +16 -1
  189. package/templates/racing/src/render/effects.ts +244 -0
  190. package/templates/racing/src/render/materialLighting.ts +5 -5
  191. package/templates/racing/src/render/materials.ts +43 -8
  192. package/templates/racing/src/render/quality.ts +7 -32
  193. package/templates/racing/src/render/shapes.ts +37 -0
  194. package/templates/racing/src/render/skids.ts +84 -0
  195. package/templates/racing/src/render/touch-controls.ts +10 -10
  196. package/templates/racing/src/scenes/Race.ts +281 -26
  197. package/templates/racing/src/state.ts +35 -0
  198. package/templates/racing/src/style.css +7 -0
  199. package/templates/racing/src/track/Track.ts +132 -58
  200. package/templates/racing/src/track/TrackSector.ts +19 -1
  201. package/templates/racing/src/track/circuit.ts +21 -15
  202. package/templates/racing/src/ui/GameUi.tsx +0 -2
  203. package/templates/racing/src/ui/Hud.tsx +417 -50
  204. package/templates/racing/threenative.config.ts +15 -0
  205. package/templates/racing/tools/make-racing-audio.mjs +388 -0
  206. package/templates/racing/tsconfig.json +1 -1
  207. package/templates/racing/vite.config.ts +2 -0
  208. package/templates/rain/AGENTS.md +6 -2
  209. package/templates/rain/CLAUDE.md +6 -2
  210. package/templates/rain/package.json +6 -6
  211. package/templates/rain/src/game.ts +1 -1
  212. package/templates/rain/src/render/noise-volume.ts +2 -1
  213. package/templates/rain/src/state.ts +3 -1
  214. package/templates/rain/src/ui/GameUi.tsx +1 -1
  215. package/templates/rain/src/ui/automation.ts +10 -8
  216. package/templates/rain/src/ui/tempest.ts +3 -4
  217. package/templates/rain/vite.config.ts +6 -0
  218. package/templates/rts/AGENTS.md +6 -2
  219. package/templates/rts/CLAUDE.md +6 -2
  220. package/templates/rts/package.json +6 -6
  221. package/templates/rts/src/game.ts +1 -1
  222. package/templates/rts/src/render/backlightControls.ts +10 -0
  223. package/templates/rts/src/render/backlightMaterial.ts +4 -4
  224. package/templates/rts/src/render/materialLighting.ts +5 -5
  225. package/templates/rts/src/render/quality.ts +7 -31
  226. package/templates/rts/src/scenes/Play.ts +1 -1
  227. package/templates/rts/src/sim/terrain.ts +1 -0
  228. package/templates/rts/src/sim/types.ts +1 -0
  229. package/templates/rts/src/style.css +4 -0
  230. package/templates/rts/vite.config.ts +2 -0
  231. package/templates/runner/AGENTS.md +7 -2
  232. package/templates/runner/CLAUDE.md +7 -2
  233. package/templates/runner/package.json +7 -7
  234. package/templates/runner/src/game.ts +1 -1
  235. package/templates/runner/src/render/atmosphere.ts +6 -0
  236. package/templates/runner/src/render/backlightControls.ts +10 -0
  237. package/templates/runner/src/render/backlightMaterial.ts +4 -4
  238. package/templates/runner/src/render/clouds.ts +16 -1
  239. package/templates/runner/src/render/materialLighting.ts +5 -5
  240. package/templates/runner/src/render/materials.ts +3 -2
  241. package/templates/runner/src/render/quality.ts +7 -32
  242. package/templates/runner/src/render/touch-controls.ts +7 -6
  243. package/templates/runner/src/scenes/Run.ts +8 -10
  244. package/templates/runner/src/style.css +4 -0
  245. package/templates/runner/tsconfig.json +1 -1
  246. package/templates/runner/vite.config.ts +2 -0
  247. package/templates/sailing/AGENTS.md +7 -2
  248. package/templates/sailing/CLAUDE.md +7 -2
  249. package/templates/sailing/package.json +7 -7
  250. package/templates/sailing/src/game.ts +1 -1
  251. package/templates/sailing/src/render/backlightControls.ts +10 -0
  252. package/templates/sailing/src/render/backlightMaterial.ts +4 -4
  253. package/templates/sailing/src/render/environmentSetup.ts +1 -1
  254. package/templates/sailing/src/render/materialLighting.ts +5 -5
  255. package/templates/sailing/src/render/quality.ts +7 -32
  256. package/templates/sailing/src/render/touch-controls.ts +7 -6
  257. package/templates/sailing/src/style.css +5 -0
  258. package/templates/sailing/vite.config.ts +6 -0
  259. package/templates/shooter/AGENTS.md +6 -2
  260. package/templates/shooter/CLAUDE.md +6 -2
  261. package/templates/shooter/package.json +7 -7
  262. package/templates/shooter/src/game.ts +3 -2
  263. package/templates/shooter/src/render/atmosphere.ts +6 -0
  264. package/templates/shooter/src/render/backlightControls.ts +10 -0
  265. package/templates/shooter/src/render/backlightMaterial.ts +4 -4
  266. package/templates/shooter/src/render/clouds.ts +16 -1
  267. package/templates/shooter/src/render/materialLighting.ts +5 -5
  268. package/templates/shooter/src/render/quality.ts +7 -32
  269. package/templates/shooter/src/scenes/Play.ts +4 -1
  270. package/templates/shooter/src/style.css +4 -0
  271. package/templates/shooter/vite.config.ts +2 -0
  272. package/templates/snow/AGENTS.md +7 -2
  273. package/templates/snow/CLAUDE.md +7 -2
  274. package/templates/snow/package.json +7 -7
  275. package/templates/snow/src/entities/Explorer.ts +6 -12
  276. package/templates/snow/src/game.ts +1 -1
  277. package/templates/snow/src/render/backlightControls.ts +10 -0
  278. package/templates/snow/src/render/backlightMaterial.ts +4 -4
  279. package/templates/snow/src/render/bootPrint.ts +3 -1
  280. package/templates/snow/src/render/camera.ts +3 -2
  281. package/templates/snow/src/render/materialLighting.ts +5 -5
  282. package/templates/snow/src/render/quality.ts +7 -32
  283. package/templates/snow/src/render/scenery.ts +3 -3
  284. package/templates/snow/src/render/touch-controls.ts +7 -6
  285. package/templates/snow/src/render/weather.ts +3 -5
  286. package/templates/snow/src/style.css +5 -0
  287. package/templates/snow/src/terrain.ts +2 -1
  288. package/templates/snow/vite.config.ts +6 -0
  289. package/templates/starter/AGENTS.md +8 -3
  290. package/templates/starter/CLAUDE.md +8 -3
  291. package/templates/starter/native-playtests/render-chain.playtest.json +9 -9
  292. package/templates/starter/package.json +7 -7
  293. package/templates/starter/src/entities/Crate.ts +5 -2
  294. package/templates/starter/src/entities/Player.ts +10 -2
  295. package/templates/starter/src/game.ts +4 -3
  296. package/templates/starter/src/render/adaptiveQuality.ts +17 -0
  297. package/templates/starter/src/render/atmosphere.ts +6 -0
  298. package/templates/starter/src/render/backlightControls.ts +10 -0
  299. package/templates/starter/src/render/backlightMaterial.ts +4 -4
  300. package/templates/starter/src/render/camera.ts +2 -2
  301. package/templates/starter/src/render/clouds.ts +16 -1
  302. package/templates/starter/src/render/contactShadow.ts +1 -1
  303. package/templates/starter/src/render/materialLighting.ts +5 -5
  304. package/templates/starter/src/render/materials.ts +3 -2
  305. package/templates/starter/src/render/postprocessing.ts +11 -10
  306. package/templates/starter/src/render/quality.ts +14 -1
  307. package/templates/starter/src/render/touch-controls.ts +7 -6
  308. package/templates/starter/src/scenes/Play.ts +13 -17
  309. package/templates/starter/src/state.ts +2 -0
  310. package/templates/starter/src/style.css +4 -0
  311. package/templates/starter/src/ui/Menu.tsx +5 -1
  312. package/templates/starter/vite.config.ts +2 -0
  313. package/templates/tower-defense/AGENTS.md +7 -2
  314. package/templates/tower-defense/CLAUDE.md +7 -2
  315. package/templates/tower-defense/package.json +7 -7
  316. package/templates/tower-defense/src/game.ts +1 -1
  317. package/templates/tower-defense/src/render/backlightControls.ts +10 -0
  318. package/templates/tower-defense/src/render/backlightMaterial.ts +4 -4
  319. package/templates/tower-defense/src/render/materialLighting.ts +5 -5
  320. package/templates/tower-defense/src/render/quality.ts +7 -32
  321. package/templates/tower-defense/src/render/shapes.ts +1 -2
  322. package/templates/tower-defense/src/scenes/Battle.ts +4 -9
  323. package/templates/tower-defense/src/style.css +4 -0
  324. package/templates/tower-defense/tsconfig.json +1 -1
  325. package/templates/tower-defense/vite.config.ts +2 -0
  326. package/templates/action-rpg/src/render/environmentContribution.ts +0 -188
  327. package/templates/action-rpg/src/render/environmentRadiance.ts +0 -36
  328. package/templates/action-rpg/src/render/environmentSampleCache.ts +0 -43
  329. package/templates/action-rpg/src/render/environmentSampling.ts +0 -193
  330. package/templates/action-rpg/src/render/environmentSnapshot.ts +0 -53
  331. package/templates/minimal/src/render/environmentContribution.ts +0 -188
  332. package/templates/minimal/src/render/environmentRadiance.ts +0 -36
  333. package/templates/minimal/src/render/environmentSampleCache.ts +0 -43
  334. package/templates/minimal/src/render/environmentSampling.ts +0 -193
  335. package/templates/minimal/src/render/environmentSnapshot.ts +0 -53
  336. package/templates/platformer/src/render/environmentContribution.ts +0 -188
  337. package/templates/platformer/src/render/environmentRadiance.ts +0 -36
  338. package/templates/platformer/src/render/environmentSampleCache.ts +0 -43
  339. package/templates/platformer/src/render/environmentSampling.ts +0 -193
  340. package/templates/platformer/src/render/environmentSnapshot.ts +0 -53
  341. package/templates/puzzle/src/render/environmentContribution.ts +0 -188
  342. package/templates/puzzle/src/render/environmentRadiance.ts +0 -36
  343. package/templates/puzzle/src/render/environmentSampleCache.ts +0 -43
  344. package/templates/puzzle/src/render/environmentSampling.ts +0 -193
  345. package/templates/puzzle/src/render/environmentSnapshot.ts +0 -53
  346. package/templates/racing/src/render/environmentContribution.ts +0 -188
  347. package/templates/racing/src/render/environmentRadiance.ts +0 -36
  348. package/templates/racing/src/render/environmentSampleCache.ts +0 -43
  349. package/templates/racing/src/render/environmentSampling.ts +0 -193
  350. package/templates/racing/src/render/environmentSnapshot.ts +0 -53
  351. package/templates/racing/src/ui/Menu.tsx +0 -7
  352. package/templates/rts/src/render/environmentContribution.ts +0 -188
  353. package/templates/rts/src/render/environmentRadiance.ts +0 -36
  354. package/templates/rts/src/render/environmentSampleCache.ts +0 -43
  355. package/templates/rts/src/render/environmentSampling.ts +0 -193
  356. package/templates/rts/src/render/environmentSnapshot.ts +0 -53
  357. package/templates/runner/src/render/environmentContribution.ts +0 -188
  358. package/templates/runner/src/render/environmentRadiance.ts +0 -36
  359. package/templates/runner/src/render/environmentSampleCache.ts +0 -43
  360. package/templates/runner/src/render/environmentSampling.ts +0 -193
  361. package/templates/runner/src/render/environmentSnapshot.ts +0 -53
  362. package/templates/sailing/src/render/environmentContribution.ts +0 -188
  363. package/templates/sailing/src/render/environmentRadiance.ts +0 -36
  364. package/templates/sailing/src/render/environmentSampleCache.ts +0 -43
  365. package/templates/sailing/src/render/environmentSampling.ts +0 -193
  366. package/templates/sailing/src/render/environmentSnapshot.ts +0 -53
  367. package/templates/shooter/src/render/environmentContribution.ts +0 -188
  368. package/templates/shooter/src/render/environmentRadiance.ts +0 -36
  369. package/templates/shooter/src/render/environmentSampleCache.ts +0 -43
  370. package/templates/shooter/src/render/environmentSampling.ts +0 -193
  371. package/templates/shooter/src/render/environmentSnapshot.ts +0 -53
  372. package/templates/snow/src/render/environmentContribution.ts +0 -188
  373. package/templates/snow/src/render/environmentRadiance.ts +0 -36
  374. package/templates/snow/src/render/environmentSampleCache.ts +0 -43
  375. package/templates/snow/src/render/environmentSampling.ts +0 -193
  376. package/templates/snow/src/render/environmentSnapshot.ts +0 -53
  377. package/templates/starter/src/render/environmentContribution.ts +0 -188
  378. package/templates/starter/src/render/environmentRadiance.ts +0 -36
  379. package/templates/starter/src/render/environmentSampleCache.ts +0 -43
  380. package/templates/starter/src/render/environmentSampling.ts +0 -193
  381. package/templates/starter/src/render/environmentSnapshot.ts +0 -53
  382. package/templates/starter/src/render/rendererGate.ts +0 -36
  383. package/templates/tower-defense/src/render/environmentContribution.ts +0 -188
  384. package/templates/tower-defense/src/render/environmentRadiance.ts +0 -36
  385. package/templates/tower-defense/src/render/environmentSampleCache.ts +0 -43
  386. package/templates/tower-defense/src/render/environmentSampling.ts +0 -193
  387. package/templates/tower-defense/src/render/environmentSnapshot.ts +0 -53
@@ -0,0 +1,117 @@
1
+ {
2
+ "name": "hud",
3
+ "target": "web",
4
+ "schemaVersion": 1,
5
+ "viewport": {
6
+ "width": 1280,
7
+ "height": 720
8
+ },
9
+ "warmupFrames": 10,
10
+ "subject": "player",
11
+ "steps": [
12
+ {
13
+ "kind": "wait",
14
+ "label": "idle",
15
+ "waitTicks": 30
16
+ },
17
+ {
18
+ "kind": "input",
19
+ "label": "drive",
20
+ "press": ["ArrowUp"],
21
+ "holdTicks": 240,
22
+ "release": false
23
+ },
24
+ {
25
+ "kind": "input",
26
+ "label": "kick",
27
+ "press": ["ArrowUp", "ArrowRight", "ShiftLeft"],
28
+ "holdTicks": 8,
29
+ "release": false
30
+ },
31
+ {
32
+ "kind": "input",
33
+ "label": "hold",
34
+ "press": ["ArrowUp", "ArrowRight"],
35
+ "holdTicks": 30,
36
+ "release": false
37
+ },
38
+ {
39
+ "kind": "input",
40
+ "label": "catch",
41
+ "press": ["ArrowUp", "ArrowLeft"],
42
+ "holdTicks": 14,
43
+ "release": false
44
+ },
45
+ {
46
+ "kind": "input",
47
+ "label": "straighten",
48
+ "press": ["ArrowUp"],
49
+ "holdTicks": 40,
50
+ "release": true
51
+ }
52
+ ],
53
+ "assert": {
54
+ "diagnostics": {
55
+ "noConsoleErrors": true,
56
+ "runtimeReady": true
57
+ },
58
+ "resources": [
59
+ {
60
+ "id": "state",
61
+ "path": "gear",
62
+ "gte": 3,
63
+ "changed": true
64
+ },
65
+ {
66
+ "id": "state",
67
+ "path": "rpm",
68
+ "gte": 0.3,
69
+ "changed": true
70
+ },
71
+ {
72
+ "id": "state",
73
+ "path": "topSpeed",
74
+ "gte": 15
75
+ },
76
+ {
77
+ "id": "state",
78
+ "path": "driftsBanked",
79
+ "gte": 1,
80
+ "changed": true
81
+ },
82
+ {
83
+ "id": "state",
84
+ "path": "driftLast",
85
+ "gte": 5,
86
+ "changed": true
87
+ },
88
+ {
89
+ "id": "state",
90
+ "path": "engineRate",
91
+ "gte": 1,
92
+ "changed": true
93
+ },
94
+ {
95
+ "id": "state",
96
+ "path": "engineRate",
97
+ "atSteps": [
98
+ {
99
+ "label": "idle",
100
+ "lte": 0.8
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "id": "state",
106
+ "path": "driftPopup",
107
+ "gte": 0.3,
108
+ "atSteps": [
109
+ {
110
+ "label": "idle",
111
+ "lte": 0
112
+ }
113
+ ]
114
+ }
115
+ ]
116
+ }
117
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "launch-pose",
3
+ "target": "web",
4
+ "schemaVersion": 1,
5
+ "viewport": { "width": 1280, "height": 720 },
6
+ "warmupFrames": 10,
7
+ "subject": "player",
8
+ "steps": [
9
+ { "kind": "input", "label": "launch", "press": ["ArrowUp"], "holdTicks": 45, "release": false }
10
+ ],
11
+ "assert": {
12
+ "diagnostics": {
13
+ "noConsoleErrors": true,
14
+ "noNetworkErrors": true,
15
+ "noRuntimeDiagnostics": true,
16
+ "runtimeReady": true
17
+ },
18
+ "components": [
19
+ {
20
+ "entity": "camera-rig",
21
+ "component": "leanRoll",
22
+ "lte": 0.2,
23
+ "gte": -0.2,
24
+ "allowTrivial": "A straight launch has no lateral load, so the body stays level side to side. With the lean axes swapped the forward load rolled the car sideways about 1 deg on every launch."
25
+ },
26
+ {
27
+ "entity": "camera-rig",
28
+ "component": "leanPitch",
29
+ "gte": 0.3,
30
+ "allowTrivial": "Full throttle from the grid is about 11 m/s2 of forward load, so the nose lifts. With the lean axes swapped the launch pitch read zero."
31
+ }
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,158 @@
1
+ {
2
+ "name": "nitro",
3
+ "target": "web",
4
+ "schemaVersion": 1,
5
+ "viewport": {
6
+ "width": 1280,
7
+ "height": 720
8
+ },
9
+ "warmupFrames": 10,
10
+ "subject": "player",
11
+ "steps": [
12
+ {
13
+ "kind": "input",
14
+ "label": "cruise",
15
+ "press": ["ArrowUp"],
16
+ "holdTicks": 30,
17
+ "release": false
18
+ },
19
+ {
20
+ "kind": "input",
21
+ "label": "nitro",
22
+ "press": ["ArrowUp", "Space"],
23
+ "holdTicks": 120,
24
+ "release": false
25
+ },
26
+ {
27
+ "kind": "input",
28
+ "label": "coast",
29
+ "press": ["ArrowUp"],
30
+ "holdTicks": 90,
31
+ "release": false
32
+ },
33
+ {
34
+ "kind": "input",
35
+ "label": "kick",
36
+ "press": ["ArrowUp", "ArrowRight", "ShiftLeft"],
37
+ "holdTicks": 8,
38
+ "release": false
39
+ },
40
+ {
41
+ "kind": "input",
42
+ "label": "hold",
43
+ "press": ["ArrowUp", "ArrowRight"],
44
+ "holdTicks": 30,
45
+ "release": false
46
+ },
47
+ {
48
+ "kind": "input",
49
+ "label": "catch",
50
+ "press": ["ArrowUp", "ArrowLeft"],
51
+ "holdTicks": 14,
52
+ "release": false
53
+ },
54
+ {
55
+ "kind": "input",
56
+ "label": "straighten",
57
+ "press": ["ArrowUp"],
58
+ "holdTicks": 40,
59
+ "release": true
60
+ }
61
+ ],
62
+ "assert": {
63
+ "diagnostics": {
64
+ "noConsoleErrors": true,
65
+ "runtimeReady": true
66
+ },
67
+ "resources": [
68
+ {
69
+ "id": "state",
70
+ "path": "nitro",
71
+ "lte": 0.7,
72
+ "changed": true
73
+ },
74
+ {
75
+ "id": "state",
76
+ "path": "nitroActive",
77
+ "atSteps": [
78
+ {
79
+ "label": "cruise",
80
+ "equals": false
81
+ },
82
+ {
83
+ "label": "nitro",
84
+ "equals": true
85
+ },
86
+ {
87
+ "label": "coast",
88
+ "equals": false
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ "id": "state",
94
+ "path": "topSpeed",
95
+ "gte": 26.5
96
+ },
97
+ {
98
+ "id": "state",
99
+ "path": "nitro",
100
+ "atSteps": [
101
+ {
102
+ "label": "coast",
103
+ "lte": 0.35
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ "id": "state",
109
+ "path": "nitroDriftGain",
110
+ "gte": 0.1,
111
+ "changed": true
112
+ },
113
+ {
114
+ "id": "state",
115
+ "path": "drifting",
116
+ "atSteps": [
117
+ {
118
+ "label": "coast",
119
+ "equals": false
120
+ },
121
+ {
122
+ "label": "hold",
123
+ "equals": true
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "id": "state",
129
+ "path": "driftSpins",
130
+ "equals": 0,
131
+ "allowTrivial": "A spin is the failure this scenario looks for; zero is the held invariant while the drift-refill gain above proves the slide happened."
132
+ },
133
+ {
134
+ "id": "state",
135
+ "path": "fovPeak",
136
+ "gte": 64,
137
+ "changed": true
138
+ },
139
+ {
140
+ "id": "state",
141
+ "path": "fov",
142
+ "atSteps": [
143
+ {
144
+ "label": "coast",
145
+ "lte": 57
146
+ }
147
+ ]
148
+ }
149
+ ],
150
+ "components": [
151
+ {
152
+ "entity": "effects",
153
+ "component": "flameTicks",
154
+ "gte": 60
155
+ }
156
+ ]
157
+ }
158
+ }
@@ -50,8 +50,8 @@
50
50
  {
51
51
  "id": "state",
52
52
  "path": "place",
53
- "equals": 2,
54
- "allowTrivial": "The demo driver starts second on the grid and stays there, so the place is a held invariant; the DNF transition below is what proves the finish."
53
+ "equals": 6,
54
+ "allowTrivial": "The demo driver starts last on the grid, slower than every rival, and stays there, so the place is a held invariant; the DNF transition below is what proves the finish."
55
55
  },
56
56
  {
57
57
  "id": "state",
@@ -81,8 +81,8 @@
81
81
  "hud": [
82
82
  {
83
83
  "id": "outcome",
84
- "equals": "P2",
85
- "allowTrivial": "The player finished every lap behind the rival: the panel names the place, not DNF, which reads as did-not-finish."
84
+ "equals": "P6",
85
+ "allowTrivial": "The player finished every lap behind the field: the panel names the place, not DNF, which reads as did-not-finish."
86
86
  }
87
87
  ]
88
88
  }
@@ -6,7 +6,7 @@
6
6
  "assert": {
7
7
  "performance": {
8
8
  "maxDrawCalls": 330,
9
- "maxTriangles": 105000,
9
+ "maxTriangles": 135000,
10
10
  "minFps": 30
11
11
  },
12
12
  "renderChain": {
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "steady-camera",
3
+ "target": "web",
4
+ "schemaVersion": 1,
5
+ "viewport": {
6
+ "width": 1280,
7
+ "height": 720
8
+ },
9
+ "warmupFrames": 10,
10
+ "subject": "player",
11
+ "steps": [
12
+ {
13
+ "kind": "input",
14
+ "label": "straight",
15
+ "press": ["ArrowUp"],
16
+ "holdTicks": 240,
17
+ "release": false
18
+ },
19
+ {
20
+ "kind": "input",
21
+ "label": "right",
22
+ "press": ["ArrowUp", "ArrowRight"],
23
+ "holdTicks": 60,
24
+ "release": false
25
+ },
26
+ {
27
+ "kind": "input",
28
+ "label": "left",
29
+ "press": ["ArrowUp", "ArrowLeft"],
30
+ "holdTicks": 60,
31
+ "release": false
32
+ },
33
+ {
34
+ "kind": "input",
35
+ "label": "right-again",
36
+ "press": ["ArrowUp", "ArrowRight"],
37
+ "holdTicks": 60,
38
+ "release": true
39
+ },
40
+ {
41
+ "kind": "input",
42
+ "label": "autopilot",
43
+ "press": ["KeyP"],
44
+ "holdTicks": 2,
45
+ "release": true
46
+ },
47
+ {
48
+ "kind": "wait",
49
+ "label": "long-drive",
50
+ "waitTicks": 1200,
51
+ "release": true
52
+ }
53
+ ],
54
+ "assert": {
55
+ "diagnostics": {
56
+ "noConsoleErrors": true,
57
+ "noNetworkErrors": true,
58
+ "noRuntimeDiagnostics": true,
59
+ "runtimeReady": true
60
+ },
61
+ "components": [
62
+ {
63
+ "entity": "camera-rig",
64
+ "component": "cameraRollStep",
65
+ "lte": 1.5,
66
+ "allowTrivial": "The meter starts at zero on the grid. Before the fix the bank read the raw per-tick tyre load and flipped its full +-3.15 deg in one tick mid-corner, 6.2 deg measured; smoothed it measured 0.51 deg, so 1.5 deg catches the flip."
67
+ },
68
+ {
69
+ "entity": "camera-rig",
70
+ "component": "cameraYawJerk",
71
+ "lte": 15,
72
+ "allowTrivial": "The second difference of the camera yaw, teleport cuts excluded. The raw velocity heading jerked 84 deg in one tick; eased like the kart camera it measured 5.7 deg at a full right-to-left steer reversal, so 15 deg catches a snap."
73
+ },
74
+ {
75
+ "entity": "camera-rig",
76
+ "component": "leanRollStep",
77
+ "lte": 2,
78
+ "allowTrivial": "The body lean read the same raw load and flipped its full +-5 deg, 10 deg in one tick, the shake on the car. Smoothed it measured 0.81 deg, so 2 deg catches the flip and leaves the real lean room."
79
+ },
80
+ {
81
+ "entity": "player",
82
+ "component": "topSpeed",
83
+ "gte": 12,
84
+ "allowTrivial": "Four seconds of full throttle reach racing speed, so the corners the meter reads are taken at speed and not on the parked grid."
85
+ }
86
+ ]
87
+ }
88
+ }
@@ -0,0 +1,138 @@
1
+ import { AudioBus } from "@threenative/core";
2
+ import type { Audio, Object3D } from "three";
3
+
4
+ /**
5
+ * The race's sound: an engine bed that pitches with the revs, a tyre squeal that opens with the
6
+ * drift angle, and a nitro burst on the button press.
7
+ *
8
+ * Every clip is baked from maths by `tools/make-racing-audio.mjs` — an engine loop has to be
9
+ * tonal and exactly periodic to be pitched live, and a recording of a real engine is neither. The
10
+ * contested part of this file is the **pitch law**: `engineRate` is the single place the needle
11
+ * becomes a frequency, and the playtest asserts it rises with speed.
12
+ *
13
+ * One runtime gap, named rather than papered over. Pitch is a `playbackRate` write, and the native
14
+ * host binds `playbackRate` on an audio source as a *passive* parameter
15
+ * (`runtime-native/src/audio/audio_bindings.cpp` `createPassiveAudioParamJS`): the write lands and
16
+ * nothing moves, so on native the bed plays at rate 1 with the same volume, squeal and burst. That
17
+ * is a degraded engine note, not a silent game, and no part of this file claims otherwise.
18
+ */
19
+ export const ENGINE_SOUND = {
20
+ /** The bed's playback rate at a standstill and at the rev limit. */
21
+ idleRate: 0.62,
22
+ redlineRate: 2.05,
23
+ /** The bed's level with the throttle closed, and the extra it gains under a nitro burn. */
24
+ volume: 0.34,
25
+ nitroVolume: 0.62,
26
+ /** The squeal's level at full lock in a slide, and the slip angle that counts as full lock. */
27
+ squealVolume: 0.5,
28
+ squealAngle: 0.55,
29
+ /** The burst's level. */
30
+ burstVolume: 0.85,
31
+ /** Baked by `tools/make-racing-audio.mjs`, logical paths into `assets/`. */
32
+ clips: {
33
+ engine: "engine-loop.wav",
34
+ squeal: "tyre-squeal.wav",
35
+ nitro: "nitro-burst.wav",
36
+ },
37
+ } as const;
38
+
39
+ /** The bed's pitch for one needle reading, 0 to 1: geometric, because pitch is logarithmic. */
40
+ export function engineRate(rpm: number): number {
41
+ const reading = Math.min(1, Math.max(0, rpm));
42
+ return ENGINE_SOUND.idleRate * (ENGINE_SOUND.redlineRate / ENGINE_SOUND.idleRate) ** reading;
43
+ }
44
+
45
+ export interface IEngineAudioInput {
46
+ /** Whether the race is running sound at all: a pause or the outcome panel silences the car. */
47
+ readonly running: boolean;
48
+ /** The needle, 0 to 1, from `gauges.ts`. */
49
+ readonly rpm: number;
50
+ /** The rear slip in radians and whether a tyre is sliding this tick. */
51
+ readonly driftAngle: number;
52
+ readonly sliding: boolean;
53
+ readonly nitroActive: boolean;
54
+ }
55
+
56
+ /**
57
+ * The bus a pause intent mutes: one race sounds at a time, so there is one handle to reach.
58
+ *
59
+ * A muted mix rather than a stopped one. `bus.pause()` holds every voice where it stands and
60
+ * `resume()` starts it again, which is right for a menu bed and wrong for an engine: a paused
61
+ * race must not be audible, and the frame loop does not tick while paused, so nothing would
62
+ * unmute a stopped voice from inside the scene.
63
+ */
64
+ let sounding: EngineAudio | undefined;
65
+
66
+ export function setRaceAudioMuted(muted: boolean): void {
67
+ sounding?.bus.setVolume(muted ? 0 : 1, 0.15);
68
+ }
69
+
70
+ /**
71
+ * The car's own sound, over one `AudioBus`.
72
+ *
73
+ * `AudioBus` queues a cue played before the first gesture and starts it on the browser's unlock
74
+ * (`keydown`/`pointerdown`/`touchstart`, installed by the bus itself), so nothing here needs a
75
+ * "click to start" gate of its own.
76
+ */
77
+ export class EngineAudio {
78
+ readonly bus: AudioBus;
79
+ /** The rate last written to the bed. 0 until the clip has loaded: a claim needs a sound. */
80
+ rate = 0;
81
+ #engine: Audio | undefined;
82
+ #squeal: Audio | undefined;
83
+ #nitro: AudioBuffer | undefined;
84
+ #nitroWasActive = false;
85
+
86
+ constructor(camera: Object3D, load: (name: string) => Promise<AudioBuffer>) {
87
+ this.bus = new AudioBus({ camera });
88
+ sounding = this;
89
+ const start = (name: keyof typeof ENGINE_SOUND.clips, cue: string, volume: number): void => {
90
+ void load(ENGINE_SOUND.clips[name])
91
+ .then((buffer) => {
92
+ if (name === "nitro") {
93
+ this.#nitro = buffer;
94
+ return;
95
+ }
96
+ const voice = this.bus.play(buffer, { cue, loop: true, volume });
97
+ if (name === "engine") this.#engine = voice;
98
+ else this.#squeal = voice;
99
+ })
100
+ .catch((error: unknown) => {
101
+ // Sound is not the race. A missing clip is reported once, by name, and the rest plays.
102
+ console.warn(
103
+ `TN_RACING_AUDIO_MISSING ${name}: ${error instanceof Error ? error.message : String(error)}`,
104
+ );
105
+ });
106
+ };
107
+ start("engine", "engine", ENGINE_SOUND.volume);
108
+ start("squeal", "tyre-squeal", 0);
109
+ start("nitro", "nitro-burst", 0);
110
+ }
111
+
112
+ update(input: IEngineAudioInput): void {
113
+ const target = input.running ? engineRate(input.rpm) : ENGINE_SOUND.idleRate * 0.7;
114
+ if (this.#engine !== undefined && Math.abs(target - this.rate) > 0.004) {
115
+ this.#engine.setPlaybackRate(target);
116
+ this.rate = target;
117
+ }
118
+ // Three's own `setVolume` is a 10 ms `setTargetAtTime` ramp on the voice's gain, on every
119
+ // runtime: a step in a sounding loop is a click, and smoothing it twice only makes the swell
120
+ // late. The bed swells under a burn and settles back.
121
+ this.#engine?.setVolume(
122
+ input.running ? ENGINE_SOUND.volume + (input.nitroActive ? ENGINE_SOUND.nitroVolume : 0) : 0,
123
+ );
124
+ const squeal = input.running
125
+ ? Math.min(1, Math.abs(input.driftAngle) / ENGINE_SOUND.squealAngle) *
126
+ ENGINE_SOUND.squealVolume
127
+ : 0;
128
+ this.#squeal?.setVolume(squeal * (input.sliding ? 1 : 0));
129
+ if (input.nitroActive && !this.#nitroWasActive && input.running && this.#nitro !== undefined)
130
+ this.bus.play(this.#nitro, { cue: "nitro-burst", volume: ENGINE_SOUND.burstVolume });
131
+ this.#nitroWasActive = input.nitroActive;
132
+ }
133
+
134
+ dispose(): void {
135
+ if (sounding === this) sounding = undefined;
136
+ this.bus.dispose();
137
+ }
138
+ }