@wildshard/engine 0.1.18 → 0.1.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 (334) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/budgets/shard-size-baseline.json +10 -4
  3. package/index.html +6 -4
  4. package/lint/engine-sides.json +18 -0
  5. package/lint/ratchet.json +0 -68
  6. package/lint/ratchet.mjs +1 -4
  7. package/package.json +19 -15
  8. package/scripts/agent-sync.mjs +27 -8
  9. package/scripts/app-build/appCook.ts +8 -2
  10. package/scripts/app-build/catalogue.ts +10 -7
  11. package/scripts/app-build/gen.ts +33 -2
  12. package/scripts/app-build/isolation.d.mts +10 -0
  13. package/scripts/app-build/isolation.mjs +47 -0
  14. package/scripts/app-build/outputProducts.mjs +4 -0
  15. package/scripts/app-build/previousDeploy.d.mts +2 -0
  16. package/scripts/app-build/previousDeploy.mjs +10 -1
  17. package/scripts/app-build/serviceWorker.ts +10 -3
  18. package/scripts/app-build/splitOutput.mjs +4 -2
  19. package/scripts/app-build/standaloneOutput.d.mts +1 -1
  20. package/scripts/app-build/standaloneOutput.mjs +5 -3
  21. package/scripts/app-build/titlePreloads.d.mts +8 -0
  22. package/scripts/app-build/titlePreloads.mjs +69 -0
  23. package/scripts/app-build/worldMapAtlas.ts +10 -6
  24. package/scripts/app-build-pipeline.mjs +31 -3
  25. package/scripts/built-product.mjs +1 -1
  26. package/scripts/cell-mem-bench.mjs +83 -23
  27. package/scripts/check-custom-sections-zero.mjs +1 -1
  28. package/scripts/check-devserver.mjs +2 -0
  29. package/scripts/check-models.mjs +2 -0
  30. package/scripts/check-paths.allow.json +0 -115
  31. package/scripts/check-paths.mjs +2 -2
  32. package/scripts/check-platform-ratchets.mjs +2 -3
  33. package/scripts/chromium-keychain.d.mts +1 -1
  34. package/scripts/ci-static.sh +1 -1
  35. package/scripts/committed-fast-checks.mjs +0 -2
  36. package/scripts/content-sw-proof.mjs +2 -1
  37. package/scripts/cook-worker.mjs +9 -3
  38. package/scripts/cook.mjs +18 -5
  39. package/scripts/docs-inputs-proof.mjs +6 -6
  40. package/scripts/e7-voice-staging-proof.mjs +1 -1
  41. package/scripts/gate-related-tests.mjs +1 -1
  42. package/scripts/git-source-view.mjs +1 -1
  43. package/scripts/goldens/capture.mjs +17 -5
  44. package/scripts/grid-crossing-nightly.mjs +59 -0
  45. package/scripts/grid-crossing-qa.mjs +44 -0
  46. package/scripts/grid-crossing-ratchet.d.mts +6 -0
  47. package/scripts/grid-crossing-ratchet.mjs +52 -0
  48. package/scripts/grid-crossing-report.mjs +122 -0
  49. package/scripts/grid-crossing-stages.mjs +47 -0
  50. package/scripts/grid-crossing-tour.mjs +284 -0
  51. package/scripts/grid-crossing-walk-proof.mjs +126 -17
  52. package/scripts/host-ruler/roots.mjs +2 -2
  53. package/scripts/host-ruler.d.mts +91 -0
  54. package/scripts/host-ruler.mjs +565 -0
  55. package/scripts/land.mjs +2 -1
  56. package/scripts/live-prepush.py +3 -5
  57. package/scripts/loading-flow/benchmax.mjs +37 -12
  58. package/scripts/loading-flow/deskbench.mjs +276 -0
  59. package/scripts/loading-flow/stalls.d.mts +17 -3
  60. package/scripts/loading-flow/stalls.mjs +82 -3
  61. package/scripts/look-loop/test_look_loop.py +1 -38
  62. package/scripts/memory-proof.mjs +61 -6
  63. package/scripts/mmo-bots.mjs +8 -2
  64. package/scripts/net-lag-proof.mjs +219 -0
  65. package/scripts/night-market-kit-budget.mjs +2 -2
  66. package/scripts/nightly-model.ts +9 -6
  67. package/scripts/offline-proof-rules.d.mts +2 -2
  68. package/scripts/offline-proof-rules.mjs +15 -4
  69. package/scripts/offline-proof.mjs +80 -13
  70. package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
  71. package/scripts/page-release/content.d.mts +9 -1
  72. package/scripts/page-release/content.mjs +131 -17
  73. package/scripts/page-release/flow.mjs +36 -10
  74. package/scripts/page-release/stamp-content.mjs +24 -0
  75. package/scripts/page-release.mjs +28 -6
  76. package/scripts/page-size.mjs +2 -1
  77. package/scripts/parity/boot-smoke.mjs +13 -2
  78. package/scripts/pin-format.ts +5 -2
  79. package/scripts/pin-packs.ts +1 -1
  80. package/scripts/pins-reuse.d.mts +1 -0
  81. package/scripts/pins-reuse.mjs +22 -0
  82. package/scripts/pins.ts +4 -4
  83. package/scripts/precommit-checks.mjs +1 -7
  84. package/scripts/precommit-jobs.mjs +0 -1
  85. package/scripts/precommit-source.py +1 -9
  86. package/scripts/program-discovery.mjs +1 -1
  87. package/scripts/ring-cook.mjs +2 -1
  88. package/scripts/ring-step.ts +1 -1
  89. package/scripts/scratch-dir.mjs +95 -0
  90. package/scripts/scratch-sweep.mjs +182 -0
  91. package/scripts/script-scenario-metrics.mjs +1 -1
  92. package/scripts/shard-output-content.d.mts +1 -1
  93. package/scripts/shard-output-content.mjs +2 -2
  94. package/scripts/shard-outputs.mjs +1 -1
  95. package/scripts/shard-public.mjs +1 -1
  96. package/scripts/shard-wire-meter.mjs +24 -9
  97. package/scripts/side-parity.mjs +4 -2
  98. package/scripts/standalone-smoke.mjs +8 -3
  99. package/scripts/tier-textures.mjs +22 -4
  100. package/scripts/tile-bake-report.mjs +1 -1
  101. package/scripts/tile-bakes.mjs +1 -1
  102. package/scripts/title-assets.generated.json +2 -0
  103. package/scripts/tsconfig.json +2 -14
  104. package/scripts/vendor/basisu/LICENSE +201 -0
  105. package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
  106. package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
  107. package/scripts/vitest-push-guards.config.ts +1 -1
  108. package/scripts/vps/harden-apply.sh +4 -1
  109. package/scripts/vps/harden-prometheus.sh +179 -0
  110. package/scripts/vps/harden.sh +16 -0
  111. package/scripts/vps/rebuild.sh +18 -0
  112. package/scripts/vps/wildshard-config +6 -2
  113. package/scripts/worker-client-play.mjs +6 -2
  114. package/scripts/worktree-reap.mjs +59 -13
  115. package/scripts/worktree.mjs +19 -5
  116. package/src/.oxlintrc.json +3 -182
  117. package/src/client/app/entry.ts +10 -2
  118. package/src/client/engine/anim/rigParser.ts +2 -2
  119. package/src/client/engine/boot/bootCache.ts +2 -2
  120. package/src/client/engine/boot/bootTrace.ts +12 -4
  121. package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
  122. package/src/client/engine/boot/clearDownloads.ts +5 -2
  123. package/src/client/engine/boot/contentRead.ts +11 -0
  124. package/src/client/engine/boot/gpuFiles.ts +4 -2
  125. package/src/client/engine/boot/lastEnd.ts +99 -12
  126. package/src/client/engine/boot/texturePack.ts +2 -2
  127. package/src/client/engine/core/Game.ts +63 -19
  128. package/src/client/engine/core/gpuOnly.ts +10 -0
  129. package/src/client/engine/core/renderBudget.ts +134 -0
  130. package/src/client/engine/net/netPlayer.ts +19 -2
  131. package/src/client/engine/net/otherPlayers.ts +55 -8
  132. package/src/client/engine/net/predictor.ts +33 -9
  133. package/src/client/engine/net/redial.ts +68 -10
  134. package/src/client/engine/pwa/cacheNames.ts +58 -1
  135. package/src/client/engine/pwa/sw.js +41 -11
  136. package/src/client/engine/render/dataLook.ts +219 -44
  137. package/src/client/engine/render/families/detail.ts +89 -0
  138. package/src/client/engine/render/families/pbr.ts +9 -1
  139. package/src/client/engine/render/families/registry.ts +11 -2
  140. package/src/client/engine/render/families/sceneSurface.ts +116 -0
  141. package/src/client/engine/render/look.ts +12 -0
  142. package/src/client/engine/render/lookLight.ts +103 -11
  143. package/src/client/engine/render/lookRender.ts +105 -0
  144. package/src/client/engine/render/precompile.ts +4 -2
  145. package/src/client/engine/render/tiers.ts +4 -1
  146. package/src/client/engine/saves/indexed.ts +2 -2
  147. package/src/client/engine/telemetry/browserErrors.ts +24 -3
  148. package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
  149. package/src/client/engine/ui/debugOptions.ts +1 -1
  150. package/src/client/engine/ui/lookLightOption.ts +10 -6
  151. package/src/client/engine/ui/namePrompt.ts +7 -0
  152. package/src/client/engine/world/declaredProps.ts +5 -1
  153. package/src/client/engine/world/skyRig.ts +4 -1
  154. package/src/client/engine/world/terrainTileView.ts +64 -23
  155. package/src/client/game/boot/audio.generated.ts +114 -114
  156. package/src/client/game/boot/bytes.generated.ts +118 -220
  157. package/src/client/game/boot/placedSpawn.ts +35 -0
  158. package/src/client/game/boot/spawnDownload.ts +25 -6
  159. package/src/client/game/boot/versions.generated.ts +7 -5
  160. package/src/client/game/devScene/hook.ts +428 -0
  161. package/src/client/game/devScene/liveLook.ts +21 -0
  162. package/src/client/game/grid/cellLoading.ts +12 -2
  163. package/src/client/game/grid/live.ts +152 -19
  164. package/src/client/game/grid/liveSession.ts +53 -3
  165. package/src/client/game/grid/mapAtlas.ts +18 -4
  166. package/src/client/game/grid/minimapBlend.ts +15 -5
  167. package/src/client/game/grid/oneWayIn.ts +5 -1
  168. package/src/client/game/grid/pageEntry.ts +12 -1
  169. package/src/client/game/grid/placedCells.ts +114 -12
  170. package/src/client/game/grid/placedContent.ts +85 -0
  171. package/src/client/game/grid/prefetch.ts +9 -1
  172. package/src/client/game/grid/productInputs.ts +23 -10
  173. package/src/client/game/grid/productLeases.ts +4 -1
  174. package/src/client/game/grid/products.ts +8 -4
  175. package/src/client/game/grid/roadLook.ts +24 -15
  176. package/src/client/game/grid/roadLookPlatform.ts +4 -2
  177. package/src/client/game/grid/roadResources.ts +24 -0
  178. package/src/client/game/grid/roadSign.worker.ts +4 -3
  179. package/src/client/game/grid/roadSignPaint.ts +16 -5
  180. package/src/client/game/grid/roadSignPreparation.ts +4 -3
  181. package/src/client/game/grid/roadSignScale.ts +8 -0
  182. package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
  183. package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
  184. package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
  185. package/src/client/game/grid/roadTileWriter.ts +2 -1
  186. package/src/client/game/grid/screenReports.ts +39 -0
  187. package/src/client/game/grid/session.ts +32 -7
  188. package/src/client/game/grid/softWallLook.ts +25 -8
  189. package/src/client/game/mainMenu.ts +6 -2
  190. package/src/client/game/plugin/context.ts +2 -1
  191. package/src/client/game/plugin/followedMovers.ts +7 -1
  192. package/src/client/game/quest/figures.ts +2 -0
  193. package/src/client/game/session/finish.ts +9 -0
  194. package/src/client/game/shardfile/assetCache.ts +4 -4
  195. package/src/client/game/shardfile/client.ts +28 -8
  196. package/src/client/game/shardfile/clientAssets.ts +9 -5
  197. package/src/client/game/shardfile/clientLibrary.ts +1 -1
  198. package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
  199. package/src/client/game/shardfile/clientViews.ts +36 -8
  200. package/src/client/game/shardfile/clientWater.ts +51 -9
  201. package/src/client/game/shardfile/clientWorker.ts +19 -7
  202. package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
  203. package/src/client/game/shardfile/groundMerge.ts +57 -5
  204. package/src/client/game/shardfile/hybrid.ts +2 -0
  205. package/src/client/game/shardfile/look.ts +8 -3
  206. package/src/client/game/shardfile/product.ts +34 -7
  207. package/src/client/game/shardfile/productChecks.ts +2 -2
  208. package/src/client/game/shardfile/productCost.ts +2 -2
  209. package/src/client/game/shardfile/readAsset.ts +2 -2
  210. package/src/client/game/shardfile/reflectingWater.ts +73 -0
  211. package/src/client/game/shardfile/seatGrace.ts +9 -0
  212. package/src/client/game/shardfile/skinPlayback.ts +1 -1
  213. package/src/client/game/shardfile/slabLibrary.ts +115 -49
  214. package/src/client/game/shardfile/tileContent.ts +1 -1
  215. package/src/client/game/shardfile/tileDriver.ts +38 -11
  216. package/src/client/game/shardfile/wirePage.ts +7 -3
  217. package/src/client/game/shardfile/worldScenes.ts +17 -10
  218. package/src/client/game/systems/npc/figureRows.ts +9 -0
  219. package/src/client/host/online/doctor.ts +22 -7
  220. package/src/client/host/online/doctorView.ts +2 -0
  221. package/src/client/host/online/linkScreens.ts +109 -5
  222. package/src/client/host/online/shell.ts +13 -4
  223. package/src/client/host/standalone/shell.ts +40 -0
  224. package/src/cook/game/astc6Encode.ts +55 -0
  225. package/src/cook/game/astc6Wasm.ts +176 -0
  226. package/src/cook/game/cookJob.ts +30 -6
  227. package/src/cook/game/cookWorker.ts +38 -11
  228. package/src/cook/game/entryTotals.ts +51 -24
  229. package/src/cook/game/shardCook.ts +35 -7
  230. package/src/cook/game/spawnParts.ts +33 -8
  231. package/src/cook/game/tierTextures.ts +87 -14
  232. package/src/server/engine/ai/bossContenders.ts +27 -3
  233. package/src/server/engine/ai/phases.ts +1 -1
  234. package/src/server/engine/entities/creatureRefill.ts +9 -2
  235. package/src/server/engine/net/ledgerBook.ts +2 -0
  236. package/src/server/engine/net/room.ts +15 -0
  237. package/src/server/engine/sim/respawn.ts +8 -0
  238. package/src/server/game/boss/arenaRoomEntry.ts +5 -1
  239. package/src/server/game/boss/arenaRoomNative.ts +2 -0
  240. package/src/server/game/boss/native.ts +2 -1
  241. package/src/server/game/boss/nativeWake.ts +9 -5
  242. package/src/server/game/boss/openArenaNative.ts +2 -2
  243. package/src/server/game/boss/openArenaRoom.ts +3 -1
  244. package/src/server/game/grid/room.ts +44 -3
  245. package/src/server/game/grid/simulation.ts +23 -0
  246. package/src/server/game/population/mixedRoster.ts +11 -3
  247. package/src/server/game/population/nativeBake.ts +8 -3
  248. package/src/server/game/population/nativeReturns.ts +6 -3
  249. package/src/server/game/population/roster.ts +5 -3
  250. package/src/server/game/quest/eliteDrops.ts +18 -3
  251. package/src/server/game/quest/nativeChapter.ts +1 -1
  252. package/src/server/game/quest/nativeComposition.ts +5 -1
  253. package/src/server/game/riding/nativeTaming.ts +22 -7
  254. package/src/server/game/riding/wildRefill.ts +3 -2
  255. package/src/server/game/shardfile/bossRow.ts +4 -2
  256. package/src/server/game/shardfile/homeKeeper.ts +4 -2
  257. package/src/server/host/bake/headlessWorker.ts +1 -1
  258. package/src/server/host/dedicated/cellHost.ts +112 -18
  259. package/src/server/host/dedicated/cellProtocol.ts +18 -1
  260. package/src/server/host/dedicated/cellWorker.ts +8 -5
  261. package/src/server/host/dedicated/dedicatedRoom.ts +38 -11
  262. package/src/server/host/dedicated/gridCells.ts +15 -6
  263. package/src/server/host/dedicated/loopLag.ts +21 -0
  264. package/src/server/host/dedicated/main.ts +13 -5
  265. package/src/server/host/dedicated/packReader.ts +3 -3
  266. package/src/server/host/dedicated/placementFile.ts +3 -2
  267. package/src/server/host/dedicated/roadRoom.ts +34 -4
  268. package/src/server/host/dedicated/serverMetrics.ts +135 -0
  269. package/src/server/host/dedicated/socketPump.ts +21 -4
  270. package/src/server/host/dedicated/workerTable.ts +32 -14
  271. package/src/server/host/dedicated/world.ts +65 -7
  272. package/src/server/host/headless.ts +1 -1
  273. package/src/server/host/headlessRuntime.ts +1 -1
  274. package/src/server/host/standalone/roadWorld.ts +15 -3
  275. package/src/server/host/standalone/serverHost.ts +57 -8
  276. package/src/server/host/standalone/serverProduct.ts +48 -16
  277. package/src/server/host/standalone/serverRuntime.ts +1 -1
  278. package/src/shared/engine/ai/BossBrain.ts +8 -0
  279. package/src/shared/engine/core/framePacing.ts +12 -1
  280. package/src/shared/engine/physics/terrainTiles.ts +20 -4
  281. package/src/shared/game/boss/wake.ts +6 -0
  282. package/src/shared/game/devColliders.ts +107 -0
  283. package/src/shared/game/devGameplay.ts +41 -0
  284. package/src/shared/game/eliteSystem.ts +8 -0
  285. package/src/shared/game/grid/allocator.ts +3 -0
  286. package/src/shared/game/grid/placementRows.ts +5 -2
  287. package/src/shared/game/plugin/bossRecord.ts +3 -2
  288. package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
  289. package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
  290. package/src/shared/game/shardfile/packReads.ts +28 -3
  291. package/src/shared/game/shardfile/serverPack.ts +9 -0
  292. package/src/shared/game/systems/looks/trampleField.ts +2 -0
  293. package/src/shared/host/formatJsonSchema.ts +2 -2
  294. package/src/tsconfig.json +1 -27
  295. package/lint/host-reviews.json +0 -14
  296. package/lint/listed-view-code.json +0 -13
  297. package/lint/platform-pending-users.json +0 -2520
  298. package/lint/platform-pending-users.md +0 -18
  299. package/scripts/cell-mem/metrics-preload.mjs +0 -65
  300. package/scripts/check-closed-components.d.mts +0 -7
  301. package/scripts/check-closed-components.mjs +0 -87
  302. package/scripts/g571-hosts.d.mts +0 -3
  303. package/scripts/g571-hosts.mjs +0 -54
  304. package/scripts/host-ruler/register-migrate.mjs +0 -242
  305. package/scripts/listed-view-code.d.mts +0 -7
  306. package/scripts/listed-view-code.mjs +0 -93
  307. package/scripts/look-loop/fit-lut.py +0 -142
  308. package/scripts/look-loop/palette-delta.py +0 -183
  309. package/scripts/look-loop/regions/driftwood-isle.json +0 -25
  310. package/scripts/look-loop/regions/far-reach.json +0 -225
  311. package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
  312. package/scripts/look-loop/regions/pine-hollow.json +0 -22
  313. package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
  314. package/scripts/platform-chargebacks.d.mts +0 -9
  315. package/scripts/platform-chargebacks.mjs +0 -135
  316. package/scripts/shard-component-spans.d.mts +0 -15
  317. package/scripts/shard-component-spans.mjs +0 -18
  318. package/scripts/shard-components.d.mts +0 -16
  319. package/scripts/shard-components.mjs +0 -363
  320. package/scripts/shard-platform-hosts.d.mts +0 -2
  321. package/scripts/shard-platform-hosts.mjs +0 -93
  322. package/scripts/shard-platform-sections.d.mts +0 -2
  323. package/scripts/shard-platform-sections.mjs +0 -9
  324. package/scripts/shard-platform.d.mts +0 -76
  325. package/scripts/shard-platform.mjs +0 -1072
  326. package/src/.oxfmtrc.json +0 -48
  327. package/src/scripts/ask-new.sh +0 -29
  328. package/src/scripts/asks.mjs +0 -142
  329. package/src/scripts/herdr-prompt.sh +0 -34
  330. package/src/scripts/herdr-question-open.sh +0 -67
  331. package/src/scripts/md-wrap.mjs +0 -229
  332. /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
  333. /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
  334. /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
