@wildshard/engine 0.1.19 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lint/engine-sides.json +4 -0
  3. package/package.json +4 -2
  4. package/scripts/app-build/gen.ts +11 -0
  5. package/scripts/cell-mem-bench.mjs +2 -0
  6. package/scripts/check-devserver.mjs +1 -1
  7. package/scripts/grid-crossing-tour.mjs +11 -4
  8. package/scripts/grid-crossing-walk-proof.mjs +4 -2
  9. package/scripts/land.mjs +2 -1
  10. package/scripts/loading-flow/benchmax.mjs +34 -11
  11. package/scripts/loading-flow/deskbench.mjs +276 -0
  12. package/scripts/loading-flow/stalls.d.mts +17 -3
  13. package/scripts/loading-flow/stalls.mjs +82 -3
  14. package/scripts/nightly-model.ts +9 -6
  15. package/scripts/offline-proof.mjs +7 -1
  16. package/scripts/parity/boot-smoke.mjs +13 -2
  17. package/scripts/pin-format.ts +5 -2
  18. package/scripts/pins-reuse.d.mts +1 -0
  19. package/scripts/pins-reuse.mjs +22 -0
  20. package/scripts/scratch-dir.mjs +95 -0
  21. package/scripts/scratch-sweep.mjs +182 -0
  22. package/scripts/tsconfig.json +2 -12
  23. package/scripts/vps/harden-prometheus.sh +3 -0
  24. package/scripts/worktree-reap.mjs +54 -8
  25. package/scripts/worktree.mjs +19 -5
  26. package/src/client/engine/anim/rigParser.ts +2 -2
  27. package/src/client/engine/core/Game.ts +63 -19
  28. package/src/client/engine/core/gpuOnly.ts +10 -0
  29. package/src/client/engine/core/renderBudget.ts +134 -0
  30. package/src/client/engine/net/redial.ts +40 -5
  31. package/src/client/engine/render/dataLook.ts +70 -7
  32. package/src/client/engine/render/families/pbr.ts +2 -0
  33. package/src/client/engine/render/families/registry.ts +11 -2
  34. package/src/client/engine/render/families/sceneSurface.ts +116 -0
  35. package/src/client/engine/render/look.ts +7 -1
  36. package/src/client/engine/render/precompile.ts +4 -2
  37. package/src/client/engine/render/tiers.ts +4 -1
  38. package/src/client/engine/world/declaredProps.ts +5 -1
  39. package/src/client/engine/world/skyRig.ts +4 -1
  40. package/src/client/engine/world/terrainTileView.ts +64 -23
  41. package/src/client/game/devScene/hook.ts +149 -12
  42. package/src/client/game/devScene/liveLook.ts +21 -0
  43. package/src/client/game/grid/live.ts +45 -8
  44. package/src/client/game/grid/liveSession.ts +23 -4
  45. package/src/client/game/grid/pageEntry.ts +12 -1
  46. package/src/client/game/grid/productInputs.ts +22 -11
  47. package/src/client/game/grid/session.ts +13 -4
  48. package/src/client/game/session/finish.ts +4 -1
  49. package/src/client/game/shardfile/client.ts +24 -7
  50. package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
  51. package/src/client/game/shardfile/clientViews.ts +36 -8
  52. package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
  53. package/src/client/game/shardfile/groundMerge.ts +57 -5
  54. package/src/client/game/shardfile/hybrid.ts +2 -0
  55. package/src/client/game/shardfile/look.ts +1 -1
  56. package/src/client/game/shardfile/slabLibrary.ts +115 -49
  57. package/src/client/game/shardfile/tileContent.ts +1 -1
  58. package/src/client/game/shardfile/tileDriver.ts +38 -11
  59. package/src/client/game/shardfile/wirePage.ts +7 -3
  60. package/src/client/game/shardfile/worldScenes.ts +17 -10
  61. package/src/client/host/online/doctor.ts +20 -7
  62. package/src/client/host/online/doctorView.ts +2 -0
  63. package/src/client/host/online/linkScreens.ts +83 -5
  64. package/src/client/host/online/shell.ts +13 -4
  65. package/src/client/host/standalone/shell.ts +37 -1
  66. package/src/server/game/quest/eliteDrops.ts +7 -3
  67. package/src/server/game/riding/nativeTaming.ts +13 -2
  68. package/src/server/host/dedicated/cellHost.ts +14 -2
  69. package/src/server/host/dedicated/cellProtocol.ts +2 -0
  70. package/src/server/host/dedicated/dedicatedRoom.ts +24 -7
  71. package/src/server/host/dedicated/serverMetrics.ts +9 -0
  72. package/src/server/host/dedicated/workerTable.ts +31 -24
  73. package/src/server/host/standalone/serverHost.ts +56 -10
  74. package/src/server/host/standalone/serverProduct.ts +9 -7
  75. package/src/server/host/standalone/serverRuntime.ts +1 -1
  76. package/src/shared/engine/core/framePacing.ts +12 -1
  77. package/src/shared/engine/physics/terrainTiles.ts +20 -4
  78. package/src/shared/game/devColliders.ts +60 -0
  79. package/src/shared/game/devGameplay.ts +41 -0
