@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,23 +1,33 @@
1
1
  import type { RoadSign, SignLine } from '../../../shared/game/grid/roadLayout';
2
2
 
3
3
  export const SIGN_LINE_W = 512, SIGN_LINE_H = 64;
4
+ /** PZ24: the atlas's texel scales. 1 is the painted size; the phone tier's 0.5 holds a quarter of the texels (Driftwood's
5
+ * two halves' atlases were 28.8 MB of GPU texture at 1, 7.2 MB at 0.5): the same painting, drawn half size. */
6
+ export const SIGN_SCALES: readonly number[] = [1, 0.5];
4
7
  export interface RoadSignPaintLayout {
5
- readonly keys: readonly string[]; readonly lines: ReadonlyMap<string, SignLine>; readonly width: number; readonly height: number;
8
+ readonly keys: readonly string[]; readonly lines: ReadonlyMap<string, SignLine>;
9
+ /** texels; `slot` and the cell size are texels too (a line cell is `SIGN_LINE_W * scale` by `SIGN_LINE_H * scale`) */
10
+ readonly width: number; readonly height: number; readonly scale: number;
6
11
  readonly slot: (index: number) => [number, number];
7
12
  }
8
13
  export type RoadSignSource = (layout: RoadSignPaintLayout) => Uint8Array<ArrayBuffer> | undefined;
9
14
  export function roadSignLineKey(line: SignLine): string { return `${line.arrow}|${line.names.join(' · ')}|${line.metres === null ? '' : String(line.metres)}`; }
10
15
  /** Original first-key ordering and last matching line, without canvas or renderer state. */