@@ -1,6 +1,7 @@
1
1
  import type { Camera, Color, DirectionalLight, Fog, Group, HemisphereLight, Material, Mesh, Object3D, Sprite, Texture, Vector3, PerspectiveCamera, Scene, WebGLRenderer, WebGLRenderTarget } from 'three';
2
2
  import type { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, Effect, EffectComposer, GodRaysEffect, HueSaturationEffect, LookupTexture, LUT3DEffect, NoiseEffect, Pass, ToneMappingEffect, VignetteEffect } from 'postprocessing';
3
3
  import type { N8AOPostPass } from 'n8ao';
4
+ import type { LiveLook, LookKey } from './dataLook';
4
5
  import type { GradeEffect } from '../core/Grade';
5
6
  import type { DayCycleClock } from '../../../shared/engine/world/dayCycle';
6
7
  import type { SkyRig as Sky } from '../world/skyRig';
@@ -259,6 +260,17 @@ export interface ExtendLook extends LookParts {
259
260
  * cell carries its engine chain only. Standalone its compose builds its composite as before.
260
261
  */
261
262
  cell?: LookCellComposite;
263
+ /**
264
+ * A data look's day keys replaced in place (SHARD-SOURCE AP5: `wildshard watch` sets a look live through engine's dev
265
+ * hook); the next frame samples them. False: this look can't take them live (a fog kind change), so the page reloads.
266
+ */
267
+ liveKeys?: (keys: readonly LookKey[]) => boolean;
268
+ /**
269
+ * SHARD-SOURCE AP17: a data look's keys, sun arc, exposure, tone, vignette and bloom set in place (`wildshard watch`, engine's
270
+ * dev hook v2). False: this change can't go live (a light row, the LUT, a fog kind, an exposure on a chain built without
271
+ * one), so the page reloads.
272
+ */
273
+ liveLook?: (next: LiveLook) => boolean;
262
274
  compose: (c: LookComposeContext) => LookComposition;
263
275
  }
