@wildshard/engine 0.1.18 → 0.1.19

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 (293) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/budgets/shard-size-baseline.json +10 -4
  3. package/index.html +6 -4
  4. package/lint/engine-sides.json +14 -0
  5. package/lint/ratchet.json +0 -68
  6. package/lint/ratchet.mjs +1 -4
  7. package/package.json +17 -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 +22 -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 +81 -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 +277 -0
  51. package/scripts/grid-crossing-walk-proof.mjs +124 -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/live-prepush.py +3 -5
  56. package/scripts/loading-flow/benchmax.mjs +3 -1
  57. package/scripts/look-loop/test_look_loop.py +1 -38
  58. package/scripts/memory-proof.mjs +61 -6
  59. package/scripts/mmo-bots.mjs +8 -2
  60. package/scripts/net-lag-proof.mjs +219 -0
  61. package/scripts/night-market-kit-budget.mjs +2 -2
  62. package/scripts/offline-proof-rules.d.mts +2 -2
  63. package/scripts/offline-proof-rules.mjs +15 -4
  64. package/scripts/offline-proof.mjs +74 -13
  65. package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
  66. package/scripts/page-release/content.d.mts +9 -1
  67. package/scripts/page-release/content.mjs +131 -17
  68. package/scripts/page-release/flow.mjs +36 -10
  69. package/scripts/page-release/stamp-content.mjs +24 -0
  70. package/scripts/page-release.mjs +28 -6
  71. package/scripts/page-size.mjs +2 -1
  72. package/scripts/pin-packs.ts +1 -1
  73. package/scripts/pins.ts +4 -4
  74. package/scripts/precommit-checks.mjs +1 -7
  75. package/scripts/precommit-jobs.mjs +0 -1
  76. package/scripts/precommit-source.py +1 -9
  77. package/scripts/program-discovery.mjs +1 -1
  78. package/scripts/ring-cook.mjs +2 -1
  79. package/scripts/ring-step.ts +1 -1
  80. package/scripts/script-scenario-metrics.mjs +1 -1
  81. package/scripts/shard-output-content.d.mts +1 -1
  82. package/scripts/shard-output-content.mjs +2 -2
  83. package/scripts/shard-outputs.mjs +1 -1
  84. package/scripts/shard-public.mjs +1 -1
  85. package/scripts/shard-wire-meter.mjs +24 -9
  86. package/scripts/side-parity.mjs +4 -2
  87. package/scripts/standalone-smoke.mjs +8 -3
  88. package/scripts/tier-textures.mjs +22 -4
  89. package/scripts/tile-bake-report.mjs +1 -1
  90. package/scripts/tile-bakes.mjs +1 -1
  91. package/scripts/title-assets.generated.json +2 -0
  92. package/scripts/tsconfig.json +0 -2
  93. package/scripts/vendor/basisu/LICENSE +201 -0
  94. package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
  95. package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
  96. package/scripts/vitest-push-guards.config.ts +1 -1
  97. package/scripts/vps/harden-apply.sh +4 -1
  98. package/scripts/vps/harden-prometheus.sh +176 -0
  99. package/scripts/vps/harden.sh +16 -0
  100. package/scripts/vps/rebuild.sh +18 -0
  101. package/scripts/vps/wildshard-config +6 -2
  102. package/scripts/worker-client-play.mjs +6 -2
  103. package/scripts/worktree-reap.mjs +5 -5
  104. package/src/.oxlintrc.json +3 -182
  105. package/src/client/app/entry.ts +10 -2
  106. package/src/client/engine/boot/bootCache.ts +2 -2
  107. package/src/client/engine/boot/bootTrace.ts +12 -4
  108. package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
  109. package/src/client/engine/boot/clearDownloads.ts +5 -2
  110. package/src/client/engine/boot/contentRead.ts +11 -0
  111. package/src/client/engine/boot/gpuFiles.ts +4 -2
  112. package/src/client/engine/boot/lastEnd.ts +99 -12
  113. package/src/client/engine/boot/texturePack.ts +2 -2
  114. package/src/client/engine/net/netPlayer.ts +19 -2
  115. package/src/client/engine/net/otherPlayers.ts +55 -8
  116. package/src/client/engine/net/predictor.ts +33 -9
  117. package/src/client/engine/net/redial.ts +29 -6
  118. package/src/client/engine/pwa/cacheNames.ts +58 -1
  119. package/src/client/engine/pwa/sw.js +41 -11
  120. package/src/client/engine/render/dataLook.ts +152 -40
  121. package/src/client/engine/render/families/detail.ts +89 -0
  122. package/src/client/engine/render/families/pbr.ts +7 -1
  123. package/src/client/engine/render/look.ts +6 -0
  124. package/src/client/engine/render/lookLight.ts +103 -11
  125. package/src/client/engine/render/lookRender.ts +105 -0
  126. package/src/client/engine/saves/indexed.ts +2 -2
  127. package/src/client/engine/telemetry/browserErrors.ts +24 -3
  128. package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
  129. package/src/client/engine/ui/debugOptions.ts +1 -1
  130. package/src/client/engine/ui/lookLightOption.ts +10 -6
  131. package/src/client/engine/ui/namePrompt.ts +7 -0
  132. package/src/client/game/boot/audio.generated.ts +114 -114
  133. package/src/client/game/boot/bytes.generated.ts +118 -220
  134. package/src/client/game/boot/placedSpawn.ts +35 -0
  135. package/src/client/game/boot/spawnDownload.ts +25 -6
  136. package/src/client/game/boot/versions.generated.ts +7 -5
  137. package/src/client/game/devScene/hook.ts +291 -0
  138. package/src/client/game/grid/cellLoading.ts +12 -2
  139. package/src/client/game/grid/live.ts +112 -16
  140. package/src/client/game/grid/liveSession.ts +33 -2
  141. package/src/client/game/grid/mapAtlas.ts +18 -4
  142. package/src/client/game/grid/minimapBlend.ts +15 -5
  143. package/src/client/game/grid/oneWayIn.ts +5 -1
  144. package/src/client/game/grid/placedCells.ts +114 -12
  145. package/src/client/game/grid/placedContent.ts +85 -0
  146. package/src/client/game/grid/prefetch.ts +9 -1
  147. package/src/client/game/grid/productInputs.ts +3 -1
  148. package/src/client/game/grid/productLeases.ts +4 -1
  149. package/src/client/game/grid/products.ts +8 -4
  150. package/src/client/game/grid/roadLook.ts +24 -15
  151. package/src/client/game/grid/roadLookPlatform.ts +4 -2
  152. package/src/client/game/grid/roadResources.ts +24 -0
  153. package/src/client/game/grid/roadSign.worker.ts +4 -3
  154. package/src/client/game/grid/roadSignPaint.ts +16 -5
  155. package/src/client/game/grid/roadSignPreparation.ts +4 -3
  156. package/src/client/game/grid/roadSignScale.ts +8 -0
  157. package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
  158. package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
  159. package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
  160. package/src/client/game/grid/roadTileWriter.ts +2 -1
  161. package/src/client/game/grid/screenReports.ts +39 -0
  162. package/src/client/game/grid/session.ts +20 -4
  163. package/src/client/game/grid/softWallLook.ts +25 -8
  164. package/src/client/game/mainMenu.ts +6 -2
  165. package/src/client/game/plugin/context.ts +2 -1
  166. package/src/client/game/plugin/followedMovers.ts +7 -1
  167. package/src/client/game/quest/figures.ts +2 -0
  168. package/src/client/game/session/finish.ts +6 -0
  169. package/src/client/game/shardfile/assetCache.ts +4 -4
  170. package/src/client/game/shardfile/client.ts +4 -1
  171. package/src/client/game/shardfile/clientAssets.ts +9 -5
  172. package/src/client/game/shardfile/clientLibrary.ts +1 -1
  173. package/src/client/game/shardfile/clientWater.ts +51 -9
  174. package/src/client/game/shardfile/clientWorker.ts +19 -7
  175. package/src/client/game/shardfile/look.ts +8 -3
  176. package/src/client/game/shardfile/product.ts +34 -7
  177. package/src/client/game/shardfile/productChecks.ts +2 -2
  178. package/src/client/game/shardfile/productCost.ts +2 -2
  179. package/src/client/game/shardfile/readAsset.ts +2 -2
  180. package/src/client/game/shardfile/reflectingWater.ts +73 -0
  181. package/src/client/game/shardfile/seatGrace.ts +9 -0
  182. package/src/client/game/shardfile/skinPlayback.ts +1 -1
  183. package/src/client/game/systems/npc/figureRows.ts +9 -0
  184. package/src/client/host/online/doctor.ts +2 -0
  185. package/src/client/host/online/linkScreens.ts +30 -4
  186. package/src/client/host/standalone/shell.ts +4 -0
  187. package/src/cook/game/astc6Encode.ts +55 -0
  188. package/src/cook/game/astc6Wasm.ts +176 -0
  189. package/src/cook/game/cookJob.ts +30 -6
  190. package/src/cook/game/cookWorker.ts +38 -11
  191. package/src/cook/game/entryTotals.ts +51 -24
  192. package/src/cook/game/shardCook.ts +35 -7
  193. package/src/cook/game/spawnParts.ts +33 -8
  194. package/src/cook/game/tierTextures.ts +87 -14
  195. package/src/server/engine/ai/bossContenders.ts +27 -3
  196. package/src/server/engine/ai/phases.ts +1 -1
  197. package/src/server/engine/entities/creatureRefill.ts +9 -2
  198. package/src/server/engine/net/ledgerBook.ts +2 -0
  199. package/src/server/engine/net/room.ts +15 -0
  200. package/src/server/engine/sim/respawn.ts +8 -0
  201. package/src/server/game/boss/arenaRoomEntry.ts +5 -1
  202. package/src/server/game/boss/arenaRoomNative.ts +2 -0
  203. package/src/server/game/boss/native.ts +2 -1
  204. package/src/server/game/boss/nativeWake.ts +9 -5
  205. package/src/server/game/boss/openArenaNative.ts +2 -2
  206. package/src/server/game/boss/openArenaRoom.ts +3 -1
  207. package/src/server/game/grid/room.ts +44 -3
  208. package/src/server/game/grid/simulation.ts +23 -0
  209. package/src/server/game/population/mixedRoster.ts +11 -3
  210. package/src/server/game/population/nativeBake.ts +8 -3
  211. package/src/server/game/population/nativeReturns.ts +6 -3
  212. package/src/server/game/population/roster.ts +5 -3
  213. package/src/server/game/quest/eliteDrops.ts +15 -4
  214. package/src/server/game/quest/nativeChapter.ts +1 -1
  215. package/src/server/game/quest/nativeComposition.ts +5 -1
  216. package/src/server/game/riding/nativeTaming.ts +10 -6
  217. package/src/server/game/riding/wildRefill.ts +3 -2
  218. package/src/server/game/shardfile/bossRow.ts +4 -2
  219. package/src/server/game/shardfile/homeKeeper.ts +4 -2
  220. package/src/server/host/bake/headlessWorker.ts +1 -1
  221. package/src/server/host/dedicated/cellHost.ts +98 -16
  222. package/src/server/host/dedicated/cellProtocol.ts +16 -1
  223. package/src/server/host/dedicated/cellWorker.ts +8 -5
  224. package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
  225. package/src/server/host/dedicated/gridCells.ts +15 -6
  226. package/src/server/host/dedicated/loopLag.ts +21 -0
  227. package/src/server/host/dedicated/main.ts +13 -5
  228. package/src/server/host/dedicated/packReader.ts +3 -3
  229. package/src/server/host/dedicated/placementFile.ts +3 -2
  230. package/src/server/host/dedicated/roadRoom.ts +34 -4
  231. package/src/server/host/dedicated/serverMetrics.ts +126 -0
  232. package/src/server/host/dedicated/socketPump.ts +21 -4
  233. package/src/server/host/dedicated/workerTable.ts +15 -4
  234. package/src/server/host/dedicated/world.ts +65 -7
  235. package/src/server/host/headless.ts +1 -1
  236. package/src/server/host/headlessRuntime.ts +1 -1
  237. package/src/server/host/standalone/roadWorld.ts +15 -3
  238. package/src/server/host/standalone/serverHost.ts +4 -1
  239. package/src/server/host/standalone/serverProduct.ts +41 -11
  240. package/src/shared/engine/ai/BossBrain.ts +8 -0
  241. package/src/shared/game/boss/wake.ts +6 -0
  242. package/src/shared/game/devColliders.ts +47 -0
  243. package/src/shared/game/eliteSystem.ts +8 -0
  244. package/src/shared/game/grid/allocator.ts +3 -0
  245. package/src/shared/game/grid/placementRows.ts +5 -2
  246. package/src/shared/game/plugin/bossRecord.ts +3 -2
  247. package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
  248. package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
  249. package/src/shared/game/shardfile/packReads.ts +28 -3
  250. package/src/shared/game/shardfile/serverPack.ts +9 -0
  251. package/src/shared/game/systems/looks/trampleField.ts +2 -0
  252. package/src/shared/host/formatJsonSchema.ts +2 -2
  253. package/src/tsconfig.json +1 -27
  254. package/lint/host-reviews.json +0 -14
  255. package/lint/listed-view-code.json +0 -13
  256. package/lint/platform-pending-users.json +0 -2520
  257. package/lint/platform-pending-users.md +0 -18
  258. package/scripts/cell-mem/metrics-preload.mjs +0 -65
  259. package/scripts/check-closed-components.d.mts +0 -7
  260. package/scripts/check-closed-components.mjs +0 -87
  261. package/scripts/g571-hosts.d.mts +0 -3
  262. package/scripts/g571-hosts.mjs +0 -54
  263. package/scripts/host-ruler/register-migrate.mjs +0 -242
  264. package/scripts/listed-view-code.d.mts +0 -7
  265. package/scripts/listed-view-code.mjs +0 -93
  266. package/scripts/look-loop/fit-lut.py +0 -142
  267. package/scripts/look-loop/palette-delta.py +0 -183
  268. package/scripts/look-loop/regions/driftwood-isle.json +0 -25
  269. package/scripts/look-loop/regions/far-reach.json +0 -225
  270. package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
  271. package/scripts/look-loop/regions/pine-hollow.json +0 -22
  272. package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
  273. package/scripts/platform-chargebacks.d.mts +0 -9
  274. package/scripts/platform-chargebacks.mjs +0 -135
  275. package/scripts/shard-component-spans.d.mts +0 -15
  276. package/scripts/shard-component-spans.mjs +0 -18
  277. package/scripts/shard-components.d.mts +0 -16
  278. package/scripts/shard-components.mjs +0 -363
  279. package/scripts/shard-platform-hosts.d.mts +0 -2
  280. package/scripts/shard-platform-hosts.mjs +0 -93
  281. package/scripts/shard-platform-sections.d.mts +0 -2
  282. package/scripts/shard-platform-sections.mjs +0 -9
  283. package/scripts/shard-platform.d.mts +0 -76
  284. package/scripts/shard-platform.mjs +0 -1072
  285. package/src/.oxfmtrc.json +0 -48
  286. package/src/scripts/ask-new.sh +0 -29
  287. package/src/scripts/asks.mjs +0 -142
  288. package/src/scripts/herdr-prompt.sh +0 -34
  289. package/src/scripts/herdr-question-open.sh +0 -67
  290. package/src/scripts/md-wrap.mjs +0 -229
  291. /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
  292. /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
  293. /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
