@wildshard/engine 0.1.19 → 0.1.21

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 (125) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lint/engine-sides.json +5 -0
  3. package/package.json +5 -2
  4. package/scripts/app-build/gen.ts +11 -0
  5. package/scripts/cell-mem-bench.mjs +2 -0
  6. package/scripts/chaos-proxy-core.mjs +14 -1
  7. package/scripts/chaos-proxy-proof.mjs +22 -0
  8. package/scripts/check-devserver.mjs +1 -1
  9. package/scripts/failmode-cases.d.mts +8 -0
  10. package/scripts/failmode-cases.mjs +97 -0
  11. package/scripts/failmode-proof.mjs +532 -0
  12. package/scripts/grid-crossing-nightly.mjs +5 -4
  13. package/scripts/grid-crossing-report.mjs +5 -2
  14. package/scripts/grid-crossing-tour.mjs +36 -12
  15. package/scripts/grid-crossing-walk-proof.mjs +4 -2
  16. package/scripts/hover-speed-probe.mjs +136 -0
  17. package/scripts/land.mjs +2 -1
  18. package/scripts/loading-flow/benchmax.mjs +34 -11
  19. package/scripts/loading-flow/deskbench.mjs +276 -0
  20. package/scripts/loading-flow/stalls.d.mts +17 -3
  21. package/scripts/loading-flow/stalls.mjs +82 -3
  22. package/scripts/net-lag-proof.mjs +3 -2
  23. package/scripts/nightly-model.ts +9 -6
  24. package/scripts/offline-proof.mjs +7 -1
  25. package/scripts/online-rig.mjs +9 -7
  26. package/scripts/parity/boot-smoke.mjs +13 -2
  27. package/scripts/pin-format.ts +5 -2
  28. package/scripts/pins-reuse.d.mts +1 -0
  29. package/scripts/pins-reuse.mjs +22 -0
  30. package/scripts/release-cook.mjs +109 -0
  31. package/scripts/scratch-dir.mjs +95 -0
  32. package/scripts/scratch-sweep.mjs +182 -0
  33. package/scripts/tsconfig.json +2 -12
  34. package/scripts/vps/harden-prometheus.sh +3 -0
  35. package/scripts/vps/rebuild.sh +35 -9
  36. package/scripts/vps/wildshard-apply.mjs +5 -1
  37. package/scripts/vps/wildshard-config +117 -1
  38. package/scripts/worktree-reap.mjs +54 -8
  39. package/scripts/worktree.mjs +19 -5
  40. package/src/client/engine/anim/rigParser.ts +2 -2
  41. package/src/client/engine/boot/contentRead.ts +54 -5
  42. package/src/client/engine/boot/gpuFiles.ts +3 -3
  43. package/src/client/engine/boot/leaveAfterPaint.ts +4 -1
  44. package/src/client/engine/core/Game.ts +63 -19
  45. package/src/client/engine/core/gpuOnly.ts +10 -0
  46. package/src/client/engine/core/renderBudget.ts +134 -0
  47. package/src/client/engine/core/shadowLayer.ts +18 -0
  48. package/src/client/engine/explore/pick.ts +13 -1
  49. package/src/client/engine/net/predictor.ts +12 -4
  50. package/src/client/engine/net/redial.ts +40 -5
  51. package/src/client/engine/player/TouchControls.ts +3 -2
  52. package/src/client/engine/render/dataLook.ts +70 -7
  53. package/src/client/engine/render/families/pbr.ts +2 -0
  54. package/src/client/engine/render/families/registry.ts +11 -2
  55. package/src/client/engine/render/families/sceneSurface.ts +118 -0
  56. package/src/client/engine/render/look.ts +7 -1
  57. package/src/client/engine/render/precompile.ts +4 -2
  58. package/src/client/engine/render/tiers.ts +4 -1
  59. package/src/client/engine/telemetry/browserErrors.ts +3 -1
  60. package/src/client/engine/ui/ErrorModal.ts +1 -1
  61. package/src/client/engine/ui/Loading.ts +14 -2
  62. package/src/client/engine/ui/errorScreen.ts +51 -9
  63. package/src/client/engine/ui/hoverBoost.ts +31 -4
  64. package/src/client/engine/ui/styles/touch.css +6 -0
  65. package/src/client/engine/world/declaredProps.ts +5 -1
  66. package/src/client/engine/world/skyRig.ts +4 -1
  67. package/src/client/engine/world/terrainTileView.ts +64 -23
  68. package/src/client/game/boot/spawnDownload.ts +44 -6
  69. package/src/client/game/devScene/hook.ts +149 -12
  70. package/src/client/game/devScene/liveLook.ts +21 -0
  71. package/src/client/game/grid/live.ts +47 -10
  72. package/src/client/game/grid/liveSession.ts +25 -6
  73. package/src/client/game/grid/pageEntry.ts +12 -1
  74. package/src/client/game/grid/productInputs.ts +22 -11
  75. package/src/client/game/grid/session.ts +15 -4
  76. package/src/client/game/grid/shardfileFar.ts +13 -2
  77. package/src/client/game/session/finish.ts +4 -1
  78. package/src/client/game/shardfile/client.ts +24 -7
  79. package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
  80. package/src/client/game/shardfile/clientSource.ts +7 -3
  81. package/src/client/game/shardfile/clientViews.ts +36 -8
  82. package/src/client/game/shardfile/clientWorker.ts +4 -4
  83. package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
  84. package/src/client/game/shardfile/groundMerge.ts +59 -5
  85. package/src/client/game/shardfile/hybrid.ts +2 -0
  86. package/src/client/game/shardfile/look.ts +1 -1
  87. package/src/client/game/shardfile/slabLibrary.ts +115 -49
  88. package/src/client/game/shardfile/tileContent.ts +1 -1
  89. package/src/client/game/shardfile/tileDriver.ts +38 -11
  90. package/src/client/game/shardfile/wirePage.ts +7 -3
  91. package/src/client/game/shardfile/worldScenes.ts +17 -10
  92. package/src/client/host/online/doctor.ts +20 -7
  93. package/src/client/host/online/doctorView.ts +2 -0
  94. package/src/client/host/online/linkScreens.ts +95 -11
  95. package/src/client/host/online/reconnectStrip.ts +3 -2
  96. package/src/client/host/online/release.ts +87 -16
  97. package/src/client/host/online/releaseScreens.ts +108 -0
  98. package/src/client/host/online/shell.ts +24 -5
  99. package/src/client/host/online/voice.ts +45 -1
  100. package/src/client/host/online/voiceUi.ts +24 -6
  101. package/src/client/host/standalone/shell.ts +37 -1
  102. package/src/server/engine/sim/playerSim.ts +1 -1
  103. package/src/server/game/grid/simulation.ts +12 -6
  104. package/src/server/game/quest/eliteDrops.ts +7 -3
  105. package/src/server/game/riding/nativeTaming.ts +13 -2
  106. package/src/server/host/dedicated/cellHost.ts +21 -2
  107. package/src/server/host/dedicated/cellProtocol.ts +2 -0
  108. package/src/server/host/dedicated/cellWorker.ts +1 -1
  109. package/src/server/host/dedicated/dedicatedRoom.ts +38 -8
  110. package/src/server/host/dedicated/roadRoom.ts +3 -0
  111. package/src/server/host/dedicated/serverMetrics.ts +9 -0
  112. package/src/server/host/dedicated/workerTable.ts +31 -24
  113. package/src/server/host/standalone/gridServer.ts +1 -1
  114. package/src/server/host/standalone/serverHost.ts +56 -10
  115. package/src/server/host/standalone/serverProduct.ts +9 -7
  116. package/src/server/host/standalone/serverRuntime.ts +1 -1
  117. package/src/shared/engine/boot/loadingWaits.ts +10 -2
  118. package/src/shared/engine/core/config.ts +3 -0
  119. package/src/shared/engine/core/framePacing.ts +12 -1
  120. package/src/shared/engine/physics/terrainTiles.ts +20 -4
  121. package/src/shared/engine/player/hoverSpeed.ts +3 -3
  122. package/src/shared/engine/strings.ts +12 -1
  123. package/src/shared/game/devColliders.ts +60 -0
  124. package/src/shared/game/devGameplay.ts +41 -0
  125. package/src/shared/game/grid/rules.ts +12 -0
