@wildshard/engine 0.1.20 → 0.1.22

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 (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lint/engine-sides.json +4 -0
  3. package/lint/shardfile-boundaries.mjs +4 -2
  4. package/lint/wildshard-plugin.js +1 -1
  5. package/package.json +3 -1
  6. package/scripts/audio-download-proof.mjs +1 -1
  7. package/scripts/chaos-proxy-core.mjs +14 -1
  8. package/scripts/chaos-proxy-proof.mjs +22 -0
  9. package/scripts/check-spelled-paths.mjs +6 -3
  10. package/scripts/committed-fast-checks.mjs +2 -2
  11. package/scripts/failmode-cases.d.mts +8 -0
  12. package/scripts/failmode-cases.mjs +97 -0
  13. package/scripts/failmode-proof.mjs +556 -0
  14. package/scripts/grid-crossing-nightly.mjs +5 -4
  15. package/scripts/grid-crossing-report.mjs +5 -2
  16. package/scripts/grid-crossing-tour.mjs +25 -8
  17. package/scripts/grid-crossing-walk-proof.mjs +3 -3
  18. package/scripts/hover-speed-probe.mjs +136 -0
  19. package/scripts/mmo-bots.mjs +7 -3
  20. package/scripts/net-lag-proof.mjs +4 -3
  21. package/scripts/online-rig.mjs +11 -9
  22. package/scripts/parity/boot-smoke.mjs +1 -1
  23. package/scripts/release-cook.mjs +113 -0
  24. package/scripts/test-products.json +0 -21
  25. package/scripts/vps/cook-follow.d.mts +6 -0
  26. package/scripts/vps/cook-follow.mjs +45 -0
  27. package/scripts/vps/harden-apply.sh +10 -1
  28. package/scripts/vps/rebuild.sh +120 -26
  29. package/scripts/vps/wildshard-apply.mjs +5 -1
  30. package/scripts/vps/wildshard-config +117 -3
  31. package/src/client/app/entry.ts +2 -3
  32. package/src/client/engine/boot/contentRead.ts +78 -9
  33. package/src/client/engine/boot/downloadGiveUp.ts +34 -0
  34. package/src/client/engine/boot/gpuFiles.ts +3 -3
  35. package/src/client/engine/boot/leaveAfterPaint.ts +4 -1
  36. package/src/client/engine/combat/EquipmentService.ts +2 -0
  37. package/src/client/engine/core/Game.ts +6 -2
  38. package/src/client/engine/core/shadowLayer.ts +18 -0
  39. package/src/client/engine/explore/pick.ts +13 -1
  40. package/src/client/engine/net/predictor.ts +12 -4
  41. package/src/client/engine/player/TouchControls.ts +3 -2
  42. package/src/client/engine/render/families/sceneSurface.ts +3 -1
  43. package/src/client/engine/telemetry/browserErrors.ts +3 -1
  44. package/src/client/engine/ui/ErrorModal.ts +1 -1
  45. package/src/client/engine/ui/Loading.ts +14 -2
  46. package/src/client/engine/ui/downloadFailed.ts +54 -0
  47. package/src/client/engine/ui/errorScreen.ts +51 -9
  48. package/src/client/engine/ui/hoverBoost.ts +31 -4
  49. package/src/client/engine/ui/styles/touch.css +6 -0
  50. package/src/client/game/boot/spawnDownload.ts +56 -7
  51. package/src/client/game/grid/copyPrompts.ts +3 -4
  52. package/src/client/game/grid/dataCellKit.ts +91 -0
  53. package/src/client/game/grid/enteredEquipment.ts +11 -2
  54. package/src/client/game/grid/live.ts +11 -301
  55. package/src/client/game/grid/liveSession.ts +33 -10
  56. package/src/client/game/grid/neighbourLife.ts +50 -32
  57. package/src/client/game/grid/reveal.ts +7 -2
  58. package/src/client/game/grid/session.ts +6 -70
  59. package/src/client/game/grid/shardfileFar.ts +13 -2
  60. package/src/client/game/plugin/weaponFamily.ts +6 -0
  61. package/src/client/game/shardfile/clientSource.ts +7 -3
  62. package/src/client/game/shardfile/clientWorker.ts +17 -7
  63. package/src/client/game/shardfile/groundMerge.ts +5 -3
  64. package/src/client/host/online/linkScreens.ts +12 -6
  65. package/src/client/host/online/reconnectStrip.ts +3 -2
  66. package/src/client/host/online/release.ts +87 -16
  67. package/src/client/host/online/releaseScreens.ts +108 -0
  68. package/src/client/host/online/shell.ts +46 -12
  69. package/src/client/host/online/voice.ts +45 -1
  70. package/src/client/host/online/voiceUi.ts +24 -6
  71. package/src/server/engine/sim/playerSim.ts +1 -1
  72. package/src/server/game/grid/room.ts +2 -38
  73. package/src/server/game/grid/simulation.ts +12 -6
  74. package/src/server/game/shardfile/declaredKitItems.ts +8 -2
  75. package/src/server/host/dedicated/cellHost.ts +9 -2
  76. package/src/server/host/dedicated/cellProtocol.ts +1 -1
  77. package/src/server/host/dedicated/cellWorker.ts +2 -2
  78. package/src/server/host/dedicated/dedicatedRoom.ts +22 -4
  79. package/src/server/host/dedicated/gridCells.ts +5 -3
  80. package/src/server/host/dedicated/main.ts +6 -4
  81. package/src/server/host/dedicated/roadRoom.ts +3 -0
  82. package/src/server/host/dedicated/workerTable.ts +0 -10
  83. package/src/server/host/dedicated/world.ts +39 -5
  84. package/src/server/host/standalone/cellWorld.ts +1 -1
  85. package/src/server/host/standalone/gridServer.ts +1 -1
  86. package/src/shared/engine/boot/loadingWaits.ts +10 -2
  87. package/src/shared/engine/core/config.ts +3 -0
  88. package/src/shared/engine/player/hoverSpeed.ts +3 -3
  89. package/src/shared/engine/saves/shape.ts +17 -2
  90. package/src/shared/engine/strings.ts +22 -1
  91. package/src/shared/game/grid/placementRows.ts +4 -3
  92. package/src/shared/game/grid/rules.ts +12 -0
  93. package/src/client/game/grid/cellLoading.ts +0 -110
  94. package/src/client/game/grid/cellScreens.ts +0 -48
@@ -9,7 +9,7 @@ import { mountedPlayerOf } from '@wildshard/engine/game/riding/native';
9
9
  import type { GridAssembly, GridCell, GridPoint } from '../../../shared/game/grid/assembly';
10
10
  import type { ResidencyAllocator } from '../../../shared/game/grid/allocator';
11
11
  import { GridContinuationCache, GRID_CONTINUATION_CACHE_BYTES } from '../../../shared/game/grid/continuations';
12
- import { gridBoardLimit } from '../../../shared/game/grid/rules';
12
+ import { gridBoardLimitAt } from '../../../shared/game/grid/rules';
13
13
  import { leadPlayer } from '@wildshard/engine/sim/leadPlayer';
14
14
 
15
15
  /** Admission returns one owned, renderer-free regional host; its world is always in authored local coordinates. */
@@ -327,10 +327,7 @@ export class GridSimulation {
327
327
  /** A seat's board cap, read in world space from wherever it stands: a resident host's feet are its cell's (P1-E5.3-A10). */
328
328
  private boardLimit(player: string): number {
329
329
  const site = this.current(player), seat = this.seat(this.hostAt(site), player), { assembly } = this;
330
- const feet = site === null ? seat.position : assembly.world(seat.position, assembly.cell(site));
331
- const p = assembly.pitch, cx = Math.round(feet.x / p), cz = Math.round(feet.z / p), cell = assembly.cells.find(row => row.cell[0] === cx && row.cell[1] === cz);
332
- return gridBoardLimit({ local: { x: feet.x - cx * p, y: feet.y, z: feet.z - cz * p }, shardCap: 14, onHighwayDeck: feet.y < 4,
333
- speedClass: cell?.speedClass ?? 'shard' });
330
+ return gridBoardLimitAt(assembly, site === null ? seat.position : assembly.world(seat.position, assembly.cell(site)));
334
331
  }
335
332
  /** The empty seat a player takes on arrival. The lead's is always there; anyone else's is made for them. */
336
333
  private arrivalSeat(host: SimHost, player: string, traveller: PlayerSim): PlayerSim {
@@ -345,7 +342,7 @@ export class GridSimulation {
345
342
  /** One tick for every world with a player in it: each player's command goes to the host it stands in. */
346
343
  stepAll(commands?: ReadonlyMap<string, SimTickCommand>): void {
347
344
  if (this.disposed) throw new Error('Grid simulation is disposed');
348
- for (const [player, site] of this.sites) this.seat(this.hostAt(site), player).hoverSpeedLimit ??= () => this.boardLimit(player);
345
+ this.capBoards();
349
346
  const sites = new Set(this.sites.values());
350
347
  for (const site of sites) {
351
348
  const host = this.hostAt(site); this.ports.beforeMove?.(site, host);
@@ -358,8 +355,17 @@ export class GridSimulation {
358
355
  /** One tick of one world, for a room stepping its own (`stepAll` does every world). */
359
356
  stepSite(site: string | null, commands: ReadonlyMap<string, SimTickCommand>): void {
360
357
  if (this.disposed) throw new Error('Grid simulation is disposed');
358
+ this.capBoards(site);
361
359
  const host = this.hostAt(site); this.ports.beforeMove?.(site, host); host.step(commands);
362
360
  }
361
+ /**
362
+ * Every seat's board takes the page's grid cap (`boardLimit`) before its world steps, by whichever path steps it. QA 11-15 row 8:
363
+ * only `stepAll` installed it, so the in-page server's rooms (`stepSite`, and a cell world stepping itself) ran 14 m/s on the road
364
+ * and 56 boosted against the page's 30 and 60 (now 120). `site` limits it to that world's seats.
365
+ */
366
+ capBoards(site?: string | null): void {
367
+ for (const [player, at] of this.sites) if (site === undefined || at === site) this.seat(this.hostAt(at), player).hoverSpeedLimit ??= () => this.boardLimit(player);
368
+ }
363
369
  /** Every world with a player in it. */
364
370
  occupiedSites(): ReadonlySet<string | null> { return new Set(this.sites.values()); }
365
371
  /** Global render pose is derived from local feet and the current frame, never saved into an authored host. */
@@ -64,6 +64,8 @@ function restoreLever(seat: LeverSeat, value: unknown): void {
64
64
  seat.store.reserve = s.reserve; seat.sinceEmpty = s.sinceEmpty; seat.taken = s.taken;
65
65
  }
66
66
 
67
+ /** The most rounds a lever's reserve holds from its rack's restocks (TC-E1d). */
68
+ export const RESTOCK_CAP = 999;
67
69
  const finite = (aim: AimCommand): boolean => [aim.origin.x, aim.origin.y, aim.origin.z, aim.direction.x, aim.direction.y, aim.direction.z].every(Number.isFinite);
68
70
  function isStates(value: unknown): value is Record<string, ItemState> { return typeof value === 'object' && value !== null && !Array.isArray(value); }
69
71
 
@@ -81,6 +83,8 @@ export function installDeclaredKitItems(host: SimHost, shard: Pick<Shardfile, 'i
81
83
  // A rack's prompt names its lever's scene: the page sends the prompt's own id, and this kit runs it, not a script (a shard may have none).
82
84
  const leverPrompts = new Map(shard.targets.interactions.flatMap(row => (shard.targets.itemActions ?? []).some(action => action.scene === row.scene && levers.has(action.item)) ? [[row.id, row.scene] as const] : []));
83
85
  const slots = declaredKitSlots(shard.items.rows), weapons = [...slots.keys()];
86
+ // TEMPLATE-E2E TC-E1c: the loadout's primary lever is in hand from the start; any other waits for its rack
87
+ const primary = shard.items.loadout.primary;
84
88
  const scenes = new Map((shard.targets.itemActions ?? []).filter(row => rows.some(item => item.id === row.item)).map(row => [row.scene, row] as const));
85
89
  const fields = (shard.targets.itemFields ?? []).flatMap(row => {
86
90
  const field = shard.state.player.find(entry => entry.id === row.fieldId);
@@ -105,7 +109,7 @@ export function installDeclaredKitItems(host: SimHost, shard: Pick<Shardfile, 'i
105
109
  })] as const));
106
110
  const seated = new Map([...levers].map(([id, { profile }]) => {
107
111
  const store = { reserve: profile.reserve };
108
- const seat: LeverSeat = { act: new RangedAction.Cycle(store, { magazine: profile.magazine, reload: profile.reload, ...profile.lever }), store, taken: false, sinceEmpty: 99 };
112
+ const seat: LeverSeat = { act: new RangedAction.Cycle(store, { magazine: profile.magazine, reload: profile.reload, ...profile.lever }), store, taken: id === primary, sinceEmpty: 99 };
109
113
  return [id, seat] as const;
110
114
  }));
111
115
  return { runtimes, levers: seated,
@@ -127,7 +131,7 @@ export function installDeclaredKitItems(host: SimHost, shard: Pick<Shardfile, 'i
127
131
  // so it never stands ahead of this host's.
128
132
  for (const [id, runtime] of runtimes) { const saved = value[id]; if (saved !== undefined) runtime.restore({ ...saved, tick: Math.max(-1, Math.min(saved.tick, host.state.tick - 1)) }); }
129
133
  // A save made before a lever existed leaves it fresh.
130
- for (const [id, seat] of seated) { const saved: unknown = value[id]; if (saved !== undefined) restoreLever(seat, saved); }
134
+ for (const [id, seat] of seated) { const saved: unknown = value[id]; if (saved !== undefined) restoreLever(seat, saved); if (id === primary) seat.taken = true; }
131
135
  } };
132
136
  });
133
137
  // Joined: a save made before this owner existed restores, and its items start fresh.
@@ -223,6 +227,8 @@ export function installDeclaredKitItems(host: SimHost, shard: Pick<Shardfile, 'i
223
227
  if (!near(taker, scene)) return true;
224
228
  // 3 takes the lever off its rack and into hand; 4 reloads it.
225
229
  if (row.action === 3) {
230
+ // TC-E1d: a rack is a restock once its lever is in hand: its row's reserve again, up to the cap
231
+ if (lever.taken) { const profile = levers.get(row.item)?.profile; if (profile !== undefined) lever.store.reserve = Math.min(RESTOCK_CAP, lever.store.reserve + profile.reserve); return true; }
226
232
  const slot = weapons.indexOf(row.item), before = held(taker);
227
233
  if (before !== undefined) safely(() => { before.hold(false, eye(taker, 0), false); });
228
234
  lever.taken = true; if (slot !== -1) taker.held = slot;
@@ -17,6 +17,7 @@ import { openRoad } from '../standalone/roadWorld';
17
17
  import type { HeadlessRuntimeInput } from '../headlessRuntime';
18
18
  import type { CellOrder, WorkerNews, WorkerReading, WorkerResident } from './cellProtocol';
19
19
  import { SeatTransport } from './socketPump';
20
+ import { allowDeveloperBoost } from '@wildshard/engine/sim/playerSim';
20
21
 
21
22
  /** How often a worker reads itself (E7.8). */
22
23
  export const READING_MS = 10_000;
@@ -62,8 +63,10 @@ export interface CellHostOptions {
62
63
  readonly booted?: (slug: string, room: DedicatedRoom) => void;
63
64
  readonly roaded?: (road: RoadRoom) => void;
64
65
  readonly playtest?:boolean;
66
+ /** QA 11-15 row 8 (G540): honour a Developer page's boost bit (on unless `WORLD_BOOST=off`, `cellWorker.ts`). */
67
+ readonly developerBoost?: boolean;
65
68
  /**
66
- * GC15 (`WORLD_CROSSING=worker`): the grid pack's road strips. Given, this worker hosts the road between its cells, each of its grid
69
+ * J353: the grid pack's road strips. Given, this worker hosts the road between its cells, each of its grid
67
70
  * cells opens onto it instead of standing in lone walls, and a seat walks cell, road, cell on one socket. Left out, or no strips, every cell is lone.
68
71
  */
69
72
  readonly road?: () => Promise<readonly GridCollisionStrip[]>;
@@ -82,6 +85,10 @@ function installCellIdentity(): void {
82
85
 
83
86
  /** Run one worker's cells until it is told to close. Anything that ends it says `failed`, and the process ends (Q77). */
84
87
  export function runCells(port: CellPort, options: CellHostOptions): { dispose: () => void } {
88
+ // QA 11-15 row 8 (G540: Developer boost "everywhere"): a Developer page's boost bit moves its board here too, to the shared speed
89
+ // law's 56 m/s in a shard and 120 on the road (4x, Jake 11-15), so the page's prediction and this authority agree. Replaces E7.7's "never installed";
90
+ // `WORLD_BOOST=off` on a box turns it back off. The server can't tell a Developer page from another, so this trusts the bit.
91
+ allowDeveloperBoost(options.developerBoost !== false);
85
92
  const scope = new Scope('dedicated.worker'), started = diagnosticNow(), cells = new Map<string, Cell>();
86
93
  let clock: ServerClock | undefined, disposed = false, ready = false, ticks: number[] = [], ticked = 0, readAt = started, dropsAt = 0;
87
94
  /** SC8: each awake cell's own tick time since the last reading (ms summed, ticks counted), so a bench can weigh cells by awake cost. */
@@ -289,7 +296,7 @@ export function runCells(port: CellPort, options: CellHostOptions): { dispose: (
289
296
  return;
290
297
  }
291
298
  if (!ready) { fail(new Error('A worker was told something before it booted')); return; }
292
- if (order.kind === 'drain') { drained = true; clock?.pause(); for (const { room } of cells.values()) room.drain(); road?.drain(); post({ kind: 'drained' }); return; }
299
+ if (order.kind === 'drain') { drained = true; clock?.pause(); for (const { room } of cells.values()) room.drain(order.leave); road?.drain(); post({ kind: 'drained' }); return; }
293
300
  if (order.kind === 'cross') { cross(order).catch(fail); return; }
294
301
  // GC15 (3): crossings between workers, and which cells on the others a walker can stand in
295
302
  if (order.kind === 'open') { road?.open(order.cells); return; }
@@ -27,7 +27,7 @@ export interface SeatEntry {
27
27
  export type CellOrder =
28
28
  | { readonly kind: 'find'; readonly id: number; readonly slug: string; readonly device: string }
29
29
  | ({ readonly kind: 'seat'; readonly slug: string; readonly port: MessagePort; readonly hello: ArrayBuffer } & SeatEntry)
30
- | { readonly kind: 'drain' }
30
+ | { readonly kind: 'drain'; readonly leave?: boolean }
31
31
  /** MP4.1: a `room` line said in cell `from`, for every other awake cell on this worker. */
32
32
  | { readonly kind: 'chat'; readonly from: string; readonly line: WorldLine }
33
33
  /** GC15: a seat in cell `from` walks into `to` on the same worker. The entry is the door's read of their save on `to`'s shard. */
@@ -17,7 +17,7 @@ import { loopLag } from './loopLag';
17
17
  export interface CellWorkerData { readonly slugs: readonly string[]; readonly build: string; readonly origin: string; readonly cache: string; readonly holdMs?: number;readonly playtest?:boolean;
18
18
  /** J107's start-over wait, a proof's override (`EMPTY_MS`): 5 minutes when absent. */
19
19
  readonly emptyMs?: number;
20
- /** GC15: `WORLD_CROSSING=worker`, this worker hosts the road between its cells. */
20
+ /** Every worker hosts its road; J353 removed the mode switch. */
21
21
  readonly crossing?: boolean;
22
22
  /** SA33: the cells the door had placed when it booted this worker; a worker's module state is its own. */
23
23
  readonly placed?: readonly PlacedCell[];
@@ -29,7 +29,7 @@ if (port === null) throw new Error('A cell runs in a worker');
29
29
  for (const row of placed ?? []) placeCell(row);
30
30
  const reads: PackReads = { fetched: 0, fetchedBytes: 0, cached: 0, refused: 0 };
31
31
  const rapier = await loadRapier(await readFile(new URL('rapier.wasm', import.meta.url)));
32
- runCells(port as unknown as CellPort, { slugs, build, bootId: () => randomBytes(4).toString('hex'), memory: () => process.memoryUsage(), ...(metrics === true ? { lag: loopLag() } : {}), closed: () => { process.exit(0); }, ...(holdMs === undefined ? {} : { holdMs }), ...(emptyMs === undefined ? {} : { emptyMs }),...(playtest===undefined?{}:{playtest}),...(crossing === true ? { road: async () => {
32
+ runCells(port as unknown as CellPort, { slugs, build, developerBoost: process.env['WORLD_BOOST'] !== 'off', bootId: () => randomBytes(4).toString('hex'), memory: () => process.memoryUsage(), ...(metrics === true ? { lag: loopLag() } : {}), closed: () => { process.exit(0); }, ...(holdMs === undefined ? {} : { holdMs }), ...(emptyMs === undefined ? {} : { emptyMs }),...(playtest===undefined?{}:{playtest}),...(crossing === true ? { road: async () => {
33
33
  // A build whose server book has no grid pack gives a road with no strips: this line says so before anyone falls through it.
34
34
  const strips = await readPackGrid(build, { origin, cache }, reads);
35
35
  console.info(JSON.stringify({ at: 'road.pack', strips: strips.length, ...reads }));
@@ -25,7 +25,8 @@ import { ShopGate } from './shopGate';
25
25
  import { HOLD_MS, type ResumeAt, type RoomNews, type SeatEntry } from './cellProtocol';
26
26
  import { LEFT } from './socketPump';
27
27
  import type {PlaytestHit} from './playtest';
28
- import { cellFrame, cellName } from './gridCells';
28
+ import { cellFrame, cellName, gridAssembly } from './gridCells';
29
+ import { gridBoardLimitAt } from '@wildshard/engine/game/grid/rules';
29
30
  import {hitHistoryOf} from '@wildshard/engine/combat/rewind';
30
31
  import { entrywaysStand, floorBelow } from '@wildshard/engine/physics/query';
31
32
  import type { GridAssembly } from '@wildshard/engine/game/grid/assembly';
@@ -74,7 +75,7 @@ export interface DedicatedRoomOptions {
74
75
  /** GO3: the grid instance this room is, which names it everywhere else and numbers its frames. Left out, the shard's own grid cell. */
75
76
  readonly cell?: string;
76
77
  /**
77
- * GC15 (`WORLD_CROSSING=worker`): this worker's road, which the cell opens onto instead of standing lone. Its seam
78
+ * J353: this worker's road, which the cell opens onto. Its seam
78
79
  * strips are built into the cell's world, and a seat whose feet leave the cell asks the door to cross onto the road.
79
80
  */
80
81
  readonly road?: DedicatedRoomRoad;
@@ -228,6 +229,7 @@ export class DedicatedRoom implements CrossTarget {
228
229
  const aside = SPAWN_ASIDE[(this.joined++) % SPAWN_ASIDE.length] ?? 0, stand = { ...spawn, x: spawn.x + aside };
229
230
  const player = lead ? this.lead : host.addPlayer(body, at ?? doc?.at ?? stand, at?.yaw ?? doc?.at.yaw ?? spawn.yaw);
230
231
  player.netName = entry.name;
232
+ this.capBoard(player);
231
233
  if (lead) player.resetPose(stand, spawn.yaw);
232
234
  book.seat(body, doc?.ledger ?? { serial: 0, rows: [] });
233
235
  // Bind owned modifiers to the fresh body baseline before restoring its already modified health.
@@ -241,6 +243,17 @@ export class DedicatedRoom implements CrossTarget {
241
243
  }
242
244
  return seat;
243
245
  }
246
+ /**
247
+ * QA 11-15 row 8: a grid cell's board cap is the page's (`installGridHoverSpeed`): 14 m/s inside (G39), easing to the road's 30 over
248
+ * the strip (G60), 30 throughout a road-class padding cell (G540). Read from world feet: this cell's x and z moved by its placement.
249
+ * A cell the grid doesn't place keeps the standalone 14.
250
+ */
251
+ private capBoard(player: PlayerSim): void {
252
+ player.hoverSpeedLimit = () => {
253
+ const assembly = this.options.road?.assembly ?? gridAssembly(), cell = assembly.cells.find(row => row.instance === this.name);
254
+ return cell === undefined ? 14 : gridBoardLimitAt(assembly, assembly.world(player.position, cell));
255
+ };
256
+ }
244
257
  /** GC30: whether a walker off the road stands at this cell's entryways (`entrywaysStand`); else its worker's road walls it. */
245
258
  entrywaysStand(): boolean { return entrywaysStand(this.host.physics, ARRIVAL_LIFT); }
246
259
  /** GC15: this seat's feet left for cell `to`, standing at `at` in that cell's own frame. The door reads their save there and orders `handOver`. */
@@ -452,8 +465,13 @@ export class DedicatedRoom implements CrossTarget {
452
465
  for (const [body, left] of this.departed) if (now - left >= FORGET_PAID_MS) { this.departed.delete(body); this.forgetPaid(body); }
453
466
  }
454
467
  /** Everyone goes, as at SIGTERM: their last checkpoint now, and a close that says a restart is why. */
455
- drain(): void {
456
- for (const seat of this.seats.values()) { this.write(seat, 'restart'); seat.holdEnds = null; const { transport } = seat; seat.transport = null; transport?.close('restart'); }
468
+ drain(leave = false): void {
469
+ for (const seat of this.seats.values()) {
470
+ this.write(seat, 'restart'); seat.holdEnds = null;
471
+ const { transport } = seat; seat.transport = null;
472
+ if (leave) this.release(seat);
473
+ transport?.close('restart');
474
+ }
457
475
  }
458
476
  dispose(): void { this.net.dispose(); this.cell.dispose(); }
459
477
  }
@@ -16,7 +16,9 @@ interface GridNames { readonly instances: readonly string[]; readonly frames: Re
16
16
  readonly spots: ReadonlyMap<string, string> }
17
17
  /** SA33: one cell a signed placement file names: the API's placement of a new slug (SA30), on a spot the catalogue leaves empty. SA47:
18
18
  * `hash` is its shardfile, for a pack the build's book lacks. */
19
- export interface PlacedCell { readonly instance: string; readonly slug: string; readonly cell: readonly [number, number]; readonly hash?: string }
19
+ export interface PlacedCell { readonly instance: string; readonly slug: string; readonly cell: readonly [number, number]; readonly hash?: string;
20
+ /** The grid row's speed class, so the board's cap in a placed road-class cell matches the page's (QA 11-15 row 8). */
21
+ readonly speedClass?: 'road' }
20
22
  /** SA33: the cells placed on this running server, in the placement file's order, after the catalogue's. A restart forgets them; the
21
23
  * placement watch's first look places them again. */
22
24
  const placed: PlacedCell[] = [];
@@ -51,7 +53,7 @@ export function placeCell(row: PlacedCell): boolean {
51
53
  if (cells.has(row.instance)) throw new Error(`${row.instance} is a placed shard's name`);
52
54
  const taken = spots.get(spot);
53
55
  if (taken !== undefined) throw new Error(`${spot} is ${taken}'s`);
54
- placed.push({ instance: row.instance, slug: row.slug, cell: [x, z], ...(row.hash === undefined ? {} : { hash: row.hash }) });
56
+ placed.push({ instance: row.instance, slug: row.slug, cell: [x, z], ...(row.hash === undefined ? {} : { hash: row.hash }), ...(row.speedClass === undefined ? {} : { speedClass: row.speedClass }) });
55
57
  if (row.hash !== undefined) hashes.set(row.slug, row.hash);
56
58
  return true;
57
59
  }
@@ -65,7 +67,7 @@ let assembled: { readonly from: unknown; readonly placed: number; readonly assem
65
67
  export function gridAssembly(placedToo = true): GridAssembly {
66
68
  const { grid } = catalogueDocument(), count = placedToo ? placed.length : 0;
67
69
  if (assembled?.from === grid && assembled.placed === count) return assembled.assembly;
68
- const assembly = new GridAssembly({ developer: false, devserver: false }, count === 0 ? grid : { ...grid, cells: [...grid.cells, ...placed.map(({ instance, slug, cell }) => ({ instance, slug, cell: [...cell] }))] });
70
+ const assembly = new GridAssembly({ developer: false, devserver: false }, count === 0 ? grid : { ...grid, cells: [...grid.cells, ...placed.map(({ instance, slug, cell, speedClass }) => ({ instance, slug, cell: [...cell], ...(speedClass === undefined ? {} : { speedClass }) }))] });
69
71
  assembled = { from: grid, placed: count, assembly };
70
72
  return assembly;
71
73
  }
@@ -25,7 +25,7 @@ import { sendSentryTest, serverSentry } from './serverSentry';
25
25
  import {PlaytestFile} from './playtest';
26
26
  import { World, type PlayerSaves, type WorkerLink } from './world';
27
27
  import { cloudflareTurn } from './voiceRelay';
28
- import { worldCrossing, worldSettings } from './workerTable';
28
+ import { worldSettings } from './workerTable';
29
29
  import { doorTrust } from './doorTrust';
30
30
  import { WHOLE_GRID, cellShard, placeCell, placedCells, worldCells } from './gridCells';
31
31
  import { PlacementWatch, fetchPlacementFile } from './placementFile';
@@ -67,8 +67,10 @@ const reports = new ServerReports({ build, channel: release.channel, telemetryUr
67
67
  const url = process.env['DATABASE_URL'] ?? savesUrl(release.channel), saves: PlayerSaves = url === 'memory:' ? memoryPlayerSaves() : await openPlayerSaves(url, new URL('migrations/', import.meta.url), release.saveEpoch, log, issue => { reports.contract(issue); });
68
68
  const recordTag=setting('RECORD_TAG');
69
69
  const turnKey = setting('WILDSHARD_TURN_KEY_ID'), turnToken = setting('WILDSHARD_TURN_KEY_TOKEN');
70
- // GC15, GC35: each worker opens its road and lets a seat walk between the cells it hosts; only `WORLD_CROSSING=off` keeps cells lone (J322).
71
- const crossing = worldCrossing(setting('WORLD_CROSSING'));
70
+ // J353: zone entry is the only implementation. Old box files may retain this row during rollout.
71
+ const legacyWorldCrossing = setting('WORLD_CROSSING');
72
+ if (legacyWorldCrossing !== undefined) log({ at: 'world.crossing.ignored', value: legacyWorldCrossing, reason: 'zone-entry' });
73
+ const crossing = true;
72
74
  // SA33: where the API's signed placement file is, and its own key's public half. Both or neither; only a whole-grid world grows.
73
75
  const placementAt = setting('PLACEMENT_URL'), placementKey = setting('PLACEMENT_PUBLIC_KEY');
74
76
  if ((placementAt === undefined) !== (placementKey === undefined)) throw new Error('PLACEMENT_URL and PLACEMENT_PUBLIC_KEY go together');
@@ -78,7 +80,7 @@ const playtest=process.env['PLAYTEST']==='1'?new PlaytestFile({directory:setting
78
80
 
79
81
  /** One row of the table is one worker thread, started once (J182). */
80
82
  function bootWorker(slugs: readonly string[]): WorkerLink {
81
- const data: CellWorkerData = { slugs, build, origin, cache, placed: placedCells(), ...(hold === undefined ? {} : { holdMs: Number(hold) }), ...(empty === undefined ? {} : { emptyMs: Number(empty) }), ...(crossing ? { crossing } : {}), ...(metrics === undefined ? {} : { metrics: true }),...(playtest===undefined?{}:{playtest:true}) };
83
+ const data: CellWorkerData = { slugs, build, origin, cache, placed: placedCells(), ...(hold === undefined ? {} : { holdMs: Number(hold) }), ...(empty === undefined ? {} : { emptyMs: Number(empty) }), crossing: true, ...(metrics === undefined ? {} : { metrics: true }),...(playtest===undefined?{}:{playtest:true}) };
82
84
  const worker = new Worker(new URL('cellWorker.mjs', import.meta.url), { workerData: data });
83
85
  let stopped = false;
84
86
  return { send: (order, transfer = []) => { worker.postMessage(order, transfer as never); },
@@ -8,6 +8,7 @@ import type { Transport } from '@wildshard/engine/net/transport';
8
8
  import type { SimHost } from '@wildshard/engine/sim';
9
9
  import type { PlayerSim } from '@wildshard/engine/sim/playerSim';
10
10
  import { carryMotion, motionOf } from '@wildshard/engine/game/grid/simulation';
11
+ import { gridBoardLimitAt } from '@wildshard/engine/game/grid/rules';
11
12
  import type { GridAssembly, GridCell } from '@wildshard/engine/game/grid/assembly';
12
13
  import type { GridCollisionStrip } from '@wildshard/engine/game/grid/gridCollision';
13
14
  import { mountedPlayerOf } from '@wildshard/engine/game/riding/native';
@@ -87,6 +88,8 @@ export class RoadRoom implements CrossTarget {
87
88
  if (this.seats.has(entry.device)) return 'held';
88
89
  const player = this.host.addPlayer(entry.body, at, at.yaw);
89
90
  player.netName = entry.name;
91
+ // QA 11-15 row 8: the road's board cap is the page's (G60: 30 m/s on the deck, easing to 14 over a cell's strip); its frame is the world's
92
+ player.hoverSpeedLimit = () => gridBoardLimitAt(this.assembly, player.position);
90
93
  player.resetPose(at, at.yaw);
91
94
  if (motion !== undefined) carryMotion(motion, player);
92
95
  const seat: RoadSeat = { device: entry.device, name: entry.name, body: entry.body, transport, client: null, closeOff: null, holdEnds: null, asked: null, askedAt: 0, fall: new FallFloor(ROAD_FLOOR, true, at) };
@@ -25,16 +25,6 @@ export function worldSettings(channel: string, env: Readonly<Record<string, stri
25
25
  return { workers: Number(env['WORLD_WORKERS'] ?? start.workers), seats: Number(env['WORLD_SEATS'] ?? start.seats) };
26
26
  }
27
27
 
28
- /**
29
- * GC35 (J322, Jake 11-13: "World crossing should be on by default. There should never be any walls"): each worker hosts the road between
30
- * its cells unless `WORLD_CROSSING=off` (a bench's lone cells). Unset, or blank, is `worker`.
31
- */
32
- export function worldCrossing(value: string | undefined): boolean {
33
- if (value === undefined || value === '' || value === 'worker') return true;
34
- if (value === 'off') return false;
35
- throw new Error(`WORLD_CROSSING=${value}: only worker (the default) or off`);
36
- }
37
-
38
28
  /** SC8: a cell's awake cost in ms per tick (measured, or an Open Plot's when it has none). */
39
29
  export function cellCost(slug: string): number { return COST.get(slug) ?? UNMEASURED; }
40
30
 
@@ -122,7 +122,7 @@ export interface WorldOptions {
122
122
  /** VH10: the pages a browser may open a socket from; `null` is any. The game's own hosts when absent. */
123
123
  readonly allowedOrigins?: readonly string[] | null;
124
124
  /**
125
- * GC15 (`WORLD_CROSSING=worker`): each worker hosts a road. SA34a: a placed cell then opens on the worker of its nearest open cell, whose
125
+ * J353: each worker hosts a road. SA34a: a placed cell then opens on the worker of its nearest open cell, whose
126
126
  * road hands a seat into it, and every worker's road is told of it; without roads it boots on a worker of its own (SA33).
127
127
  */
128
128
  readonly roads?: boolean;
@@ -146,6 +146,10 @@ export class World {
146
146
  /** The static table: which worker each cell is on (J182). */
147
147
  private readonly links = new Map<string, WorkerLink>();
148
148
  private readonly workers: WorkerLink[] = [];
149
+ /** The row each worker owns, retained for a planned replacement. */
150
+ private readonly workerSlugs = new Map<WorkerLink, readonly string[]>();
151
+ /** A replacement's old worker may exit without taking the whole server down. */
152
+ private readonly replacing = new Set<WorkerLink>();
149
153
  private readonly sockets = new Map<string, number>();
150
154
  private readonly connects = new Map<string, ConnectAttempt[]>();
151
155
  private readonly ends = new Set<SocketTransport>();
@@ -201,13 +205,16 @@ export class World {
201
205
  }
202
206
  /** A worker on its row. At startup its cells are in the table at once, and any failure ends the process (Q77). SA33: a `late` worker's cells
203
207
  * join the table only once it has booted, and one that fails to boot is let go with nobody seated on it; after its boot it is like any. */
204
- private bootWorker(slugs: readonly string[], late = false): Promise<void> {
205
- const link = this.options.boot(slugs), index = this.workers.push(link) - 1;
208
+ private bootWorker(slugs: readonly string[], late = false, slot?: number): Promise<void> {
209
+ const link = this.options.boot(slugs), index = slot ?? this.workers.push(link) - 1;
210
+ if (slot !== undefined) this.workers[slot] = link;
211
+ this.workerSlugs.set(link, slugs);
206
212
  if (!late) for (const slug of slugs) this.links.set(slug, link);
207
213
  let up = false;
208
214
  return new Promise((resolve, reject) => {
209
215
  const ended = (reason: string): void => {
210
- this.options.log({ at: 'worker.ended', index, slugs, reason }); reject(new Error(reason)); this.up.delete(link); this.resident.delete(link);
216
+ this.options.log({ at: 'worker.ended', index, slugs, reason }); reject(new Error(reason)); this.up.delete(link); this.resident.delete(link); this.stands.delete(link); this.workerSlugs.delete(link);
217
+ if (this.replacing.delete(link)) return;
211
218
  if (late && !up) { link.stop(); if (this.workers.at(-1) === link) this.workers.pop(); return; }
212
219
  this.options.crashed(new Error(reason));
213
220
  };
@@ -217,6 +224,33 @@ export class World {
217
224
  }, ended);
218
225
  });
219
226
  }
227
+ /** MP1.3: replace an idle worker without exposing a process or host control surface. Seats need the drain/reconnect half first. */
228
+ async restartWorker(index: number): Promise<void> {
229
+ const old = this.workers[index], slugs = old === undefined ? undefined : this.workerSlugs.get(old);
230
+ if (old === undefined || slugs === undefined) throw new Error(`No worker ${String(index)}`);
231
+ if ([...this.seated.values()].some(slug => this.linkOf(slug) === old)) throw new Error('A worker with seated players needs drain and reconnect');
232
+ this.options.log({ at: 'worker.restarting', index, slugs });
233
+ this.replacing.add(old); this.up.delete(old); this.resident.delete(old); this.stands.delete(old); old.stop();
234
+ await this.bootWorker(slugs, false, index);
235
+ this.openRoads();
236
+ }
237
+ /** MP1.3: drain one worker's seats through their normal save-and-redial path, then replace only that worker. */
238
+ async restartDrainedWorker(index: number): Promise<void> {
239
+ const old = this.workers[index], slugs = old === undefined ? undefined : this.workerSlugs.get(old);
240
+ if (old === undefined || slugs === undefined) throw new Error(`No worker ${String(index)}`);
241
+ this.options.log({ at: 'worker.draining', index, slugs });
242
+ const drained = new Promise<void>(resolve => {
243
+ const timer = this.scope.timeout(DRAIN_MS, resolve);
244
+ this.drains.set(index, () => { this.scope.cancelTimer(timer); resolve(); });
245
+ old.send({ kind: 'drain', leave: true });
246
+ });
247
+ await drained;
248
+ if (!await this.options.saves.drain(DRAIN_MS)) throw new Error('Worker save drain timed out');
249
+ if ([...this.seated.values()].some(slug => this.linkOf(slug) === old)) throw new Error('Worker drain left seated players');
250
+ this.replacing.add(old); this.up.delete(old); this.resident.delete(old); this.stands.delete(old); old.stop();
251
+ await this.bootWorker(slugs, false, index);
252
+ this.openRoads();
253
+ }
220
254
  /**
221
255
  * SA33: open cells on a running world (a placement the API made, J314) on a worker of their own. No other worker is told anything, so every
222
256
  * player in another cell stays where they are, and the door seats a player in a new cell only once its worker has booted. A cell this world
@@ -460,7 +494,7 @@ export class World {
460
494
  }
461
495
  /**
462
496
  * GC15: a seat's feet left cell `from` for `to`. On the same worker the door reads their save on `to`'s shard and orders the move, which
463
- * keeps the seat and the socket. A cell and its worker's road (`WORLD_CROSSING`) cross the same way, with no save to read for the road. Between workers nothing moves yet (GC15 (3): `exportPlayer`/`importPlayer` and re-pointing the socket).
497
+ * keeps the seat and the socket. A cell and its worker's road cross the same way, with no save to read for the road. Between workers nothing moves yet (GC15 (3): `exportPlayer`/`importPlayer` and re-pointing the socket).
464
498
  */
465
499
  private async crossing(from: string, device: string, to: string, at: ResumeAt): Promise<void> {
466
500
  const link = this.linkOf(to), name = this.names.get(device);
@@ -64,7 +64,7 @@ export interface CellWorld extends GridResident {
64
64
  /** What a host lends a cell it opens. */
65
65
  export interface CellWorldOptions {
66
66
  readonly saves: SaveStore;
67
- /** A cell with no road around it (a one-shard page, `WORLD_CROSSING=off`): its fall floor sets a player back on the ground they last
67
+ /** A one-shard page's fall floor sets a player back on the ground they last
68
68
  * stood on instead of a death. It has no edge walls (GC36, J322), so past its edge a player falls to that floor. */
69
69
  readonly lone: boolean;
70
70
  /** C6: a room holds every solid, since no one list can follow every player. Left out, a native world keeps its solids near its lead. */
@@ -218,7 +218,7 @@ export class StandaloneGrid {
218
218
  netWorldInput(routes, inputs); netBuys(routes, inputs);
219
219
  const stepping = sessionPlayer(this.grid.hostOf(site));
220
220
  this.grid.hostOf(site).physics.near?.update(stepping.position.x, stepping.position.z);
221
- if (world === undefined) this.grid.stepSite(site, commandsOf(inputs)); else world.step(inputs);
221
+ if (world === undefined) this.grid.stepSite(site, commandsOf(inputs)); else { this.grid.capBoards(site); world.step(inputs); }
222
222
  const host = this.grid.hostOf(site), player = sessionPlayer(host);
223
223
  // The page used to catch a fall, on its own body. The server's world has nothing below it, so it would fall for ever.
224
224
  world?.fall.step(player, () => { host.combat.fall(player.health, player.position, { kind: 'out-of-world', label: '' }); });
@@ -16,6 +16,12 @@ export interface LoadingWaitEntry {
16
16
  retryNavigation?: boolean;
17
17
  /** Exact transport identity for diagnostics; never the human work caption. */
18
18
  resource?: string;
19
+ /** FM6 (meta MMO-FAILURE-MODES-PLAN modes 33 to 35, 43, 44): the failure catalogue's ids for this wait (`packs-5xx`, `packs-429`,
20
+ * `book-5xx`, `storage-full`, `packs-5xx pack-broken`) and the line a player reads for it, with no address or raw error. */
21
+ failmode?: string;
22
+ line?: string;
23
+ /** A retry actually scheduled for this time (`diagnosticNow`): the card counts down to it. None scheduled, no countdown. */
24
+ dueAt?: number;
19
25
  }
20
26
  export interface LoadingWaitState { version: 1; sequence: number; pending: Map<number, LoadingWaitEntry> }
21
27
  const loadingWaitKey = Symbol.for('engine.loading.waits.v1');
@@ -40,7 +46,7 @@ export function loadingWaitState(target: object = waitCarrier()): LoadingWaitSta
40
46
  const state: LoadingWaitState = { version: 1, sequence: 0, pending: new Map() };
41
47
  Reflect.set(target, loadingWaitKey, state); return state;
42
48
  }
43
- export type LoadingWaitOptions = Partial<Pick<LoadingWaitEntry, 'kind' | 'step' | 'owner' | 'startedAt' | 'progressAt' | 'loadedBytes' | 'totalBytes' | 'retry' | 'inline' | 'resource' | 'retryNavigation'>>;
49
+ export type LoadingWaitOptions = Partial<Pick<LoadingWaitEntry, 'kind' | 'step' | 'owner' | 'startedAt' | 'progressAt' | 'loadedBytes' | 'totalBytes' | 'retry' | 'inline' | 'resource' | 'retryNavigation' | 'failmode' | 'line' | 'dueAt'>>;
44
50
  /** Register work without changing its lifetime or concurrency. Only an explicit
45
51
  * failed-operation callback offers RETRY; pending work never implies reload. */
46
52
  export function beginLoadingWait(label: string, options: LoadingWaitOptions = {}): number {
@@ -49,7 +55,9 @@ export function beginLoadingWait(label: string, options: LoadingWaitOptions = {}
49
55
  startedAt: options.startedAt ?? now, progressAt: options.progressAt ?? now, loadedBytes: options.loadedBytes ?? 0,
50
56
  totalBytes: options.totalBytes ?? null, retry: options.retry ?? null,
51
57
  progress: '', inline: options.inline ?? false, ...(options.resource === undefined ? {} : {resource: options.resource}),
52
- ...(options.retryNavigation === undefined ? {} : {retryNavigation: options.retryNavigation}) });
58
+ ...(options.retryNavigation === undefined ? {} : {retryNavigation: options.retryNavigation}),
59
+ ...(options.failmode === undefined ? {} : {failmode: options.failmode}), ...(options.line === undefined ? {} : {line: options.line}),
60
+ ...(options.dueAt === undefined ? {} : {dueAt: options.dueAt}) });
53
61
  return id;
54
62
  }
55
63
  /** Only real byte growth or a semantic progress-key change changes the reported progress age. */
@@ -22,6 +22,9 @@ export const CELL_ABOVE: number = contentBounds.CELL_ABOVE;
22
22
  export const CONTENT_MB: 1000000 = contentBounds.CONTENT_MB;
23
23
  /** Provisional phone caps v1 (SF22a); shadow draws count in each draw cap. */
24
24
  export const CONTENT_CAPS: { readonly l0: { readonly size: 62.5; readonly resident: number; readonly compressed: number; readonly triangles: 40000; readonly draws: 8; }; readonly l1: { readonly size: 125; readonly resident: number; readonly compressed: number; readonly triangles: 10000; readonly draws: 2; }; readonly far: { readonly resident: number; readonly compressed: 1000000; readonly triangles: 8000; readonly draws: 1; }; readonly library: { readonly resident: number; readonly compressed: number; }; readonly sim: { readonly resident: number; readonly compressed: number; }; readonly engineBase: number; readonly playing: number; readonly loading: number; readonly l0Count: 40; readonly l1Count: 32; readonly farCount: 9; readonly simCount: 4; readonly libraryCount: 4; readonly overlap: number; readonly residentFactor: 1.11; readonly nearRadius: 150; readonly shadowRadius: 80; readonly pitch: 562.5; } = contentBounds.CONTENT_CAPS;
25
+ /** GC13: the phone tier's playing envelope, G65's 1.0 GB (the shared caps' Explorer figure is 1.2 GB until SHARD-PLATFORM
26
+ * closes): a phone page admits, retains and evicts against this, so a straight walk stays under it. */
27
+ export const PHONE_PLAYING_BYTES: number = 1000 * contentBounds.CONTENT_MB;
25
28
 
26
29
  export const TERRAIN_RES = 256; // vertices per side
27
30
 
@@ -1,9 +1,9 @@
1
- /** Base cruise is 14 m/s standalone or a grid cap ≤ 30. Developer boost gives 4× interiors and 2× roads, easing over strips. */
1
+ /** Base cruise is 14 m/s standalone or a grid cap ≤ 30. Developer boost is 4× everywhere: 56 in a shard, 120 on the road (J-road-4x). */
2
2
  export function hoverSpeed(limit?: number, boost = false): number {
3
3
  const base = limit ?? 14;
4
4
  if (!Number.isFinite(base) || base <= 0 || base > 30) throw new RangeError('Invalid hover speed cap');
5
- // Keep the strip smooth between 4× interior (56) and 2× road (60).
6
- return boost ? base <= 14 ? base * 4 : 56 + (base - 14) / 4 : base;
5
+ // Jake 11-15 12:10: "Road push should be a 4x as well. So this should go to 120". 4× of the cap stays smooth over the strip.
6
+ return boost ? base * 4 : base;
7
7
  }
8
8
 
9
9
  /** m/s² the board loses gliding with no input, at or below the 14 m/s standalone cruise (25 % of its acceleration). */
@@ -15,14 +15,29 @@ const optionsOf = (schema: Node): readonly Schema[] => schema['options'] as Sche
15
15
  const lazy = (schema: Node, input: unknown): Schema => (schema['getter'] as (input: unknown) => Schema)(input);
16
16
  /** A lazy getter that cannot answer without its input: whatever it reaches is unknown. */
17
17
  const OPAQUE: Node = { type: 'opaque' };
18
+ /** A lazy getter that takes no input answers the same for every value: its answer, once per lazy schema. */
19
+ const resolvedLazies = new WeakMap<object, unknown>();
20
+ function inputFree(s: Node): unknown {
21
+ const getter = s['getter'];
22
+ if (typeof getter !== 'function' || getter.length > 0) return OPAQUE;
23
+ if (!resolvedLazies.has(s)) {
24
+ let answer: unknown = OPAQUE;
25
+ try { answer = (getter as () => unknown)(); } catch { /* a getter that throws without input is opaque */ }
26
+ resolvedLazies.set(s, answer);
27
+ }
28
+ return resolvedLazies.get(s);
29
+ }
18
30
  /** The schemas directly inside `schema`. A lazy one's is its getter's answer with no input. */
19
31
  function children(s: Node): unknown[] {
20
32
  const out: unknown[] = [];
21
33
  for (const key of ['wrapped', 'item', 'value', 'rest']) if (record(s[key])) out.push(s[key]);
22
34
  if (record(s['entries'])) out.push(...Object.values(s['entries']));
23
35
  for (const key of ['items', 'options']) if (Array.isArray(s[key])) out.push(...(s[key] as unknown[]).filter(record));
24
- // A lazy getter's answer can depend on its input: whatever it reaches is unknown until a real value resolves it.
25
- if (s.type === 'lazy') return [OPAQUE];
36
+ // A lazy getter's answer can depend on its input: whatever it reaches is unknown until a real value resolves it. One that
37
+ // declares no input can't (the JSON slots' recursive `v.lazy(() => …)`): its answer is walked like any child, so a save of
38
+ // plain JSON reaches no object and `known` / `keepUnknown` return it as is (NINE-DRAGON-BENCHMAX NB2: walking each boot
39
+ // trace write cost ~85 ms at CPU x4, ~24 s of Nine's shaders and firstFrame on NB1).
40
+ if (s.type === 'lazy') return [inputFree(s)];
26
41
  return out.filter(child => child === OPAQUE || (record(child) && child['kind'] === 'schema'));
27
42
  }
28
43
  /** Which object types a schema reaches, once per schema: `strict` for `known`, `objects` for `keepUnknown`. Most save
@@ -431,6 +431,26 @@ export const ENGINE_STRINGS = {
431
431
  "s_doctor_note": "Check every link the online world needs: this page, the signed release, the packs, the server and this browser.",
432
432
  "s_doctor_open": "Check connection",
433
433
  "s_doctor_failed": "Connection doctor",
434
+ "s_doctor_http_title": "The check didn't open",
435
+ "s_doctor_http_body": "The Connection check couldn't load just now. You're still here: try again, or go back to the game.",
436
+ "s_doctor_http_retry": "Try again",
437
+ "s_doctor_http_checking": "Checking…",
438
+ "s_doctor_http_back": "Back to the game",
439
+ "s_doctor_http_details": "Details",
440
+ "s_doctor_http_fact": "⟦0⟧. A check that opens says only that its page answered.",
441
+ "s_doctor_http_status": "HTTP ⟦0⟧",
442
+ "s_doctor_http_none": "No HTTP response",
443
+ "s_doctor_http_slow": "No answer in ⟦0⟧ s",
444
+ "s_download_failed_tag": "Download failed",
445
+ "s_download_failed_title": "The world didn't download",
446
+ "s_download_failed_body": "We tried ⟦0⟧ times and the files didn't arrive. What's already downloaded is kept, so the next try is quicker.",
447
+ "s_download_failed_retry": "Try again",
448
+ "s_download_failed_trying": "Trying…",
449
+ "s_download_failed_check": "Check connection",
450
+ "s_download_failed_copy": "Copy diagnostics",
451
+ "s_download_failed_copied": "Copied",
452
+ "s_download_failed_refused": "Copy refused",
453
+ "s_download_failed_details": "Details",
434
454
  "s_build_title": "Build",
435
455
  "s_build_running": "Running now",
436
456
  "s_build_check": "Check",
@@ -738,7 +758,8 @@ export const ENGINE_STRINGS = {
738
758
  "s_e94f3b418bf5": "Deletes the downloaded game files (every cache and the service worker) so the next load is a first visit. Keeps saves, settings and the review login.",
739
759
  "s_9c6373f9a730": "Sound effects: MOSS-SoundEffect v2 · Stable Audio 3 Medium — Powered by Stability AI",
740
760
  "s_ef691a454428": "Powered by Stability AI",
741
- "s_7fc7e56bbd7f": "Music: MiniMax-Music3"
761
+ "s_7fc7e56bbd7f": "Music: MiniMax-Music3",
762
+ "s_hover_boost": "Boost"
742
763
  } as const;
743
764
  export type EngineStringKey = keyof typeof ENGINE_STRINGS;
744
765
  const overrides: Partial<Record<EngineStringKey, string>> = {};
@@ -11,15 +11,16 @@ export interface PlacementFile {
11
11
  /** Rises with every write; an older file is never believed (J179). */
12
12
  readonly serial: number;
13
13
  /** SA47: `hash` is the channel pointer's shardfile (the raw upload), so a box whose build's book lacks the slug opens it from the
14
- * cook's `index/<build>/<hash>.json`. A file from before SA47 names none. */
15
- readonly cells: readonly { readonly instance: string; readonly slug: string; readonly cell: readonly [number, number]; readonly hash?: string }[];
14
+ * cook's `index/<build>/<hash>.json`. A file from before SA47 names none. `speedClass` is the grid row's (QA 11-15 row 8): the
15
+ * server reads no manifest, so a placed road-class cell keeps the page's 30 m/s board only when the file carries it. */
16
+ readonly cells: readonly { readonly instance: string; readonly slug: string; readonly cell: readonly [number, number]; readonly hash?: string; readonly speedClass?: 'road' }[];
16
17
  }
17
18
  const placedId = v.pipe(v.string(), v.regex(/^_?[a-z0-9]+(?:-[a-z0-9]+)*$/u), v.maxLength(64));
18
19
  const placedSpot = v.pipe(v.number(), v.integer());
19
20
  const placedHash = v.pipe(v.string(), v.regex(/^[a-f0-9]{64}$/u));
20
21
  /** A placement file's body, once its signature has held. The spot's bounds are `placeCell`'s. */
21
22
  export const PlacementSchema: v.GenericSchema<PlacementFile> = v.object({ kind: v.literal('placement'), channel: v.picklist(['production', 'staging']), serial: v.pipe(v.number(), v.integer(), v.minValue(0)),
22
- cells: v.pipe(v.array(v.object({ instance: placedId, slug: placedId, cell: v.tuple([placedSpot, placedSpot]), hash: v.exactOptional(placedHash) })), v.maxLength(49)) });
23
+ cells: v.pipe(v.array(v.object({ instance: placedId, slug: placedId, cell: v.tuple([placedSpot, placedSpot]), hash: v.exactOptional(placedHash), speedClass: v.exactOptional(v.literal('road')) })), v.maxLength(49)) });
23
24
  /** The file on R2: the body as signed, and its signature in hex (as the release file's, `releaseRows.ts`). */
24
25
  export const SignedPlacementSchema: v.GenericSchema<{ readonly body: string; readonly signature: string }> = v.object({ body: v.string(), signature: v.string() });
25
26
  /** The API's placement key (SA33a, `~/.config/wildshard/placement-signing-key.pub.pem`), SPKI DER in hex: the box's PLACEMENT_PUBLIC_KEY. */
@@ -25,6 +25,18 @@ export function gridBoardLimit(state: GridHoverState): number {
25
25
  const cap = gridHoverSpeed(state.local, state.shardCap, state.speedClass);
26
26
  return gridZone(state.local) === 'highway' && !state.onHighwayDeck ? state.shardCap : cap;
27
27
  }
28
+ /** What `gridBoardLimitAt` reads of a grid: its pitch and each placed cell's spot and speed class (`GridAssembly`). */
29
+ export interface GridHoverCells { readonly pitch: number; readonly cells: readonly { readonly cell: readonly [number, number]; readonly speedClass?: 'road' }[] }
30
+ /**
31
+ * The board's cap at world-frame feet on this grid: the in-page server's and a dedicated worker's road and cell rooms' one read of
32
+ * it, the same `gridBoardLimit` the page's `installGridHoverSpeed` reads, so prediction and authority agree (QA 11-15 row 8: G60's
33
+ * 30 m/s road, G39's 14 m/s shard, G540's road class).
34
+ */
35
+ export function gridBoardLimitAt(grid: GridHoverCells, feet: Readonly<GridPoint>, shardCap = 14): number {
36
+ finite(feet);
37
+ const p = grid.pitch, cx = Math.round(feet.x / p), cz = Math.round(feet.z / p), cell = grid.cells.find(row => row.cell[0] === cx && row.cell[1] === cz);
38
+ return gridBoardLimit({ local: { x: feet.x - cx * p, y: feet.y, z: feet.z - cz * p }, shardCap, onHighwayDeck: feet.y < 4, speedClass: cell?.speedClass ?? 'shard' });
39
+ }
28
40
  /** Minimal board port for standalone and residency policy; no Player or browser dependency enters here. */
29
41
  export interface GridHoverPort { hoverSpeedLimit: (() => number) | null }
30
42
  /** A directly opened padding shard uses its same authored road class; ordinary shards retain their existing port. */