264
276
 
@@ -11,12 +11,21 @@
11
11
  * - `pools`: light pools on the ground under lamps (`lightPools`), one additive instanced decal draw for all of them,
12
12
  * never a dynamic light per lamp.
13
13
  * - `grade.bloom`: the engine bloom's intensity and threshold, which a shardfile shard had hard-wired to 0 (LF1-2).
14
+ * - `lamps`, `bounce`, `environment` (meta TEMPLATES-CLEANROOM B2): real point lights at lanterns, tents and fires; a
15
+ * shadowless warm fill from the anti-sun heading; an environment filtered once from the look's own sky over a ground
16
+ * colour (`dataLook`).
14
17
  *
15
- * All of it waits behind Settings ▸ Debug ▸ Look ▸ "Look light" (default off, read at load) until Jake picks: with the row
16
- * off, a look that declares every setting draws as one that declares none.
18
+ * - `shadow`, `motes`, a lamp's `decay`, `halo` and `flicker` (TEMPLATES-CLEANROOM M4): the sun's shadow strength,
19
+ * radius and normal bias; drifting glow points; lamp halos and an unsteady fire light (`lookRender.ts`).
20
+ *
21
+ * All of it waits behind Settings ▸ Debug ▸ Look ▸ "Look light" (read at load; default on): with the row off, a look that
22
+ * declares every setting draws as one that declares none. TEMPLATES-CLEANROOM M4.9 gates it per field on the phone tier
23
+ * instead of all or nothing: a phone keeps the environment, bounce, pools, rim, height fog and shadow look, at most
24
+ * `PHONE_LAMPS` lamps, half the motes, and no bloom or AO.
17
25
  */