@@ -12,13 +12,14 @@ import * as THREE from 'three';
12
12
  import type { PaintedNumbers } from '@wildshard/format/paintedLook';
13
13
  import { BlendFunction, Effect, LookupTexture, ToneMappingMode } from 'postprocessing';
14
14
  import { DEFAULT_NORMALIZED_DAY, normalizedDayClock, DayCycle } from '../../../shared/engine/world/dayCycle';
15
- import type { LookStrategy, SkyBackdropTargets, TerrainPainter } from './look';
15
+ import type { EngineEffects, LookStrategy, SkyBackdropTargets, TerrainPainter } from './look';
16
16
  import { LUT_SIZE, fetchLut } from './lut';
17
17
  import { PATCH_ORDER, patchShader, setInheritedPatch, type ShaderSource } from './shaderPatches';
18
18
  import { Scope } from '../../../shared/engine/app/scope';
19
19
  import { curveAt, type Curve } from '@wildshard/format/materials';
20
- import type { GraphIr } from '@wildshard/format/materialGraph';
20
+ import type { GraphBudget, GraphIr } from '@wildshard/format/materialGraph';
21
21
  import { loadLookGraphCompiler } from './graphBackend';
22
+ import { LOOK_SKY_BUDGET } from '@wildshard/format/look-sky';
22
23
  import { EmissiveLook } from './families/emissive';
23
24
  import { familyMaterial } from './families/registry';
24
25
  import { ToonLook } from './families/toon';
@@ -77,6 +78,13 @@ export interface DataLookSpec {
77
78
  readonly exposure?: number;
78
79
  readonly vignette?: LookVignette | null;
79
80
  readonly bloomRadius?: number | null;
81
+ /**
82
+ * SHARD-SOURCE AP14 (`look.sky`): the dome's painted sky, an unlit material graph over the dome's direction
83
+ * (`normalize(positionLocal)`), compiled on the page's renderer with the backdrop in place of the gradient. The
84
+ * environment (`light.environment`) is filtered from the same dome, so reflections show the painted sky. Absent or
85
+ * null: the gradient of the keys' zenith and horizon.
86
+ */
87
+ readonly sky?: GraphIr | null;
80
88
  }
81
89
 
82
90
  /** A sampled look: plain numbers, blended between the two keys around a time of day. */
@@ -118,13 +126,23 @@ export function sampleLook(keys: readonly LookKey[], time: number, out: LookSamp
118
126
  return out;
119
127
  }
120
128
 
129
+
130
+ /**
131
+ * SHARD-SOURCE AP17: what a data look takes in place (`LookStrategy.liveLook`, driven by `wildshard watch` through engine's
132
+ * dev hook v2): its spec as a fresh build would read it, plus the engine bloom's intensity and threshold (the level grade's
133
+ * at boot). The keys, the sun's arc, exposure, tone, vignette and bloom go live; the light rows and the LUT must not change.
134
+ */
135
+ export interface LiveLook extends Omit<DataLookSpec, 'lut'> {
136
+ readonly lut: string | null;
137
+ readonly bloom: { readonly intensity: number; readonly threshold: number; readonly radius: number | null };
138
+ }
121
139
  /** The engine clock for a data look (an hour clock with one day-long segment, the sun on the day's arc). */
122
140
  export function dataLookClock(day: LookDay, dayOverride: number | null): DayCycle {
123
141
  return normalizedDayClock(day, dayOverride);
124
142
  }
125
143
 
126
144
  /** The engine's gradient dome: radius 600 m, drawn first, unfogged, kept on the camera by Game (the backdrop's `clouds`). */
