create-threenative 0.2.8 → 0.2.10

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 (431) hide show
  1. package/agent-docs/references/assertion-reference.md +87 -35
  2. package/agent-docs/references/auto-exposure.md +57 -0
  3. package/agent-docs/references/capability-reference.md +1097 -23
  4. package/agent-docs/references/debug-surface.md +6 -0
  5. package/agent-docs/references/finding-assets.md +46 -10
  6. package/agent-docs/references/performance-basics.md +5 -4
  7. package/agent-docs/references/terrain-authoring.md +140 -0
  8. package/agent-files/.agents/skills/threenative-assets/SKILL.md +2 -1
  9. package/capabilities.json +1210 -27
  10. package/dist/index.d.ts +28 -3
  11. package/dist/index.js +396 -166
  12. package/dist/threenative.js +986 -235
  13. package/dist/web-engine-buffer-geometry-utils.js +281 -0
  14. package/dist/web-engine-decal-geometry.js +184 -0
  15. package/dist/web-engine-gltf-loader.js +196 -0
  16. package/dist/web-engine-hdr-loader.js +190 -0
  17. package/dist/web-engine-lut-cube-loader.js +122 -0
  18. package/dist/web-engine-mesh-bvh-webgpu.js +29 -0
  19. package/dist/web-engine-mesh-bvh.js +32 -0
  20. package/dist/web-engine-post-effects.js +168 -0
  21. package/dist/web-engine-runtime.js +42506 -0
  22. package/package.json +11 -8
  23. package/template-assets/autoExposure.ts +225 -0
  24. package/template-assets/exposure.ts +111 -0
  25. package/template-assets/exposureGraph.ts +178 -0
  26. package/template-assets/exposureReadback.ts +79 -0
  27. package/template-assets/patches/@tailwindcss__node@4.3.3.patch +22 -0
  28. package/template-assets/patches/three@0.185.1.patch +6594 -700
  29. package/template-assets/patches/vite@8.2.0.patch +422 -0
  30. package/template-assets/worldEnvironment.ts +433 -30
  31. package/templates/action-rpg/AGENTS.md +11 -10
  32. package/templates/action-rpg/CLAUDE.md +11 -10
  33. package/templates/action-rpg/package.json +13 -10
  34. package/templates/action-rpg/playtests/performance.playtest.json +7 -1
  35. package/templates/action-rpg/src/progress.ts +0 -4
  36. package/templates/action-rpg/src/render/autoExposure.ts +225 -0
  37. package/templates/action-rpg/src/render/backlightControls.ts +66 -0
  38. package/templates/action-rpg/src/render/backlightMaterial.ts +147 -0
  39. package/templates/action-rpg/src/render/environmentContribution.ts +188 -0
  40. package/templates/action-rpg/src/render/environmentRadiance.ts +36 -0
  41. package/templates/action-rpg/src/render/environmentSampleCache.ts +43 -0
  42. package/templates/action-rpg/src/render/environmentSampling.ts +193 -0
  43. package/templates/action-rpg/src/render/environmentSnapshot.ts +53 -0
  44. package/templates/action-rpg/src/render/exposure.ts +111 -0
  45. package/templates/action-rpg/src/render/exposureGraph.ts +178 -0
  46. package/templates/action-rpg/src/render/exposureReadback.ts +79 -0
  47. package/templates/action-rpg/src/render/heightFog.ts +118 -0
  48. package/templates/action-rpg/src/render/lighting.ts +26 -1
  49. package/templates/action-rpg/src/render/materialAssignments.ts +160 -0
  50. package/templates/action-rpg/src/render/materialLighting.ts +155 -0
  51. package/templates/action-rpg/src/render/postprocessing.ts +17 -2
  52. package/templates/action-rpg/src/render/quality.ts +61 -2
  53. package/templates/action-rpg/src/render/sky.ts +21 -1
  54. package/templates/action-rpg/src/render/vfx.ts +133 -58
  55. package/templates/action-rpg/src/render/worldEnvironment.ts +433 -30
  56. package/templates/action-rpg/src/scenes/Play.ts +81 -16
  57. package/templates/action-rpg/threenative.config.ts +3 -0
  58. package/templates/action-rpg/vite.config.ts +10 -2
  59. package/templates/minimal/AGENTS.md +9 -10
  60. package/templates/minimal/CLAUDE.md +9 -10
  61. package/templates/minimal/package.json +11 -9
  62. package/templates/minimal/playtests/play.playtest.json +7 -1
  63. package/templates/minimal/playtests/sky.playtest.json +10 -1
  64. package/templates/minimal/src/render/autoExposure.ts +225 -0
  65. package/templates/minimal/src/render/backlightControls.ts +66 -0
  66. package/templates/minimal/src/render/backlightMaterial.ts +147 -0
  67. package/templates/minimal/src/render/environmentContribution.ts +188 -0
  68. package/templates/minimal/src/render/environmentRadiance.ts +36 -0
  69. package/templates/minimal/src/render/environmentSampleCache.ts +43 -0
  70. package/templates/minimal/src/render/environmentSampling.ts +193 -0
  71. package/templates/minimal/src/render/environmentSnapshot.ts +53 -0
  72. package/templates/minimal/src/render/exposure.ts +111 -0
  73. package/templates/minimal/src/render/exposureGraph.ts +178 -0
  74. package/templates/minimal/src/render/exposureReadback.ts +79 -0
  75. package/templates/minimal/src/render/heightFog.ts +118 -0
  76. package/templates/minimal/src/render/lighting.ts +25 -1
  77. package/templates/minimal/src/render/materialAssignments.ts +102 -0
  78. package/templates/minimal/src/render/materialLighting.ts +146 -0
  79. package/templates/minimal/src/render/postprocessing.ts +16 -2
  80. package/templates/minimal/src/render/quality.ts +60 -2
  81. package/templates/minimal/src/render/sky.ts +21 -1
  82. package/templates/minimal/src/render/worldEnvironment.ts +433 -30
  83. package/templates/minimal/src/scenes/Play.ts +50 -1
  84. package/templates/minimal/vite.config.ts +10 -2
  85. package/templates/platformer/AGENTS.md +7 -5
  86. package/templates/platformer/CLAUDE.md +7 -5
  87. package/templates/platformer/package.json +13 -10
  88. package/templates/platformer/playtests/performance.playtest.json +7 -1
  89. package/templates/platformer/src/render/autoExposure.ts +225 -0
  90. package/templates/platformer/src/render/backlightControls.ts +66 -0
  91. package/templates/platformer/src/render/backlightMaterial.ts +147 -0
  92. package/templates/platformer/src/render/environmentContribution.ts +188 -0
  93. package/templates/platformer/src/render/environmentRadiance.ts +36 -0
  94. package/templates/platformer/src/render/environmentSampleCache.ts +43 -0
  95. package/templates/platformer/src/render/environmentSampling.ts +193 -0
  96. package/templates/platformer/src/render/environmentSnapshot.ts +53 -0
  97. package/templates/platformer/src/render/exposure.ts +111 -0
  98. package/templates/platformer/src/render/exposureGraph.ts +178 -0
  99. package/templates/platformer/src/render/exposureReadback.ts +79 -0
  100. package/templates/platformer/src/render/heightFog.ts +118 -0
  101. package/templates/platformer/src/render/lighting.ts +26 -1
  102. package/templates/platformer/src/render/materialAssignments.ts +160 -0
  103. package/templates/platformer/src/render/materialLighting.ts +155 -0
  104. package/templates/platformer/src/render/materials.ts +7 -2
  105. package/templates/platformer/src/render/palette.ts +3 -3
  106. package/templates/platformer/src/render/postprocessing.ts +17 -2
  107. package/templates/platformer/src/render/quality.ts +61 -2
  108. package/templates/platformer/src/render/sky.ts +72 -23
  109. package/templates/platformer/src/render/skyEnvironment.ts +50 -0
  110. package/templates/platformer/src/render/worldEnvironment.ts +433 -30
  111. package/templates/platformer/src/scenes/Play.ts +70 -6
  112. package/templates/platformer/vite.config.ts +10 -2
  113. package/templates/puzzle/AGENTS.md +10 -9
  114. package/templates/puzzle/CLAUDE.md +10 -9
  115. package/templates/puzzle/package.json +13 -10
  116. package/templates/puzzle/playtests/boot-failure.playtest.json +2 -2
  117. package/templates/puzzle/playtests/lit.playtest.json +7 -1
  118. package/templates/puzzle/playtests/performance.playtest.json +7 -1
  119. package/templates/puzzle/src/render/autoExposure.ts +225 -0
  120. package/templates/puzzle/src/render/backlightControls.ts +66 -0
  121. package/templates/puzzle/src/render/backlightMaterial.ts +147 -0
  122. package/templates/puzzle/src/render/environmentContribution.ts +188 -0
  123. package/templates/puzzle/src/render/environmentRadiance.ts +36 -0
  124. package/templates/puzzle/src/render/environmentSampleCache.ts +43 -0
  125. package/templates/puzzle/src/render/environmentSampling.ts +193 -0
  126. package/templates/puzzle/src/render/environmentSnapshot.ts +53 -0
  127. package/templates/puzzle/src/render/exposure.ts +111 -0
  128. package/templates/puzzle/src/render/exposureGraph.ts +178 -0
  129. package/templates/puzzle/src/render/exposureReadback.ts +79 -0
  130. package/templates/puzzle/src/render/heightFog.ts +118 -0
  131. package/templates/puzzle/src/render/lighting.ts +33 -1
  132. package/templates/puzzle/src/render/materialAssignments.ts +160 -0
  133. package/templates/puzzle/src/render/materialLighting.ts +155 -0
  134. package/templates/puzzle/src/render/materials.ts +1 -1
  135. package/templates/puzzle/src/render/postprocessing.ts +8 -2
  136. package/templates/puzzle/src/render/quality.ts +62 -1
  137. package/templates/puzzle/src/render/sky.ts +20 -1
  138. package/templates/puzzle/src/render/worldEnvironment.ts +433 -30
  139. package/templates/puzzle/src/scenes/Play.ts +51 -2
  140. package/templates/puzzle/vite.config.ts +10 -2
  141. package/templates/racing/AGENTS.md +8 -7
  142. package/templates/racing/CLAUDE.md +8 -7
  143. package/templates/racing/package.json +13 -10
  144. package/templates/racing/playtests/performance.playtest.json +7 -1
  145. package/templates/racing/playtests/survives.playtest.json +6 -0
  146. package/templates/racing/src/render/autoExposure.ts +225 -0
  147. package/templates/racing/src/render/backlightControls.ts +66 -0
  148. package/templates/racing/src/render/backlightMaterial.ts +147 -0
  149. package/templates/racing/src/render/environmentContribution.ts +188 -0
  150. package/templates/racing/src/render/environmentRadiance.ts +36 -0
  151. package/templates/racing/src/render/environmentSampleCache.ts +43 -0
  152. package/templates/racing/src/render/environmentSampling.ts +193 -0
  153. package/templates/racing/src/render/environmentSnapshot.ts +53 -0
  154. package/templates/racing/src/render/exposure.ts +111 -0
  155. package/templates/racing/src/render/exposureGraph.ts +178 -0
  156. package/templates/racing/src/render/exposureReadback.ts +79 -0
  157. package/templates/racing/src/render/heightFog.ts +118 -0
  158. package/templates/racing/src/render/lighting.ts +29 -1
  159. package/templates/racing/src/render/materialAssignments.ts +160 -0
  160. package/templates/racing/src/render/materialLighting.ts +155 -0
  161. package/templates/racing/src/render/palette.ts +1 -10
  162. package/templates/racing/src/render/postprocessing.ts +17 -2
  163. package/templates/racing/src/render/quality.ts +61 -2
  164. package/templates/racing/src/render/shapes.ts +0 -25
  165. package/templates/racing/src/render/sky.ts +25 -5
  166. package/templates/racing/src/render/worldEnvironment.ts +433 -30
  167. package/templates/racing/src/scenes/Race.ts +110 -13
  168. package/templates/racing/src/track/circuit.ts +0 -9
  169. package/templates/racing/vite.config.ts +10 -2
  170. package/templates/rain/AGENTS.md +8 -9
  171. package/templates/rain/CLAUDE.md +8 -9
  172. package/templates/rain/native-playtests/boot.playtest.json +11 -1
  173. package/templates/rain/package.json +14 -10
  174. package/templates/rain/playtests/automation.playtest.json +1 -1
  175. package/templates/rain/playtests/performance.playtest.json +11 -1
  176. package/templates/rain/playtests/tiers.playtest.json +15 -0
  177. package/templates/rain/playtests/weather.playtest.json +1 -1
  178. package/templates/rain/src/game.ts +1 -34
  179. package/templates/rain/src/render/autoExposure.ts +225 -0
  180. package/templates/rain/src/render/exposure.ts +111 -0
  181. package/templates/rain/src/render/exposureGraph.ts +178 -0
  182. package/templates/rain/src/render/exposureReadback.ts +79 -0
  183. package/templates/rain/src/render/postprocessing.ts +3 -0
  184. package/templates/rain/src/render/quality.ts +27 -1
  185. package/templates/rain/src/render/worldEnvironment.ts +433 -30
  186. package/templates/rain/src/scenes/Boot.ts +14 -0
  187. package/templates/rain/src/state.ts +5 -1
  188. package/templates/rain/src/ui/GameUi.tsx +6 -6
  189. package/templates/rain/tools/generate-shaders.mjs +1 -1
  190. package/templates/rain/vite.config.ts +10 -2
  191. package/templates/rts/AGENTS.md +10 -11
  192. package/templates/rts/CLAUDE.md +10 -11
  193. package/templates/rts/package.json +12 -9
  194. package/templates/rts/playtests/performance.playtest.json +7 -1
  195. package/templates/rts/playtests/rts-ai-attack.playtest.json +10 -1
  196. package/templates/rts/playtests/rts-attack.playtest.json +10 -1
  197. package/templates/rts/playtests/rts-build.playtest.json +10 -1
  198. package/templates/rts/playtests/rts-orders.playtest.json +7 -1
  199. package/templates/rts/playtests/rts-train.playtest.json +10 -1
  200. package/templates/rts/src/render/army.ts +10 -2
  201. package/templates/rts/src/render/autoExposure.ts +225 -0
  202. package/templates/rts/src/render/backlightControls.ts +66 -0
  203. package/templates/rts/src/render/backlightMaterial.ts +147 -0
  204. package/templates/rts/src/render/environmentContribution.ts +188 -0
  205. package/templates/rts/src/render/environmentRadiance.ts +36 -0
  206. package/templates/rts/src/render/environmentSampleCache.ts +43 -0
  207. package/templates/rts/src/render/environmentSampling.ts +193 -0
  208. package/templates/rts/src/render/environmentSnapshot.ts +53 -0
  209. package/templates/rts/src/render/exposure.ts +111 -0
  210. package/templates/rts/src/render/exposureGraph.ts +178 -0
  211. package/templates/rts/src/render/exposureReadback.ts +79 -0
  212. package/templates/rts/src/render/heightFog.ts +118 -0
  213. package/templates/rts/src/render/lighting.ts +26 -1
  214. package/templates/rts/src/render/materialAssignments.ts +160 -0
  215. package/templates/rts/src/render/materialLighting.ts +155 -0
  216. package/templates/rts/src/render/postprocessing.ts +8 -2
  217. package/templates/rts/src/render/quality.ts +61 -2
  218. package/templates/rts/src/render/sky.ts +21 -1
  219. package/templates/rts/src/render/worldEnvironment.ts +433 -30
  220. package/templates/rts/src/scenes/Play.ts +54 -3
  221. package/templates/rts/src/sim/ai.ts +0 -1
  222. package/templates/rts/src/sim/terrain.ts +0 -4
  223. package/templates/rts/vite.config.ts +10 -2
  224. package/templates/runner/AGENTS.md +10 -8
  225. package/templates/runner/CLAUDE.md +10 -8
  226. package/templates/runner/package.json +13 -10
  227. package/templates/runner/playtests/performance.playtest.json +10 -1
  228. package/templates/runner/src/physics.ts +0 -1
  229. package/templates/runner/src/render/autoExposure.ts +225 -0
  230. package/templates/runner/src/render/backlightControls.ts +66 -0
  231. package/templates/runner/src/render/backlightMaterial.ts +147 -0
  232. package/templates/runner/src/render/environmentContribution.ts +188 -0
  233. package/templates/runner/src/render/environmentRadiance.ts +36 -0
  234. package/templates/runner/src/render/environmentSampleCache.ts +43 -0
  235. package/templates/runner/src/render/environmentSampling.ts +193 -0
  236. package/templates/runner/src/render/environmentSnapshot.ts +53 -0
  237. package/templates/runner/src/render/exposure.ts +111 -0
  238. package/templates/runner/src/render/exposureGraph.ts +178 -0
  239. package/templates/runner/src/render/exposureReadback.ts +79 -0
  240. package/templates/runner/src/render/heightFog.ts +118 -0
  241. package/templates/runner/src/render/lighting.ts +26 -1
  242. package/templates/runner/src/render/materialAssignments.ts +160 -0
  243. package/templates/runner/src/render/materialLighting.ts +155 -0
  244. package/templates/runner/src/render/postprocessing.ts +17 -2
  245. package/templates/runner/src/render/quality.ts +61 -2
  246. package/templates/runner/src/render/sky.ts +21 -1
  247. package/templates/runner/src/render/worldEnvironment.ts +433 -30
  248. package/templates/runner/src/scenes/Run.ts +67 -2
  249. package/templates/runner/threenative.config.ts +3 -0
  250. package/templates/runner/vite.config.ts +10 -2
  251. package/templates/sailing/AGENTS.md +14 -13
  252. package/templates/sailing/CLAUDE.md +14 -13
  253. package/templates/sailing/native-playtests/survives.playtest.json +7 -0
  254. package/templates/sailing/package.json +13 -10
  255. package/templates/sailing/playtests/live/render-motion.playtest.json +30 -0
  256. package/templates/sailing/src/entities/Ship.ts +38 -18
  257. package/templates/sailing/src/render/autoExposure.ts +225 -0
  258. package/templates/sailing/src/render/backlightControls.ts +66 -0
  259. package/templates/sailing/src/render/backlightMaterial.ts +147 -0
  260. package/templates/sailing/src/render/camera.ts +12 -4
  261. package/templates/sailing/src/render/environmentContribution.ts +188 -0
  262. package/templates/sailing/src/render/environmentRadiance.ts +36 -0
  263. package/templates/sailing/src/render/environmentSampleCache.ts +43 -0
  264. package/templates/sailing/src/render/environmentSampling.ts +193 -0
  265. package/templates/sailing/src/render/environmentSetup.ts +24 -0
  266. package/templates/sailing/src/render/environmentSnapshot.ts +53 -0
  267. package/templates/sailing/src/render/exposure.ts +111 -0
  268. package/templates/sailing/src/render/exposureGraph.ts +178 -0
  269. package/templates/sailing/src/render/exposureReadback.ts +79 -0
  270. package/templates/sailing/src/render/heightFog.ts +118 -0
  271. package/templates/sailing/src/render/lighting.ts +26 -1
  272. package/templates/sailing/src/render/materialAssignments.ts +160 -0
  273. package/templates/sailing/src/render/materialLighting.ts +155 -0
  274. package/templates/sailing/src/render/ocean.ts +71 -53
  275. package/templates/sailing/src/render/postprocessing.ts +16 -2
  276. package/templates/sailing/src/render/props.ts +0 -45
  277. package/templates/sailing/src/render/quality.ts +61 -1
  278. package/templates/sailing/src/render/sky.ts +21 -1
  279. package/templates/sailing/src/render/worldEnvironment.ts +433 -30
  280. package/templates/sailing/src/scenes/Boot.ts +12 -1
  281. package/templates/sailing/src/scenes/Sailing.ts +87 -2
  282. package/templates/sailing/src/scenes/ocean-readiness.ts +68 -0
  283. package/templates/sailing/threenative.config.ts +3 -0
  284. package/templates/sailing/vite.config.ts +10 -2
  285. package/templates/shooter/AGENTS.md +8 -6
  286. package/templates/shooter/CLAUDE.md +8 -6
  287. package/templates/shooter/package.json +13 -10
  288. package/templates/shooter/playtests/performance.playtest.json +7 -1
  289. package/templates/shooter/src/entities/Enemy.ts +0 -15
  290. package/templates/shooter/src/entities/Rifle.ts +38 -1
  291. package/templates/shooter/src/render/autoExposure.ts +225 -0
  292. package/templates/shooter/src/render/backlightControls.ts +66 -0
  293. package/templates/shooter/src/render/backlightMaterial.ts +147 -0
  294. package/templates/shooter/src/render/camera.ts +1 -12
  295. package/templates/shooter/src/render/decals.ts +299 -5
  296. package/templates/shooter/src/render/environmentContribution.ts +188 -0
  297. package/templates/shooter/src/render/environmentRadiance.ts +36 -0
  298. package/templates/shooter/src/render/environmentSampleCache.ts +43 -0
  299. package/templates/shooter/src/render/environmentSampling.ts +193 -0
  300. package/templates/shooter/src/render/environmentSnapshot.ts +53 -0
  301. package/templates/shooter/src/render/exposure.ts +111 -0
  302. package/templates/shooter/src/render/exposureGraph.ts +178 -0
  303. package/templates/shooter/src/render/exposureReadback.ts +79 -0
  304. package/templates/shooter/src/render/gunfx.ts +0 -1
  305. package/templates/shooter/src/render/heightFog.ts +118 -0
  306. package/templates/shooter/src/render/lighting.ts +26 -1
  307. package/templates/shooter/src/render/materialAssignments.ts +160 -0
  308. package/templates/shooter/src/render/materialLighting.ts +155 -0
  309. package/templates/shooter/src/render/postprocessing.ts +17 -2
  310. package/templates/shooter/src/render/quality.ts +61 -2
  311. package/templates/shooter/src/render/scale.ts +2 -93
  312. package/templates/shooter/src/render/sky.ts +21 -1
  313. package/templates/shooter/src/render/vehicles.ts +0 -17
  314. package/templates/shooter/src/render/worldEnvironment.ts +433 -30
  315. package/templates/shooter/src/scenes/Play.ts +64 -2
  316. package/templates/shooter/vite.config.ts +10 -2
  317. package/templates/snow/AGENTS.md +8 -6
  318. package/templates/snow/CLAUDE.md +8 -6
  319. package/templates/snow/package.json +13 -10
  320. package/templates/snow/src/render/autoExposure.ts +225 -0
  321. package/templates/snow/src/render/backlightControls.ts +66 -0
  322. package/templates/snow/src/render/backlightMaterial.ts +147 -0
  323. package/templates/snow/src/render/environmentContribution.ts +188 -0
  324. package/templates/snow/src/render/environmentRadiance.ts +36 -0
  325. package/templates/snow/src/render/environmentSampleCache.ts +43 -0
  326. package/templates/snow/src/render/environmentSampling.ts +193 -0
  327. package/templates/snow/src/render/environmentSnapshot.ts +53 -0
  328. package/templates/snow/src/render/exposure.ts +111 -0
  329. package/templates/snow/src/render/exposureGraph.ts +178 -0
  330. package/templates/snow/src/render/exposureReadback.ts +79 -0
  331. package/templates/snow/src/render/heightFog.ts +118 -0
  332. package/templates/snow/src/render/lighting.ts +33 -1
  333. package/templates/snow/src/render/materialAssignments.ts +160 -0
  334. package/templates/snow/src/render/materialLighting.ts +155 -0
  335. package/templates/snow/src/render/postprocessing.ts +16 -2
  336. package/templates/snow/src/render/quality.ts +59 -1
  337. package/templates/snow/src/render/sky.ts +21 -2
  338. package/templates/snow/src/render/worldEnvironment.ts +433 -30
  339. package/templates/snow/src/scenes/Snow.ts +29 -1
  340. package/templates/snow/threenative.config.ts +3 -0
  341. package/templates/snow/vite.config.ts +10 -2
  342. package/templates/starter/AGENTS.md +11 -16
  343. package/templates/starter/CLAUDE.md +11 -16
  344. package/templates/starter/native-playtests/react-hud.playtest.json +1 -1
  345. package/templates/starter/native-playtests/render-chain.playtest.json +51 -8
  346. package/templates/starter/native-playtests/smooth-motion.playtest.json +64 -0
  347. package/templates/starter/package.json +13 -10
  348. package/templates/starter/playtests/live/smooth-motion.playtest.json +63 -0
  349. package/templates/starter/playtests/movement.playtest.json +192 -0
  350. package/templates/starter/playtests/play.playtest.json +18 -2
  351. package/templates/starter/playtests/production-readiness.playtest.json +43 -1
  352. package/templates/starter/public/grade.cube +735 -0
  353. package/templates/starter/src/entities/Crate.ts +4 -0
  354. package/templates/starter/src/entities/Player.ts +79 -18
  355. package/templates/starter/src/game.ts +1 -0
  356. package/templates/starter/src/render/adaptiveQuality.ts +28 -41
  357. package/templates/starter/src/render/autoExposure.ts +225 -0
  358. package/templates/starter/src/render/backlightControls.ts +66 -0
  359. package/templates/starter/src/render/backlightMaterial.ts +147 -0
  360. package/templates/starter/src/render/environmentContribution.ts +188 -0
  361. package/templates/starter/src/render/environmentRadiance.ts +36 -0
  362. package/templates/starter/src/render/environmentSampleCache.ts +43 -0
  363. package/templates/starter/src/render/environmentSampling.ts +193 -0
  364. package/templates/starter/src/render/environmentSnapshot.ts +53 -0
  365. package/templates/starter/src/render/exposure.ts +111 -0
  366. package/templates/starter/src/render/exposureGraph.ts +178 -0
  367. package/templates/starter/src/render/exposureReadback.ts +79 -0
  368. package/templates/starter/src/render/grade.ts +157 -0
  369. package/templates/starter/src/render/heightFog.ts +118 -0
  370. package/templates/starter/src/render/lighting.ts +26 -1
  371. package/templates/starter/src/render/materialAssignments.ts +160 -0
  372. package/templates/starter/src/render/materialLighting.ts +155 -0
  373. package/templates/starter/src/render/postprocessing.ts +90 -4
  374. package/templates/starter/src/render/quality.ts +80 -8
  375. package/templates/starter/src/render/qualityPolicy.ts +54 -0
  376. package/templates/starter/src/render/rendererGate.ts +36 -0
  377. package/templates/starter/src/render/sky.ts +23 -1
  378. package/templates/starter/src/render/temporalAA.ts +197 -0
  379. package/templates/starter/src/render/temporalAAFrame.ts +179 -0
  380. package/templates/starter/src/render/temporalAAHooks.ts +101 -0
  381. package/templates/starter/src/render/temporalAAInput.ts +56 -0
  382. package/templates/starter/src/render/temporalAAResolve.ts +65 -0
  383. package/templates/starter/src/render/temporalAAStage.ts +76 -0
  384. package/templates/starter/src/render/temporalCurrentArea.ts +31 -0
  385. package/templates/starter/src/render/temporalCurrentFootprint.ts +198 -0
  386. package/templates/starter/src/render/temporalCurrentFootprintMath.ts +41 -0
  387. package/templates/starter/src/render/temporalCurrentProducer.ts +161 -0
  388. package/templates/starter/src/render/temporalCurrentReplay.ts +160 -0
  389. package/templates/starter/src/render/temporalCurrentSelection.ts +89 -0
  390. package/templates/starter/src/render/temporalCurrentVisibility.ts +170 -0
  391. package/templates/starter/src/render/temporalDepthSamples.ts +34 -0
  392. package/templates/starter/src/render/temporalRejectionCounter.ts +179 -0
  393. package/templates/starter/src/render/temporalResolve.ts +139 -0
  394. package/templates/starter/src/render/temporalResolveDepth.ts +193 -0
  395. package/templates/starter/src/render/temporalResolveMath.ts +196 -0
  396. package/templates/starter/src/render/volumetricFog.ts +124 -0
  397. package/templates/starter/src/render/volumetricFogOptions.ts +96 -0
  398. package/templates/starter/src/render/volumetricFogTransport.ts +176 -0
  399. package/templates/starter/src/render/volumetricFogVolume.ts +139 -0
  400. package/templates/starter/src/render/worldEnvironment.ts +433 -30
  401. package/templates/starter/src/scenes/Play.ts +110 -1
  402. package/templates/starter/src/state.ts +1 -0
  403. package/templates/starter/src/ui/Hud.tsx +1 -1
  404. package/templates/starter/src/ui/Menu.tsx +1 -1
  405. package/templates/starter/tools/make-grade-lut.mjs +101 -0
  406. package/templates/starter/vite.config.ts +10 -2
  407. package/templates/tower-defense/AGENTS.md +10 -9
  408. package/templates/tower-defense/CLAUDE.md +10 -9
  409. package/templates/tower-defense/package.json +13 -10
  410. package/templates/tower-defense/playtests/performance.playtest.json +7 -1
  411. package/templates/tower-defense/src/render/autoExposure.ts +225 -0
  412. package/templates/tower-defense/src/render/backlightControls.ts +66 -0
  413. package/templates/tower-defense/src/render/backlightMaterial.ts +147 -0
  414. package/templates/tower-defense/src/render/environmentContribution.ts +188 -0
  415. package/templates/tower-defense/src/render/environmentRadiance.ts +36 -0
  416. package/templates/tower-defense/src/render/environmentSampleCache.ts +43 -0
  417. package/templates/tower-defense/src/render/environmentSampling.ts +193 -0
  418. package/templates/tower-defense/src/render/environmentSnapshot.ts +53 -0
  419. package/templates/tower-defense/src/render/exposure.ts +111 -0
  420. package/templates/tower-defense/src/render/exposureGraph.ts +178 -0
  421. package/templates/tower-defense/src/render/exposureReadback.ts +79 -0
  422. package/templates/tower-defense/src/render/lighting.ts +33 -1
  423. package/templates/tower-defense/src/render/materialAssignments.ts +160 -0
  424. package/templates/tower-defense/src/render/materialLighting.ts +155 -0
  425. package/templates/tower-defense/src/render/postprocessing.ts +8 -2
  426. package/templates/tower-defense/src/render/quality.ts +61 -2
  427. package/templates/tower-defense/src/render/shapes.ts +0 -3
  428. package/templates/tower-defense/src/render/worldEnvironment.ts +433 -30
  429. package/templates/tower-defense/src/scenes/Battle.ts +65 -2
  430. package/templates/tower-defense/vite.config.ts +10 -2
  431. package/templates/minimal/src/scenes/Boot.ts +0 -5