18
26
  import * as THREE from 'three';
19
- import type { LookLight, LookPools, LookRim } from '@wildshard/format/look-light';
27
+ import type { LookBounce, LookEnvironment, LookLamp, LookLight, LookPools, LookRim } from '@wildshard/format/look-light';
28
+ import type { LookMotes, LookShadow } from '@wildshard/format/look-render';
20
29
  import type { ShaderSource } from './shaderPatches';
21
30
 
22
31
  /** the rim's shader patch id */
@@ -26,32 +35,52 @@ export const LOOK_RIM_PATCH = 'engine.look.rim';
26
35
  export interface LookLightResolved {
27
36
  /** the engine fog program's height term (`LevelSpec.atmosphere`'s fields) */
28
37
  readonly atmosphere: { readonly fogHeight: number; readonly fogHeightFalloff: number; readonly fogHeightDensity: number };
29
- /** the engine bloom (intensity 0: none) */
30
- readonly bloom: { readonly intensity: number; readonly threshold: number };
38
+ /** the engine bloom (intensity 0: none) and its spread (null: the engine's) */
39
+ readonly bloom: { readonly intensity: number; readonly threshold: number; readonly radius: number | null };
31
40
  /** the engine AO on the desktop tier; null: none */
32
41
  readonly ao: { readonly intensity: number; readonly radius: number } | null;
33
42
  readonly rim: LookRim | null;
34
43
  readonly pools: LookPools | null;
44
+ readonly lamps: readonly LookLamp[] | null;
45
+ readonly bounce: LookBounce | null;
46
+ readonly environment: LookEnvironment | null;
47
+ /** M4.2: the sun's shadow look; null: the engine's */
48
+ readonly shadow: LookShadow | null;
49
+ /** M4.4: glow motes; null: none */
50
+ readonly motes: LookMotes | null;
35
51
  }
36
52
 
37
53
  /** the settings a shardfile look carries (structural: `Shardfile['look']` fits) */
38
54
  export interface LookLightSource {
39
55
  readonly light?: LookLight | undefined;
40
- readonly grade: { readonly bloom?: { readonly intensity: number; readonly threshold: number } | undefined };
56
+ readonly grade: { readonly bloom?: { readonly intensity: number; readonly threshold: number; readonly radius?: number | undefined } | undefined };
41
57
  }
42
58
 
43
59
  /** No height fog: the fields a shardfile manifest had before LF1-4. */
44
60
  const NO_HEIGHT_FOG = { fogHeight: -20, fogHeightFalloff: 0, fogHeightDensity: 0 } as const;
45
61
 
46
- /** Resolve a look's light settings; `on` is the Debug row ("Look light"). Off, or nothing declared: as before. */
47
- export function lookLightManifest(look: LookLightSource, on: boolean): LookLightResolved {
48
- const light = on ? look.light : undefined, bloom = on ? look.grade.bloom : undefined, fog = light?.heightFog;
62
+ /** M4.9: at most this many of a look's lamps light on the phone tier (each costs every lit draw a light-loop step) */
63
+ export const PHONE_LAMPS = 4;
64
+
65
+ /**
66
+ * Resolve a look's light settings; `on` is the Debug row ("Look light"), `tier` the page's. Off, or nothing declared: as
67
+ * before. The phone tier keeps the cheap fields (M4.9): no bloom or AO, the first `PHONE_LAMPS` lamps, half the motes.
68
+ */
69
+ export function lookLightManifest(look: LookLightSource, on: boolean, tier = 'desktop'): LookLightResolved {
70
+ const phone = tier === 'phone';
71
+ const light = on ? look.light : undefined, bloom = on && !phone ? look.grade.bloom : undefined, fog = light?.heightFog;
72
+ const motes = light?.motes === undefined ? null : phone ? { ...light.motes, count: Math.max(1, Math.floor(light.motes.count / 2)) } : light.motes;
49
73
  return {
50
74
  atmosphere: fog === undefined ? { ...NO_HEIGHT_FOG } : { fogHeight: fog.height, fogHeightFalloff: fog.falloff, fogHeightDensity: fog.density },
51
- bloom: bloom === undefined ? { intensity: 0, threshold: 1 } : { intensity: bloom.intensity, threshold: bloom.threshold },
52
- ao: light?.ao === undefined ? null : { intensity: light.ao.intensity, radius: light.ao.radius },
75
+ bloom: bloom === undefined ? { intensity: 0, threshold: 1, radius: null } : { intensity: bloom.intensity, threshold: bloom.threshold, radius: bloom.radius ?? null },
76
+ ao: light?.ao === undefined || phone ? null : { intensity: light.ao.intensity, radius: light.ao.radius },
53
77
  rim: light?.rim ?? null,
54
78
  pools: light?.pools ?? null,
79
+ lamps: light?.lamps === undefined ? null : phone ? light.lamps.slice(0, PHONE_LAMPS) : light.lamps,
80
+ bounce: light?.bounce ?? null,
81
+ environment: light?.environment ?? null,
82
+ shadow: light?.shadow ?? null,
83
+ motes,
55
84
  };
56
85
  }
57
86
 
@@ -105,3 +134,66 @@ export function lightPools(pools: LookPools): THREE.InstancedMesh<THREE.PlaneGeo
105
134
  mesh.name = 'look-light-pools'; mesh.renderOrder = 1; mesh.castShadow = false; mesh.receiveShadow = false;
106
135
  return mesh;
107
136
  }