11
- export function roadSignPaintLayout(signs: readonly Pick<RoadSign, 'lines'>[]): RoadSignPaintLayout {
16
+ export function roadSignPaintLayout(signs: readonly Pick<RoadSign, 'lines'>[], scale = 1): RoadSignPaintLayout {
17
+ if (!SIGN_SCALES.includes(scale)) throw new Error(`No road sign atlas scale ${String(scale)}`);
12
18
  const keys = [...new Set(signs.flatMap(s => s.lines.map(roadSignLineKey)))], lines = new Map<string, SignLine>();
13
19
  for (const sign of signs) for (const line of sign.lines) lines.set(roadSignLineKey(line), line);
14
- const width = 1024, perRow = width / SIGN_LINE_W, height = Math.ceil((keys.length + 1) / perRow) * SIGN_LINE_H;
15
- return { keys, lines, width, height, slot: k => [(k % perRow) * SIGN_LINE_W, Math.floor(k / perRow) * SIGN_LINE_H] };
20
+ const perRow = 1024 / SIGN_LINE_W, cellW = SIGN_LINE_W * scale, cellH = SIGN_LINE_H * scale;
21
+ const width = 1024 * scale, height = Math.ceil((keys.length + 1) / perRow) * cellH;
22
+ return { keys, lines, width, height, scale, slot: k => [(k % perRow) * cellW, Math.floor(k / perRow) * cellH] };
16
23
  }
17
24
  /** Exact original commands, font, coordinates and canvas state on either native 2D surface. */
18
25
  export function paintRoadSignCanvas(g: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, atlas: RoadSignPaintLayout): void {
19
- const { keys, lines, slot, width: W, height: H } = atlas, LINE_W = SIGN_LINE_W, LINE_H = SIGN_LINE_H, WHITE = '#e9ebe6';
26
+ const { keys, lines, width: W, height: H, scale } = atlas, LINE_W = SIGN_LINE_W, LINE_H = SIGN_LINE_H, WHITE = '#e9ebe6';
27
+ // the same commands in painted units at every scale (PZ24): only the transform shrinks them
28
+ const slot = (k: number): [number, number] => { const [x, y] = atlas.slot(k); return [x / scale, y / scale]; };
20
29
  g.fillStyle = '#0d6b3c'; g.fillRect(0, 0, W, H);
30
+ g.save(); g.scale(scale, scale);
21
31
  keys.forEach((key, k) => {
22
32
  const line = lines.get(key); if (line === undefined) return;
23
33
  const [x, y] = slot(k), mid = y + LINE_H / 2;
@@ -35,4 +45,5 @@ export function paintRoadSignCanvas(g: CanvasRenderingContext2D | OffscreenCanva
35
45
  });
36
46
  const [sx, sy] = slot(keys.length);
37
47
  g.fillStyle = WHITE; g.fillRect(sx + 128, sy, 64, SIGN_LINE_H);
48
+ g.restore();
38
49
  }
@@ -3,12 +3,13 @@ import type { ResidencyAllocator } from '../../../shared/game/grid/allocator';
3
3
  import type { RoadSign } from '../../../shared/game/grid/roadLayout';
4
4
  import { coverageTable } from './roadSolid';
5
5
  import { roadSignPaintLayout, type RoadSignSource } from './roadSignPaint';
6
+ import { roadSignScale } from './roadSignScale';
6
7
 
7
8
  export interface RoadSignPreparation { readonly ready: Promise<void>; readonly get: RoadSignSource; readonly release: () => void }
8
9
  /** One road bank's scoped coverage; exact original main-thread painting remains the fallback. */
9
10
  export function startRoadSigns(parent: Scope, allocator: ResidencyAllocator, home: string, signs: readonly RoadSign[], phase: 'initial' | 'outer' = 'initial'): RoadSignPreparation | undefined {
10
11
  if (typeof Worker !== 'function' || typeof OffscreenCanvas !== 'function' || parent.disposed || parent.disposing) return undefined;
11
- const layout = roadSignPaintLayout(signs), rows = [...layout.lines.values()], signature = JSON.stringify(rows), count = layout.width * layout.height;
12
+ const layout = roadSignPaintLayout(signs, roadSignScale()), rows = [...layout.lines.values()], signature = JSON.stringify(rows), count = layout.width * layout.height;
12
13
  if (rows.length > 2048 || count > 16 * 1024 * 1024 || signature.length > 131072) return undefined;
13
14
  // Canvas + RGBA readback + final RG8 + conversion lookup; duplicated job text is bounded too.
14
15
  // T10: claimed at once: a stepped eviction here (6369cf2558, retired with the rest of it) kept the evicted world
@@ -38,8 +39,8 @@ export function startRoadSigns(parent: Scope, allocator: ResidencyAllocator, hom
38
39
  listeners.push(scope.listen(worker, 'messageerror', () => { failed('transfer failed'); }));
39
40
  deadline = scope.timeout(30_000, () => { failed('worker deadline'); });
40
41
  const colours = { from: '#0d6b3c', to: '#e9ebe6', blueFromRed: 0.45, sentinel: { v: 1.5, colour: '#6f7378' } };
41
- worker.postMessage({ rows, red: coverageTable(colours, 0), green: coverageTable(colours, 1) }, { transfer: [] });
42
+ worker.postMessage({ rows, scale: layout.scale, red: coverageTable(colours, 0), green: coverageTable(colours, 1) }, { transfer: [] });
42
43
  } catch (error) { failed(error instanceof Error ? error.message : String(error)); }
43
- return { ready, get: current => settled && current.width === layout.width && current.height === layout.height
44
+ return { ready, get: current => settled && current.width === layout.width && current.height === layout.height && current.scale === layout.scale
44
45
  && JSON.stringify([...current.lines.values()]) === signature ? plane : undefined, release: () => { scope.dispose(); } };
45
46
  }
@@ -0,0 +1,8 @@
1
+ import { TIER } from '@wildshard/engine/core/tier';
2
+
3
+ /**
4
+ * PZ24 (meta PAGE-SIZE): the road sign atlas's texel scale for this page's tier. The phone paints it half size: Driftwood's
5
+ * two road halves held 28.8 MB of sign atlas on the iPhone profile (1024x4096 and 1024x6464 RG8 with mips), a quarter of
6
+ * that at 0.5: a sign line is 256x32 texels across a 3.4 m board. The desktop keeps the painted size. Read at each build, so a tier change takes effect with the next road.
7
+ */
8
+ export function roadSignScale(): number { return TIER === 'phone' ? 0.5 : 1; }
@@ -2,6 +2,7 @@ import { roadTileCache } from './roadTileArchive';
2
2
  import { captureJobTiles } from './roadTileCaptureJob';
3
3
  import type { CaptureJob } from './roadTileCaptureWorker';
4
4
  import { installWorkerBootTiming } from '@wildshard/engine/boot/workerTiming';
5
+ import { setCacheChannel } from '@wildshard/engine/pwa/cacheNames';
5
6
 
6
7
  installWorkerBootTiming('road-tile-capture');
7
8
 
@@ -10,5 +11,6 @@ async function answer(job: CaptureJob): Promise<void> {
10
11
  try { self.postMessage({ id: job.id, ok: true, ...await captureJobTiles(job, roadTileCache(caches, job.origin)) }, { transfer: [] }); }
11
12
  catch (error: unknown) { self.postMessage({ id: job.id, ok: false, error: error instanceof Error ? error.message : String(error) }, { transfer: [] }); }
12
13
  }
13
- self.onmessage = (event: MessageEvent<CaptureJob>): void => { void answer(event.data); };
14
+ // OF12: this worker has no document stamp; each job names the page's cache channel
15
+ self.onmessage = (event: MessageEvent<CaptureJob>): void => { setCacheChannel(Reflect.get(event.data, 'channel')); void answer(event.data); };
14
16
  self.postMessage({ ready: true }, { transfer: [] });
@@ -1,3 +1,4 @@
1
+ import { pageCacheChannel } from '@wildshard/engine/pwa/cacheNames';
1
2
  /** DL11: the road tile capture's worker, owned by the backing's scope. A source's compaction, coarse merge and
2
3
  * archive writes run there on a copy of its arrays, so the page publishes (and uploads) the source at once and
3
4
  * only the references come back. Until the worker says it is running, and whenever it cannot start, the backing
@@ -69,7 +70,7 @@ export class RoadTileCaptureWorker {
69
70
  const worker = this.worker; if (!this.usable() || worker === undefined) return null;
70
71
  return new Promise<CaptureResult>((resolve, reject) => {
71
72
  this.waiting.set(job.id, { job, resolve, reject, refused });
72
- worker.postMessage(job, { transfer: [] });
73
+ worker.postMessage({ ...job, channel: pageCacheChannel() }, { transfer: [] }); // OF12: the worker's cache channel
73
74
  });
74
75
  }
75
76
  private message(reply: unknown): void {
@@ -1,4 +1,4 @@
1
- import { ASSET_CACHE_NAME } from '@wildshard/engine/pwa/cacheNames';
1
+ import { assetCacheName, setCacheChannel } from '@wildshard/engine/pwa/cacheNames';
2
2
  import { installWorkerBootTiming } from '@wildshard/engine/boot/workerTiming';
3
3
 
4
4
  installWorkerBootTiming('road-tile-write');
@@ -11,10 +11,12 @@ self.onmessage = (event: MessageEvent<unknown>): void => {
11
11
  if (typeof message !== 'object' || message === null) return;
12
12
  const id: unknown = Reflect.get(message, 'id'), url: unknown = Reflect.get(message, 'url'), bytes: unknown = Reflect.get(message, 'bytes');
13
13
  if (typeof id !== 'number' || typeof url !== 'string' || !(bytes instanceof Uint8Array) || !(bytes.buffer instanceof ArrayBuffer)) return;
14
+ // OF12: this worker has no document stamp; the page names its channel's cache
15
+ setCacheChannel(Reflect.get(message, 'channel'));
14
16
  const body = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
15
17
  void (async (): Promise<void> => {
16
18
  try {
17
- await (await caches.open(ASSET_CACHE_NAME)).put(url, new Response(body, {
19
+ await (await caches.open(assetCacheName())).put(url, new Response(body, {
18
20
  headers: { 'content-type': 'application/octet-stream', 'content-length': String(body.length) },
19
21
  }));
20
22
  self.postMessage({ id, ok: true }, { transfer: [] });
@@ -1,3 +1,4 @@
1
+ import { pageCacheChannel } from '@wildshard/engine/pwa/cacheNames';
1
2
  /** DL11: road archive writes go to one dedicated worker that owns the Cache
2
3
  * Storage put; the page transfers each freshly encoded body instead of copying
3
4
  * it. Reads, hashes and URLs are the original store's. Until the worker says it
@@ -61,7 +62,7 @@ export function roadTileWriter(scope: Scope, storage: Pick<CacheStorage, 'open'>
61
62
  const id = next++;
62
63
  return new Promise<boolean>(resolve => {
63
64
  waiting.set(id, { hash, finish: resolve });
64
- target.postMessage({ id, url: roadTileUrl(origin, hash), bytes }, { transfer: [bytes.buffer] });
65
+ target.postMessage({ id, url: roadTileUrl(origin, hash), bytes, channel: pageCacheChannel() }, { transfer: [bytes.buffer] });
65
66
  });
66
67
  } };
67
68
  }
@@ -0,0 +1,39 @@
1
+ import { captureBrowserError } from '@wildshard/engine/telemetry/browserErrors';
2
+ import type { GridCrossingState } from '../../../shared/game/grid/crossing';
3
+ import type { CrossingSaveStatus } from './borderShimmer';
4
+
5
+ declare const __BUILD_ID__: string;
6
+ const buildId = (): string => { try { return __BUILD_ID__; } catch { return ''; } };
7
+
8
+ /**
9
+ * SENTRY-TRIAGE S18: the grid's SAVE FAILED, RETRY at a border is a screen of a fault. The first time a session shows it, one
10
+ * report names the cell the crossing left and the one it aimed for; later failures in the same session stay quiet, so an
11
+ * offline player who keeps trying can't fill the screen outbox (8 kept) and push out an unsent error-modal.
12
+ */
13
+ export function saveFailedReporter(slugOf: (instance: string | null) => string, capture: typeof captureBrowserError = captureBrowserError):
14
+ (status: CrossingSaveStatus, state: GridCrossingState | null | undefined) => void {
15
+ let reported = false;
16
+ return (status, state) => {
17
+ if (reported || status !== 'failed') return;
18
+ reported = true;
19
+ try {
20
+ capture(new Error(`a border crossing could not save (SAVE FAILED, RETRY): ${state?.issue ?? state?.phase ?? 'unknown'}`), {
21
+ system: 'grid', build: buildId(), shard: slugOf(state?.current ?? null), bootStage: 'playing', fatal: false, screen: 'save-failed',
22
+ diagnostic: { phase: state?.phase ?? null, target: slugOf(state?.target ?? null) } });
23
+ } catch { /* a report never holds the crossing */ }
24
+ };
25
+ }
26
+
27
+ /** S18: a neighbour that can't load shows UNAVAILABLE on Shard Select. One report per cell a session, at warning level. */
28
+ export function refusalReporter(capture: typeof captureBrowserError = captureBrowserError):
29
+ (instance: string, slug: string, refusal: string, error: unknown) => void {
30
+ const seen = new Set<string>();
31
+ return (instance, slug, refusal, error) => {
32
+ if (seen.has(instance)) return;
33
+ seen.add(instance);
34
+ try {
35
+ capture(error instanceof Error ? error : new Error(String(error)), { system: 'grid', build: buildId(), shard: slug, bootStage: 'playing',
36
+ fatal: false, screen: 'cell-unavailable', diagnostic: { refusal, cell: instance } });
37
+ } catch { /* a report never holds the refusal */ }
38
+ };
39
+ }
@@ -98,12 +98,14 @@ import { clientTileViews, type ClientTileViews } from '../shardfile/clientViews'
98
98
  import type { ClientSkin } from '../shardfile/clientSkins';
99
99
  import { setParkedMatricesFrozen, setWarmUpHeld } from '@wildshard/engine/render/precompile';
100
100
  import { setBuildHeldTimed } from '@wildshard/engine/core/heldTiming';
101
+ import { setBuildUrgent } from '@wildshard/engine/core/framePacing';
101
102
  import { NeighbourLife, type NeighbourLifeCell } from './neighbourLife';
102
103
  import { NeighbourPanels } from './neighbourPanels';
103
104
  import { copyMarks } from './copyIdentity';
104
105
  import { CellMinimaps } from './minimapBlend';
105
106
  import { leaseMapImage } from '../shardfile/mapImage';
106
107
  import { crossingSaveStatus, installBorderShimmer, type BorderShimmerState, type CrossingSaveStatus } from './borderShimmer';
108
+ import { refusalReporter, saveFailedReporter } from './screenReports';
107
109
  import { GAME_STRINGS } from '../../../shared/game/strings';
108
110
  import { GridCellWaitingError, classifyRefusal, pageShardRefusals, refusalReason, type ShardRefusal } from './refusal';
109
111
  import { tileRing } from '../shardfile/tileDriver';
@@ -113,6 +115,7 @@ import { readGridSeamData, type GridSeamAddress } from '../../../shared/game/gri
113
115
  import { readCompiledGridStrips } from '../../../shared/game/grid/compiledStrips';
114
116
  import { startRoadGrain } from './roadGrainPreparation';
115
117
  import { startRoadSigns } from './roadSignPreparation';
118
+ import { RoadMapShare } from './roadResources';
116
119
  import { clientPreparationBatch } from '../shardfile/preparationTiming';
117
120
 
118
121
  import { admittedRuntimeProduct } from '../shardfile/runtimeProduct';
@@ -208,8 +211,16 @@ export interface GridSessionState {
208
211
  readonly shimmer: BorderShimmerState;
209
212
  /** G555: the cell whose step-by-step loading screen is open (its entry or re-entry waits), or null */
210
213
  readonly cellLoading: string | null;
214
+ /** NET-LAG NL7: the loading card's running row, by label (null: no card). */
215
+ readonly cellStage: string | null;
216
+ /** GC8: the `cell` path step that screen shows now and its detail, so a harness times each step. */
217
+ readonly cellStep: { readonly step: string; readonly detail: string } | null;
218
+ /** GC6: the hybrid runtime session's entry state (liveSession `hybridState`) */
219
+ readonly hybrid?: ReturnType<LiveGridSession['hybridState']> | null;
211
220
  /** the allocator's grid content (MB) and the §3.2 playing total with the engine base (MB, the 1.0 GB envelope, G65) */
212
221
  readonly residentMB: number; readonly playingMB: number;
222
+ /** GC6: the playing envelope the allocator admits against (MB) */
223
+ readonly envelopeMB?: number;
213
224
  /** Exact category sum before engine base, overlap allowance or calibration factor; used by the soak harness. */
214
225
  readonly accountedBytes: number;
215
226
  readonly rings: { readonly frame?: number; readonly far: number; readonly l1: number; readonly l0: number; readonly refused: number; readonly inFlight: number; readonly queued: number;
@@ -371,6 +382,8 @@ export class GridSession {
371
382
  private readonly shimmer: { readonly step: () => void; readonly state: () => BorderShimmerState };
372
383
  /** G167: why a neighbour's shard can't load (its product refused, with the admission's message) and its far view's status */
373
384
  private readonly refusals = new Map<string, ShardRefusal>();
385
+ /** SENTRY-TRIAGE S18: UNAVAILABLE reports once per cell a session (screenReports.ts) */
386
+ private readonly reportRefusal = refusalReporter();
374
387
  private readonly issues = new Map<string, string>();
375
388
  private readonly farViews = new Set<string>();
376
389
  private readonly farPreparation: () => readonly FarPreparationWait[];
@@ -500,7 +513,7 @@ export class GridSession {
500
513
  return compiledOuter?.strips ?? generatePlatformSliced(source.cells, source.empty, pause, OUTER_RING_STRETCH_MS, await seamPlans(), (x, z) => !ring(x, z)); // T10: built in play after controls, short stretches beside the frame
501
514
  };
502
515
  const roadInput = { strips, home, pitch: assembly.pitch, layout, scene: host.scene,
503
- scope: roadScope, camera: () => host.frame?.camera, plans, admission, tileBacking,
516
+ scope: roadScope, camera: () => host.frame?.camera, plans, admission, tileBacking, maps: new RoadMapShare(),
504
517
  ...(grain === undefined ? {} : { grain: grain.get }), ...(signs === undefined ? {} : { signs: signs.get }) };
505
518
  const pause = async (): Promise<void> => { await construction.check(); };
506
519
  // Spawn heap (T10): no closure here may capture `compiled`. Every closure of this scope shares one context, and the
@@ -674,18 +687,25 @@ export class GridSession {
674
687
  const look = { instance: cell.instance, x: edge.x, z: edge.z, axis: edge.axis, halfLength: edge.halfLength };
675
688
  return cell.edgeLook === undefined ? look : Object.assign(look, { height: cell.edgeLook.height });
676
689
  })),
677
- ports: { closed: (id) => this.live === null || !this.live.live.ready(id) } });
690
+ // GC12: drawn only while the traveller stands at that edge (the feet in the home frame)
691
+ ports: { closed: (id) => this.live === null || !this.live.live.ready(id),
692
+ feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; } } });
678
693
  // QA 2026-11-13: a waiting cell's loading steps on SHARD SELECT's loading card, inset over the live world