@@ -7,9 +7,11 @@
7
7
  * shares one program per object variant and a missing map is a uniform, not a recompile (the same trick the sky rig
8
8
  * plays on loaded models). Program changes come only from `vertexColours`, `faceted`, `doubleSided`, `alphaCutoff > 0` and a
9
9
  * procedural `ground` layer (ground.ts: wind ripples, grain and terrain light shaping, Signal Dunes' sand) or `measure`
10
- * layer (measure.ts: SF56's dev-map grid, roles and size labels).
10
+ * layer (measure.ts: SF56's dev-map grid, roles and size labels) or `detail` layer (detail.ts: M4.11's world-space
11
+ * mottling, grain, bumps and moss).
11
12
  */
12
13
  import * as THREE from 'three';
14
+ import { applyDetail } from './detail';
13
15
  import { applyGround } from './ground';
14
16
  import { applyMeasure } from './measure';
15
17
  import type { PbrMaterialParams } from '@wildshard/format/materialFamilies';
@@ -63,5 +65,9 @@ export function compilePbr(params: PbrMaterialParams, textures: TextureResolver,
63
65
  if (params.ground !== null && params.measure !== null) throw new Error('material family: a PBR surface takes a ground or a measure layer, not both');
64
66
  if (params.ground !== null) applyGround(m, params.ground, textures, emitterPools);
65
67
  if (params.measure !== null) applyMeasure(m, params.measure);
68
+ if (params.detail !== undefined) {
69
+ if (params.ground !== null || params.measure !== null) throw new Error('material family: a PBR surface takes a detail layer alone, not with a ground or measure layer');
70
+ applyDetail(m, params.detail);
71
+ }
66
72
  return m;
67
73
  }
@@ -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 { 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,11 @@ 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;
262
268
  compose: (c: LookComposeContext) => LookComposition;
263
269
  }
264
270
 
@@ -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
+ }
@@ -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
+ }