127
- function gradientDome(): { dome: THREE.Mesh<THREE.SphereGeometry, THREE.ShaderMaterial>; zenith: THREE.Color; horizon: THREE.Color } {
145
+ function gradientDome(): { dome: THREE.Mesh<THREE.SphereGeometry, THREE.Material>; zenith: THREE.Color; horizon: THREE.Color } {
128
146
  const zenith = new THREE.Color(), horizon = new THREE.Color();
129
147
  const material = new THREE.ShaderMaterial({ side: THREE.BackSide, depthWrite: false, fog: false,
130
148
  uniforms: { uZenith: { value: zenith }, uHorizon: { value: horizon } },
@@ -136,6 +154,18 @@ function gradientDome(): { dome: THREE.Mesh<THREE.SphereGeometry, THREE.ShaderMa
136
154
  return { dome, zenith, horizon };
137
155
  }
138
156
 
157
+ /**
158
+ * AP14: a look's painted sky on the dome: its graph compiled (by `compile`, the page's look-graph compiler) as an unlit
159
+ * material drawn on the inside of the sphere, first, unfogged and writing no depth, as the gradient's material is (the
160
+ * old material is freed).
161
+ */
162
+ export function paintDome(dome: THREE.Mesh<THREE.SphereGeometry, THREE.Material>, sky: GraphIr, compile: (ir: GraphIr, opts: { readonly budget: GraphBudget }) => { readonly material: THREE.Material }): void {
163
+ const { material } = compile(sky, { budget: LOOK_SKY_BUDGET });
164
+ material.side = THREE.BackSide; material.depthWrite = false; material.name = 'engine.look.sky';
165
+ if ('fog' in material) material.fog = false;
166
+ dome.material.dispose(); dome.material = material;
167
+ }
168
+
139
169
  async function lutTexture(url: string | Uint8Array | null): Promise<LookupTexture | null> {
140
170
  if (url === null) return null;
141
171
  const data = typeof url === 'string' ? await fetchLut(url) : Uint8Array.from(url);
@@ -239,9 +269,15 @@ ${mist ? `
239
269
  #endif`);
240
270
  shader.fragmentShader = `#ifdef USE_FOG\nuniform float wsLookFogNear; uniform float wsLookFogFar; uniform float wsLookFogEnabled;\n#endif\n${patched}`;
241
271
  };
242
- const owned: { dome: THREE.Mesh<THREE.SphereGeometry, THREE.ShaderMaterial> | null; lut: LookupTexture | null; pools: THREE.Object3D | null; rim: boolean;
272
+ const owned: { dome: THREE.Mesh<THREE.SphereGeometry, THREE.Material> | null; lut: LookupTexture | null; pools: THREE.Object3D | null; rim: boolean;
243
273
  lamps: ReturnType<typeof lampLights> | null; bounce: ReturnType<typeof bounceLight> | null; environment: THREE.WebGLRenderTarget | null;
244
- glow: THREE.Object3D[] | null } = { dome: null, lut: null, pools: null, rim: false, lamps: null, bounce: null, environment: null, glow: null };
274
+ glow: THREE.Object3D[] | null; fx: EngineEffects | null; exposure: ExposureEffect | null; clock: DayCycle | null;
275
+ chain: { vignette: { offset: number; darkness: number }; radius: number } | null } = { dome: null, lut: null, pools: null, rim: false, lamps: null, bounce: null, environment: null, glow: null,
276
+ fx: null, exposure: null, clock: null, chain: null };
277
+ // AP17: what `liveLook` last set (the light rows and the LUT are compared with the build's, never set)
278
+ let day = spec.day, dayOverride = spec.dayOverride;
279
+ const fixedOf = (light: DataLookSpec['light'], lut: unknown): string => JSON.stringify({ light: light ?? null, lut: typeof lut === 'string' || lut === null ? lut : 'bytes' });
280
+ const fixed = fixedOf(spec.light, spec.lut);
245
281
  const shadow = spec.light?.shadow ?? null;
246
282
  const bounceRow = spec.light?.bounce ?? null;
247
283
  // the bounce exists from the backdrop on (it follows the clock's sun there); compose adds it to the scene
@@ -254,6 +290,27 @@ ${mist ? `
254
290
  keys = next;
255
291
  return true;
256
292
  },
293
+ liveLook: (next) => {
294
+ const { fx, clock, chain } = owned;
295
+ // check everything first: a refusal changes nothing
296
+ if (fx === null || clock === null || chain === null) return false;
297
+ if (next.keys.length === 0 || next.keys.some((key) => (key.fog.near !== undefined) !== linear)) return false;
298
+ // the light rows and the LUT are built once; an exposure on a chain built without one, a new day length or a new fixed
299
+ // time of day each need a new look
300
+ if (fixedOf(next.light, next.lut) !== fixed || ((next.exposure ?? 0) !== 0 && owned.exposure === null)) return false;
301
+ if (next.day.minutes !== day.minutes || next.dayOverride !== dayOverride) return false;
302
+ keys = next.keys; day = next.day; dayOverride = next.dayOverride;
303
+ Object.assign(clock.spec.sun as { maxElevation: number; azimuthOffset: number }, { maxElevation: next.day.maxElevation, azimuthOffset: next.day.azimuth });
304
+ const exposure = owned.exposure?.uniforms.get('uExposure');
305
+ if (exposure !== undefined) exposure.value = 2 ** (next.exposure ?? 0);
306
+ const tone = next.aces === true ? ToneMappingMode.ACES_FILMIC : next.neutral === true ? ToneMappingMode.NEUTRAL : ToneMappingMode.AGX;
307
+ if (fx.tone.mode !== tone) fx.tone.mode = tone;
308
+ const vignette = next.vignette ?? chain.vignette;
309
+ fx.vignette.offset = vignette.offset; fx.vignette.darkness = vignette.darkness;
310
+ fx.bloom.intensity = next.bloom.intensity; fx.bloom.luminanceMaterial.threshold = next.bloom.threshold;
311
+ fx.bloom.mipmapBlurPass.radius = next.bloom.radius ?? next.bloomRadius ?? chain.radius;
312
+ return true;
313
+ },
257
314
  // the sky builds before the composer: the level scope takes the dome and the LUT here
258
315
  mode: 'extend', chain: 'clean', compose: ({ engineChain, scene, scope, fx, renderer }) => {
259
316
  const rim = spec.light?.rim ?? null, pools = spec.light?.pools ?? null, lamps = spec.light?.lamps ?? null;
@@ -328,6 +385,9 @@ ${mist ? `
328
385
  if (dome !== null) { scope.own(dome.geometry); scope.own(dome.material); scope.onDispose(() => { dome.removeFromParent(); }); }
329
386
  if (lut !== null) scope.own(lut);
330
387
  const chain = engineChain('clean');
388
+ // AP17: the chain as the engine built it, before this look's own vignette and bloom spread, for `liveLook`
389
+ owned.fx = fx; owned.chain = { vignette: { offset: fx.vignette.offset, darkness: fx.vignette.darkness }, radius: fx.bloom.mipmapBlurPass.radius };
390
+ scope.onDispose(() => { if (owned.fx === fx) { owned.fx = null; owned.chain = null; owned.exposure = null; } });
331
391
  // B2: the Neutral curve keeps the look's saturated albedo saturated, where AgX would grey it (asked after the clean chain)
332
392
  if (spec.neutral === true) fx.tone.mode = ToneMappingMode.NEUTRAL;
333
393
  // M4.7: ACES, the look's own vignette and bloom spread, and its exposure ahead of the curve
@@ -335,7 +395,7 @@ ${mist ? `
335
395
  if (spec.vignette !== undefined && spec.vignette !== null) { fx.vignette.offset = spec.vignette.offset; fx.vignette.darkness = spec.vignette.darkness; }
336
396
  if (spec.bloomRadius !== undefined && spec.bloomRadius !== null) fx.bloom.mipmapBlurPass.radius = spec.bloomRadius;
337
397
  const stops = spec.exposure ?? 0, at = chain.indexOf(fx.tone);
338
- if (stops !== 0 && at !== -1) { const exposure = new ExposureEffect(stops); scope.own(exposure); chain.splice(at, 0, exposure); }
398
+ if (stops !== 0 && at !== -1) { const exposure = new ExposureEffect(stops); scope.own(exposure); chain.splice(at, 0, exposure); owned.exposure = exposure; }
339
399
  return { chain };
340
400
  },
341
401
  // G992: no sun disc or corona over the gradient dome. A 1° disc read as a blurred speck with a halo ("half-assed moon
@@ -343,9 +403,12 @@ ${mist ? `
343
403
  sky: { clouds: false, planet: false, sun: { disc: false, halo: false } },
344
404
  // M4.7: the look's shadow radius and normal bias (its strength is set on the cascades each frame, below)
345
405
  ...(shadow === null ? {} : { shadows: { rig: 'tier' as const, radius: shadow.radius, normalBias: shadow.normalBias } }),
346
- backdrop: async ({ sky }) => {
406
+ backdrop: async ({ sky, renderer }) => {
347
407
  const clock = dataLookClock(spec.day, spec.dayOverride), now = lookSample();
408
+ owned.clock = clock;
348
409
  const { dome, zenith, horizon } = gradientDome();
410
+ // AP14: the painted sky replaces the gradient before the compose filters the environment from the dome
411
+ if (spec.sky !== undefined && spec.sky !== null) paintDome(dome, spec.sky, (await loadLookGraphCompiler(renderer)).compileGraph);
349
412
  owned.dome = dome;
350
413
  const bounce = owned.bounce;
351
414
  let targets: SkyBackdropTargets | null = null, flicker = 0;
@@ -62,6 +62,8 @@ export function compilePbr(params: PbrMaterialParams, textures: TextureResolver,
62
62
  alphaTest: params.alphaCutoff,
63
63
  });
64
64
  m.name = 'family:pbr';
65
+ // M4.3: the surface's own glow, added over its lit colour (lamp glass that the sun still lights); absent = black
66
+ if (params.emissive !== undefined) { m.emissive.setRGB(...params.emissive, THREE.SRGBColorSpace); m.emissiveIntensity = params.emissiveIntensity ?? 1; }
65
67
  if (params.ground !== null && params.measure !== null) throw new Error('material family: a PBR surface takes a ground or a measure layer, not both');
66
68
  if (params.ground !== null) applyGround(m, params.ground, textures, emitterPools);
67
69
  if (params.measure !== null) applyMeasure(m, params.measure);
@@ -16,6 +16,7 @@ import { parseFamilyMaterial, type FamilyMaterialParams } from '@wildshard/forma
16
16
  import { compileEmissive, type EmissiveLook } from './emissive';
17
17
  import { compilePainterly, type PainterlyLook } from './painterly';
18
18
  import { compilePbr, type TextureResolver } from './pbr';
19
+ import { applySceneEmissive, applySceneSurface } from './sceneSurface';
19
20
  import { updateGround } from './ground';
20
21
  import { compileToon, type ToonLook } from './toon';
21
22
 
@@ -39,13 +40,21 @@ const live = new Map<THREE.Material, FamilyMaterialParams>();
39
40
 
40
41
  function compile(params: FamilyMaterialParams, ctx: FamilyContext): THREE.Material {
41
42
  if (params.family === 'toon') return compileToon(params, ctx.toon);
42
- if (params.family === 'pbr') return compilePbr(params, ctx.textures, ctx.emitterPools);
43
+ if (params.family === 'pbr') {
44
+ // SHARD-SOURCE AP10, AP12: a scene's alpha, decal offset, sway and uv scroll, on the emissive look's clock
45
+ const m = compilePbr(params, ctx.textures, ctx.emitterPools);
46
+ applySceneSurface(m, params, ctx.emissive?.uniforms.famEmitTime);
47
+ return m;
48
+ }
43
49
  if (params.family === 'painterly') {
44
50
  if (ctx.painterly === undefined) throw new Error('material family: a painterly entry needs a painterly look in its family context');
45
51
  return compilePainterly(params, ctx.painterly, ctx.textures);
46
52
  }
47
53
  if (ctx.emissive === undefined) throw new Error('material family: an emissive entry needs an emissive look in its family context');
48
- return compileEmissive(params, ctx.emissive, ctx.textures);
54
+ const m = compileEmissive(params, ctx.emissive, ctx.textures);
55
+ // SHARD-SOURCE AP11, AP12: alpha cards, camera-facing cards and their declared motion
56
+ applySceneEmissive(m, params, ctx.emissive.uniforms.famEmitTime);
57
+ return m;
49
58
  }
50
59
 
51
60
  /**
@@ -0,0 +1,118 @@
1
+ /**
2
+ * What a three.js scene says about a surface (meta SHARD-SOURCE AP10 to AP12, `@wildshard/format/scene-render`), drawn on
3
+ * the family's own material after it compiles (`registry.ts`):
4
+ *
5
+ * - **PBR** `blend: 'alpha'` and `opacity`: a see-through surface (a stencil, a sign), drawn after the opaque world with
6
+ * no depth write (three sorts it back to front); `depthOffset`: a polygon offset (a decal on a wall); `sway`: each vertex
7
+ * moves by its `wsSway` attribute (the GLB's `_SWAY` channel, metres) along the wind at about `rate` hertz, phased by
8
+ * where it stands; `uvScroll`: the colour map's uv moves on the look's clock.
9
+ * - **Emissive** `blend: 'alpha'`: an unlit card blended over what is behind it; `card`: every vertex is a camera-facing
10
+ * card corner, `position` its seat and `wsCorner` (the GLB's `_CORNER` channel) the corner's view-space offset;
11
+ * `motion`: the card's `pulse`, `drift` or `rise`, phased by its seat.
12
+ *
13
+ * A see-through surface is marked `userData.sceneAlpha`, so a prop's GLB (opaque by default) never turns it opaque
14
+ * (`declaredProps.ts`). Every number is a uniform; the program changes only with which of these a surface uses. The clock is the emissive
15
+ * look's (`famEmitTime`): with no emissive look the surface holds still.
16
+ */
17
+ import * as THREE from 'three';
18
+ import type { EmissiveMaterialParams, PbrMaterialParams } from '@wildshard/format/materialFamilies';
19
+ import { patchShader, PATCH_ORDER } from '../shaderPatches';
20
+
21
+ /** the attribute a swaying surface reads (GLTFLoader's `_sway`, renamed by its binding's channels) */
22
+ export const SWAY_ATTRIBUTE = 'wsSway';
23
+ /** the attribute a card reads (GLTFLoader's `_corner`) */
24
+ export const CORNER_ATTRIBUTE = 'wsCorner';
25
+
26
+ /** The vertex channels a surface reads, as `PropSurfaceBinding.channels`; null when it reads none. */
27
+ export function sceneSurfaceChannels(entry: unknown): Readonly<Record<string, { readonly attribute: string; readonly itemSize: number }>> | null {
28
+ if (typeof entry !== 'object' || entry === null) return null;
29
+ const row = entry as { readonly family?: unknown; readonly sway?: unknown; readonly card?: unknown };
30
+ if (row.family === 'pbr' && row.sway !== undefined) return { _sway: { attribute: SWAY_ATTRIBUTE, itemSize: 1 } };
31
+ if (row.family === 'emissive' && row.card === true) return { _corner: { attribute: CORNER_ATTRIBUTE, itemSize: 2 } };
32
+ return null;
33
+ }
34
+
35
+ const STILL: THREE.IUniform<number> = { value: 0 };
36
+
37
+ const SWAY_VERTEX = /* glsl */`
38
+ #include <begin_vertex>
39
+ {
40
+ mat4 wsSwayM = modelMatrix;
41
+ vec3 wsSwayAt = ( wsSwayM * vec4( transformed, 1.0 ) ).xyz;
42
+ float wsSwayPh = wsSceneTime * wsSwayWind.z * 6.2831853 + wsSwayAt.x * 0.37 + wsSwayAt.z * 0.29;
43
+ float wsSwayAmt = wsSway * ( 0.7 * sin( wsSwayPh ) + 0.3 * sin( wsSwayPh * 2.3 + 1.7 ) );
44
+ // the wind is a world direction and wsSway world metres: back into the mesh's own frame by the inverse, which (unlike
45
+ // the transpose) also undoes the mesh's scale, so a scaled frond still moves its declared metres
46
+ vec3 wsSwayDir = inverse( mat3( wsSwayM ) ) * vec3( wsSwayWind.x, 0.0, wsSwayWind.y );
47
+ transformed += wsSwayDir * wsSwayAmt;
48
+ }
49
+ `;
50
+
51
+ /** PBR: alpha, depth offset, sway and uv scroll (a no-op for a surface with none of them). */
52
+ export function applySceneSurface(m: THREE.MeshStandardMaterial, params: PbrMaterialParams, clock: THREE.IUniform<number> = STILL): void {
53
+ if (params.blend === 'alpha') { m.transparent = true; m.depthWrite = false; m.opacity = params.opacity ?? 1; m.userData['sceneAlpha'] = true; }
54
+ const offset = params.depthOffset ?? 0;
55
+ if (offset !== 0) { m.polygonOffset = true; m.polygonOffsetFactor = offset; m.polygonOffsetUnits = offset; }
56
+ const sway = params.sway, scroll = params.uvScroll;
57
+ if (sway === undefined && scroll === undefined) return;
58
+ const uniforms: Record<string, THREE.IUniform> = {
59
+ wsSceneTime: clock,
60
+ wsSwayWind: { value: new THREE.Vector3(sway?.direction[0] ?? 0, sway?.direction[1] ?? 0, sway?.rate ?? 0) },
61
+ wsUvScroll: { value: new THREE.Vector2(scroll?.[0] ?? 0, scroll?.[1] ?? 0) },
62
+ };
63
+ patchShader(m, 'engine.family.sceneSurface', PATCH_ORDER.material, (shader) => {
64
+ Object.assign(shader.uniforms, uniforms);
65
+ let vs = shader.vertexShader.replace('#include <common>', `#include <common>\nuniform float wsSceneTime;\nuniform vec3 wsSwayWind;\nuniform vec2 wsUvScroll;\n${sway === undefined ? '' : `attribute float ${SWAY_ATTRIBUTE};`}`);
66
+ if (sway !== undefined) vs = vs.replace('#include <begin_vertex>', SWAY_VERTEX);
67
+ if (scroll !== undefined) vs = vs.replace('#include <uv_vertex>', '#include <uv_vertex>\n#ifdef USE_MAP\n\tvMapUv += wsUvScroll * wsSceneTime;\n#endif');
68
+ shader.vertexShader = vs;
69
+ }, { key: (before) => `${before}|scene-surface|${sway === undefined ? '' : 's'}${scroll === undefined ? '' : 'u'}` });
70
+ }
71
+
72
+ const CARD_VERTEX = /* glsl */`
73
+ vec3 wsSeat = transformed;
74
+ float wsPh = fract( sin( dot( wsSeat, vec3( 127.1, 311.7, 74.7 ) ) ) * 43758.5453 );
75
+ vec2 wsC = ${CORNER_ATTRIBUTE};
76
+ float wsT = wsCardTime * wsCardMotion.y;
77
+ wsCardFade = 1.0;
78
+ if ( wsCardMotion.x > 0.5 && wsCardMotion.x < 1.5 ) {
79
+ float s = 0.6 * sin( wsT * 6.2831853 + wsPh * 6.2831853 ) + 0.4 * sin( wsT * 15.1 + wsPh * 12.0 );
80
+ wsC.y *= 1.0 + wsCardMotion.z * s;
81
+ wsC.x *= 1.0 - 0.5 * wsCardMotion.z * s;
82
+ } else if ( wsCardMotion.x > 1.5 && wsCardMotion.x < 2.5 ) {
83
+ wsSeat += vec3( sin( wsT + wsPh * 6.2831853 ), 0.42 * sin( wsT * 2.3 + wsPh * 12.5 ), cos( wsT * 0.83 + wsPh * 6.2831853 ) ) * wsCardMotion.z;
84
+ } else if ( wsCardMotion.x > 2.5 ) {
85
+ float k = fract( wsPh * 7.0 + wsT );
86
+ float a = wsPh * 40.0;
87
+ wsSeat += vec3( cos( a ) * wsCardMotion.w * k, wsCardMotion.z * k, sin( a ) * wsCardMotion.w * k );
88
+ wsCardFade = 1.0 - k;
89
+ wsC *= 1.0 - 0.5 * k;
90
+ }
91
+ vec4 mvPosition = modelViewMatrix * vec4( wsSeat, 1.0 );
92
+ mvPosition.xy += wsC;
93
+ gl_Position = projectionMatrix * mvPosition;
94
+ `;
95
+
96
+ const MOTION_KIND: Readonly<Record<string, number>> = { pulse: 1, drift: 2, rise: 3 };
97
+
98
+ /** Emissive: alpha blend, cards and their motion (a no-op for a plain surface). `clock` is the emissive look's. */
99
+ export function applySceneEmissive(m: THREE.MeshBasicMaterial, params: EmissiveMaterialParams, clock: THREE.IUniform<number>): void {
100
+ if (params.blend === 'alpha') { m.transparent = true; m.depthWrite = false; m.alphaTest = Math.max(m.alphaTest, 0.01); m.userData['sceneAlpha'] = true; }
101
+ if (params.card !== true) return;
102
+ const motion = params.motion;
103
+ const vector = new THREE.Vector4(motion === undefined ? 0 : MOTION_KIND[motion.kind] ?? 0, motion?.rate ?? 0,
104
+ motion === undefined ? 0 : motion.kind === 'pulse' ? motion.amount : motion.kind === 'drift' ? motion.radius : motion.height,
105
+ motion?.kind === 'rise' ? motion.spread : 0);
106
+ const uniforms: Record<string, THREE.IUniform> = { wsCardTime: clock, wsCardMotion: { value: vector } };
107
+ m.userData['sceneCard'] = true;
108
+ patchShader(m, 'engine.family.sceneCard', PATCH_ORDER.material, (shader) => {
109
+ Object.assign(shader.uniforms, uniforms);
110
+ if (!shader.vertexShader.includes('#include <project_vertex>')) throw new Error('scene card: the basic vertex source has no <project_vertex>');
111
+ shader.vertexShader = shader.vertexShader
112
+ .replace('#include <common>', `#include <common>\nuniform float wsCardTime;\nuniform vec4 wsCardMotion;\nattribute vec2 ${CORNER_ATTRIBUTE};\nvarying float wsCardFade;`)
113
+ .replace('#include <project_vertex>', CARD_VERTEX);
114
+ shader.fragmentShader = shader.fragmentShader
115
+ .replace('#include <common>', '#include <common>\nvarying float wsCardFade;')
116
+ .replace('#include <opaque_fragment>', 'outgoingLight *= wsCardFade;\ndiffuseColor.a *= wsCardFade;\n#include <opaque_fragment>');
117
+ }, { key: (before) => `${before}|scene-card` });
118
+ }
@@ -1,7 +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
+ import type { LiveLook, LookKey } from './dataLook';
5
5
  import type { GradeEffect } from '../core/Grade';
6
6
  import type { DayCycleClock } from '../../../shared/engine/world/dayCycle';
7
7
  import type { SkyRig as Sky } from '../world/skyRig';
@@ -265,6 +265,12 @@ export interface ExtendLook extends LookParts {
265
265
  * hook); the next frame samples them. False: this look can't take them live (a fog kind change), so the page reloads.
266
266
  */
267
267
  liveKeys?: (keys: readonly LookKey[]) => boolean;
268
+ /**
269
+ * SHARD-SOURCE AP17: a data look's keys, sun arc, exposure, tone, vignette and bloom set in place (`wildshard watch`, engine's
270
+ * dev hook v2). False: this change can't go live (a light row, the LUT, a fog kind, an exposure on a chain built without
271
+ * one), so the page reloads.
272
+ */
273
+ liveLook?: (next: LiveLook) => boolean;
268
274
  compose: (c: LookComposeContext) => LookComposition;
269
275
  }
270
276
 
@@ -25,7 +25,7 @@ import { shadowDepthResolver, type ShadowDepthResolver } from './shadowDepthVari
25
25
  import { boundEntryWarmup } from './entryWarmupBound';
26
26
  import { workSlice } from '../../../shared/engine/core/workSlice';
27
27
  import { SHADOW_LAYER } from '../core/shadowLayer';
28
- import { buildHeld, heldBudget, nativeBudgetSpent, presenting } from '../../../shared/engine/core/framePacing';
28
+ import { buildHeld, buildUrgent, heldBudget, nativeBudgetSpent, presenting } from '../../../shared/engine/core/framePacing';
29
29
  import { countedWait, waitFor } from '../../../shared/engine/boot/waits';
30
30
  import { isDev } from '../core/devMode';
31
31
 
@@ -940,7 +940,9 @@ export const LIVE_HELD_PROGRAMS_PER_FRAME = 4;
940
940
  let warmUpHeld = false;
941
941
  /** Whether the traveller waits for a live warm-up (a grid cell's loading screen shows); the grid sets it, off by default. */
942
942
  export function setWarmUpHeld(held: boolean): void { warmUpHeld = held; }
943
- const programsPerFrame = (): number => (warmUpHeld ? LIVE_HELD_PROGRAMS_PER_FRAME : LIVE_PROGRAMS_PER_FRAME);
943
+ /** GC6: an entry warm-up on the road, for the cell the traveller heads into (`buildUrgent`), issues this many a frame. */
944
+ export const LIVE_URGENT_PROGRAMS_PER_FRAME = 2;
945
+ const programsPerFrame = (): number => (warmUpHeld ? LIVE_HELD_PROGRAMS_PER_FRAME : buildUrgent() ? LIVE_URGENT_PROGRAMS_PER_FRAME : LIVE_PROGRAMS_PER_FRAME);
944
946
  let parkedFrozen = false;
945
947
  /** G580 T2: whether a live warm-up freezes its parked (invisible) future root's matrices (`freezeParkedMatrices`); the grid
946
948
  * sets it, off by default. */
@@ -7,6 +7,9 @@ export const TIER_TABLE = {
7
7
  // PF3: the cascades redraw on every Nth drawn frame (skyRig.ts); a held map keeps the matrix it was drawn with, so a
8
8
  // static shadow stays exactly where it was and only a moving caster's shadow steps. 1 = every frame (a level's row may raise it)
9
9
  shadowEvery: 1,
10
+ // NB5: the cascades' staggered cadence (shadowCadence.ts) on every shard, not only a `texelBias: 'phone'` rig (skyRig.ts);
11
+ // the phone keeps its own rule, the desktop takes it (its three cascades were redrawn every frame)
12
+ cascadeStagger: false,
10
13
  // animals shadow as far as the cascade reaches (E90: at 30 m an animal's shadow switched on in plain view)
11
14
  animalShadowDist: 80, animalHideDist: 150, furShells: false,
12
15
  // animal draws (Animal.setDrawLod): fur / hard / eye within animalEyeDist, eyes in the hard material to animalOneDrawDist,
@@ -49,7 +52,7 @@ export const TIER_TABLE = {
49
52
  },
50
53
  desktop: {
51
54
  maxTexture: 4096, layerSize: 1024, dpr: 1.5, ao: true,
52
- cascades: 3, shadowMapSize: 2048, shadowFar: 220, shadowMargin: 120, softShadows: true, shadowEvery: 1,
55
+ cascades: 3, shadowMapSize: 2048, shadowFar: 220, shadowMargin: 120, softShadows: true, shadowEvery: 1, cascadeStagger: true,
53
56
  animalShadowDist: 90, animalHideDist: 400, furShells: true,
54
57
  // PH-P2: an eye is under a pixel past ~20 m at 1600×900 and a hoof tip past ~60 m, so the
55
58
  // phone's draw LOD at 1.3–1.5× its distances. ~150 animals × 3 draws were half of the desktop frame;
@@ -45,11 +45,13 @@ export interface BrowserErrorTags {
45
45
  * once per cell a session; warning
46
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
47
  * (game/grid/mapAtlas.ts; QA-FEEDBACK 2026-11-13 row 44), once per slug a page; warning
48
+ * release-unsigned FM5 mode 39's page, "Couldn't check the world": the release file failed its signature, so the page dials
49
+ * nothing (host/online/releaseScreens.ts), once a page
48
50
  * Not screens of a fault, so never reported: the player's own reload, back or exit (QA 11-12 row 35), "Playing somewhere else",
49
51
  * "The world is full", the reconnect banner (counted in `net` telemetry), title refusal lines and the Connection doctor.
50
52
  */
51
53
  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;
54
+ 'loading-stall', 'stale-reload', 'self-reload', 'save-failed', 'cell-unavailable', 'map-tile-missing', 'release-unsigned'] as const;
53
55
  /** S18: screens common enough on a bad network that each is a Sentry warning, never an error */
54
56
  export const WARNING_SCREENS: readonly ErrorScreen[] = ['loading-stall', 'stale-reload', 'self-reload', 'cell-unavailable', 'map-tile-missing'];
55
57
  export type ErrorScreen = typeof ERROR_SCREENS[number];
@@ -159,7 +159,7 @@ function build(): HTMLElement {
159
159
  const doctor = document.createElement('button');
160
160
  doctor.type = 'button'; doctor.className = 'doctor'; doctor.textContent = engineString('s_doctor_failed');
161
161
  q(el, '.title').after(doctor);
162
- scope.listen(doctor, 'click', () => { doctor.disabled = true; openDoctorPage('failed-join'); });
162
+ scope.listen(doctor, 'click', () => { doctor.disabled = true; void openDoctorPage('failed-join').then(left => { doctor.disabled = left; return left; }); });
163
163
  }
164
164
  // a dead loop can't be played on: KEEP PLAYING only acts while the loop still runs (it is hidden otherwise)
165
165
  scope.listen(q(el, '.keep'), 'click', () => { if (loopState() !== 'running') return; closeFatal(); document.dispatchEvent(new Event('ws:error-keep')); });
@@ -14,7 +14,7 @@ import { loadShellTemplate, START_STEPS, stopShellClock } from '../boot/shell';
14
14
  import { appIdentity } from '../../../shared/engine/app/identity';
15
15
  import { recordBootCheckpoint, recordBootProgress, startBoot } from '../boot/bootTrace';
16
16
  import { adoptLoadingWait } from '../boot/download';
17
- import { beginLoadingWait, reportLoadingWait, finishLoadingWait, loadingWaitState } from '../../../shared/engine/boot/loadingWaits';
17
+ import { beginLoadingWait, reportLoadingWait, finishLoadingWait, loadingWaitState, type LoadingWaitEntry } from '../../../shared/engine/boot/loadingWaits';
18
18
  import { loadingCacheText, loadingDownloadText, loadingDownloadFraction, loadingPrefetchFraction, loadingPrefetchText, type LoadingPrefetchSnapshot, type LoadingDownloadSnapshot } from '../boot/loadingDownloadText';
19
19
  import { LoadingTimeline, installLoadingTimeline, type LoadingPath, type LoadingRow, type LoadingGap } from '../../../shared/engine/boot/timeline';
20
20
  import {loadingFraction} from '../boot/weights';
@@ -579,7 +579,7 @@ export class Loading {
579
579
 
580
580
  private paintWaiting(timeline: TimelineSnapshot): void {
581
581
  if (this.view?.error || this.failedReason !== null) return;
582
- if (this.finished) { set(this.els.foot, ''); this.els.retry.hidden = true; setData(this.root, 'stalled', 'false'); return; }
582
+ if (this.finished) { set(this.els.foot, ''); delete this.els.foot.dataset['failmode']; this.els.retry.hidden = true; setData(this.root, 'stalled', 'false'); return; }
583
583
  const pending = this.scoped ? [] : loadingStepWaits(bootWaits(), timeline.display, timeline.current, this.timeline.waitOwner).filter(wait => wait.id !== this.waitId);
584
584
  const files = pending.filter(wait => wait.kind === 'file');
585
585
  // The outer admission promise has no file identity. Let the current
@@ -615,6 +615,18 @@ export class Loading {
615
615
  // A quiet phase still reports its actual age, without advancing a byte,
616
616
  // file or setup credit. Only an explicit failed-read retry capability offers
617
617
  // an action; a long pending operation remains pending.
618
+ // FM6 (meta MMO-FAILURE-MODES-PLAN modes 33 to 35, 43, 44): a failed read says what failed in a player's words, how long it has
619
+ // waited, and the retry actually scheduled; the catalogue's ids ride on the line. A RETRY wait wins over a note (storage full).
620
+ const said = (row: LoadingWaitEntry): boolean => row.failmode !== undefined && row.line !== undefined;
621
+ const pick = (rows: readonly LoadingWaitEntry[]): LoadingWaitEntry | undefined => rows.find(row => row.retry !== null) ?? rows.find(row => row.dueAt !== undefined) ?? rows[0];
622
+ const fault = pick(pending.filter(said)) ?? (stalled ? undefined : pick([...loadingWaitState().pending.values()].filter(row => said(row) && row.owner === null)));
623
+ if (fault?.failmode !== undefined && fault.line !== undefined) {
624
+ const due = fault.dueAt === undefined ? '' : ` · next try in ${String(Math.max(0, Math.ceil((fault.dueAt - now) / 1000)))} s`;
625
+ this.els.foot.dataset['failmode'] = fault.failmode;
626
+ set(this.els.foot, `${fault.line} · ${String(Math.floor(Math.max(0, now - fault.startedAt) / 1000))} s${due}`);
627
+ return;
628
+ }
629
+ delete this.els.foot.dataset['failmode'];
618
630
  set(this.els.foot, stalled ? `Waiting for ${label} · ${(quietMs / 1000).toFixed(1)} s` : !this.finished && quietMs >= 500
619
631
  ? `No reported progress for ${(quietMs / 1000).toFixed(1)} s · ${detail}` : detail);
620
632
  }
@@ -7,7 +7,7 @@ import { app } from '../app/runtime';
7
7
  import { uiScope, mountUi } from './ownership';
8
8
  import { listenTap } from '../input/dom';
9
9
  import { copyText, diagnosticsSource, DOCTOR_EARLIER_KEY } from './diagnosticsCopy';
10
- import type { Scope } from '../../../shared/engine/app/scope';
10
+ import { Scope } from '../../../shared/engine/app/scope';
11
11
 
12
12
  const scope = uiScope('loadFailure', app.engineScope);
13
13
 
@@ -28,19 +28,61 @@ export function doctorUrl(from: string, at: Location = location): string {
28
28
  return url.href;
29
29
  }
30
30
 
31
- /** Leave for the doctor: a held session saves first, and the page's report and the way back go with it. */
32
- export function openDoctorPage(from: string): void {
33
- const read = diagnosticsSource();
31
+ /** FM8 mode 14: how long the doctor's preflight may take before it counts as failed. */
32
+ const DOCTOR_PREFLIGHT_MS = 8000;
33
+ /** FM8 mode 14 (meta MMO-FAILURE-MODES-PLAN): a same-origin preflight of the doctor's own page. It says only that this one
34
+ * request answered now; it can't promise the document's later reads will, so a pass never claims more. Null when it answered. */
35
+ export async function doctorPreflight(url: string, read: typeof fetch = fetch, deadlineMs: number = DOCTOR_PREFLIGHT_MS): Promise<string | null> {
36
+ const abort = new AbortController(), timer = setTimeout(() => { abort.abort(); }, deadlineMs);
37
+ try {
38
+ const response = await read(url, { method: 'HEAD', cache: 'no-store', signal: abort.signal });
39
+ return response.ok ? null : engineString('s_doctor_http_status', [response.status]);
40
+ } catch { return abort.signal.aborted ? engineString('s_doctor_http_slow', [Math.round(deadlineMs / 1000)]) : engineString('s_doctor_http_none'); }
41
+ finally { clearTimeout(timer); }
42
+ }
43
+ /** The doctor-http card on screen, if any: a new one (or a repeated `ws:doctor`) closes it, scope and all. */
44
+ let doctorCardClose: (() => void) | null = null;
45
+ /** FM8 mode 14's card: the doctor didn't open, and this page stays as it was. Try again re-checks with the card up (a failure
46
+ * replaces it, a pass leaves the page); Back closes the card. */
47
+ function doctorHttpCard(measured: string, again: () => Promise<boolean>): void {
48
+ doctorCardClose?.();
49
+ const card = document.createElement('div'), box = document.createElement('div'), title = document.createElement('h1'), body = document.createElement('p');
50
+ const retry = document.createElement('button'), back = document.createElement('button'), details = document.createElement('details'), summary = document.createElement('summary'), fact = document.createElement('p');
51
+ card.dataset['failmode'] = 'doctor-http'; card.dataset['tone'] = 'warn'; card.setAttribute('role', 'alertdialog'); card.setAttribute('aria-modal', 'true'); card.setAttribute('aria-label', engineString('s_doctor_http_title'));
52
+ card.style.cssText = 'position:fixed;inset:0;z-index:2147482600;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(4,9,14,.62);color:#e6f2f8;font:12px/1.5 "JetBrains Mono",Menlo,monospace';
53
+ box.style.cssText = 'width:min(440px,100%);padding:22px 18px 16px;background:rgba(13,27,38,.92);border:1px solid rgba(143,227,255,.35);display:flex;flex-direction:column;gap:10px';
54
+ title.textContent = engineString('s_doctor_http_title'); title.style.cssText = 'margin:0;font:700 24px/1.1 Rajdhani,Bahnschrift,sans-serif;letter-spacing:.1em;text-transform:uppercase;color:#fff';
55
+ body.textContent = engineString('s_doctor_http_body'); body.style.margin = '0';
56
+ const button = 'min-height:48px;padding:13px 16px;cursor:pointer;font:700 12px/1 "JetBrains Mono",Menlo,monospace;letter-spacing:.22em;text-transform:uppercase;border:1px solid rgba(143,227,255,.35);background:rgba(13,27,38,.6);color:#e6f2f8';
57
+ retry.type = 'button'; retry.className = 'go'; retry.textContent = engineString('s_doctor_http_retry'); retry.style.cssText = `${button};border-color:#8fe3ff;background:rgba(143,227,255,.18)`;
58
+ back.type = 'button'; back.textContent = engineString('s_doctor_http_back'); back.style.cssText = button;
59
+ summary.textContent = engineString('s_doctor_http_details'); fact.textContent = engineString('s_doctor_http_fact', [measured]); fact.style.cssText = 'margin:8px 0 0;opacity:.6';
60
+ details.append(summary, fact);
61
+ const owner = new Scope('doctor-http', scope), close = (): void => { if (doctorCardClose === close) doctorCardClose = null; owner.dispose(); card.remove(); };
62
+ doctorCardClose = close;
63
+ owner.listen(retry, 'click', () => { retry.disabled = true; retry.textContent = engineString('s_doctor_http_checking'); void again(); });
64
+ owner.listen(back, 'click', close);
65
+ box.append(title, body, retry, back, details); card.append(box);
66
+ mountUi(card, owner, document.body);
67
+ retry.focus();
68
+ }
69
+
70
+ /** Leave for the doctor: a held session saves first, and the page's report and the way back go with it. FM8 mode 14: a doctor page
71
+ * that doesn't answer its preflight leaves this page as it was, with a card saying so. Resolves true when the page leaves. */
72
+ export async function openDoctorPage(from: string, read: typeof fetch = fetch): Promise<boolean> {
73
+ const url = doctorUrl(from), failed = await doctorPreflight(url, read);
74
+ if (failed !== null) { doctorHttpCard(failed, () => openDoctorPage(from, read)); return false; }
75
+ const report = diagnosticsSource();
34
76
  try {
35
77
  // oxlint-disable-next-line wildshard/no-raw-save -- one tab-scoped handoff key the doctor's page reads; that page loads no save service
36
- sessionStorage.setItem(DOCTOR_EARLIER_KEY, JSON.stringify({ earlier: read === null ? null : read(), back: `${location.pathname}${location.search}` }));
78
+ sessionStorage.setItem(DOCTOR_EARLIER_KEY, JSON.stringify({ earlier: report === null ? null : report(), back: `${location.pathname}${location.search}` }));
37
79
  } catch { /* storage refused: the doctor still runs, its report is just shorter */ }
38
- const url = doctorUrl(from);
39
80
  leaveSaved(() => { markUnload('doctor'); location.assign(url); });
81
+ return true;
40
82
  }
41
83
 
42
84
  // The online page's own module graph (src/client/host/online/shell.ts) asks by event: it can't share this bundle's save hold.
43
- scope.listen(document, 'ws:doctor', event => { openDoctorPage(event instanceof CustomEvent && typeof event.detail === 'string' ? event.detail : 'online'); });
85
+ scope.listen(document, 'ws:doctor', event => { void openDoctorPage(event instanceof CustomEvent && typeof event.detail === 'string' ? event.detail : 'online'); });
44
86
 
45
87
  /** Settings ▸ Connection: the doctor for everyone, beside Offline play (the title's Settings and the pause menu's saves). */
46
88
  export function buildConnectionRow(owner: Scope): HTMLElement {
@@ -48,7 +90,7 @@ export function buildConnectionRow(owner: Scope): HTMLElement {
48
90
  const label = document.createElement('div'); label.className = 'ws-gmenu-label'; label.textContent = engineString('s_doctor_title');
49
91
  const note = document.createElement('div'); note.className = 'ws-gmenu-note'; note.textContent = engineString('s_doctor_note');
50
92
  const go = document.createElement('button'); go.type = 'button'; go.className = 'ws-gmenu-btn ws-gmenu-doctor'; go.textContent = engineString('s_doctor_open');
51
- listenTap(owner, go, () => { go.disabled = true; openDoctorPage('settings'); });
93
+ listenTap(owner, go, () => { go.disabled = true; void openDoctorPage('settings').then(left => { go.disabled = left; return left; }); });
52
94
  box.append(label, note, go);
53
95
  return box;
54
96
  }
@@ -98,7 +140,7 @@ export function showLoadFailure(failure: LoadFailure): HTMLElement {
98
140
  const doctor = document.createElement('button');
99
141
  doctor.type = 'button'; doctor.className = 'ws-load-doctor'; doctor.textContent = engineString('s_doctor_failed');
100
142
  doctor.style.cssText = button;
101
- listenTap(scope, doctor, () => { doctor.disabled = true; openDoctorPage('ls4'); });
143
+ listenTap(scope, doctor, () => { doctor.disabled = true; void openDoctorPage('ls4').then(left => { doctor.disabled = left; return left; }); });
102
144
  actions.append(doctor);
103
145
  root.append(heading, context, message, stack, actions);
104
146
  mountUi(root, scope, document.body);
@@ -1,5 +1,6 @@
1
1
  import type { Scope } from '../../../shared/engine/app/scope';
2
2
  import type { Events } from '../../../shared/engine/events/events';
3
+ import { engineString } from '../../../shared/engine/strings';
3
4
  import { isDev, onDev } from '../core/devMode';
4
5
 
5
6
  // QA row 42 (Jake, 2026-11-10): "Let's get rid of the boost button. Let's make boost be like an undocumented double tap on the
@@ -50,12 +51,38 @@ export function pressHover(player: HoverPort, taps: HoverTaps, now: number): voi
50
51
  /** Boost shows while it moves the board: Developer mode, riding, latched. */
51
52
  export const boostShown = (player: Pick<HoverPort, 'hover' | 'hoverBoost'>): boolean => isDev() && player.hover && player.hoverBoost;
52
53
 
53
- /** The HOVER tab turns amber (`.boost`) while boost is shown. */
54
- export function mountBoostLook(button: HTMLElement, player: Pick<HoverPort, 'hover' | 'hoverBoost'>, events: Events, scope: Scope): void {
55
- const sync = (): void => { button.classList.toggle('boost', boostShown(player)); };
54
+ /** The word BOOST, hidden until `follow` shows it. */
55
+ function boostWord(scope: Scope): HTMLElement {
56
+ const word = document.createElement('b');
57
+ word.className = 'ws-touch-boost-word'; word.textContent = engineString('s_hover_boost'); word.hidden = true;
58
+ scope.onDispose(() => { word.remove(); });
59
+ return word;
60
+ }
61
+ /** Run `show` with whether boost is shown now and on every change that can move it, until `scope` ends. */
62
+ function follow(player: Pick<HoverPort, 'hover' | 'hoverBoost'>, events: Events, scope: Scope, show: (on: boolean) => void): void {
63
+ const sync = (): void => { show(boostShown(player)); };
56
64
  events.on('player.hover', sync, scope);
57
65
  events.on('player.boost', sync, scope);
58
66
  scope.onDispose(onDev(sync));
59
- scope.onDispose(() => { button.classList.remove('boost'); });
60
67
  sync();
61
68
  }
69
+
70
+ /**
71
+ * The HOVER tab turns amber (`.boost`) while boost is shown, and says BOOST under its HOVER. QA 11-15 row 9 (Jake: "I want that little
72
+ * icon on the left edge of the screen to say hover boost. I just want the word boost there, boost is on. I want the word boost gone [when]
73
+ * boost is off."): the word is there only while boost is on.
74
+ */
75
+ export function mountBoostLook(button: HTMLElement, player: Pick<HoverPort, 'hover' | 'hoverBoost'>, events: Events, scope: Scope): void {
76
+ const word = boostWord(scope);
77
+ button.append(word);
78
+ scope.onDispose(() => { button.classList.remove('boost'); });
79
+ follow(player, events, scope, on => { button.classList.toggle('boost', on); word.hidden = !on; });
80
+ }
81
+ /** QA 11-15 row 9 on a keyboard page, which has no HOVER tab: the same word on the left edge, where the phone's tab stands, only while
82
+ * boost is on. */
83
+ export function mountBoostTag(hud: HTMLElement, player: Pick<HoverPort, 'hover' | 'hoverBoost'>, events: Events, scope: Scope): void {
84
+ const tag = boostWord(scope);
85
+ tag.classList.add('ws-touch-boost-tag');
86
+ hud.append(tag);
87
+ follow(player, events, scope, on => { tag.hidden = !on; });
88
+ }
@@ -300,4 +300,10 @@ html[data-ws-keyboard] .ws-touch { visibility: hidden; pointer-events: none; }
300
300
 
301
301
  /* QA row 42: no BOOST button. A double tap of HOVER latches Developer boost; the tab burns amber while it moves the board
302
302
  (ui/hoverBoost.ts `.boost`), as do the board's repulsors. */
303
+ /* QA 11-15 row 9: the word BOOST under HOVER while boost is on, gone while it is off (ui/hoverBoost.ts `.ws-touch-boost-word`). A keyboard
304
+ page has no tab: the word stands alone on the left edge, at the tab's height, in the tab's amber. */
305
+ .ws-touch-boost-word { display: block; font: inherit; font-weight: 700; letter-spacing: inherit; line-height: 1; }
306
+ .ws-touch-boost-word[hidden] { display: none; }
307
+ #hud .ws-touch-boost-tag { position: absolute; z-index: calc(var(--ws-layer-hud) + 2); left: env(safe-area-inset-left, 0px); top: 46%; transform: translateY(-50%); padding: 8px 10px 8px 8px; border: 1px solid var(--ws-amber); border-left: 0; border-radius: 0 10px 10px 0; background: var(--ws-amber); color: #2a1600; box-shadow: 0 0 0 2px rgba(255, 181, 71, 0.35), 0 0 18px rgba(255, 181, 71, 0.75); font-family: var(--ws-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; pointer-events: none; }
308
+ #hud .ws-touch-boost-tag[hidden] { display: none; }
303
309
  #hud .ws-touch .ws-touch-hover.on.boost { color: #2a1600; border-color: var(--ws-amber); background: var(--ws-amber); box-shadow: 0 0 0 2px rgba(255, 181, 71, 0.35), 0 0 18px rgba(255, 181, 71, 0.75); text-shadow: none; font-weight: 700; }