679
694
  this.cellLoading = new CellLoading(new CellLoadingCard(), (waiting) => this.neighbours.some(row => row.instance === waiting));
680
695
  setParkedMatricesFrozen(true); // G580 T2: a hidden parked world skips matrix updates during its warm-up
681
- host.scope.onDispose(() => { this.cellLoading.close(); if (host.heldFrame !== undefined) host.heldFrame.enabled = false; setWarmUpHeld(false); setParkedMatricesFrozen(false); setBuildHeldTimed(false); });
696
+ host.scope.onDispose(() => { this.cellLoading.close(); if (host.heldFrame !== undefined) host.heldFrame.enabled = false; setWarmUpHeld(false); setParkedMatricesFrozen(false); setBuildHeldTimed(false); setBuildUrgent(false); });
682
697
  // G78: a shimmer line at every shard border on its real ground; G119: SAVING… / SAVE FAILED, RETRY while a crossing waits
683
698
  const rows = new Map((edges ?? []).map((cell) => [cell.instance, cell.edges]));
684
699
  let status: CrossingSaveStatus = null, polled = 0;
700
+ // S18: SAVE FAILED, RETRY reports the first time a session shows it
701
+ const reportSave = saveFailedReporter((id) => { try { return id === null ? '' : this.assembly.cell(id).slug; } catch { return ''; } });
685
702
  this.shimmer = installBorderShimmer({ scene: host.scene, scope: host.scope, time: () => app.clock.now,
686
703
  cells: this.assembly.cells.map((cell) => ({ x: cell.origin.x - home.origin.x, z: cell.origin.z - home.origin.z, edges: rows.get(cell.instance) ?? null })),
687
704
  ports: { feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; },
688
- status: () => { if (++polled % 4 === 0) status = crossingSaveStatus(this.live?.state().crossing); return status; },
705
+ status: () => {
706
+ if (++polled % 4 === 0) { const crossing = this.live?.state().crossing; status = crossingSaveStatus(crossing); reportSave(status, crossing); }
707
+ return status;
708
+ },
689
709
  text: (shown) => (shown === 'saving' ? GAME_STRINGS.grid.saving : GAME_STRINGS.grid.saveFailed) } });