@@ -3,6 +3,7 @@ import {
3
3
  Scene,
4
4
  type SceneFrame,
5
5
  afterPhysics,
6
+ getPlatform,
6
7
  isMobile,
7
8
  isTouchscreenAvailable,
8
9
  } from "@threenative/core";
@@ -13,9 +14,16 @@ import { RacingCar } from "../entities/RacingCar.js";
13
14
  import { Rival } from "../entities/Rival.js";
14
15
  import { emitPlaytestEvent } from "../playtest-events.js";
15
16
  import { cameraBank, chaseCamera, setupCamera } from "../render/camera.js";
17
+ import { type IEnvironmentSample, sampleEnvironment } from "../render/environmentSampling.js";
16
18
  import { setupLighting } from "../render/lighting.js";
17
19
  import { createLoadingScreen } from "../render/loading.js";
20
+ import { createMaterialLighting } from "../render/materialLighting.js";
18
21
  import { setupPost } from "../render/postprocessing.js";
22
+ import {
23
+ type QualityTier,
24
+ isWebGLFallbackRenderer,
25
+ materialLightingEnabled,
26
+ } from "../render/quality.js";
19
27
  import { SUN_DIRECTION, setupSky } from "../render/sky.js";
20
28
  import { TouchControls } from "../render/touch-controls.js";