137
+
138
+ /** how far out the bounce light stands from its target (metres): far enough that its direction is the whole frame's */
139
+ const BOUNCE_DISTANCE = 100;
140
+
141
+ /**
142
+ * The look's warm bounce (B2): one shadowless directional light from the anti-sun heading, lifted by `lift`, in linear
143
+ * `colour` × `intensity`. `aim` points it for a sun direction (the clock's): call it when the sun moves.
144
+ */
145
+ export function bounceLight(bounce: LookBounce): { light: THREE.DirectionalLight; aim: (sun: THREE.Vector3) => void } {
146
+ const light = new THREE.DirectionalLight(new THREE.Color().setRGB(bounce.colour[0], bounce.colour[1], bounce.colour[2], THREE.LinearSRGBColorSpace), bounce.intensity);
147
+ light.name = 'look-light-bounce'; light.castShadow = false;
148
+ const dir = new THREE.Vector3();
149
+ const aim = (sun: THREE.Vector3): void => {
150
+ dir.set(-sun.x, 0, -sun.z);
151
+ if (dir.lengthSq() < 1e-8) dir.set(0, 0, 1);
152
+ dir.normalize().multiplyScalar(Math.sqrt(1 - bounce.lift * bounce.lift)).setY(bounce.lift);
153
+ light.position.copy(dir).multiplyScalar(BOUNCE_DISTANCE); light.target.position.set(0, 0, 0);
154
+ light.target.updateMatrixWorld();
155
+ };
156
+ return { light, aim };
157
+ }
158
+
159
+ /**
160
+ * The look's lamps (B2): one shadowless point light each, physical decay unless the lamp sets its own (M4.3). `update`
161
+ * flickers the lamps that declare a flicker (two incommensurate sines per lamp, so no two lamps pulse together); it is
162
+ * null when none does.
163
+ */
164
+ export function lampLights(lamps: readonly LookLamp[]): THREE.Group & { update: ((time: number) => void) | null } {
165
+ const group = Object.assign(new THREE.Group(), { update: null as ((time: number) => void) | null });
166
+ group.name = 'look-light-lamps';
167
+ const flickering: { light: THREE.PointLight; base: number; rate: number; amount: number; phase: number }[] = [];
168
+ lamps.forEach((lamp, i) => {
169
+ const light = new THREE.PointLight(new THREE.Color().setRGB(lamp.colour[0], lamp.colour[1], lamp.colour[2], THREE.LinearSRGBColorSpace), lamp.intensity, lamp.distance, lamp.decay ?? 2);
170
+ light.position.set(lamp.at[0], lamp.at[1], lamp.at[2]); light.castShadow = false;
171
+ group.add(light);
172
+ if (lamp.flicker !== undefined && lamp.flicker.amount > 0) flickering.push({ light, base: lamp.intensity, rate: lamp.flicker.rate, amount: lamp.flicker.amount, phase: i * 2.399 });
173
+ });
174
+ if (flickering.length > 0) {
175
+ group.update = (time) => {
176
+ for (const f of flickering) {
177
+ const w = Math.sin(time * f.rate * 2.1 + f.phase) * 0.6 + Math.sin(time * f.rate * 5.3 + f.phase * 1.7) * 0.4;
178
+ f.light.intensity = f.base * (1 - f.amount * 0.5 + f.amount * 0.5 * w);
179
+ }
180
+ };
181
+ }
182
+ return group;
183
+ }
184
+
185
+ /** the ground disc under the environment's sky: far below and wide, so every downward ray meets it */
186
+ const ENV_GROUND = { radius: 900, depth: -40 } as const;
187
+
188
+ /**
189
+ * The look's environment scene (B2): the sky dome's own material over a ground disc in linear `ground`, for a PMREM to
190
+ * filter once. The caller disposes the disc (the dome is the look's).
191
+ */
192
+ export function environmentScene(dome: THREE.Mesh, environment: LookEnvironment): { scene: THREE.Scene; dispose: () => void } {
193
+ const scene = new THREE.Scene();
194
+ const sky = new THREE.Mesh(dome.geometry, dome.material);
195
+ const floor = new THREE.Mesh(new THREE.CircleGeometry(ENV_GROUND.radius, 24).rotateX(-Math.PI / 2).translate(0, ENV_GROUND.depth, 0),
196
+ new THREE.MeshBasicMaterial({ color: new THREE.Color().setRGB(environment.ground[0], environment.ground[1], environment.ground[2], THREE.LinearSRGBColorSpace) }));
197
+ scene.add(sky, floor);
198
+ return { scene, dispose: () => { floor.geometry.dispose(); floor.material.dispose(); } };
199
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * A look's render-match draws (meta TEMPLATES-CLEANROOM M4.7/M4.8, `@wildshard/format/look-render`): what a cleanroom
3
+ * three.js scene adds round its lamps and in its air, and the exposure its renderer applies before tone mapping.
4
+ *
5
+ * - `lampHalos`: one instanced, additive, unfogged billboard per lamp that declares a `halo` (one draw, one program).
6
+ * - `lookMotes`: fireflies, sparks or dust, one additive points draw; each mote wanders round its seed point and breathes.
7
+ * - `ExposureEffect`: `2^exposure` on the scene's linear colour, ahead of the tone curve (`look.grade.exposure`, in stops;
8
+ * 0 adds no effect).
9
+ */
10
+ import * as THREE from 'three';
11
+ import { Effect } from 'postprocessing';
12
+ import type { LookLamp } from '@wildshard/format/look-light';
13
+ import type { LookMotes } from '@wildshard/format/look-render';
14
+
15
+ const linear = (rgb: readonly [number, number, number]): THREE.Color => new THREE.Color().setRGB(rgb[0], rgb[1], rgb[2], THREE.LinearSRGBColorSpace);
16
+
17
+ /** The halos of the lamps that declare one; null when none does. Each lamp's halo is its colour × `opacity`, `size` m across. */
18
+ export function lampHalos(lamps: readonly LookLamp[]): THREE.InstancedMesh<THREE.PlaneGeometry, THREE.ShaderMaterial> | null {
19
+ const glowing = lamps.filter((lamp) => lamp.halo !== undefined);
20
+ if (glowing.length === 0) return null;
21
+ const geometry = new THREE.PlaneGeometry(1, 1), glow = new Float32Array(glowing.length * 3);
22
+ glowing.forEach((lamp, i) => { const c = linear(lamp.colour).multiplyScalar(lamp.halo?.opacity ?? 0); glow.set([c.r, c.g, c.b], i * 3); });
23
+ geometry.setAttribute('aGlow', new THREE.InstancedBufferAttribute(glow, 3));
24
+ const material = new THREE.ShaderMaterial({
25
+ name: 'engine.look.halos', transparent: true, depthWrite: false, fog: false, blending: THREE.AdditiveBlending,
26
+ vertexShader: /* glsl */`
27
+ attribute vec3 aGlow; varying vec3 vGlow; varying vec2 vDisc;
28
+ void main() {
29
+ vGlow = aGlow; vDisc = position.xy * 2.0;
30
+ vec4 centre = modelViewMatrix * instanceMatrix * vec4(0.0, 0.0, 0.0, 1.0);
31
+ float size = length(instanceMatrix[0].xyz);
32
+ centre.xy += position.xy * size;
33
+ gl_Position = projectionMatrix * centre;
34
+ }`,
35
+ fragmentShader: /* glsl */`
36
+ varying vec3 vGlow; varying vec2 vDisc;
37
+ void main() { float r = clamp(1.0 - length(vDisc), 0.0, 1.0); gl_FragColor = vec4(vGlow * r * r * r, 1.0); }`,
38
+ });
39
+ const mesh = new THREE.InstancedMesh(geometry, material, glowing.length);
40
+ const m = new THREE.Matrix4(), q = new THREE.Quaternion(), p = new THREE.Vector3(), s = new THREE.Vector3();
41
+ glowing.forEach((lamp, i) => { const size = lamp.halo?.size ?? 1; mesh.setMatrixAt(i, m.compose(p.set(lamp.at[0], lamp.at[1], lamp.at[2]), q, s.set(size, size, size))); });
42
+ mesh.instanceMatrix.needsUpdate = true;
43
+ mesh.computeBoundingSphere();
44
+ mesh.name = 'look-light-halos'; mesh.renderOrder = 2; mesh.castShadow = false; mesh.receiveShadow = false; mesh.frustumCulled = false;
45
+ return mesh;
46
+ }
47
+
48
+ /** a mote's wander (metres) round its seed point */
49
+ const MOTE_WANDER = 0.45;
50
+
51
+ /** The look's motes: `count` points seeded (fixed, so a capture repeats) through the box, one additive draw; they move on
52
+ * the look's clock (`tickGlow`). */
53
+ export function lookMotes(motes: LookMotes): THREE.Points<THREE.BufferGeometry, THREE.ShaderMaterial> {
54
+ const at = new Float32Array(motes.count * 3), seed = new Float32Array(motes.count);
55
+ let s = 0x2f6b1d;
56
+ const next = (): number => { s = (Math.imul(s ^ (s >>> 15), 0x2c1b3c6d) + 0x297a2d39) >>> 0; return s / 4294967296; };
57
+ for (let i = 0; i < motes.count; i++) {
58
+ for (let k = 0; k < 3; k++) at[i * 3 + k] = (motes.min[k] ?? 0) + ((motes.max[k] ?? 0) - (motes.min[k] ?? 0)) * next();
59
+ seed[i] = next() * 100;
60
+ }
61
+ const geometry = new THREE.BufferGeometry();
62
+ geometry.setAttribute('position', new THREE.BufferAttribute(at, 3));
63
+ geometry.setAttribute('aSeed', new THREE.BufferAttribute(seed, 1));
64
+ const material = new THREE.ShaderMaterial({
65
+ name: 'engine.look.motes', transparent: true, depthWrite: false, fog: false, blending: THREE.AdditiveBlending,
66
+ uniforms: { uTime: { value: 0 }, uColour: { value: linear(motes.colour).multiplyScalar(motes.gain) }, uSize: { value: motes.size }, uScale: { value: 500 } },
67
+ vertexShader: /* glsl */`
68
+ uniform float uTime, uSize, uScale; attribute float aSeed; varying float vBreath;
69
+ void main() {
70
+ vec3 p = position + vec3(sin(uTime * 0.31 + aSeed), sin(uTime * 0.23 + aSeed * 1.7) * 0.6, cos(uTime * 0.27 + aSeed * 0.7)) * ${MOTE_WANDER.toFixed(2)};
71
+ vec4 mv = modelViewMatrix * vec4(p, 1.0);
72
+ vBreath = 0.35 + 0.65 * pow(0.5 + 0.5 * sin(uTime * 1.7 + aSeed * 3.1), 2.0);
73
+ gl_PointSize = max(1.0, uSize * uScale / -mv.z);
74
+ gl_Position = projectionMatrix * mv;
75
+ }`,
76
+ fragmentShader: /* glsl */`
77
+ uniform vec3 uColour; varying float vBreath;
78
+ void main() { float r = clamp(1.0 - length(gl_PointCoord * 2.0 - 1.0), 0.0, 1.0); gl_FragColor = vec4(uColour * vBreath * r * r, 1.0); }`,
79
+ });
80
+ const points = new THREE.Points(geometry, material);
81
+ points.name = 'look-light-motes'; points.frustumCulled = false; points.renderOrder = 2;
82
+ const size = new THREE.Vector2();
83
+ points.onBeforeRender = (renderer, _scene, camera) => {
84
+ const scale = material.uniforms['uScale'];
85
+ // pixels per metre at 1 m: the drawing buffer's height over the view's vertical extent
86
+ if (scale !== undefined && camera instanceof THREE.PerspectiveCamera) scale.value = renderer.getDrawingBufferSize(size).y / (2 * Math.tan(THREE.MathUtils.degToRad(camera.fov) / 2));
87
+ };
88
+ return points;
89
+ }
90
+
91
+ /** Set the look's clock (seconds since the look went in) on its glow draws (the motes' wander and breath). */
92
+ export function tickGlow(draws: readonly THREE.Object3D[], time: number): void {
93
+ for (const draw of draws) {
94
+ const material = (draw as Partial<THREE.Mesh>).material;
95
+ if (material instanceof THREE.ShaderMaterial) { const uTime = material.uniforms['uTime']; if (uTime !== undefined) uTime.value = time; }
96
+ }
97
+ }
98
+
99
+ /** `look.grade.exposure` (stops) on the scene's linear colour, ahead of the tone curve. */
100
+ export class ExposureEffect extends Effect {
101
+ constructor(stops: number) {
102
+ super('ExposureEffect', 'uniform float uExposure; void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) { outputColor = vec4(inputColor.rgb * uExposure, inputColor.a); }',
103
+ { uniforms: new Map([['uExposure', new THREE.Uniform(2 ** stops)]]) });
104
+ }
105
+ }
@@ -25,7 +25,7 @@ import { shadowDepthResolver, type ShadowDepthResolver } from './shadowDepthVari
25
25
  import { boundEntryWarmup } from './entryWarmupBound';