690
710
  this.constructorTiming?.('presentation');
691
711
  const nativeOrigin = { origin: { x: 0, z: 0 } };
@@ -947,6 +967,7 @@ export class GridSession {
947
967
  const refusal = classifyRefusal(error);
948
968
  if (refusal === null || this.host.scope.disposed) return;
949
969
  console.warn(`[grid] ${cell.instance} can't load (${refusal}):`, error);
970
+ this.reportRefusal(cell.instance, cell.slug, refusal, error);
950
971
  this.refusals.set(cell.instance, refusal); this.issues.set(cell.instance, error instanceof Error ? error.message : String(error)); pageShardRefusals().note(cell.slug, refusal);
951
972
  }
952
973
  /**
@@ -956,7 +977,8 @@ export class GridSession {
956
977
  */
957
978
  private cellLoadingInput(): CellLoadingInput | null {
958
979
  const live = this.live; if (live === null) return null;
959
- const current = live.live.current(), ready = (id: string): boolean => live.live.ready(id) && (current !== id || live.gameplayReady());
980
+ // GC6: a world built ahead whose entry still prepares holds its crossing on the road: the screen shows it
981
+ const current = live.live.current(), ready = (id: string): boolean => live.live.ready(id) && !live.entryPending(id) && (current !== id || live.gameplayReady());
960
982
  let target: GridCell | undefined = current !== null && !ready(current) ? this.assembly.cell(current) : undefined;
961
983
  if (target === undefined) {
962
984
  const at = this.world();
@@ -995,6 +1017,9 @@ export class GridSession {
995
1017
  // G580 T2 / T5: a held traveller's warm-up issues more programs a frame and its builds run a bigger budget
996
1018
  setWarmUpHeld(this.cellLoading.open !== null);
997
1019
  setBuildHeldTimed(this.cellLoading.open !== null);
1020
+ // GC6: a world the traveller heads into, or the road (where its entry prepares), builds with the urgent budget
1021
+ const live = this.live;
1022
+ setBuildUrgent(live !== null && (live.live.building() || live.entriesPending()));
998
1023
  }
999
1024
  private refusal(instance: string): ShardRefusal | null {
1000
1025
  const live = this.live?.refusal(instance);
@@ -1231,8 +1256,8 @@ export class GridSession {
1231
1256
  pitch: this.assembly.pitch,
1232
1257
  home: this.home.instance, inside: gridCells.cell?.instance ?? null, feet: { x: Math.round(at.x * 100) / 100, z: Math.round(at.z * 100) / 100 },
1233
1258
  cells: this.assembly.cells.map((cell) => { const d = drawn(cell.instance); return { instance: cell.instance, slug: cell.slug, cell: cell.cell, shows: shows(cell.instance, d), drawn: d }; }),
1234
- strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: this.cellLoading.open, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
1235
- residentMB: Math.round(cost.accounted / 1e4) / 100, playingMB: Math.round(cost.playing / 1e4) / 100,
1259
+ strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: this.cellLoading.open, cellStage: this.cellLoading.stage, cellStep: this.cellLoading.now, hybrid: this.live?.hybridState() ?? null, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
1260
+ residentMB: Math.round(cost.accounted / 1e4) / 100, playingMB: Math.round(cost.playing / 1e4) / 100, envelopeMB: Math.round(this.allocator.envelope() / 1e4) / 100,
1236
1261
  accountedBytes: cost.accounted,
1237
1262
  rings: { frame: stats.frame, far: stats.resident.far, l1: stats.resident.l1, l0: stats.resident.l0, refused: stats.refused, inFlight: stats.inFlight, queued: stats.queued,
1238
1263
  ghosts: { count: this.tileGhosts.count(), tiles: this.tileGhosts.regions() } },
@@ -6,6 +6,10 @@
6
6
  *
7
7
  * One draw for every wall (a curtain quad per edge, additive, faded out past ~70 m so a 500 m wall never dominates the
8
8
  * view). Which walls are closed comes from the session each fixed step; a wall opens the moment its neighbour is ready.
9
+ *
10
+ * GC12 (Jake, 2026-11-13 ~22:50 Cancún, board A): the wall shows only when a player meets a closed edge. A closed wall is drawn
11
+ * while the traveller's feet stand within `MEET_METRES` of it, so a warm crossing (or a wall seen from across the cell) never
12
+ * shows it; the readiness wall itself still holds at every closed edge.
9
13
  */
10
14
  import { AdditiveBlending, BufferAttribute, BufferGeometry, Color, DoubleSide, DynamicDrawUsage, Group, Mesh, type Object3D, ShaderMaterial } from 'three';
11
15
  import type { LookScope } from '../../../shared/game/grid/roadLayout';
@@ -15,9 +19,19 @@ export interface SoftWallEdge { readonly instance: string; readonly x: number; r
15
19
  /** What the look reads each fixed step. */
16
20
  export interface SoftWallPorts {
17
21
  readonly closed: (instance: string) => boolean;
22
+ /** the traveller's feet in the home frame; absent: every closed wall shows, as before GC12 */
23
+ readonly feet?: () => { readonly x: number; readonly z: number };
24
+ }
25
+ /** GC12: how near a closed edge the feet must stand for its wall to show (a player at the wall, a stride or two short of it). */
26
+ export const MEET_METRES = 6;
27
+ /** Distance from the feet to an edge's wall segment, in the home frame. */
28
+ export function edgeDistance(edge: SoftWallEdge, feet: { readonly x: number; readonly z: number }): number {
29
+ const dx = feet.x - edge.x, dz = feet.z - edge.z;
30
+ const across = edge.axis === 'x' ? dx : dz, along = edge.axis === 'x' ? dz : dx;
31
+ return Math.hypot(across, Math.max(0, Math.abs(along) - edge.halfLength));
18
32
  }
19
- /** The readout: how many neighbour edges are closed. */
20
- export interface SoftWallState { readonly closed: number }
33
+ /** The readout: how many neighbour edges are closed, and how many of those show (GC12: the ones the traveller meets). */
34
+ export interface SoftWallState { readonly closed: number; readonly shown: number }
21
35
 
22
36
  const HEIGHT = 7, CYAN = new Color(0x38e6ff);
23
37
 
@@ -99,18 +113,21 @@ export function installSoftWallLook(input: { readonly edges: readonly SoftWallEd
99
113
  const closedAttr = wall.geometry.getAttribute('aClosed');
100
114
  group.add(wall); scene.add(group);
101
115
  const flags = edges.map(() => -1);
102
- let closedCount = 0;
116
+ let closedCount = 0, shownCount = 0;
103
117
  const step = (): void => {
104
118
  uTime.value = input.time();
105
- closedCount = 0;
119
+ closedCount = 0; shownCount = 0;
120
+ const feet = ports.feet?.();
106
121
  for (let k = 0; k < edges.length; k++) {
107
122
  const edge = edges[k];
108
123
  if (edge === undefined) continue;
109
- const closed = ports.closed(edge.instance) ? 1 : 0;
110
- if (closed === 1) closedCount++;
111
- if (flags[k] !== closed) { flags[k] = closed; for (let c = 0; c < 4; c++) closedAttr.setX(k * 4 + c, closed); closedAttr.needsUpdate = true; }
124
+ const closed = ports.closed(edge.instance);
125
+ if (closed) closedCount++;
126
+ const shown = closed && (feet === undefined || edgeDistance(edge, feet) <= MEET_METRES) ? 1 : 0;
127
+ shownCount += shown;
128
+ if (flags[k] !== shown) { flags[k] = shown; for (let c = 0; c < 4; c++) closedAttr.setX(k * 4 + c, shown); closedAttr.needsUpdate = true; }
112
129
  }
113
130
  };
114
131
  scope.onDispose(() => { group.removeFromParent(); wall.geometry.dispose(); material.dispose(); });
115
- return { step, state: () => ({ closed: closedCount }) };
132
+ return { step, state: () => ({ closed: closedCount, shown: shownCount }) };
116
133
  }
@@ -40,6 +40,10 @@ const LOW_POWER_BANNER = 'Low Power Mode is on, so you\'re on Low graphics. Turn
40
40
  export const MAIN_MENU_HERO: string = titleAssetURL('/assets/title/main-crossroads-landscape.jpg');
41
41
  /** Square title artwork shared by the menu deck. */
42
42
  export const MAIN_MENU_SQUARE_HERO: string = titleAssetURL('/assets/title/main-crossroads-square.jpg');
43
+ /** PZ19: the shell's ~30 kB first cuts of both heroes; the menu layers the full image over its first cut, so the art never
44
+ * blanks while the full image arrives, and the full image is fetched only once the title is up. */
45
+ const FIRST_HERO: string = titleAssetURL('/assets/title/main-crossroads-landscape-first.jpg');
46
+ const FIRST_SQUARE_HERO: string = titleAssetURL('/assets/title/main-crossroads-square-first.jpg');
43
47
 
44
48
  const CARDS_ICON = '<svg viewBox="0 0 64 48" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"><rect x="6" y="11" width="18" height="27" rx="2" transform="rotate(-16 15 24)"/><rect x="40" y="11" width="18" height="27" rx="2" transform="rotate(16 49 24)"/><rect x="22" y="4" width="20" height="31" rx="2" fill="rgba(6,10,18,0.85)"/></g></svg>';
45
49
  const GRID_CELLS = [0, 1, 2].flatMap((r) => [0, 1, 2].map((c) => `<rect x="${17 + c * 11}" y="${6 + r * 13}" width="8" height="9" rx="1"/>`)).join('');
@@ -125,8 +129,8 @@ export function buildTitleMenu(opts: TitleMenuOptions): TitleMenu {
125
129
  ${online ? `<div class="ws-main-row"><button class="ws-main-settings ws-main-doctor" type="button"><i class="ws-main-doctor-dot" aria-hidden="true"></i>${s.checkConnection}</button></div>` : ''}
126
130
  </div>`;
127
131
  const hero = required(main, '.ws-main-hero', HTMLElement);
128
- hero.style.setProperty('--ws-hero-landscape', `url('${MAIN_MENU_HERO}')`);
129
- hero.style.setProperty('--ws-hero-square', `url('${MAIN_MENU_SQUARE_HERO}')`);
132
+ hero.style.setProperty('--ws-hero-landscape', `url('${MAIN_MENU_HERO}'), url('${FIRST_HERO}')`);
133
+ hero.style.setProperty('--ws-hero-square', `url('${MAIN_MENU_SQUARE_HERO}'), url('${FIRST_SQUARE_HERO}')`);
130
134
  if (notice !== undefined && notice !== '') {
131
135
  const line = document.createElement('div');
132
136
  line.className = 'ws-main-notice';
@@ -19,6 +19,7 @@ import type { Shardfile } from '@wildshard/format/shardSchema';
19
19
  import { ownedPresentationImages } from '../shardfile/presentation';
20
20
  import { lookLightManifest } from '@wildshard/engine/render/lookLight';
21
21
  import { lookLightOn } from '@wildshard/engine/ui/lookLightOption';
22
+ import { TIER } from '@wildshard/engine/core/tier';
22
23
  import { absentShardProduct, type ShardProduct } from '../../../shared/game/shardfile/shardProduct';
23
24
 
24
25
 
@@ -163,7 +164,7 @@ export function sourceManifest(source: Pick<Shardfile, 'identity' | 'accent' | '
163
164
  const slug = parseShardSlug(source.identity.slug);
164
165
  const images = imageOwner === undefined ? undefined : ownedPresentationImages(source, assets, imageOwner);
165
166
  // LF1-4: the look's light settings (height fog, bloom, desktop AO) behind Settings ▸ Debug ▸ Look ▸ "Look light"
166
- const light = lookLightManifest(source.look, lookLightOn());
167
+ const light = lookLightManifest(source.look, lookLightOn(), TIER);
167
168
  const card = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/%3E';
168
169
  return {
169
170
  ...(source.navigation === null || source.navigation === undefined || navigation === undefined ? {} : { navigation: { row: source.navigation, bytes: navigation } }),
@@ -179,6 +179,12 @@ export function installFollowedMovers(ctx: LevelContext, world: World, options:
179
179
  ctx.scope.onDispose(() => { if (movers.riding()) world.player.carried = false; });
180
180
  if (options.onDispose !== undefined) ctx.scope.onDispose(options.onDispose);
181
181
  ctx.debug.expose(`movers.${options.systemId}`, { showRest: () => { movers.showRest(); } }); // the map bake poses movers at rest
182
- for (const row of options.data) wirePage.movers.set(row.id, { pose: pose => { wirePage.posed++; movers.follow(row.id, pose); }, place: (at, next) => { movers.replayPose(row.id, at, next); } });
182
+ // GC30b: the scope frees these movers' bodies, so their views leave the wire with it, or the next row of that id poses a freed
183
+ // body ("null pointer passed to rust"). Only this cell's own view: another cell may have lent one under the same id since.
184
+ for (const row of options.data) {
185
+ const view: MoverView = { pose: pose => { wirePage.posed++; movers.follow(row.id, pose); }, place: (at, next) => { movers.replayPose(row.id, at, next); } };
186
+ wirePage.movers.set(row.id, view);
187
+ ctx.scope.onDispose(() => { if (wirePage.movers.get(row.id) === view) wirePage.movers.delete(row.id); });
188
+ }
183
189
  return movers;
184
190
  }
@@ -84,6 +84,8 @@ export function questFigure(row: QuestFigureRows, ports: QuestFigurePorts): KitF
84
84
  const figure = new KitFigure(ports.sky, row.kit, ports.catalogue.rows(row.kit), ports.catalogue.kit(row.kit),
85
85
  { geometry, objects, channels: ports.channels }, ports.resources, ports.scope);
86
86
  figure.group.position.set(feet.x, feet.y, feet.z); figure.group.rotation.y = yaw;
87
+ // its body box was read at the origin, before the figure stood at its feet
88
+ figure.presentation.syncAnchors();
87
89
  return figure;
88
90
  }
89
91
 
@@ -1,6 +1,7 @@
1
1
  import type { BuiltWorld } from './context';
2
2
  import { bootMark, bootTask } from '@wildshard/engine/boot/timing';
3
3
  import { diagnosticNow } from '@wildshard/engine/core/clock';
4
+ import { captureHeightfield } from '@wildshard/engine/world/Heightfield';
4
5
  import { sustainedFrames } from '@wildshard/engine/core/sustainedFrames';
5
6
  import { Rng } from '@wildshard/engine/core/rng';
6
7
  import { gridCells } from '../plugin/context';
@@ -397,6 +398,14 @@ export async function finishStage(ctx: Awaited<ReturnType<typeof playStage>>): P
397
398
  installProbe(handle, { leakPhysics, health: () => playerHealth.attributes.health, quest: () => ({ adventure: boot.runtime.hooks.adventureFlags?.() ?? [], quest: boot.runtime.hooks.questFlags?.() ?? [] }),
398
399
  // T2E-1b: a grid page's area is the cell the player is in, not the shell
399
400
  area: () => grid === null ? shardArea(slug, app.debug.snapshot()['shardfile'], boot.runtime.hooks.questFlags?.() ?? []) : grid.area() });
401
+ // SHARD-SOURCE AP5 (J347): a DEVSERVER page carries the dev hook sharddev's `watch` page script drives; a production
402
+ // build's define makes this `false` in this module, so the import and its chunk go (scripts/check-devserver.mjs checks;
403
+ // DEVSERVER imported from grid/menu did not fold across modules and kept the chunk).
404
+ if (typeof __DEVSERVER__ === 'boolean' && __DEVSERVER__) void import('../devScene/hook').then(dev => dev.installDevHook({ scope: game.levelScope, scene: game.rootScene, physics: () => world.physics,
405
+ look: () => game.look, server: () => window.__workerClientDevColliders ?? null, serverGround: () => window.__workerClientDevGround ?? null,
406
+ restart: () => window.__workerClientDevRestart ?? null, quests: () => window.__shardfileDevQuests ?? null,
407
+ player: () => world.player, terrainField: captureHeightfield, watchFrames: fn => game.watchFrames(fn) }))
408
+ .catch((cause: unknown) => { console.error('[devScene]', cause); });
400
409
  ctx.startExplore?.();
401
410
  document.dispatchEvent(new Event('ws:ready')); // booted to the title
402
411
  const completeOfflineCopy = async (): Promise<void> => {
@@ -1,4 +1,4 @@
1
- import { ASSET_CACHE_NAME } from '@wildshard/engine/pwa/cacheNames';
1
+ import { assetCacheName } from '@wildshard/engine/pwa/cacheNames';
2
2
  import { readContentResponse } from '@wildshard/engine/boot/readContentResponse';
3
3
 
4
4
  type ReadStorage = Pick<CacheStorage, 'open'> & Partial<Pick<CacheStorage, 'match'>>;
@@ -7,9 +7,9 @@ type ReadStorage = Pick<CacheStorage, 'open'> & Partial<Pick<CacheStorage, 'matc
7
7
  async function matchAsset(storage: ReadStorage, url: string): Promise<Response | undefined> {
8
8
  try {
9
9
  const match = storage.match;
10
- if (match !== undefined) return await match.call(storage, url, { cacheName: ASSET_CACHE_NAME, ignoreVary: true });
10
+ if (match !== undefined) return await match.call(storage, url, { cacheName: assetCacheName(), ignoreVary: true });
11
11
  } catch { /* The existing read port may still be available. */ }
12
- return (await storage.open(ASSET_CACHE_NAME)).match(url, { ignoreVary: true });
12
+ return (await storage.open(assetCacheName())).match(url, { ignoreVary: true });
13
13
  }
14
14
 
15
15
  /** Shared service-worker URL storage, without a page index, queue or leases. */
@@ -38,7 +38,7 @@ export async function cacheAsset(storage: Pick<CacheStorage, 'open'>, url: strin
38
38
  const type = path.endsWith('.wasm') ? 'application/wasm' : path.endsWith('.json') ? 'application/json'
39
39
  : path.endsWith('.glb') ? 'model/gltf-binary' : path.endsWith('.ktx2') ? 'image/ktx2' : 'application/octet-stream';
40
40
  try {
41
- await (await storage.open(ASSET_CACHE_NAME)).put(url, new Response(Uint8Array.from(bytes), {
41
+ await (await storage.open(assetCacheName())).put(url, new Response(Uint8Array.from(bytes), {
42
42
  headers: { 'content-type': type, 'content-length': String(bytes.length) },
43
43
  }));
44
44
  return true;
@@ -2,6 +2,7 @@ import {readModuleGroups} from '@wildshard/engine/boot/download';
2
2
  import { whenControl } from '@wildshard/engine/boot/prefetch';
3
3
  import type * as ScriptPresentation from '../plugin/ui';
4
4
  import type { Scope } from '@wildshard/engine/app/scope';
5
+ import type { SystemSpec } from '@wildshard/engine/app/systems';
5
6
  import type * as LootPresentation from '../loot/runtime';
6
7
  import type * as CompendiumPresentation from '../compendium/install';
7
8
 
@@ -285,7 +286,10 @@ export class ShardfileClient {
285
286
  worldStep(ctx, 'item models');
286
287
  this.skins = await loadClientSkins(this.source, this.assets.retained, presentation.compile, ctx.scope);
287
288
  worldStep(ctx, 'skins');
288
- installClientWater(undrawnWater(this.source.water, this.plan?.features ?? []), { root: ctx.root, scope: ctx.scope, materials: presentation.materials, outline: presentation.outline });
289
+ // M4.6: a planar pool's ripples run on the game clock
290
+ const waterClocks: ((dt: number) => void)[] = [];
291
+ installClientWater(undrawnWater(this.source.water, this.plan?.features ?? []), { root: ctx.root, scope: ctx.scope, materials: presentation.materials, outline: presentation.outline, frame: (run) => { waterClocks.push(run); } });
292
+ if (waterClocks.length > 0) ctx.system({ id: 'game.shardfile.water', phase: 'update', run: (dt) => { for (const run of waterClocks) run(dt); } });
289
293
  const nativeWorld = this.nativeFeatures || this.mode === 'presentation';
290
294
  const start = nativeWorld ? ctx.manifest.spawn : this.source.spawn;
291
295
  const collider = nativeWorld && this.source.terrain !== null ? await this.assets.read(this.source.terrain.collider) : undefined;
@@ -607,13 +611,29 @@ export class ShardfileClient {
607
611
  player: () => world.player.position });
608
612
  ctx.debug.expose('shardfileTalks', { talks: () => talks.map(talk => ({ id: talk.id, node: talk.node() ?? null, open: box?.isOpen ?? false })) });
609
613
  }
610
- for (const declaration of source.quests.quests) {
611
- const quest = new QuestState(declaration, flags, ctx.app.events, ctx.scope);
612
- const options = declaration.track === false ? { chip: () => ({ label: '', count: '' }) } : {};
613
- // a retained (grid) runtime's chip, pins and card are its entered cell's only
614
- if (presentation === null) throw new Error('Missing quest presentation module');
615
- if (retainsRuntimeServices(ctx)) presentation.installEnteredQuestPresentation(ctx, quest, options); else presentation.installQuestPresentation(ctx, quest, options);
616
- }
614
+ const installQuests = (quests: Shardfile['quests'], at: ShardContext, ui: typeof presentation): void => {
615
+ for (const declaration of quests.quests) {
616
+ const quest = new QuestState(declaration, flags, ctx.app.events, at.scope);
617
+ const options = declaration.track === false ? { chip: () => ({ label: '', count: '' }) } : {};
618
+ // a retained (grid) runtime's chip, pins and card are its entered cell's only
619
+ if (ui === null) throw new Error('Missing quest presentation module');
620
+ if (retainsRuntimeServices(ctx)) ui.installEnteredQuestPresentation(at, quest, options); else ui.installQuestPresentation(at, quest, options);
621
+ }
622
+ };
623
+ // SHARD-SOURCE AP19 (DEVSERVER): `wildshard watch`'s soft restart rebuilds the quest views from a new quest section, so on a
624
+ // watched (one-shard) page they live in one child scope it replaces; elsewhere they are the context's, as they always were.
625
+ if (typeof __DEVSERVER__ === 'boolean' && __DEVSERVER__ && !retainsRuntimeServices(ctx) && typeof window !== 'undefined') {
626
+ const views = (scope: Scope): ShardContext => Object.create(ctx, { scope: { value: scope }, system: { value: (spec: SystemSpec) => { ctx.app.addSystem(spec, scope); } } }) as ShardContext;
627
+ let held = ctx.scope.child('shardfile.quests');
628
+ installQuests(source.quests, views(held), presentation);
629
+ ctx.scope.expose(window, '__shardfileDevQuests', async (quests: Shardfile['quests']): Promise<boolean> => {
630
+ const ui = presentation ?? await import('../plugin/ui');
631
+ if (ctx.scope.disposed) return false;
632
+ // the old views go first: a quest's system keeps its id across the swap
633
+ held.dispose(); held = ctx.scope.child('shardfile.quests');
634
+ try { installQuests(quests, views(held), ui); return true; } catch (cause) { console.error('[devScene] quest views', cause); return false; }
635
+ });
636
+ } else installQuests(source.quests, ctx, presentation);
617
637
  if (ctx.product.has('ui/completion') && ctx.product.section('ui/completion').trigger === 'quest') installCompletion(ctx, flags, play.progress);
618
638
  runtime.hooks.questFlags = () => flags.all; runtime.hooks.adventureFlags = () => flags.all;
619
639
  // An admitted scene installs its own declared profiles once in the play phase.
@@ -4,9 +4,12 @@ import { memoryAttribution } from '@wildshard/engine/core/memoryAttribution';
4
4
 
5
5
  import { boundedResponse, type ProductOptions } from './product';
6
6
  import { outputBlobUrl, outputDescriptor } from '../../../shared/game/shardfile/outputDescriptor';
7
- import { readPackWhole, releasePackWholes } from '../../../shared/game/shardfile/packReads';
7
+ import { packMissing, packOrLoose, readPackWhole, releasePackWholes } from '../../../shared/game/shardfile/packReads';
8
8
  import type { Shardfile } from '@wildshard/format/shardSchema';
9
9
 
10
+ /** PZ7: the marker for "read this member loose" */
11
+ const LOOSE = new Uint8Array(0);
12
+
10
13
  /** Release admitted transport copies after decoding; revisiting a tile rechecks immutable bytes from cache or the product. */
11
14
  export class ClientAssets {
12
15
  private readonly wire: Map<string, Uint8Array>;
@@ -105,9 +108,10 @@ export class ClientAssets {
105
108
  const packs = outputDescriptor(this.source)?.index.packs;
106
109
  const pack = packs?.find(row => row.entries.some(entry => entry.hash === ref));
107
110
  const member = pack?.entries.find(entry => entry.hash === ref);
108
- if (packs === undefined || pack === undefined || member === undefined) return undefined;
111
+ if (packs === undefined || pack === undefined || member === undefined || packMissing(pack)) return undefined;
109
112
  if (member.bytes !== cap) throw new Error('Resident packed member size mismatch');
110
- const wire = await readPackWhole(packs, pack, async (path, maximum) => {
113
+ // PZ7: a pack that is not published (or fails) leaves the member to its loose blob (an abort still throws)
114
+ const wire = await packOrLoose(() => readPackWhole(packs, pack, async (path, maximum) => {
111
115
 
112
116
  const fetch = priority === 'low' ? this.options.backgroundFetch ?? this.options.fetch : this.options.fetch;
113
117
  const response = await fetch(new URL(path, this.options.base).href);
@@ -115,8 +119,8 @@ export class ClientAssets {
115
119
  const bytes = await boundedResponse(response, maximum);
116
120
 
117
121
  return this.observe(pack.hash, bytes);
118
- }, bytes => this.hashOf(bytes), this.options.hash);
119
- return wire.slice(member.offset, member.offset + member.bytes);
122
+ }, bytes => this.hashOf(bytes), this.options.hash), () => Promise.resolve(LOOSE));
123
+ return wire === LOOSE ? undefined : wire.slice(member.offset, member.offset + member.bytes);
120
124
  }
121
125
 
122
126
  /** SHA-256 of `bytes` off the page (an owned copy through `hashOwned`), else on the page. */