package/CHANGELOG.md CHANGED
@@ -9,6 +9,14 @@ run `../repo-kit/release.sh vX.Y.Z --prepare` and `--finish` as before (the help
9
9
  `scripts/changelog.mjs` checks the format; the pre-push hook and CI refuse a push whose `package.json` version has no
10
10
  valid section, and a `vX.Y.Z` tag whose commit has none.
11
11
 
12
+ ## v0.1.20 (2026-11-14)
13
+
14
+ - Big desktop screens stay smoother: the game drops its render sharpness a step when frames run slow and raises it again when there is room.
15
+ - Walking into the next shard is faster: the shard ahead loads first, and you no longer freeze at the edge of a shard while it builds.
16
+ - Glowing parts of a shard, like lamps and lit windows, glow again in the new looks.
17
+ - A small chip tells you when your connection is slow or unstable, and coming back after a long time away shows a welcome back card.
18
+ - Behind the scenes: the server spreads busy shards across its workers by how much work each one costs, and its monitoring works again.
19
+
12
20
  ## v0.1.19 (2026-11-13)
13
21
 
14
22
  - Mossgate Hollow and Brasscap Mesa have new looks: sunset sky, warm lamps, mossy stone, and a beach edge on Mossgate's pond.
@@ -161,6 +161,7 @@
161
161
  "src/client/engine/core/scopedWorkerPool.ts": "client",
162
162
  "src/client/engine/core/shadowLayer.ts": "client",
163
163
  "src/client/engine/core/slowGpuPacing.ts": "client",
164
+ "src/client/engine/core/renderBudget.ts": "client",
164
165
  "src/client/engine/core/sustainedFrames.ts": "client",
165
166
  "src/client/engine/core/tier.ts": "client",
166
167
  "src/client/engine/core/Tour.ts": "client",
@@ -348,6 +349,7 @@
348
349
  "src/client/engine/render/families/painterly.ts": "client",
349
350
  "src/client/engine/render/families/pbr.ts": "client",
350
351
  "src/client/engine/render/families/registry.ts": "client",
352
+ "src/client/engine/render/families/sceneSurface.ts": "client",
351
353
  "src/client/engine/render/families/toon.ts": "client",
352
354
  "src/client/engine/render/fogPatches.ts": "client",
353
355
  "src/client/engine/render/frameCounter.ts": "client",
@@ -657,6 +659,7 @@
657
659
  "src/client/game/grid/memoryWarning.ts": "client",
658
660
  "src/client/game/grid/menu.ts": "client",
659
661
  "src/client/game/devScene/hook.ts": "client",
662
+ "src/client/game/devScene/liveLook.ts": "client",
660
663
  "src/client/game/grid/minimapBlend.ts": "client",
661
664
  "src/client/game/grid/nearGrain.ts": "client",
662
665
  "src/client/game/grid/nearPlaceholderPlan.ts": "client",
@@ -1604,6 +1607,7 @@
1604
1607
  "src/shared/engine/world/yawFrame.ts": "shared",
1605
1608
  "src/shared/game/achievements.ts": "shared",
1606
1609
  "src/shared/game/devColliders.ts": "shared",
1610
+ "src/shared/game/devGameplay.ts": "shared",
1607
1611
  "src/shared/game/ambient/flock.ts": "shared",
1608
1612
  "src/shared/game/animation/limbBlend.ts": "shared",
1609
1613
  "src/shared/game/animation/limbRig.ts": "shared",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/engine",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -67,7 +67,7 @@
67
67
  "@sentry/browser": "11.0.0",
68
68
  "@sentry/core": "11.0.0",
69
69
  "@valibot/to-json-schema": "1.8.0",
70
- "@wildshard/format": "npm:@wildshard/shard-format@^0.5.2",
70
+ "@wildshard/format": "npm:@wildshard/shard-format@^0.5.7",
71
71
  "@wildshard/wire": "^0.1.0",
72
72
  "ajv": "6.15.0",
73
73
  "fflate": "0.8.3",
@@ -531,6 +531,7 @@
531
531
  "./world/csmLightBlock": "./src/client/engine/world/csmLightBlock.ts",
532
532
  "./world/shadowFilter": "./src/client/engine/world/shadowFilter.ts",
533
533
  "./render/families/registry": "./src/client/engine/render/families/registry.ts",
534
+ "./render/families/sceneSurface": "./src/client/engine/render/families/sceneSurface.ts",
534
535
  "./render/families/toon": "./src/client/engine/render/families/toon.ts",
535
536
  "./render/hoverboardGeometry": "./src/client/engine/render/hoverboardGeometry.ts",
536
537
  "./render/graph/colourFunction": "./src/client/engine/render/graph/colourFunction.ts",
@@ -893,6 +894,7 @@
893
894
  "./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
894
895
  "./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
895
896
  "./game/devColliders": "./src/shared/game/devColliders.ts",
897
+ "./game/devGameplay": "./src/shared/game/devGameplay.ts",
896
898
  "./game/grid/catalogueSlot": "./src/shared/game/grid/catalogueSlot.ts",
897
899
  "./game/grid/placedCells": "./src/client/game/grid/placedCells.ts",
898
900
  "./game/grid/placedCards": "./src/client/game/grid/placedCards.ts",
@@ -9,6 +9,7 @@ import { contentNamed, hashTree } from './assetHashes';
9
9
  import { copyRapierWasm } from '../../vite/rapier';
10
10
  import { copyBasisTranscoder } from './basis';
11
11
  import { publicBytesTableSource, assetVersionsTableSource } from '../boot-publication.mjs';
12
+ import { stalePinProducts } from '../pins-reuse.mjs';
12
13
 
13
14
  // /asset-index.json: every file under public/assets with its byte size, so the loading
14
15
  // screen can show real "x / y MB" totals for the files it has requested so far.
@@ -29,6 +30,16 @@ export function assetIndex(): string {
29
30
  // denominators need no fetch and `pnpm tsc` fails when a file a chunk declares disappears.
30
31
  const BYTES_TABLE = 'src/client/game/boot/bytes.generated.ts';
31
32
  function bytesModule(): string {
33
+ // A pinned product older than the pins (a tree installed before a pin bump) published its old mounts under public/:
34
+ // stamping them would put that revision's files back in the table, as lands from such worktrees did (Far Reach rev 1).
35
+ // Only land, which commits what this writes, refuses (`WS_STALE_PINS=refuse`, scripts/land.mjs); elsewhere it warns, since
36
+ // CI's ring-1 job installs its own pin list into out/ on purpose (main red 43568190100).
37
+ const stale = stalePinProducts('.');
38
+ if (stale.length > 0) {
39
+ const why = `out/ holds pinned products the pins no longer name (${stale.map(row => `${row.folder} revision ${String(row.revision)}`).join(', ')}): their public/ mounts would go into the boot stamps. Run \`pnpm pins\` in this tree, then gen:inputs again`;
40
+ if (process.env['WS_STALE_PINS'] === 'refuse') throw new Error(why);
41
+ console.warn(`gen:inputs: ${why}`);
42
+ }
32
43
  const rows = Object.fromEntries(Object.entries(JSON.parse(assetIndex()) as Record<string, number>).filter(([name]) => !name.endsWith('.DS_Store')));
33
44
  // The staged table is the baseline (HEAD's, unless a fix to it is staged on purpose), not the file a local run last
34
45
  // wrote: that may hold an older public/'s sizes.
@@ -109,6 +109,8 @@ async function phase(/** @type {number} */ seconds, /** @type {string[]} */ work
109
109
  tickP50: Math.max(0, ...ticks.map(row => row.p50)), tickP95: Math.max(0, ...ticks.map(row => row.p95)), tickP99: Math.max(0, ...ticks.map(row => row.p99)), tickMax: Math.max(0, ...ticks.map(row => row.max)),
110
110
  drops: ticks.reduce((total, row) => total + row.drops, 0), minTicksPerSecond: Math.min(60, ...ticks.map(row => row.ticksPerSecond)),
111
111
  awake: Math.max(0, ...samples.map(row => sum(row, 'wildshard_cells_awake'))), players: Math.max(0, ...samples.map(row => sum(row, 'wildshard_players'))),
112
+ // SC8: each cell's awake cost, the median of its worker's readings (mean ms per tick it was awake): `workerTable`'s weights.
113
+ cellMs: (() => { const by = /** @type {Record<string, number[]>} */ ({}); for (const row of ticks) for (const [slug, ms] of Object.entries(row.cellMs ?? {})) (by[slug] ??= []).push(/** @type {number} */ (ms)); return Object.fromEntries(Object.entries(by).map(([slug, list]) => [slug, Number(median(list).toFixed(3))])); })(),
112
114
  perThreadHeapMB: Object.fromEntries(Object.entries(last).filter(([name]) => name.startsWith('wildshard_thread_memory_bytes') && name.includes('kind="heap"')).map(([name, value]) => [/thread="([^"]+)"/u.exec(name)?.[1] ?? name, mb(value)])),
113
115
  };
114
116
  }
@@ -18,7 +18,7 @@ export function assertProductionBuild(directory) {
18
18
  const code = readFileSync(full, 'utf8');
19
19
  if (code.includes('__DEVSERVER__') || code.includes('__PREPARATION_ONLY__')) throw new Error('Production bundle contains an unsubstituted DEVSERVER or PREPARATION_ONLY define');
20
20
  // SHARD-SOURCE AP5 (J347): the dev hook (src/client/game/devScene/hook.ts) and its server half are DEVSERVER-only.
21
- for (const marker of ['__wildshardDevHook', 'wildshardDevColliders']) if (code.includes(marker)) throw new Error(`Production bundle ${file.name} contains the dev hook (${marker})`);
21
+ for (const marker of ['__wildshardDevHook', 'wildshardDevColliders', 'wildshardDevRestart', '__shardfileDevQuests']) if (code.includes(marker)) throw new Error(`Production bundle ${file.name} contains the dev hook (${marker})`);
22
22
  }
23
23
  }
24
24
  };
@@ -31,6 +31,8 @@ const base = flag('base', '').replace(/\/$/u, ''), out = absolute(flag('out', ''
31
31
  if (!/^https:\/\/preview\.wildshard\.io$|^http:\/\/127\.0\.0\.1:\d+$/u.test(base) || out === absolute('')) throw new Error('usage: grid-crossing-tour.mjs --base=<preview or loopback url> --out=<dir> [--engine=chromium|webkit] [--layout=phone] [--arcs=a:b,…] [--limit=n]');
32
32
  if (engineName !== 'chromium' && engineName !== 'webkit') throw new Error(`No engine ${engineName}`);
33
33
  const limit = Number(flag('limit', '400')), only = flag('arcs', '').split(',').filter(Boolean), cold = process.argv.includes('--cold'), lane = flag('lane', 'opus-gcm2'), hold = Number(flag('hold', '0')), laps = Number(flag('laps', '1'));
34
+ // --viewport=<w>x<h>@<dpr> (desktop): Jake's window is 2992x1434@2 (QA 11-14 row 6)
35
+ const desk = (/^(\d+)x(\d+)@([\d.]+)$/u.exec(flag('viewport', '1440x900@1')) ?? [0, '1440', '900', '1']).slice(1).map(Number);
34
36
  let currentLap = 1;
35
37
  mkdirSync(out, { recursive: true });
36
38
  const sleep = (/** @type {number} */ ms) => new Promise(resolve => { setTimeout(resolve, ms); });
@@ -52,11 +54,12 @@ for (const cell of cells) for (const [dx, dz] of [[1, 0], [-1, 0], [0, 1], [0, -
52
54
  if (next !== undefined) arcs.push({ from: cell.instance, to: next.instance, dx, dz, boost: dx + dz < 0 });
53
55
  }
54
56
  const wanted = only.length === 0 ? arcs : arcs.filter(arc => only.includes(`${arc.from}:${arc.to}`));
55
- const HOME = 'driftwood-isle', HOME_CARD = 'Driftwood Isle', EDGE_IN = 238, LEG_MS = 90_000, STUCK_MS = 1500;
57
+ // --in=<m>: how far inside its cell's edge each walk starts (default 12 m), so a walk from deeper in measures the pre-warm (GC6)
58
+ const HOME = 'driftwood-isle', HOME_CARD = 'Driftwood Isle', EDGE_IN = 250 - Number(flag('in', '12')), LEG_MS = 90_000, STUCK_MS = 1500;
56
59
 
57
60
  /** @type {Record<string, unknown>[]} */
58
61
  const crossings = [];
59
- const result = { lane, base, build, cold, engine: engineName, layout: phone ? 'phone 402x874 touch' : 'desktop 1440x900', at: new Date().toISOString(), arcs: wanted.length, crossings, errors: /** @type {string[]} */ ([]), reloads: 0, reentries: 0, lostPage: /** @type {Record<string, unknown>[]} */ ([]), note: '', untried: /** @type {string[]} */ ([]) };
62
+ const result = { lane, base, build, cold, engine: engineName, layout: phone ? 'phone 402x874 touch' : `desktop ${String(desk[0])}x${String(desk[1])}@${String(desk[2])}`, at: new Date().toISOString(), arcs: wanted.length, crossings, errors: /** @type {string[]} */ ([]), console: /** @type {string[]} */ ([]), reloads: 0, reentries: 0, lostPage: /** @type {Record<string, unknown>[]} */ ([]), note: '', untried: /** @type {string[]} */ ([]) };
60
63
  const save = () => writeFileSync(join(out, `${engineName}-${phone ? 'phone' : 'desktop'}-tour.json`), `${JSON.stringify(result, null, 2)}\n`);
61
64
  const browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true, args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist', '--enable-precise-memory-info'] : [] });
62
65
  let code = 1;
@@ -70,7 +73,7 @@ try {
70
73
  await context?.close();
71
74
  context = await browser.newContext(phone ? { viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, isMobile: engineName === 'chromium', hasTouch: true,
72
75
  userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1', ...cold ? { serviceWorkers: 'block' } : {} }
73
- : { viewport: { width: 1440, height: 900 }, ...cold ? { serviceWorkers: 'block' } : {} });
76
+ : { viewport: { width: desk[0], height: desk[1] }, deviceScaleFactor: desk[2], ...cold ? { serviceWorkers: 'block' } : {} });
74
77
  await saveFixture(context, { scope: 'device', key: 'firstPlayDone', data: true });
75
78
  await saveFixture(context, { scope: 'device', key: 'devMode', data: true });
76
79
  await saveFixture(context, { scope: 'global', key: 'settings', merge: true, data: phone ? { tier: 'phone', volume: 0 } : { volume: 0 } });
@@ -78,6 +81,8 @@ try {
78
81
  if (cold && engineName === 'chromium') await (await context.newCDPSession(page)).send('Network.setCacheDisabled', { cacheDisabled: true });
79
82
  const opened = page;
80
83
  page.on('pageerror', error => { if (result.errors.length < 20) result.errors.push(error.message.slice(0, 240)); });
84
+ // GC6: the page's own warnings name a stuck entry preparation (`[grid] <cell>: entry preparation on the road`)
85
+ page.on('console', message => { if ((message.type() === 'warning' || message.type() === 'error') && result.console.length < 60) result.console.push(`${message.type()} ${message.text().slice(0, 300)}`); });
81
86
  page.on('framenavigated', frame => { if (frame === opened.mainFrame()) navigations++; });
82
87
  };
83
88
  /** Into the grid by Driftwood's deck card, and the sampler on: at the start, and again when the tour is stranded in a cell it can't leave. */
@@ -107,7 +112,7 @@ try {
107
112
  q.samples.push({ t: Math.round(performance.now() - t0), x: Number(p.position.x.toFixed(2)), y: Number(p.position.y.toFixed(2)), z: Number(p.position.z.toFixed(2)), inside: st.inside,
108
113
  phase: lv?.crossing?.phase, ready: lv?.live?.gameplayReady, loading: st.cellLoading, step: st.cellStep?.step ?? null,
109
114
  // GC6: whether the crossing's target world (colliders and sim) is resident yet, and the world built ahead (GC5)
110
- built: q.target === undefined ? null : lv?.live?.residents?.includes(q.target) === true, ahead: lv?.live?.ahead?.instance ?? null,
115
+ built: q.target === undefined ? null : lv?.live?.residents?.includes(q.target) === true, ahead: lv?.live?.ahead?.instance ?? null, refused: lv?.live?.ahead?.refused ?? null, hy: st.hybrid ?? null, fc: W.__wildshard.world?.game?.frameCount ?? null, deferred: lv?.live?.ahead?.deferred ?? null, env: st.envelopeMB ?? null, pending: lv?.live?.pending ?? null,
111
116
  // GC13: the cells whose worlds the page holds, and what playing costs
112
117
  res: lv?.live?.residents ?? null, mb: st.playingMB ?? null,
113
118
  // GC12: how many closed walls show (only the ones the walker stands at)
@@ -196,6 +201,8 @@ try {
196
201
  // GC8: how long each `cell` step stood on the loading screen in this crossing (samples every 100 ms; a build before GC8 reads none)
197
202
  steps: speeds.reduce((/** @type {Record<string, number>} */ onScreen, x) => { if (x.t <= untilT && typeof x.r.step === 'string' && x.r.step !== '') onScreen[x.r.step] = (onScreen[x.r.step] ?? 0) + 100; return onScreen; }, {}),
198
203
  worstFrameMs: Math.max(0, ...near), jumps, lowestY: Math.min(...rows.map(r => r.y)), end: { inside: last.inside, x: last.x, y: last.y, z: last.z, phase: last.phase } });
204
+ // GC6: each crossing keeps its samples (every 500 ms), so its cause can be read from the json
205
+ row.trace = rows.filter((_, i) => i % 5 === 0).map(r => ({ t: r.t - tFrom, x: r.x, z: r.z, inside: r.inside, phase: r.phase, ready: r.ready, step: r.step, built: r.built, ahead: r.ahead, refused: r.refused, hy: r.hy, fc: r.fc, deferred: r.deferred, mb: r.mb, env: r.env, pending: r.pending, res: r.res }));
199
206
  // a failed crossing held on the road boosts back into the cell it left, so the tour goes on from there
200
207
  if (!row.ok && last.inside !== arc.from && last.inside !== arc.to) {
201
208
  await face(yaw + Math.PI); await page.keyboard.down('KeyW'); await page.keyboard.down('ShiftLeft');
@@ -26,6 +26,8 @@ const phone = process.argv.includes('--layout=phone'), solo = process.argv.inclu
26
26
  // it stands: jump into it, jump along it both ways, and boost-jump into it. A case holds when the page never enters the target
27
27
  // while its crossing is unready and the walker stays on the road, standing; entering once the neighbour is ready is the crossing.
28
28
  const breach = process.argv.includes('--breach');
29
+ // GC6: --viewport=<w>x<h>@<dpr> (desktop): Jake's window is 2992x1434@2 (QA 11-14 row 6)
30
+ const desk = (/^--viewport=(\d+)x(\d+)@([\d.]+)$/u.exec(process.argv.find(arg => arg.startsWith('--viewport=')) ?? '') ?? [0, '1440', '900', '1']).slice(1).map(Number);
29
31
  /** The page's memory now: JS heap (Chromium), the grid's resident and playing MB, the owner ledger's totals, the memory warning. */
30
32
  const MEMORY_READ = `(() => { const api = window.__wildshard; let ledger = null; try { const mem = ${pageMemoryAttributionExpression}; ledger = mem?.totals ? { gpuMB: Math.round(mem.totals.gpu / 1048576), ramMB: Math.round(mem.totals.ram / 1048576) } : null; } catch {}
31
33
  let grid = null; try { const st = api.shard.grid.state(); grid = { inside: st.inside, residentMB: st.residentMB, playingMB: st.playingMB }; } catch {}
@@ -33,7 +35,7 @@ const MEMORY_READ = `(() => { const api = window.__wildshard; let ledger = null;
33
35
  return { heapMB: performance.memory ? Math.round(performance.memory.usedJSHeapSize / 1048576) : null, ledger, grid, memoryWarning: warning !== null && warning.getClientRects().length > 0 }; })()`;
34
36
  /** @param {import('playwright').Browser} b */
35
37
  const newContext = b => b.newContext(phone ? { viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, isMobile: engineName === 'chromium', hasTouch: true,
36
- userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1' } : { viewport: { width: 1440, height: 900 } });
38
+ userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1' } : { viewport: { width: desk[0] ?? 1440, height: desk[1] ?? 900 }, deviceScaleFactor: desk[2] ?? 1 });
37
39
  mkdirSync(out, { recursive: true });
38
40
  /** Driftwood is cell [0, 0]; its same-worker neighbours Pine Hollow [0, 1] (+z, across the island from the spawn at z -194) and Sunscar
39
41
  * [-1, 0] (-x). Far Reach [0, -1] is sky islands: arriving at road height falls below its death floor (GC15b). */
@@ -70,7 +72,7 @@ const rig = served !== '' ? { base: served.replace(/\/$/, ''), close: () => Prom
70
72
  : await openRig({ dist, work, keyFile, pgBin: 'memory:', pgData: '', shard: HOME, more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid', crossing: true, workers });
71
73
  let code = 1, browser = /** @type {import('playwright').Browser | null} */ (null);
72
74
  /** @type {Record<string, unknown>} */
73
- const result = { lane: 'opus-gc15c', engine: engineName, layout: phone ? 'phone 402x874 touch' : 'desktop 1440x900', site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
75
+ const result = { lane: 'opus-gc15c', engine: engineName, layout: phone ? 'phone 402x874 touch' : `desktop ${String(desk[0])}x${String(desk[1])}@${String(desk[2])}`, site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
74
76
  try {
75
77
  let open = served !== '' ? { cells: 25 } : null;
76
78
  for (let tries = 0; tries < 300 && open === null; tries++) { open = await fetch(`http://127.0.0.1:${String(WORLD_PORT)}/health`).then(found => found.ok ? found.json() : null).catch(() => null); if (open === null) await sleep(200); }
package/scripts/land.mjs CHANGED
@@ -400,7 +400,8 @@ class Landing{
400
400
  regenerate(){
401
401
  if(!existsSync(join(this.root,GEN[0])))return;
402
402
  const before=this.holds('before gen:inputs');
403
- const ran=spawnSync(process.execPath,[...GEN],{cwd:this.root,env:this.env,encoding:'utf8',stdio:['ignore','pipe','pipe'],timeout:300_000,maxBuffer:64<<20});
403
+ // the stamps it writes are committed here, so stale pin output refuses instead of warning (gen.ts, stalePinProducts)
404
+ const ran=spawnSync(process.execPath,[...GEN],{cwd:this.root,env:{...this.env,WS_STALE_PINS:'refuse'},encoding:'utf8',stdio:['ignore','pipe','pipe'],timeout:300_000,maxBuffer:64<<20});
404
405
  const head=this.head();
405
406
  if(head!==before){
406
407
  this.receipt(`STOP ${GEN.join(' ')} moved HEAD ${short(before)} -> ${short(head)}`);
@@ -4,12 +4,13 @@
4
4
  // level download on packs, a cold profile: it enters a shard through the title as Jake does (SHARD SELECT, the card,
5
5
  // ENTER WORLD), then plays (walk 10 s, hoverboard at boost) and prints what Copy diagnostics would name:
6
6
  // · the load: control's time from the world page's navigation, the boot stages longest first, the named waits of 200 ms
7
- // or more, and every stretch of 200 ms or more inside readyFrame that no boot entry covers (NB3's "unlogged");
7
+ // or more, and every stretch of 100 ms or more inside readyFrame that no boot entry covers (NB3's "unlogged");
8
8
  // · the play: each 10 s and the whole window's fps, frame p50 / p95, gpu~ p50 / p95 (the game's own frame ring: a
9
9
  // frame's wait beyond its work and the cap, src/shared/engine/core/frameCost.ts), draws and triangles.
10
10
  // Indicative, not a phone: calibrate against the plan's phone table before trusting a ranking (NB1's done-when).
11
11
  // scripts/browser-lane.sh node scripts/loading-flow/benchmax.mjs --base <url> [--shard 'Nine'] [--throttle 4]
12
12
  // [--seconds 60] [--dpr 2] [--json <out.json>] [--profile <cpuprofile.json>]
13
+ // --window 1496x717@2: a desktop window (Jake's Mac, 2992x1434 device pixels) on the desktop tier instead of the phone (NB5).
13
14
  // --dpr: the render scale the game draws at (Graphics' saved pick; the viewport stays a 2x phone); NB5 reads 1 and 2.
14
15
  // --seconds 600: NINE-DRAGON-BENCHMAX NB5's sustained run, printed per minute.
15
16
  import { writeFileSync } from 'node:fs';
@@ -17,20 +18,24 @@ import { parseArgs } from 'node:util';
17
18
  import { chromium, devices } from 'playwright';
18
19
  import { KEYCHAIN_ARGS } from '../chromium-keychain.mjs';
19
20
  import { NAME_ASKED, developerSettings, saveFixture, levelDownloadFixtures, hideDeveloperOverlays } from '../debug-settings.mjs';
20
- import { bootTimelineEntries, CLOCK_MARK_EXPRESSION, profileAnchor, profileIdle, stageStalls, STALL_IDLE_SHARE, STALL_WINDOW_MS } from './stalls.mjs';
21
+ import { bootTimelineEntries, clockMarkExpression, profileAnchor, profileIdle, stageStalls, STALL_IDLE_SHARE, STALL_WINDOW_MS } from './stalls.mjs';
21
22
 
22
23
  const { values } = parseArgs({ options: { base: { type: 'string' }, shard: { type: 'string', default: 'Nine' }, throttle: { type: 'string', default: '4' },
23
24
  seconds: { type: 'string', default: '60' }, json: { type: 'string' }, profile: { type: 'string' },
24
- dpr: { type: 'string', default: '2' } } });
25
+ dpr: { type: 'string', default: '2' }, window: { type: 'string' } } });
25
26
  if (values.base === undefined) { console.error('usage: benchmax.mjs --base <url> [--shard <card title regex>] [--throttle 4] [--seconds 60] [--dpr 2] [--json <file>] [--profile <file>]'); process.exit(2); }
27
+ // --window <css W>x<css H>@<scale>: a desktop browser window instead of the phone (NB5, Jake's Mac: 1496x717@2 is 2992x1434), desktop tier
28
+ const desktop = /^(\d+)x(\d+)@([\d.]+)$/u.exec(values.window ?? '');
29
+ if (values.window !== undefined && desktop === null) { console.error('--window wants <W>x<H>@<scale>, e.g. 1496x717@2'); process.exit(2); }
26
30
  const base = values.base.replace(/\/$/u, ''), shard = new RegExp(values.shard ?? 'Nine', 'iu'), throttle = Number(values.throttle), seconds = Number(values.seconds);
27
31
  /** @param {number} ms */
28
32
  const sleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
29
33
 
30
34
  const browser = await chromium.launch({ headless: true, args: [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] });
31
35
  try {
32
- const context = await browser.newContext({ ...devices['iPhone 16 Pro'], viewport: { width: 402, height: 874 }, deviceScaleFactor: 2 });
33
- await developerSettings(context, { tier: 'phone', volume: 0 });
36
+ const context = desktop === null ? await browser.newContext({ ...devices['iPhone 16 Pro'], viewport: { width: 402, height: 874 }, deviceScaleFactor: 2 })
37
+ : await browser.newContext({ viewport: { width: Number(desktop[1]), height: Number(desktop[2]) }, deviceScaleFactor: Number(desktop[3]) });
38
+ await developerSettings(context, { tier: desktop === null ? 'phone' : 'desktop', volume: 0 });
34
39
  await saveFixture(context, { scope: 'global', key: 'gfx', data: { dpr: values.dpr ?? '2', aa: 'auto' } });
35
40
  for (const fixture of levelDownloadFixtures('packs')) await saveFixture(context, fixture);
36
41
  // a phone's first PLAY goes straight to Driftwood's first-play card (MOBILE-GRAPHICS MG5): this device has done it
@@ -69,7 +74,7 @@ try {
69
74
  if (!await until(control, 240_000)) throw new Error('never reached control');
70
75
  if (values.profile !== undefined) {
71
76
  // the profile's end is the page's `performance.now()` read just before the stop (its clock is the profiler's own)
72
- const markPageMs = Number(await page.evaluate(CLOCK_MARK_EXPRESSION)), pageEnd = await page.evaluate('performance.now()');
77
+ const markPageMs = Number(await page.evaluate(clockMarkExpression())), pageEnd = await page.evaluate('performance.now()');
73
78
  const { profile } = await cdp.send('Profiler.stop');
74
79
  writeFileSync(values.profile, JSON.stringify({ pageEnd, profile }));
75
80
  // NB6: the ring-1 stall ratchet's own reading of this load (stalls.mjs), every load stage
@@ -90,8 +95,8 @@ try {
90
95
  const inside = done.filter(e => e !== ready && !e.op.startsWith('stage:') && e.start < ready.start + ready.ms && e.start + e.ms > ready.start)
91
96
  .map(e => [Math.max(e.start, ready.start), Math.min(e.start + e.ms, ready.start + ready.ms)]).sort((a, b) => a[0] - b[0]);
92
97
  let at = ready.start;
93
- for (const [from, to] of inside) { if (from - at >= 200) gaps.push({ from: at - ready.start, ms: from - at }); at = Math.max(at, to); }
94
- if (ready.start + ready.ms - at >= 200) gaps.push({ from: at - ready.start, ms: ready.start + ready.ms - at });
98
+ for (const [from, to] of inside) { if (from - at >= 100) gaps.push({ from: at - ready.start, ms: from - at }); at = Math.max(at, to); }
99
+ if (ready.start + ready.ms - at >= 100) gaps.push({ from: at - ready.start, ms: ready.start + ready.ms - at });
95
100
  }
96
101
  const control = entries.find(e => e.operation === 'app:control-ready')?.start ?? Number.NaN, first = Math.min(...stage.map(e => e.start));
97
102
  const timeline = entries.map(e => ({ op: e.operation, realm: e.realm, start: Math.round(e.start), ms: e.end === null ? null : Math.round(e.end - e.start), result: e.result }));
@@ -100,7 +105,20 @@ try {
100
105
  && e.start >= ready.start && e.start < ready.start + ready.ms).map(e => ({ op: e.op, from: e.start - ready.start, ms: e.ms }));
101
106
  // NB4: the boot's script memory bank against what the page took from it by control (fixedMemory.ts census)
102
107
  const scriptMemory = window.__wildshard?.scriptMemory?.() ?? null;
103
- return { phases: { control, firstStage: first }, stage, waits, readyGaps: gaps, readyParts, scriptMemory, timeline };
108
+ // NB3's cut: the settle's per-tile attaches (tileDriver's DL21 measure), by content: how many, their summed and longest ms
109
+ // (FENCE_LANES run at once, so the sum exceeds the span), and the attaches' own wall span
110
+ const attaches = performance.getEntriesByName('wildshard.tile.attach'), byContent = new Map();
111
+ for (const a of attaches) for (const [id, ms] of Object.entries(a.detail?.contents ?? {})) {
112
+ const row = byContent.get(id) ?? { id, n: 0, ms: 0, max: 0 }; row.n++; row.ms += ms; row.max = Math.max(row.max, ms); byContent.set(id, row); }
113
+ const attachSpan = attaches.length === 0 ? 0 : Math.max(...attaches.map(a => a.startTime + a.duration)) - Math.min(...attaches.map(a => a.startTime));
114
+ // DL21's Developer split of each slab part's geometry warm (Game.warmSceneRoots): its prepare and its parked draws
115
+ const warm = Object.fromEntries(['prepare', 'draws'].map(part => { const list = performance.getEntriesByName('wildshard.warm.geometry-' + part);
116
+ return [part, { n: list.length, ms: list.reduce((sum, e) => sum + e.duration, 0) }]; }));
117
+ const raw = ['wildshard.tile.attach', 'wildshard.warm.geometry-prepare', 'wildshard.warm.geometry-draws'].flatMap(n => performance.getEntriesByName(n)
118
+ .map(e => ({ n: n.split('.').pop(), start: Math.round(e.startTime), ms: Math.round(e.duration), key: e.detail?.key, layer: e.detail?.layer })));
119
+ const tileAttach = { raw, warm, tiles: attaches.length, span: attachSpan, contents: [...byContent.values()].sort((a, b) => b.ms - a.ms),
120
+ slowest: [...attaches].sort((a, b) => b.duration - a.duration).slice(0, 5).map(a => ({ key: a.detail?.key, layer: a.detail?.layer, ms: Math.round(a.duration), contents: a.detail?.contents })) };
121
+ return { phases: { control, firstStage: first }, stage, waits, readyGaps: gaps, readyParts, scriptMemory, tileAttach, timeline };
104
122
  })()`);
105
123
 
106
124
  // the play: walk 10 s, then the hoverboard at boost; the game's own frame ring, read every 250 ms
@@ -164,14 +182,19 @@ try {
164
182
  const s = ms => `${(ms / 1000).toFixed(1)} s`;
165
183
  /** @param {number} n */
166
184
  const f = n => n.toFixed(1);
167
- console.log(`benchmax: ${titles[target]} at ${base}, Chromium headless, CPU x${throttle}, 402x874 @2, packs, cold`);
185
+ console.log(`benchmax: ${titles[target]} at ${base}, Chromium headless, CPU x${throttle}, ${desktop === null ? '402x874 @2 (phone)' : `${desktop[1]}x${desktop[2]} @${desktop[3]} (desktop)`}, packs, cold`);
168
186
  console.log(`control ${s(load.phases.control)} after the world page's navigation · its first boot stage at ${s(load.phases.firstStage)}`);
169
187
  console.log('stages, longest first:'); for (const e of load.stage.slice(0, 10)) console.log(` ${e.op.slice(6).padEnd(16)} ${s(e.ms)}`);
170
188
  console.log('named waits >= 200 ms:'); for (const e of load.waits.slice(0, 10)) console.log(` ${e.op.slice(5, 90).padEnd(60)} ${s(e.ms)}`);
171
189
  console.log('readyFrame parts >= 100 ms:'); for (const e of load.readyParts.slice(0, 12)) console.log(` +${s(e.from)} ${e.op.slice(0, 60).padEnd(60)} ${s(e.ms)}`);
190
+ const ta = load.tileAttach;
191
+ console.log(`spawn-view tile attaches: ${ta.tiles} measures over ${s(ta.span)}, by content (count · sum · longest):`);
192
+ for (const row of ta.contents.slice(0, 12)) console.log(` ${String(row.id).padEnd(40)} ${String(row.n).padStart(3)} · ${s(row.ms)} · ${s(row.max)}`);
193
+ console.log(` geometry warms: prepare ${ta.warm.prepare.n} · ${s(ta.warm.prepare.ms)} · parked draws ${ta.warm.draws.n} · ${s(ta.warm.draws.ms)}`);
194
+ for (const row of ta.slowest.slice(0, 2)) console.log(` slowest tile ${row.key} ${row.layer} ${s(row.ms)}: ${Object.entries(row.contents ?? {}).sort((a, b) => b[1] - a[1]).slice(0, 4).map(([id, ms]) => `${id.slice(0, 28)} ${ms} ms`).join(', ')}`);
172
195
  const bank = (/** @type {{ hits: number, misses: number, retained: number } | null} */ m) => m === null ? 'n/a' : `hits ${m.hits} · misses ${m.misses} · retained ${m.retained}`;
173
196
  console.log(`script memory bank: at control ${bank(load.scriptMemory)} · after play ${bank(play.scriptMemory)}`);
174
- console.log(`readyFrame unlogged >= 200 ms: ${load.readyGaps.length === 0 ? 'none' : load.readyGaps.map((/** @type {{ ms: number, from: number }} */ g) => `${s(g.ms)} at +${s(g.from)}`).join(', ')}`);
197
+ console.log(`readyFrame unlogged >= 100 ms: ${load.readyGaps.length === 0 ? 'none' : load.readyGaps.map((/** @type {{ ms: number, from: number }} */ g) => `${s(g.ms)} at +${s(g.from)}`).join(', ')}`);
175
198
  console.log(`play ${seconds} s: ${f(play.all.fps)} fps · frame p50 ${f(play.all.p50)} / p95 ${f(play.all.p95)} ms · gpu~ p50 ${f(play.all.gpu50)} / p95 ${f(play.all.gpu95)} ms · ${play.draws} draws · ${(play.triangles / 1e6).toFixed(2)} M tris · pixel ratio ${play.pixelRatio}`);
176
199
  console.log('triangles by material (visible, in view):'); for (const row of where) console.log(` ${row.name.padEnd(48)} ${(row.tris / 1e6).toFixed(3)} M · ${row.draws} draws`);
177
200
  console.log(`shadow pass: ${shadow.draws} of ${shadow.allDraws} draws · ${(shadow.triangles / 1e6).toFixed(2)} of ${(shadow.allTriangles / 1e6).toFixed(2)} M tris`);