26
26
  import { workSlice } from '../../../shared/engine/core/workSlice';
27
27
  import { SHADOW_LAYER } from '../core/shadowLayer';
28
- import { buildHeld, heldBudget, nativeBudgetSpent, presenting } from '../../../shared/engine/core/framePacing';
28
+ import { buildHeld, buildUrgent, heldBudget, nativeBudgetSpent, presenting } from '../../../shared/engine/core/framePacing';
29
29
  import { countedWait, waitFor } from '../../../shared/engine/boot/waits';
30
30
  import { isDev } from '../core/devMode';
31
31
 
@@ -940,7 +940,9 @@ export const LIVE_HELD_PROGRAMS_PER_FRAME = 4;
940
940
  let warmUpHeld = false;
941
941
  /** Whether the traveller waits for a live warm-up (a grid cell's loading screen shows); the grid sets it, off by default. */
942
942
  export function setWarmUpHeld(held: boolean): void { warmUpHeld = held; }
943
- const programsPerFrame = (): number => (warmUpHeld ? LIVE_HELD_PROGRAMS_PER_FRAME : LIVE_PROGRAMS_PER_FRAME);
943
+ /** GC6: an entry warm-up on the road, for the cell the traveller heads into (`buildUrgent`), issues this many a frame. */
944
+ export const LIVE_URGENT_PROGRAMS_PER_FRAME = 2;
945
+ const programsPerFrame = (): number => (warmUpHeld ? LIVE_HELD_PROGRAMS_PER_FRAME : buildUrgent() ? LIVE_URGENT_PROGRAMS_PER_FRAME : LIVE_PROGRAMS_PER_FRAME);
944
946
  let parkedFrozen = false;
945
947
  /** G580 T2: whether a live warm-up freezes its parked (invisible) future root's matrices (`freezeParkedMatrices`); the grid
946
948
  * sets it, off by default. */