21
29
  import { type GameState, type RaceStatus, resolveRaceStatus } from "../state.js";
@@ -89,21 +97,61 @@ export class Race extends Scene<GameState, IPhysicsContext> {
89
97
  #sky: Texture | undefined;
90
98
 
91
99
  /**
92
- * The sky photograph, fetched but **not awaited**.
100
+ * The sky photograph, **awaited** before the scene enters.
93
101
  *
94
- * `await`ing it here held the scene's first frame for the length of a texture decode, and the
95
- * playtest bridge describes the scene before the runtime enters it: `survives` failed
96
- * `TN_PLAYTEST_CAPABILITY_MISSING` on `runtime.components` because there was no `player` entity
97
- * yet to describe. The scene now enters on the fallback colour and the photograph is swapped in
98
- * the moment it decodes, which is also what a player sees — a sky that arrives rather than a
99
- * black screen that waits.
102
+ * It used to be fetched without waiting and swapped in when it decoded. On `engine: "threejs"`
103
+ * that swap lands in the middle of a frame (WebGPU rendering yields between its awaits), next to
104
+ * the shadow pass, which clears `scene.background` and puts it back. A swap after the first frame
105
+ * was never drawn: the sky stayed the fallback colour on a fast GPU, and the engine-parity guard
106
+ * scored the template 0.823 against the correct `threenative` frame, passing only when a slow
107
+ * adapter let the photograph land before the first render. Applied before the first frame the
108
+ * same texture draws, and parity scores 0.001.
100
109
  */
101
- override load(ctx: GameCtx): void {
102
- void ctx.assets.texture("sky.jpg").then((texture) => {
103
- this.#sky = texture;
104
- const scene = ctx.scene;
105
- if (scene !== undefined) setupSky(scene, texture);
110
+ #post: ReturnType<typeof setupPost> | undefined;
111
+ #environmentSample: IEnvironmentSample | undefined;
112
+ #materialLighting: ReturnType<typeof createMaterialLighting> | undefined;
113
+ #lightingGeneration = 0;
114
+
115
+ override async load(ctx: GameCtx): Promise<void> {
116
+ const generation = ++this.#lightingGeneration;
117
+ const texture = await ctx.assets.texture("sky.jpg");
118
+ if (generation !== this.#lightingGeneration) return;
119
+ this.#sky = texture;
120
+ const scene = ctx.scene;
121
+ if (scene === undefined) return;
122
+ setupSky(scene, texture);
123
+ // The measurement is not awaited: it reads the GPU back and must not hold the first frame.
124
+ void this.#sampleSky(ctx, scene, generation);
125
+ }
126
+
127
+ async #sampleSky(
128
+ ctx: GameCtx,
129
+ scene: NonNullable<GameCtx["scene"]>,
130
+ generation: number,
131
+ ): Promise<void> {
132
+ const controller = this.#materialLighting;
133
+ const sample = await sampleEnvironment(ctx.renderer.raw, scene, {
134
+ web: getPlatform().runtime === "web",
135
+ rendererKind: ctx.renderer.kind,
136
+ webglFallback: isWebGLFallbackRenderer(ctx.renderer.raw),
137
+ mobile: isMobile(),
138
+ software: ctx.renderer.softwareAdapter !== undefined,
106
139
  });
140
+ if (generation !== this.#lightingGeneration || ctx.scene !== scene) return;
141
+ this.#environmentSample = sample;
142
+ // A cached sky may start sampling before enter creates the receiver controller.
143
+ // A controller that already existed when sampling began must still be the same one.
144
+ const currentController = this.#materialLighting;
145
+ if (
146
+ currentController !== undefined &&
147
+ (controller === undefined || controller === currentController)
148
+ )
149
+ currentController.setEnvironmentMeasurement(
150
+ sample.measurement,
151
+ sample.source,
152
+ sample.intensity,
153
+ sample,
154
+ );
107
155
  }
108
156
 
109
157
  override enter(ctx: GameCtx): SceneFrame<GameState, IPhysicsContext> {
@@ -115,10 +163,23 @@ export class Race extends Scene<GameState, IPhysicsContext> {
115
163
  );
116
164
  // isMobile() arrives as an argument because src/render/ imports no framework package: the
117
165
  // platform decision is made here, in portable game code, exactly like createRandom.
118
- setupPost(ctx.renderer, ctx.scene, ctx.camera, {
166
+ const materialEnvironment = {
167
+ web: getPlatform().runtime === "web",
168
+ rendererKind: ctx.renderer.kind,
169
+ webglFallback: isWebGLFallbackRenderer(ctx.renderer.raw),
170
+ mobile: isMobile(),
171
+ software: ctx.renderer.softwareAdapter !== undefined,
172
+ };
173
+ let materialTier: QualityTier = "low";
174
+ this.#post = setupPost(ctx.renderer, ctx.scene, ctx.camera, {
175
+ onTierChanged: (tier) => {
176
+ materialTier = tier;
177
+ this.#materialLighting?.setEnabled(materialLightingEnabled(tier, materialEnvironment));
178
+ },
119
179
  godraysLight: lighting.key,
120
180
  mobile: isMobile(),
121
181
  software: ctx.renderer.softwareAdapter !== undefined,
182
+ gpuClass: ctx.renderer.gpuClass?.class,
122
183
  });
123
184
  const loading = createLoadingScreen(ctx);
124
185
  const camera = ctx.camera as PerspectiveCamera;
@@ -137,6 +198,14 @@ export class Race extends Scene<GameState, IPhysicsContext> {
137
198
  const rival = new Rival(ctx, GRID_DISTANCE.rival);
138
199
  ctx.entities.add("player", car);
139
200
  ctx.entities.add("rival", rival);
201
+ // The sun's aim as three reads it: the target's world matrix, which only a scene traversal refreshes.
202
+ ctx.entities.add("sun", {
203
+ get targetGap(): number {
204
+ return new Vector3()
205
+ .setFromMatrixPosition(lighting.key.target.matrixWorld)
206
+ .distanceTo(car.body.position);
207
+ },
208
+ });
140
209
 
141
210
  // `travelDirection` is the car's **measured** velocity, not the heading it was asked for: a
142
211
  // car that is sliding through a corner is travelling somewhere other than where it points, and
@@ -229,6 +298,24 @@ export class Race extends Scene<GameState, IPhysicsContext> {
229
298
  camera.rotateZ(cameraBank(car.lateralLoad, FEEL.lateral));
230
299
  });
231
300
 
301
+ // Collect only after the loaded character and scene receivers are attached.
302
+ this.#materialLighting = ctx.entities.add(
303
+ "material-lighting",
304
+ createMaterialLighting(ctx.scene, ctx.camera, lighting.key, {
305
+ ...materialEnvironment,
306
+ enabled: materialLightingEnabled(materialTier, materialEnvironment),
307
+ }),
308
+ );
309
+ if (this.#environmentSample !== undefined) {
310
+ const sample = this.#environmentSample;
311
+ this.#materialLighting.setEnvironmentMeasurement(
312
+ sample.measurement,
313
+ sample.source,
314
+ sample.intensity,
315
+ sample,
316
+ );
317
+ }
318
+
232
319
  return (frameCtx, dt) => {
233
320
  loading.update();
234
321
  if (frameCtx.input.justPressed("restart")) {
@@ -277,4 +364,14 @@ export class Race extends Scene<GameState, IPhysicsContext> {
277
364
  frameCtx.state.set(statePatch);
278
365
  };
279
366
  }
367
+
368
+ override exit(ctx: GameCtx): void {
369
+ this.#materialLighting?.dispose();
370
+ this.#materialLighting = undefined;
371
+ this.#post?.dispose();
372
+ this.#post = undefined;
373
+ this.#environmentSample = undefined;
374
+ this.#lightingGeneration += 1;
375
+ super.exit(ctx);
376
+ }
280
377
  }
@@ -466,12 +466,3 @@ export const GRID_DISTANCE = {
466
466
  export function lineDistance(fraction: number): number {
467
467
  return fraction * CIRCUIT.totalLength;
468
468
  }
469
-
470
- /**
471
- * A point on the tarmac: `offset` metres right of the centreline at `distance`, on the banked
472
- * surface rather than on a flat plane through it, so anything parked on the track sits on it.
473
- */
474
- export function pointOnTrack(distance: number, offset: number, target: Vector3): Vector3 {
475
- const sample = CIRCUIT.at(distance, CIRCUIT.createSample());
476
- return target.lerpVectors(sample.left, sample.rightEdge, (offset + HALF) / TRACK_WIDTH);
477
- }
@@ -1,7 +1,11 @@
1
1
  import tailwindcss from "@tailwindcss/vite";
2
2
  import { watchAssets } from "@threenative/assets";
3
3
  import react from "@vitejs/plugin-react";
4
- import { createEngineFreshnessPlugin, createWebBrandPlugin } from "create-threenative";
4
+ import {
5
+ createEngineFreshnessPlugin,
6
+ createWebBrandPlugin,
7
+ webRuntimeDecoders,
8
+ } from "create-threenative";
5
9
  import { defineConfig } from "vite";
6
10
  import type { Plugin } from "vite";
7
11
  import config from "./threenative.config.js";
@@ -15,7 +19,11 @@ function assetsWatchPlugin(): Plugin {
15
19
  name: "threenative-assets-watch",
16
20
  apply: "serve",
17
21
  async configureServer(server) {
18
- const handle = watchAssets({ config: config.assets, cwd: server.config.root });
22
+ const handle = watchAssets({
23
+ config: config.assets,
24
+ cwd: server.config.root,
25
+ runtimeDecoders: webRuntimeDecoders(config),
26
+ });
19
27
  server.httpServer?.once("close", () => handle.close());
20
28
  // Nothing is served before the first cook settles: until it does, `public/` has no
21
29
  // `assets.manifest.json` and every asset answers from its source fallback.
@@ -1,14 +1,11 @@
1
1
  # AGENTS.md — __PROJECT_NAME__ rain
2
-
3
2
  Instructions for the AI agent in this game. `CLAUDE.md` mirrors this file; edit `AGENTS.md`.
4
3
 
5
4
  ## Ownership
6
-
7
5
  ThreeNative owns bootstrap, renderer, fixed-step loop, input, loading, audio lifetimes, and the state bridge. This repository owns the coastal storm: weather presets and easing, the fly camera, the shaders, lightning, sound design and the
8
- interface; `src/game.ts` is portable and React mounts from `src/main.ts`. The render camera also skips an object that projects under **0.5 px** in it; `renderer.minimumProjectedPixels` raises that threshold (`false` disables the cut, not the count) and `alwaysRender(object)` exempts an object, while camera-attached objects and shadow casters are kept. The engine also owns the per-frame world-matrix walk, and by default it does not descend into a hidden subtree — so a game that reads a hidden object's `matrixWorld` directly must use `getWorldPosition` (or call `object.updateWorldMatrix(true, false)`) first; `renderer.matrixWorld: "all"` restores three's every-node walk, and `TN_PROJECTION` reports the visited-node count either way.
6
+ interface; `src/game.ts` is portable and React mounts from `src/main.ts`. The render camera also skips an object that projects under **0.5 px** in it; `renderer.minimumProjectedPixels` raises that threshold (`false` disables the cut, not the count) and `alwaysRender(object)` exempts an object, while camera-attached objects and shadow casters are kept. The engine also owns the per-frame world-matrix walk, and by default it does not descend into a hidden subtree — so a game that reads a hidden object's `matrixWorld` directly must use `getWorldPosition` (or call `object.updateWorldMatrix(true, false)`) first; `renderer.matrixWorld: "all"` restores three's every-node walk, and `TN_PROJECTION` reports the visited-node count either way. Physics bodies and `ctx.camera` interpolate between fixed ticks by default; `physicsInterpolation: false` disables it globally, `body.interpolate = false` disables one body, `ctx.interpolate(object)` opts in another transform, and `ctx.resetInterpolation(object)` resets game-driven teleports (`TN_PHYSICS_INTERPOLATION` reports the setting and tracked count).
9
7
 
10
8
  ## Start every change
11
-
12
9
  1. **Critical planning gate:** invoke `threenative-capabilities` before `prd-creator`. Search
13
10
  `engine_search_capabilities` for the full request and each concrete mechanic, inspect relevant
14
11
  matches with `engine_capability_detail`, and record a capability or no-match for the plan. Apply the `ponytail` ladder before writing code; never hand-write what the capability search already installs.
@@ -36,7 +33,7 @@ bridge; avoid DOM globals, dynamic `import()`, and raw physics handles. **Report
36
33
  - `.agents/skills/threenative-performance/SKILL.md` / `.claude/skills/threenative-performance/SKILL.md` — measured budgets.
37
34
  - `.agents/skills/threenative-ui/SKILL.md` / `.claude/skills/threenative-ui/SKILL.md` — native-safe UI.
38
35
  - `.agents/skills/threenative-context/SKILL.md` / `.claude/skills/threenative-context/SKILL.md` — portable ctx APIs.
39
- - Confirmed framework bugs: use `file-engine-bug` in `.agents/skills/` or `.claude/skills/` after a minimal repro. A game-side `patches/` fix is temporary: once it is settled, it moves into the engine in one PR. Lazy-first: `.agents/skills/ponytail/SKILL.md` / `.claude/skills/ponytail/SKILL.md` — smallest correct change, and its reuse rung is the capability search above.
36
+ - Confirmed framework bugs: use `file-engine-bug` in `.agents/skills/` or `.claude/skills/` after a minimal repro. A game-side `patches/` fix is temporary: once it is settled, it moves into the engine in one PR. Lazy-first: `.agents/skills/ponytail/SKILL.md` / `.claude/skills/ponytail/SKILL.md` — smallest correct change, and its reuse rung is the capability search above. Engine: The owned C++ engine is the default for a new game: the Wasm engine on web and the engine player on desktop. This template pins `engine: "threejs"` in `threenative.config.ts` because the native engine does not bind some of its imports yet. The pin keeps upstream Three.js on web and the legacy host on desktop. A native build names each unbound import with `TN_NATIVE_ENGINE_UNBOUND`. Android and iOS use the legacy host.
40
37
 
41
38
  ## Commands and map
42
39
 
@@ -53,7 +50,7 @@ the `distance / 343` thunder delay; `src/scenes/Boot.ts` runs the simulation clo
53
50
  (gated on cloud cover above 0.35) and publishes everything the UI reads. The coast, clouds, rain
54
51
  and bloom/grade are shaders generated from `tools/tempest-*.frag` by `node tools/generate-shaders.mjs`;
55
52
  edit the `.frag`, never a generated `*-shader.ts`. Their named colours and lights live in
56
- `src/render/palette.ts`, `sky.ts`, `lighting.ts` and `materials.ts`, the bolt in `lightning.ts`.
53
+ `src/render/palette.ts`, `sky.ts`, `lighting.ts` and `materials.ts`, the bolt in `lightning.ts`. Imported foliage (Fab/Megascans cutouts) draws with its own albedo, normal map and alpha cutoff under the scene's environment light — never tint it, fake its emission or flatten its normals to make up for missing light; `TN_UNLIT_FOLIAGE` names cutout materials drawn with no environment.
57
54
  The coast is one ray-marched screen quad, so it is marked with `alwaysRender`; so are the rain and
58
55
  the bolt, whose quads are projected by their own vertex stage. Sound is three clips baked by
59
56
  `tools/make-storm-audio.mjs` and played through `AudioBus` in `src/audio/storm.ts`; audio starts on a
@@ -74,7 +71,7 @@ state; from a frame function `goto` and then `return`; `ctx.state.set({ /* copy
74
71
  is a partial patch. `game.goto("<scene-name>")` also rebuilds the scene, but it resets the game's
75
72
  state. Seeded randomness is deterministic only when `defineGame({ seed })` is configured.
76
73
 
77
- `src/render/quality.ts` owns `low`, `medium`, `high` (the engine chain: no built-in stage at any tier); `isMobile()` chooses `low`, otherwise `high`; override with `setupPost(..., { tier: "low" })`. Unknown tiers throw and `TN_QUALITY_TIER` reports
74
+ WebGPU reports `TN_GPU_CLASS` once per launch. Automatic `render.resolutionScale` starts at 0.85 for `mobile-low`, otherwise 1; a numeric value pins it. `TN_FRAME_BUDGET` reports the actual scale under both policies. `src/render/quality.ts` owns `low`, `medium`, `high` (the engine chain: no built-in stage at any tier); the GPU family from `ctx.renderer.gpuClass` sets the start (`discrete` `high`, `integrated` and `mobile-high` `medium`, other phones `low`); `isMobile()` chooses `low`, otherwise `high` when the family is `unknown`; override with `setupPost(..., { tier: "low" })`. Unknown tiers throw and `TN_QUALITY_TIER` reports
78
75
  the source. The player's four tiers are `STUDY_TIERS` in the same file. The bridge flushes about 100 ms; a control flushes it at once.
79
76
 
80
77
  When an animation looks wrong, measure it before rewriting it. `clipPoseError` scores a
@@ -84,13 +81,15 @@ caught where a bone-direction check reads zero. `clipTrackBindings` names tracks
84
81
  (the `<bone>.undefined` failure that plays the bind pose instead of the animation),
85
82
  `clipBoneCoverage` names bones the clip does not drive and which therefore keep the previous
86
83
  clip's pose, and `boneContact` reports in metres whether a named bone reaches the prop it is
87
- supposed to be touching. Two loading conventions come from `@threenative/core`, not from your own loops: `loadAll(items, load)` fetches six at a time and returns results **in the input's order** (a pool that pushes returns completion order, so a positional pick lands a different asset every load), and `addInSlices(objects, (object) => ctx.add(object))` attaches 256 per presented frame so hundreds of objects never land in one long frame; override `concurrency`/`sliceSize`, pass `while: () => alive` to stop a torn-down scene without throwing, and `marker: false` silences `TN_LOAD_ALL`/`TN_ADD_SLICES` but never the measurement.
84
+ supposed to be touching. Two loading conventions come from `@threenative/core`, not from your own loops: `loadAll(items, load)` fetches six at a time and returns results **in the input's order** (a pool that pushes returns completion order, so a positional pick lands a different asset every load), and `addInSlices(objects, (object) => ctx.add(object))` attaches in 8 ms slices so hundreds of objects never land in one long frame; override `concurrency`/`sliceSize`, pass `while: () => alive` to stop a torn-down scene without throwing, and `marker: false` silences `TN_LOAD_ALL`/`TN_ADD_SLICES` but never the measurement. Gate the loading curtain on a measured readiness with `ctx.startup.hold(label, () => ready)`: core polls it every rendered frame, so it settles without a physics step.
88
85
  ## Budget real time for the look
89
86
 
90
87
  Reference-driven authoring starts at `node_modules/create-threenative/agent-docs/references/dream-loop.md`.
91
88
 
92
89
  Open a capture after visual changes. A scenario with no assertions or missing observations fails. The engine warns you before a human does: `TN_SCENE_WARNING` fires when the GPU used under a third of the frame while the JS render phase ran longer than the display's own period, and names the census behind it — objects considered, draws per pass, triangles per draw, shadow-exempt casters. It is a scene-shape verdict, so answer it by moving the draw and object counts, not the engine: read the bucket census before promising a merge. `npx threenative doctor` repeats the last verdict and the `DEV_MODE=true` chip shows it beside the frame rate; `TN_FRAME_SPANS=1` adds the render phase's own span tree when you need to know which part costs the milliseconds. The cheapest static object is one whose transform you never write: measured on 1,561 objects, leaving them alone costs 10.10 ms of render phase against 17.45 ms when the game rewrites every transform each frame, because three skips the per-object binding update when nothing changed. So do not touch a transform you do not need to — that is worth ~7 ms where `markStatic(root)`, which additionally composes a never-moving subtree once, measured 0.009 ms. Use it for scenery you are sure of, and `invalidateStatic(object)` to announce a write inside one; it deletes matrix arithmetic, not the walk. `TN_RENDERLIST_VALIDATE=1` recomputes every world matrix the long way each frame and throws on the first that disagrees, which is how you prove a freeze did not leave something stale on screen.
93
90
 
94
- Recipes in the installed create-threenative: `node_modules/create-threenative/agent-docs/references/assertion-reference.md`, `node_modules/create-threenative/agent-docs/references/build-profiles.md`, `node_modules/create-threenative/agent-docs/references/capability-reference.md`, `node_modules/create-threenative/agent-docs/references/capture-the-frame.md`, `node_modules/create-threenative/agent-docs/references/creating-creatures.md`, `node_modules/create-threenative/agent-docs/references/ctx-cookbook.md`, `node_modules/create-threenative/agent-docs/references/debug-surface.md`, `node_modules/create-threenative/agent-docs/references/finding-assets.md`, `node_modules/create-threenative/agent-docs/references/gameplay-recipes.md`, `node_modules/create-threenative/agent-docs/references/menu-screens.md`, `node_modules/create-threenative/agent-docs/references/mobile-memory-budget.md`, `node_modules/create-threenative/agent-docs/references/performance-basics.md`, `node_modules/create-threenative/agent-docs/references/rigging-characters.md`, `node_modules/create-threenative/agent-docs/references/sculpt-from-a-reference.md`, `node_modules/create-threenative/agent-docs/references/trace-a-slow-frame.md`, `node_modules/create-threenative/agent-docs/references/visual-baseline.md`, and `node_modules/create-threenative/agent-docs/references/webview-ui.md`.
91
+ For terrain generation or editing, read `node_modules/create-threenative/agent-docs/references/terrain-authoring.md`; install optional `@threenative/terrain`, bake before play, and own its appearance in `src/render/`; test water proximity with its `createSegmentIndex` and steep ground with `slopeQuantile`, never a per-point scan or fixed degrees. Recipes in the installed create-threenative: `node_modules/create-threenative/agent-docs/references/assertion-reference.md`, `node_modules/create-threenative/agent-docs/references/build-profiles.md`, `node_modules/create-threenative/agent-docs/references/capability-reference.md`, `node_modules/create-threenative/agent-docs/references/capture-the-frame.md`, `node_modules/create-threenative/agent-docs/references/creating-creatures.md`, `node_modules/create-threenative/agent-docs/references/ctx-cookbook.md`, `node_modules/create-threenative/agent-docs/references/debug-surface.md`, `node_modules/create-threenative/agent-docs/references/finding-assets.md`, `node_modules/create-threenative/agent-docs/references/gameplay-recipes.md`, `node_modules/create-threenative/agent-docs/references/menu-screens.md`, `node_modules/create-threenative/agent-docs/references/mobile-memory-budget.md`, `node_modules/create-threenative/agent-docs/references/performance-basics.md`, `node_modules/create-threenative/agent-docs/references/rigging-characters.md`, `node_modules/create-threenative/agent-docs/references/sculpt-from-a-reference.md`, `node_modules/create-threenative/agent-docs/references/trace-a-slow-frame.md`, `node_modules/create-threenative/agent-docs/references/visual-baseline.md`, and `node_modules/create-threenative/agent-docs/references/webview-ui.md`.
95
92
  ## Optional multiplayer transport
96
93
  For online play only, import `connect` from `@threenative/core/net` with an HTTPS URL and nonempty identity credential; configure `connectTimeoutMs`, `maxReliableMessageBytes`, `maxQueuedReliableBytes`, and `maxQueuedDatagrams` (10s/65,536/1 MiB/256), use `reliable-ordered` for ordered reliable messages and bounded `unreliable` datagrams that may drop, and keep serialization, replication, prediction, interpolation, snapshots and rejoin in this game's `src/` and server. There is no fallback: unsupported WebTransport/native rejects with `TN_NET_UNAVAILABLE`; reference Go server: `packages/runtime-native/examples/webtransport/server`.
94
+ Backlight exception: this storm raymarches custom shader lighting in `src/render/lighting.ts`; standard-material `rimGain`/`fillGain` conversion is unqualified. Preserve its authored flash rim and sky fill. The cloud render-target radiance is unknown until sampled; do not claim an environment contribution from `scene.environment`.
95
+ `src/render/exposure.ts` owns optional adaptation (`enabled: false`); `autoExposure.ts` meters even when disabled. Recipe: `node_modules/create-threenative/agent-docs/references/auto-exposure.md`.
@@ -1,16 +1,13 @@
1
1
  <!-- Generated mirror of AGENTS.md. Do not edit; edit AGENTS.md. -->
2
2
 
3
3
  # AGENTS.md — __PROJECT_NAME__ rain
4
-
5
4
  Instructions for the AI agent in this game. `CLAUDE.md` mirrors this file; edit `AGENTS.md`.
6
5
 
7
6
  ## Ownership
8
-
9
7
  ThreeNative owns bootstrap, renderer, fixed-step loop, input, loading, audio lifetimes, and the state bridge. This repository owns the coastal storm: weather presets and easing, the fly camera, the shaders, lightning, sound design and the
10
- interface; `src/game.ts` is portable and React mounts from `src/main.ts`. The render camera also skips an object that projects under **0.5 px** in it; `renderer.minimumProjectedPixels` raises that threshold (`false` disables the cut, not the count) and `alwaysRender(object)` exempts an object, while camera-attached objects and shadow casters are kept. The engine also owns the per-frame world-matrix walk, and by default it does not descend into a hidden subtree — so a game that reads a hidden object's `matrixWorld` directly must use `getWorldPosition` (or call `object.updateWorldMatrix(true, false)`) first; `renderer.matrixWorld: "all"` restores three's every-node walk, and `TN_PROJECTION` reports the visited-node count either way.
8
+ interface; `src/game.ts` is portable and React mounts from `src/main.ts`. The render camera also skips an object that projects under **0.5 px** in it; `renderer.minimumProjectedPixels` raises that threshold (`false` disables the cut, not the count) and `alwaysRender(object)` exempts an object, while camera-attached objects and shadow casters are kept. The engine also owns the per-frame world-matrix walk, and by default it does not descend into a hidden subtree — so a game that reads a hidden object's `matrixWorld` directly must use `getWorldPosition` (or call `object.updateWorldMatrix(true, false)`) first; `renderer.matrixWorld: "all"` restores three's every-node walk, and `TN_PROJECTION` reports the visited-node count either way. Physics bodies and `ctx.camera` interpolate between fixed ticks by default; `physicsInterpolation: false` disables it globally, `body.interpolate = false` disables one body, `ctx.interpolate(object)` opts in another transform, and `ctx.resetInterpolation(object)` resets game-driven teleports (`TN_PHYSICS_INTERPOLATION` reports the setting and tracked count).
11
9
 
12
10
  ## Start every change
13
-
14
11
  1. **Critical planning gate:** invoke `threenative-capabilities` before `prd-creator`. Search
15
12
  `engine_search_capabilities` for the full request and each concrete mechanic, inspect relevant
16
13
  matches with `engine_capability_detail`, and record a capability or no-match for the plan. Apply the `ponytail` ladder before writing code; never hand-write what the capability search already installs.
@@ -38,7 +35,7 @@ bridge; avoid DOM globals, dynamic `import()`, and raw physics handles. **Report
38
35
  - `.agents/skills/threenative-performance/SKILL.md` / `.claude/skills/threenative-performance/SKILL.md` — measured budgets.
39
36
  - `.agents/skills/threenative-ui/SKILL.md` / `.claude/skills/threenative-ui/SKILL.md` — native-safe UI.
40
37
  - `.agents/skills/threenative-context/SKILL.md` / `.claude/skills/threenative-context/SKILL.md` — portable ctx APIs.
41
- - Confirmed framework bugs: use `file-engine-bug` in `.agents/skills/` or `.claude/skills/` after a minimal repro. A game-side `patches/` fix is temporary: once it is settled, it moves into the engine in one PR. Lazy-first: `.agents/skills/ponytail/SKILL.md` / `.claude/skills/ponytail/SKILL.md` — smallest correct change, and its reuse rung is the capability search above.
38
+ - Confirmed framework bugs: use `file-engine-bug` in `.agents/skills/` or `.claude/skills/` after a minimal repro. A game-side `patches/` fix is temporary: once it is settled, it moves into the engine in one PR. Lazy-first: `.agents/skills/ponytail/SKILL.md` / `.claude/skills/ponytail/SKILL.md` — smallest correct change, and its reuse rung is the capability search above. Engine: The owned C++ engine is the default for a new game: the Wasm engine on web and the engine player on desktop. This template pins `engine: "threejs"` in `threenative.config.ts` because the native engine does not bind some of its imports yet. The pin keeps upstream Three.js on web and the legacy host on desktop. A native build names each unbound import with `TN_NATIVE_ENGINE_UNBOUND`. Android and iOS use the legacy host.
42
39
 
43
40
  ## Commands and map
44
41
 
@@ -55,7 +52,7 @@ the `distance / 343` thunder delay; `src/scenes/Boot.ts` runs the simulation clo
55
52
  (gated on cloud cover above 0.35) and publishes everything the UI reads. The coast, clouds, rain
56
53
  and bloom/grade are shaders generated from `tools/tempest-*.frag` by `node tools/generate-shaders.mjs`;
57
54
  edit the `.frag`, never a generated `*-shader.ts`. Their named colours and lights live in
58
- `src/render/palette.ts`, `sky.ts`, `lighting.ts` and `materials.ts`, the bolt in `lightning.ts`.
55
+ `src/render/palette.ts`, `sky.ts`, `lighting.ts` and `materials.ts`, the bolt in `lightning.ts`. Imported foliage (Fab/Megascans cutouts) draws with its own albedo, normal map and alpha cutoff under the scene's environment light — never tint it, fake its emission or flatten its normals to make up for missing light; `TN_UNLIT_FOLIAGE` names cutout materials drawn with no environment.
59
56
  The coast is one ray-marched screen quad, so it is marked with `alwaysRender`; so are the rain and
60
57
  the bolt, whose quads are projected by their own vertex stage. Sound is three clips baked by
61
58
  `tools/make-storm-audio.mjs` and played through `AudioBus` in `src/audio/storm.ts`; audio starts on a
@@ -76,7 +73,7 @@ state; from a frame function `goto` and then `return`; `ctx.state.set({ /* copy
76
73
  is a partial patch. `game.goto("<scene-name>")` also rebuilds the scene, but it resets the game's
77
74
  state. Seeded randomness is deterministic only when `defineGame({ seed })` is configured.
78
75
 
79
- `src/render/quality.ts` owns `low`, `medium`, `high` (the engine chain: no built-in stage at any tier); `isMobile()` chooses `low`, otherwise `high`; override with `setupPost(..., { tier: "low" })`. Unknown tiers throw and `TN_QUALITY_TIER` reports
76
+ WebGPU reports `TN_GPU_CLASS` once per launch. Automatic `render.resolutionScale` starts at 0.85 for `mobile-low`, otherwise 1; a numeric value pins it. `TN_FRAME_BUDGET` reports the actual scale under both policies. `src/render/quality.ts` owns `low`, `medium`, `high` (the engine chain: no built-in stage at any tier); the GPU family from `ctx.renderer.gpuClass` sets the start (`discrete` `high`, `integrated` and `mobile-high` `medium`, other phones `low`); `isMobile()` chooses `low`, otherwise `high` when the family is `unknown`; override with `setupPost(..., { tier: "low" })`. Unknown tiers throw and `TN_QUALITY_TIER` reports
80
77
  the source. The player's four tiers are `STUDY_TIERS` in the same file. The bridge flushes about 100 ms; a control flushes it at once.
81
78
 
82
79
  When an animation looks wrong, measure it before rewriting it. `clipPoseError` scores a
@@ -86,13 +83,15 @@ caught where a bone-direction check reads zero. `clipTrackBindings` names tracks
86
83
  (the `<bone>.undefined` failure that plays the bind pose instead of the animation),
87
84
  `clipBoneCoverage` names bones the clip does not drive and which therefore keep the previous
88
85
  clip's pose, and `boneContact` reports in metres whether a named bone reaches the prop it is
89
- supposed to be touching. Two loading conventions come from `@threenative/core`, not from your own loops: `loadAll(items, load)` fetches six at a time and returns results **in the input's order** (a pool that pushes returns completion order, so a positional pick lands a different asset every load), and `addInSlices(objects, (object) => ctx.add(object))` attaches 256 per presented frame so hundreds of objects never land in one long frame; override `concurrency`/`sliceSize`, pass `while: () => alive` to stop a torn-down scene without throwing, and `marker: false` silences `TN_LOAD_ALL`/`TN_ADD_SLICES` but never the measurement.
86
+ supposed to be touching. Two loading conventions come from `@threenative/core`, not from your own loops: `loadAll(items, load)` fetches six at a time and returns results **in the input's order** (a pool that pushes returns completion order, so a positional pick lands a different asset every load), and `addInSlices(objects, (object) => ctx.add(object))` attaches in 8 ms slices so hundreds of objects never land in one long frame; override `concurrency`/`sliceSize`, pass `while: () => alive` to stop a torn-down scene without throwing, and `marker: false` silences `TN_LOAD_ALL`/`TN_ADD_SLICES` but never the measurement. Gate the loading curtain on a measured readiness with `ctx.startup.hold(label, () => ready)`: core polls it every rendered frame, so it settles without a physics step.
90
87
  ## Budget real time for the look
91
88
 
92
89
  Reference-driven authoring starts at `node_modules/create-threenative/agent-docs/references/dream-loop.md`.
93
90
 
94
91
  Open a capture after visual changes. A scenario with no assertions or missing observations fails. The engine warns you before a human does: `TN_SCENE_WARNING` fires when the GPU used under a third of the frame while the JS render phase ran longer than the display's own period, and names the census behind it — objects considered, draws per pass, triangles per draw, shadow-exempt casters. It is a scene-shape verdict, so answer it by moving the draw and object counts, not the engine: read the bucket census before promising a merge. `npx threenative doctor` repeats the last verdict and the `DEV_MODE=true` chip shows it beside the frame rate; `TN_FRAME_SPANS=1` adds the render phase's own span tree when you need to know which part costs the milliseconds. The cheapest static object is one whose transform you never write: measured on 1,561 objects, leaving them alone costs 10.10 ms of render phase against 17.45 ms when the game rewrites every transform each frame, because three skips the per-object binding update when nothing changed. So do not touch a transform you do not need to — that is worth ~7 ms where `markStatic(root)`, which additionally composes a never-moving subtree once, measured 0.009 ms. Use it for scenery you are sure of, and `invalidateStatic(object)` to announce a write inside one; it deletes matrix arithmetic, not the walk. `TN_RENDERLIST_VALIDATE=1` recomputes every world matrix the long way each frame and throws on the first that disagrees, which is how you prove a freeze did not leave something stale on screen.
95
92
 
96
- Recipes in the installed create-threenative: `node_modules/create-threenative/agent-docs/references/assertion-reference.md`, `node_modules/create-threenative/agent-docs/references/build-profiles.md`, `node_modules/create-threenative/agent-docs/references/capability-reference.md`, `node_modules/create-threenative/agent-docs/references/capture-the-frame.md`, `node_modules/create-threenative/agent-docs/references/creating-creatures.md`, `node_modules/create-threenative/agent-docs/references/ctx-cookbook.md`, `node_modules/create-threenative/agent-docs/references/debug-surface.md`, `node_modules/create-threenative/agent-docs/references/finding-assets.md`, `node_modules/create-threenative/agent-docs/references/gameplay-recipes.md`, `node_modules/create-threenative/agent-docs/references/menu-screens.md`, `node_modules/create-threenative/agent-docs/references/mobile-memory-budget.md`, `node_modules/create-threenative/agent-docs/references/performance-basics.md`, `node_modules/create-threenative/agent-docs/references/rigging-characters.md`, `node_modules/create-threenative/agent-docs/references/sculpt-from-a-reference.md`, `node_modules/create-threenative/agent-docs/references/trace-a-slow-frame.md`, `node_modules/create-threenative/agent-docs/references/visual-baseline.md`, and `node_modules/create-threenative/agent-docs/references/webview-ui.md`.
93
+ For terrain generation or editing, read `node_modules/create-threenative/agent-docs/references/terrain-authoring.md`; install optional `@threenative/terrain`, bake before play, and own its appearance in `src/render/`; test water proximity with its `createSegmentIndex` and steep ground with `slopeQuantile`, never a per-point scan or fixed degrees. Recipes in the installed create-threenative: `node_modules/create-threenative/agent-docs/references/assertion-reference.md`, `node_modules/create-threenative/agent-docs/references/build-profiles.md`, `node_modules/create-threenative/agent-docs/references/capability-reference.md`, `node_modules/create-threenative/agent-docs/references/capture-the-frame.md`, `node_modules/create-threenative/agent-docs/references/creating-creatures.md`, `node_modules/create-threenative/agent-docs/references/ctx-cookbook.md`, `node_modules/create-threenative/agent-docs/references/debug-surface.md`, `node_modules/create-threenative/agent-docs/references/finding-assets.md`, `node_modules/create-threenative/agent-docs/references/gameplay-recipes.md`, `node_modules/create-threenative/agent-docs/references/menu-screens.md`, `node_modules/create-threenative/agent-docs/references/mobile-memory-budget.md`, `node_modules/create-threenative/agent-docs/references/performance-basics.md`, `node_modules/create-threenative/agent-docs/references/rigging-characters.md`, `node_modules/create-threenative/agent-docs/references/sculpt-from-a-reference.md`, `node_modules/create-threenative/agent-docs/references/trace-a-slow-frame.md`, `node_modules/create-threenative/agent-docs/references/visual-baseline.md`, and `node_modules/create-threenative/agent-docs/references/webview-ui.md`.
97
94
  ## Optional multiplayer transport
98
95
  For online play only, import `connect` from `@threenative/core/net` with an HTTPS URL and nonempty identity credential; configure `connectTimeoutMs`, `maxReliableMessageBytes`, `maxQueuedReliableBytes`, and `maxQueuedDatagrams` (10s/65,536/1 MiB/256), use `reliable-ordered` for ordered reliable messages and bounded `unreliable` datagrams that may drop, and keep serialization, replication, prediction, interpolation, snapshots and rejoin in this game's `src/` and server. There is no fallback: unsupported WebTransport/native rejects with `TN_NET_UNAVAILABLE`; reference Go server: `packages/runtime-native/examples/webtransport/server`.
96
+ Backlight exception: this storm raymarches custom shader lighting in `src/render/lighting.ts`; standard-material `rimGain`/`fillGain` conversion is unqualified. Preserve its authored flash rim and sky fill. The cloud render-target radiance is unknown until sampled; do not claim an environment contribution from `scene.environment`.
97
+ `src/render/exposure.ts` owns optional adaptation (`enabled: false`); `autoExposure.ts` meters even when disabled. Recipe: `node_modules/create-threenative/agent-docs/references/auto-exposure.md`.
@@ -8,6 +8,16 @@
8
8
  "steps": [{ "kind": "wait", "waitTicks": 120, "release": true }],
9
9
  "assert": {
10
10
  "resources": [{ "id": "state", "path": "elapsed", "changed": true }],
11
- "renderChain": { "tier": "high", "stages": { "includes": ["stormPost"] } }
11
+ "renderChain": {
12
+ "tier": "high",
13
+ "perAdapter": {
14
+ "integrated": { "stages": { "includes": ["stormPost"] }, "tier": "medium" },
15
+ "mobile-high": { "stages": { "includes": ["stormPost"] }, "tier": "medium" },
16
+ "mobile-low": { "stages": { "includes": ["stormPost"] }, "tier": "low" },
17
+ "mobile-mid": { "stages": { "includes": ["stormPost"] }, "tier": "low" },
18
+ "software": { "stages": { "includes": ["stormPost"] }, "tier": "low" }
19
+ },
20
+ "stages": { "includes": ["stormPost"] }
21
+ }
12
22
  }
13
23
  }
@@ -15,8 +15,8 @@
15
15
  "typecheck": "tsc --noEmit -p tsconfig.json"
16
16
  },
17
17
  "dependencies": {
18
- "@threenative/core": "0.3.4",
19
- "@threenative/ui": "0.3.4",
18
+ "@threenative/core": "0.3.6",
19
+ "@threenative/ui": "0.3.6",
20
20
  "react": "19.2.0",
21
21
  "react-dom": "19.2.0",
22
22
  "react-reconciler": "0.33.0",
@@ -24,25 +24,27 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@tailwindcss/vite": "4.3.3",
27
- "@threenative/assets": "0.3.5",
28
- "@threenative/playtest": "0.3.4",
27
+ "@threenative/assets": "0.3.7",
28
+ "@threenative/playtest": "0.3.6",
29
29
  "@types/react": "19.2.0",
30
30
  "@types/react-dom": "19.2.0",
31
31
  "@types/three": "0.185.3",
32
32
  "@vitejs/plugin-react": "6.0.5",
33
- "create-threenative": "0.2.8",
33
+ "create-threenative": "0.2.10",
34
34
  "esbuild": "0.27.0",
35
35
  "playwright": "1.62.1",
36
36
  "tailwindcss": "4.3.3",
37
- "typescript": "5.9.3",
37
+ "typescript": "7.0.2",
38
38
  "vite": "8.2.0",
39
- "@gltf-transform/cli": "4.4.2"
39
+ "@gltf-transform/cli": "4.4.2",
40
+ "@typescript/typescript6": "6.0.2"
40
41
  },
41
42
  "optionalDependencies": {
42
- "@threenative/runtime-native": "0.3.4"
43
+ "@threenative/runtime-native": "0.3.6"
43
44
  },
44
45
  "overrides": {
45
- "sharp": ">=0.35.4"
46
+ "sharp": ">=0.35.4",
47
+ "@vitejs/devtools": "0.4.1"
46
48
  },
47
49
  "pnpm": {
48
50
  "overrides": {
@@ -50,7 +52,9 @@
50
52
  },
51
53
  "onlyBuiltDependencies": ["@threenative/core", "@threenative/runtime-native"],
52
54
  "patchedDependencies": {
53
- "three@0.185.1": "patches/three@0.185.1.patch"
55
+ "three@0.185.1": "patches/three@0.185.1.patch",
56
+ "vite@8.2.0": "patches/vite@8.2.0.patch",
57
+ "@tailwindcss/node@4.3.3": "patches/@tailwindcss__node@4.3.3.patch"
54
58
  }
55
59
  }
56
60
  }
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "warmupFrames": 60,
10
10
  "artifacts": {
11
- "screenshots": "both"
11
+ "screenshots": "after"
12
12
  },
13
13
  "steps": [
14
14
  {
@@ -8,7 +8,17 @@
8
8
  "maxTriangles": 40000,
9
9
  "minFps": 30
10
10
  },
11
- "renderChain": { "tier": "high", "stages": { "includes": ["stormPost"] } }
11
+ "renderChain": {
12
+ "tier": "high",
13
+ "perAdapter": {
14
+ "integrated": { "stages": { "includes": ["stormPost"] }, "tier": "medium" },
15
+ "mobile-high": { "stages": { "includes": ["stormPost"] }, "tier": "medium" },
16
+ "mobile-low": { "stages": { "includes": ["stormPost"] }, "tier": "low" },
17
+ "mobile-mid": { "stages": { "includes": ["stormPost"] }, "tier": "low" },
18
+ "software": { "stages": { "includes": ["stormPost"] }, "tier": "low" }
19
+ },
20
+ "stages": { "includes": ["stormPost"] }
21
+ }
12
22
  },
13
23
  "name": "rain-production-performance",
14
24
  "schemaVersion": 1,
@@ -11,6 +11,21 @@
11
11
  "screenshots": "before-after"
12
12
  },
13
13
  "steps": [
14
+ {
15
+ "kind": "click",
16
+ "at": { "element": { "id": "quality" } },
17
+ "waitTicks": 2,
18
+ "release": true
19
+ },
20
+ { "kind": "input", "press": "Escape", "waitTicks": 2, "release": true },
21
+ { "kind": "input", "press": "End", "waitTicks": 2, "release": true },
22
+ {
23
+ "kind": "input",
24
+ "press": "ArrowUp",
25
+ "label": "requested-high",
26
+ "waitTicks": 2,
27
+ "release": true
28
+ },
14
29
  {
15
30
  "kind": "wait",
16
31
  "label": "high",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "warmupFrames": 60,
10
10
  "artifacts": {
11
- "screenshots": "both"
11
+ "screenshots": "after"
12
12
  },
13
13
  "steps": [
14
14
  {
@@ -4,14 +4,7 @@ import { UI_READY_INTENT } from "@threenative/core/ui-layer";
4
4
  import config from "../threenative.config.js";
5
5
  import { type IStormAudio, STORM_AUDIO_ENTITY } from "./audio/storm.js";
6
6
  import { Coast } from "./scenes/Boot.js";
7
- import {
8
- type GameState,
9
- type PresetName,
10
- type QualityName,
11
- VISIBILITY_INTENT,
12
- type WeatherKey,
13
- intentPatch,
14
- } from "./state.js";
7
+ import { type GameState, VISIBILITY_INTENT, intentPatch } from "./state.js";
15
8
 
16
9
  const game = defineGame<GameState>({
17
10
  input: {
@@ -48,32 +41,6 @@ const game = defineGame<GameState>({
48
41
 
49
42
  export default game;
50
43
 
51
- /**
52
- * The intents the UI sends, and the payload each one carries. The UI slice owns nothing else:
53
- * every control here is a named intent and a validated payload, and nothing else crosses.
54
- */
55
- export type RainIntent =
56
- | { readonly name: "closeHelp" }
57
- | { readonly name: "help" }
58
- | { readonly name: "hideUi" }
59
- | { readonly name: "pause" }
60
- | { readonly name: "resetCamera"; readonly payload?: never }
61
- | { readonly name: "resume" }
62
- | { readonly name: "setAudioEnabled"; readonly payload: boolean }
63
- | { readonly name: "setAutoLightning"; readonly payload: boolean }
64
- | { readonly name: "setCinematic"; readonly payload: boolean }
65
- | { readonly name: "setDroplets"; readonly payload: boolean }
66
- | { readonly name: "setFrozen"; readonly payload: boolean }
67
- | { readonly name: "setMuted"; readonly payload: boolean }
68
- | { readonly name: "setPreset"; readonly payload: PresetName }
69
- | { readonly name: "setQuality"; readonly payload: QualityName }
70
- | { readonly name: "setSafe"; readonly payload: boolean }
71
- | { readonly name: "setWeather"; readonly payload: Partial<Record<WeatherKey, number>> }
72
- | { readonly name: "showUi" }
73
- | { readonly name: "step"; readonly payload: number }
74
- | { readonly name: "strike"; readonly payload?: never }
75
- | { readonly name: typeof VISIBILITY_INTENT; readonly payload: boolean };
76
-
77
44
  game.ui.onIntent((intent, payload) => {
78
45
  // The framework's own "my tree has rendered" signal, and the one control that is not a player's:
79
46
  // it arrives on the same door but carries no weather, so it is answered before the validator