@@ -7,6 +7,9 @@ export const TIER_TABLE = {
7
7
  // PF3: the cascades redraw on every Nth drawn frame (skyRig.ts); a held map keeps the matrix it was drawn with, so a
8
8
  // static shadow stays exactly where it was and only a moving caster's shadow steps. 1 = every frame (a level's row may raise it)
9
9
  shadowEvery: 1,
10
+ // NB5: the cascades' staggered cadence (shadowCadence.ts) on every shard, not only a `texelBias: 'phone'` rig (skyRig.ts);
11
+ // the phone keeps its own rule, the desktop takes it (its three cascades were redrawn every frame)
12
+ cascadeStagger: false,
10
13
  // animals shadow as far as the cascade reaches (E90: at 30 m an animal's shadow switched on in plain view)
11
14
  animalShadowDist: 80, animalHideDist: 150, furShells: false,
12
15
  // animal draws (Animal.setDrawLod): fur / hard / eye within animalEyeDist, eyes in the hard material to animalOneDrawDist,
@@ -49,7 +52,7 @@ export const TIER_TABLE = {
49
52
  },
50
53
  desktop: {
51
54
  maxTexture: 4096, layerSize: 1024, dpr: 1.5, ao: true,
52
- cascades: 3, shadowMapSize: 2048, shadowFar: 220, shadowMargin: 120, softShadows: true, shadowEvery: 1,
55
+ cascades: 3, shadowMapSize: 2048, shadowFar: 220, shadowMargin: 120, softShadows: true, shadowEvery: 1, cascadeStagger: true,
53
56
  animalShadowDist: 90, animalHideDist: 400, furShells: true,
54
57
  // PH-P2: an eye is under a pixel past ~20 m at 1600×900 and a hoof tip past ~60 m, so the
55
58
  // phone's draw LOD at 1.3–1.5× its distances. ~150 animals × 3 draws were half of the desktop frame;
@@ -3,7 +3,7 @@
3
3
  import type { ImportReport, SaveStorage } from '../../../shared/engine/saves/store';
4
4
  import { installedIdentity, saveEpoch } from '../../../shared/engine/app/identity';
5
5
  import { deviceIdentity } from '../../../shared/engine/net/identity';
6
- import { ASSET_CACHE_NAME } from '../pwa/cacheNames';
6
+ import { assetCacheName } from '../pwa/cacheNames';
7
7
  import { bootTiming } from '../../../shared/engine/boot/timing';
8
8
 
9
9
  /** A server's saves on a page: the same documents localStorage would hold. */
@@ -89,7 +89,7 @@ export async function openIndexedSaves(name: string): Promise<IndexedSaves> {
89
89
  // Resource timings lend already-known URLs and measured sizes: no native
90
90
  // Cache.keys enumeration can be left pending across a title navigation.
91
91
  try {
92
- const cache = await caches.open(ASSET_CACHE_NAME), origin = globalThis.location?.origin;
92
+ const cache = await caches.open(assetCacheName()), origin = globalThis.location?.origin;
93
93
  const observed = new Map<string, number>();
94
94
  for (const entry of bootTiming()?.resources ?? []) {
95
95
  const url = entry['url'], bytes = entry['decodedBodySize'];
@@ -34,10 +34,24 @@ export interface BrowserErrorTags {
34
34
  * link-refused the online stop card "The world turned this connection away" (the same file)
35
35
  * stale-build the stale-build screen (index.html data-stale-build, STALE-BUILD SB6), reported by the next build that boots
36
36
  * (telemetry/staleBuildReport.ts) since that page stops before Sentry can load
37
+ * loading-stall the loading card's RETRY for a content read that failed past its own retry (boot/contentRead.ts
38
+ * retryFromCard, SENTRY-TRIAGE S18), once per page; a common screen, so it reports at warning level
39
+ * stale-reload the RELOADING cover over a build whose files are gone from the server (boot/browserChunkRecovery.ts
40
+ * reloadIfStaleBuild); the outbox carries it across the reload; warning (every deploy meets open tabs)
41
+ * self-reload index.html's 12 s self-reload of a page whose entry never arrived, reported by the page it reloads into
42
+ * (telemetry/staleBuildReport.ts reportSelfReload), since the inline script has no Sentry; warning
43
+ * save-failed the grid's SAVE FAILED, RETRY at a border (game/grid/screenReports.ts), once a session
44
+ * cell-unavailable a Shard Select UNAVAILABLE card: a neighbour cell that can't load (game/grid/session.ts refuse),
45
+ * once per cell a session; warning
46
+ * map-tile-missing a full-map cell the world map atlas has no tile for, drawn as a plain plot or its own map instead
47
+ * (game/grid/mapAtlas.ts; QA-FEEDBACK 2026-11-13 row 44), once per slug a page; warning
37
48
  * Not screens of a fault, so never reported: the player's own reload, back or exit (QA 11-12 row 35), "Playing somewhere else",
38
49
  * "The world is full", the reconnect banner (counted in `net` telemetry), title refusal lines and the Connection doctor.
39
50
  */
40
- export const ERROR_SCREENS = ['error-modal', 'stuck-step', 'glitch-chip', 'load-failure', 'title-drop', 'link-lost', 'link-refused', 'stale-build'] as const;
51
+ export const ERROR_SCREENS = ['error-modal', 'stuck-step', 'glitch-chip', 'load-failure', 'title-drop', 'link-lost', 'link-refused', 'stale-build',
52
+ 'loading-stall', 'stale-reload', 'self-reload', 'save-failed', 'cell-unavailable', 'map-tile-missing'] as const;
53
+ /** S18: screens common enough on a bad network that each is a Sentry warning, never an error */
54
+ export const WARNING_SCREENS: readonly ErrorScreen[] = ['loading-stall', 'stale-reload', 'self-reload', 'cell-unavailable', 'map-tile-missing'];
41
55
  export type ErrorScreen = typeof ERROR_SCREENS[number];
42
56
 
43
57
  // A DSN is a public browser endpoint, not an auth token. Only real production pages report.
@@ -101,7 +115,8 @@ export function browserErrorNoise(event: ErrorEvent, page: { readonly environmen
101
115
  const UNSUPPORTED_BROWSER = ['This browser is too old for the online world'] as const;
102
116
 
103
117
  /** The Sentry level an error reports at: `warning` for a designed old-browser refusal, else `fatal` or `error`. Pure, so it is tested. */
104
- export function browserErrorLevel(error: unknown, fatal: boolean): 'warning' | 'error' | 'fatal' {
118
+ export function browserErrorLevel(error: unknown, fatal: boolean, screen?: ErrorScreen): 'warning' | 'error' | 'fatal' {
119
+ if (screen !== undefined && WARNING_SCREENS.includes(screen)) return 'warning';
105
120
  const message = error instanceof Error ? error.message
106
121
  : typeof error === 'object' && error !== null && 'message' in error && typeof error.message === 'string' ? error.message : String(error);
107
122
  // includes, not startsWith: a title drop reports it as `<what>: <reason>` (src/client/app/entry.ts showDrop).
@@ -190,6 +205,12 @@ function asError(error: unknown): Error {
190
205
  * the outbox only once Sentry acknowledges it, so a page that reloads, goes to the title or dies right after still delivers it
191
206
  * (the next page sends it with the same event id, so Sentry keeps one).
192
207
  */
208
+ /** S18: the tags for a screen engine code opens outside any level (the loading card's RETRY): this page's build, no level */
209
+ export function engineScreenTags(screen: ErrorScreen, system: string, bootStage: string, diagnostic?: Record<string, unknown>): BrowserErrorTags {
210
+ let build = ''; try { build = __BUILD_ID__; } catch { /* under Node */ }
211
+ return { system, build, shard: '', bootStage, fatal: false, screen, ...(diagnostic === undefined ? {} : { diagnostic }) };
212
+ }
213
+
193
214
  export function captureBrowserError(error: unknown, tags: BrowserErrorTags): void {
194
215
  if (!dsn || !productionPage()) return;
195
216
  if (tags.screen !== undefined) { reportScreen(error, tags); return; }
@@ -218,7 +239,7 @@ export async function deliverBrowserError(error: Error, tags: BrowserErrorTags,
218
239
  try {
219
240
  sentry.withScope((scope) => {
220
241
  scope.setTags(tagsOf(tags));
221
- scope.setLevel(browserErrorLevel(error, tags.screen !== undefined && tags.fatal));
242
+ scope.setLevel(browserErrorLevel(error, tags.screen !== undefined && tags.fatal, tags.screen));
222
243
  if (tags.diagnostic) scope.setContext('boot_diagnostic', tags.diagnostic);
223
244
  sentId = sentry.captureException(error, eventId === undefined ? undefined : { event_id: eventId });
224
245
  });
@@ -1,5 +1,6 @@
1
1
  import { takeStaleBuildNote, type StaleBuildNote } from '../saves/staleBuildNote';
2
- import { captureBrowserError, staleBuildReport } from './browserErrors';
2
+ import { saveStorage } from '../saves/slots';
3
+ import { captureBrowserError, engineScreenTags, staleBuildReport } from './browserErrors';
3
4
 
4
5
  /** STALE-BUILD SB6: report an earlier page's stale-build note (browserErrors.ts staleBuildReport), if there is one; the note is gone after this. */
5
6
  export function reportStaleBuild(take: () => StaleBuildNote | null = takeStaleBuildNote, capture: typeof captureBrowserError = captureBrowserError): void {
@@ -10,3 +11,23 @@ export function reportStaleBuild(take: () => StaleBuildNote | null = takeStaleBu
10
11
  capture(error, tags);
11
12
  } catch { /* telemetry never disrupts the boot */ }
12
13
  }
14
+
15
+ /** a claim this long before this document started is the reload that started it (lastEnd.ts SELF_RELOAD_MS) */
16
+ const SELF_RELOAD_MS = 3000;
17
+ /** S18: the session `boot.selfReload` claim as this document found it. Read it at boot: an online boot's settle clears it
18
+ * within seconds (browserChunkRecovery.ts settleRefusedBuild). */
19
+ export function selfReloadClaim(read: () => string | null = () => saveStorage('session').getItem('boot.selfReload')): string | null {
20
+ try { return read(); } catch { return null; }
21
+ }
22
+ /** SENTRY-TRIAGE S18: index.html's 12 s self-reload (RL3) stamps session `boot.selfReload` with the time, then reloads; it has
23
+ * no Sentry, so the page it reloaded into reports it. Only that page: a claim older than this document is an earlier one's.
24
+ * `read` is selfReloadClaim's reading at boot; chunk recovery's and GpuRecovery's claims are '1', never a time. stuck.ts's
25
+ * retry stamps a time too, but marks its reload (lastEnd.ts markReload), which index.html's script never does: the caller
26
+ * passes no claim for a marked reload (bootTrace.ts). */
27
+ export function reportSelfReload(read: () => string | null, startedAt: number = performance.timeOrigin, capture: typeof captureBrowserError = captureBrowserError): void {
28
+ try {
29
+ const at = Number(read());
30
+ if (!Number.isFinite(at) || at < 1e12 || at > startedAt + 50 || startedAt - at >= SELF_RELOAD_MS) return;
31
+ capture(new Error("the page's entry never arrived; index.html reloaded it after 12 s"), engineScreenTags('self-reload', 'boot', 'loading'));
32
+ } catch { /* telemetry never disrupts the boot */ }
33
+ }
@@ -147,7 +147,7 @@ const earlyProgramsRow: DebugRow = { id: 'earlyPrograms', group: 'loading', labe
147
147
  note: 'DL10: compile the spawn view\'s shader programs during loading, as soon as the world is built; default off until a Simulator / iPhone reading.',
148
148
  ask: 'E526', reviewBy: '2026-12-30' };
149
149
  /** LF1-4 (meta TEMPLATE-E2E-PLAN): a look's optional light and post settings (contact AO, a warm rim, height fog, light
150
- * pools, a declared bloom; render/lookLight.ts). Read at load, so a pick reloads; default off until Jake picks. */
150
+ * pools, a declared bloom; render/lookLight.ts). Read at load, so a pick reloads; default on for desktop since TEMPLATES-CLEANROOM B2. */
151
151
  const lookLightRow: DebugRow = { id: 'lookLight', group: 'look', label: engineString('s_debug_look_light'), reload: true, when: always,
152
152
  choices: () => [{ v: 'off', text: engineString('s_ca7981b46ecf') }, { v: 'on', text: engineString('s_130011756125') }],
153
153
  get: () => lookLightSaved() ? 'on' : 'off',
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Settings ▸ Debug ▸ Look ▸ "Look light" (meta TEMPLATE-E2E-PLAN LF1-4): whether a look's optional light and post settings
3
- * (`look.light`, `look.grade.bloom`; `render/lookLight.ts`) draw. Default off until Jake picks; read at load, so a pick
3
+ * (`look.light`, `look.grade.bloom`; `render/lookLight.ts`) draw. Default on for the desktop tier since TEMPLATES-CLEANROOM
4
+ * B2 (was off until Jake picked; Jake's 2026-11-13 cleanroom port asks for the look as authored); read at load, so a pick
4
5
  * reloads the page.
5
6
  */
6
7
  import { jsonSlot } from '../saves/slots';
@@ -9,14 +10,17 @@ import { TIER } from '../core/tier';
9
10
  /** the saved slot's key */
10
11
  export const LOOK_LIGHT_SLOT = 'debug.lookLight';
11
12
 
12
- /** The row's saved value: 'on' or 'off' (anything else, or no storage: off). */
13
+ /**
14
+ * The row's saved value: on unless saved 'off' (TEMPLATES-CLEANROOM B2: a look's declared light is how its author asked
15
+ * it to look, so it draws by default; no storage: on).
16
+ */
13
17
  export function lookLightSaved(): boolean {
14
- try { return jsonSlot(LOOK_LIGHT_SLOT, 'device').read() === 'on'; } catch { return false; }
18
+ try { return jsonSlot(LOOK_LIGHT_SLOT, 'device').read() !== 'off'; } catch { return true; }
15
19
  }
16
20
  /**
17
- * Whether the settings draw on this page: the row on, and the desktop tier. The phone tier draws none of them until
18
- * Jake picks (its 30 fps lock and program set stay as they are).
21
+ * Whether the settings draw on this page: the row on. TEMPLATES-CLEANROOM M4.9: the phone tier draws them too, gated per
22
+ * field (`lookLightManifest`: no bloom or AO, at most 4 lamps, half the motes), not all or nothing; `tier` stays for callers.
19
23
  */
20
- export function lookLightOn(tier: string = TIER): boolean { return tier !== 'phone' && lookLightSaved(); }
24
+ export function lookLightOn(_tier: string = TIER): boolean { return lookLightSaved(); }
21
25
  /** Save the row's value (the page reloads to apply it). */
22
26
  export function setLookLight(on: boolean): void { jsonSlot(LOOK_LIGHT_SLOT, 'device').write(on ? 'on' : 'off'); }
@@ -137,3 +137,10 @@ export function nameSettingRows(scope: Scope): HTMLElement[] {
137
137
  });
138
138
  return [row, note];
139
139
  }
140
+
141
+ /** OFFLINE OF11 (J298): a page joining the world asks the Name only with a link. Offline it goes on as Skip would, without
142
+ * marking the device asked, so Worker boot never waits on a prompt the world can't hear yet and the next online join asks. */
143
+ export function askNameToJoin(scope: Scope, options: Omit<NamePromptOptions, 'current'>, online: boolean = navigator.onLine): Promise<boolean> {
144
+ if (!online) return Promise.resolve(true);
145
+ return askNameOnce(scope, options);
146
+ }
@@ -189,12 +189,16 @@ export async function installDeclaredProps(props: DeclaredProps, ports: {
189
189
  // TEMPLATE-E2E LF1-2: an unlit (emissive) surface is its declared colour × intensity, so it takes the mesh's
190
190
  // vertex colours only when it declares them: a lamp baked grey beside measure stone still glows its own amber
191
191
  const unlit = base instanceof MeshBasicMaterial;
192
+ const seeThrough = base.userData['sceneAlpha'] === true;
192
193
  const m = acquireVariant(base, { colour: glb?.color ?? null, roughness: standard?.roughness ?? null, metalness: standard?.metalness ?? null, map: undefined, vertexColours: unlit ? base.vertexColors && vertexColours : vertexColours, flat,
193
- side: source?.side ?? base.side, transparent: source?.transparent ?? base.transparent, opacity: source?.opacity ?? base.opacity,
194
+ // SHARD-SOURCE AP10: a see-through family entry (`blend: 'alpha'`, an alpha card) stays see-through whatever the GLB says
195
+ side: source?.side ?? base.side, transparent: seeThrough || (source?.transparent ?? base.transparent), opacity: seeThrough ? base.opacity : source?.opacity ?? base.opacity,
194
196
  named: { maps: binding.maps, emissive: glb?.emissive ?? null } });
195
197
  source?.dispose(); held.push(m); bases.set(m, base); return m;
196
198
  };
197
199
  o.material = Array.isArray(o.material) ? original.map(convert) : convert(original[0]);
200
+ // SHARD-SOURCE AP11: a card's corners and rise live in the shader, past the seats its bounds hold: never culled
201
+ if ((Array.isArray(o.material) ? o.material : [o.material]).some((m) => m.userData['sceneCard'] === true)) o.frustumCulled = false;
198
202
  o.castShadow = o.userData['castShadow'] !== false; o.receiveShadow = o.userData['receiveShadow'] !== false;
199
203
  });
200
204
  if (disposed) { releaseAll(); throw new Error('Props level unloaded while parsing'); }
@@ -152,7 +152,10 @@ export class SkyRig {
152
152
  // a low sun (golden hour, dawn) grazes flat decks: a shadow style may take more normal bias, or the planks speckle with acne
153
153
  for (const l of this.csm.lights) { l.color.copy(this.sunColor); l.shadow.normalBias = shadows?.normalBias ?? 0.05; l.shadow.radius = shadows?.radius ?? 2; }
154
154
  this.texelBias = shadows?.texelBias === 'phone' && rig.phone;
155
- this.farEveryOther = this.texelBias && this.csm.lights.length > 1;
155
+ // NB5 (QA-FEEDBACK-2026-11-14 rows 2, 3, 5): the desktop's three 2048² cascades take the phone's staggered cadence too
156
+ // (BA-3's A / B, shadowCadence.ts): near every frame, middle every 2nd, far every 4th. Desktop frames run at 60-120, so a
157
+ // far moving caster steps at 15-30 Hz; the shadow pass was ~110 of Driftwood's ~320 draws a frame
158
+ this.farEveryOther = (this.texelBias || TIER_CONFIG.cascadeStagger) && this.csm.lights.length > 1;
156
159
  // E174: the phone rig's shadow maps are depth only at 16 bits (Jake's pick C; shadowVariants.ts): 40 MB, not three's 160
157
160
  if (shadows?.depth16 === 'phone' && rig.phone) {
158
161
  const maps = new ShadowMaps(this.renderer, this.csm, this.shadowFade?.ghosts ?? [], rig.size);