@wildshard/engine 0.1.22 → 0.1.24
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.
- package/CHANGELOG.md +15 -0
- package/index.html +17 -4
- package/lint/engine-sides.json +9 -0
- package/lint/sim-players.json +2 -13
- package/package.json +36 -3
- package/scripts/apfs-clone.mjs +5 -2
- package/scripts/app-build/catalogue.ts +39 -8
- package/scripts/app-build/serviceWorker.ts +4 -1
- package/scripts/app-build/splitOutput.mjs +33 -11
- package/scripts/app-build/titlePreloads.mjs +8 -5
- package/scripts/bake-road-surfaces.entry.ts +18 -0
- package/scripts/bake-road-surfaces.mjs +44 -0
- package/scripts/changelog.mjs +2 -1
- package/scripts/ci-pack.mjs +3 -3
- package/scripts/engine-ci-shard.mjs +11 -0
- package/scripts/fight-page-census.mjs +131 -0
- package/scripts/goldens/board.py +44 -11
- package/scripts/goldens/capture.mjs +18 -6
- package/scripts/goldens/native-residency.d.mts +2 -0
- package/scripts/goldens/native-residency.mjs +31 -4
- package/scripts/grid-road-lag.mjs +209 -0
- package/scripts/keep-copy.mjs +172 -0
- package/scripts/land.d.mts +4 -1
- package/scripts/land.mjs +121 -9
- package/scripts/lane-live.mjs +136 -0
- package/scripts/leftovers-report.mjs +47 -0
- package/scripts/loading-card-proof.mjs +42 -9
- package/scripts/loading-flow/benchmax.mjs +59 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- package/scripts/map-hash.mjs +1 -1
- package/scripts/mmo-bots.mjs +5 -3
- package/scripts/mmo-grid-proof.mjs +74 -0
- package/scripts/mmo-seat-proof.mjs +43 -0
- package/scripts/nightly-heads.ts +13 -13
- package/scripts/nightly-model.ts +26 -12
- package/scripts/nightly-tag.mjs +2 -4
- package/scripts/nightly.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- package/scripts/page-release/content.mjs +19 -10
- package/scripts/page-release/flow.d.mts +3 -2
- package/scripts/page-release/flow.mjs +31 -21
- package/scripts/page-release/packs.d.mts +5 -0
- package/scripts/page-release/packs.mjs +13 -3
- package/scripts/page-release/preview.d.mts +2 -0
- package/scripts/page-release/preview.mjs +74 -0
- package/scripts/page-release.mjs +13 -5
- package/scripts/physics-route.json +6 -6
- package/scripts/pins-reuse.mjs +1 -0
- package/scripts/pins-staging.ts +54 -0
- package/scripts/pins.ts +5 -0
- package/scripts/ring3.proof.ts +71 -0
- package/scripts/ring3.ts +100 -0
- package/scripts/road-drive-proof.mjs +269 -0
- package/scripts/road-memory-probe.mjs +129 -0
- package/scripts/scratch-dir.mjs +33 -14
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/github.mjs +59 -26
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +24 -2
- package/scripts/server-release/sign.mjs +8 -4
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -0
- package/scripts/test_prebuilt_output.py +3 -1
- package/scripts/tsconfig.json +2 -0
- package/scripts/turn-in-shots.mjs +83 -0
- package/scripts/vitest-bench-observe-proof.py +168 -0
- package/scripts/vitest-bench.py +122 -77
- package/scripts/vitest-ci-files.ts +5 -1
- package/scripts/vps/rebuild.sh +3 -1
- package/scripts/vps/wildshard-config +106 -1
- package/scripts/warm-native-chrome.mjs +9 -3
- package/scripts/worker-client-fights.mjs +9 -3
- package/scripts/worktree-reap.mjs +36 -140
- package/scripts/worktree.mjs +92 -12
- package/scripts/zone-gate-proof.mjs +93 -0
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/boot/sw.ts +3 -1
- package/src/client/engine/core/ktx2.ts +33 -10
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/models/place.ts +7 -5
- package/src/client/engine/pwa/sw.js +83 -10
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/render/precompile.ts +6 -0
- package/src/client/engine/render/tiers.ts +9 -0
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/engine/ui/playerReload.ts +5 -5
- package/src/client/game/audio/cueDirector.ts +2 -1
- package/src/client/game/boot/bytes.generated.ts +4 -1
- package/src/client/game/boot/versions.generated.ts +8 -5
- package/src/client/game/boss/arenaRoom.ts +4 -3
- package/src/client/game/boss/roamingProjection.ts +1 -1
- package/src/client/game/devScene/hook.ts +1 -1
- package/src/client/game/devScene/liveLook.ts +1 -1
- package/src/client/game/grid/cellClip.ts +70 -6
- package/src/client/game/grid/dataCellKit.ts +9 -1
- package/src/client/game/grid/gateCard.css +9 -0
- package/src/client/game/grid/gateCard.ts +67 -0
- package/src/client/game/grid/live.ts +17 -3
- package/src/client/game/grid/liveSession.ts +15 -5
- package/src/client/game/grid/neighbourLife.ts +10 -1
- package/src/client/game/grid/neighbourPanels.ts +29 -2
- package/src/client/game/grid/pageEntry.ts +21 -0
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/regionalWorld.ts +5 -0
- package/src/client/game/grid/roadCompressedSurfaces.ts +69 -0
- package/src/client/game/grid/roadLook.ts +5 -73
- package/src/client/game/grid/roadLookPlatform.ts +11 -6
- package/src/client/game/grid/roadSurfaceMaps.ts +80 -0
- package/src/client/game/grid/roadTilePool.ts +4 -0
- package/src/client/game/grid/session.ts +58 -16
- package/src/client/game/grid/softWallLook.ts +6 -1
- package/src/client/game/plugin/ui.ts +3 -0
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/session/play.ts +3 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientSource.ts +5 -2
- package/src/client/game/shardfile/clientWorker.ts +25 -8
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- package/src/client/game/shardfile/slabLibrary.ts +37 -0
- package/src/client/game/shardfile/slabRanges.ts +145 -0
- package/src/client/game/shardfile/wirePage.ts +5 -2
- package/src/client/game/shardfile/worldSceneTextures.ts +15 -9
- package/src/client/host/online/shell.ts +2 -2
- package/src/client/host/standalone/shell.ts +4 -1
- package/src/cook/game/cookWorker.ts +8 -5
- package/src/cook/game/tierTextures.ts +5 -3
- package/src/server/engine/net/simWorld.ts +3 -4
- package/src/server/game/grid/cellHome.ts +58 -0
- package/src/server/game/grid/simulation.ts +32 -8
- package/src/server/game/plugin/mover.ts +18 -14
- package/src/server/game/plugin/simulation.ts +2 -0
- package/src/server/game/shardfile/dataRespawn.ts +47 -0
- package/src/server/game/shardfile/declaredKitItems.ts +31 -7
- package/src/server/host/bake/headlessWorker.ts +3 -3
- package/src/server/host/dedicated/cellWorker.ts +4 -2
- package/src/server/host/dedicated/main.ts +7 -4
- package/src/server/host/dedicated/packReader.ts +15 -2
- package/src/server/host/dedicated/playerStore.ts +1 -1
- package/src/server/host/headlessRuntime.ts +11 -6
- package/src/server/host/standalone/cellWorld.ts +20 -6
- package/src/server/host/standalone/gridServer.ts +20 -6
- package/src/server/host/standalone/roadWorld.ts +36 -0
- package/src/server/host/standalone/serverHost.ts +2 -2
- package/src/shared/engine/entities/AnimalSim.ts +10 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/physics/transferWalls.ts +9 -4
- package/src/shared/engine/sim/snapshot.ts +5 -5
- package/src/shared/game/grid/allocator.ts +8 -1
- package/src/shared/game/grid/gateCount.ts +27 -0
- package/src/shared/game/grid/zoneWalls.ts +64 -0
- package/src/shared/game/ledger.ts +13 -4
- package/src/shared/game/loot/platformCatalogue.ts +14 -0
- package/src/shared/game/quest/ledger.ts +3 -3
- package/src/shared/game/shardfile/items.ts +9 -1
- package/src/shared/game/strings.ts +2 -0
- package/src/shared/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
- package/src/shared/host/standalone/harnessPlace.ts +4 -0
- package/src/test/engine/simState.ts +134 -0
- package/src/test/game/builtProduct.ts +6 -0
- package/src/test/game/headless/admittedProductCache.ts +61 -0
- package/src/test/game/headless/checkedReplayPipeline.ts +21 -0
- package/src/test/game/headless/nativeBounds.ts +27 -0
- package/src/test/game/headless/processUsage.ts +22 -0
- package/src/test/game/headless/productSession.ts +39 -0
- package/src/test/game/headless/ropeBodies.ts +60 -0
- package/src/test/game/headless/worker.ts +34 -0
- package/src/test/game/headlessNative.ts +114 -0
- package/src/test/game/headlessWorker.ts +43 -0
- package/src/test/tsconfig.game.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,21 @@ 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.24 (2026-11-15)
|
|
13
|
+
|
|
14
|
+
- A phone holding an old version no longer sits on "still waiting": the new version takes over by itself, even on bad Wi-Fi.
|
|
15
|
+
- New versions download in the background while you play and switch in on your next visit, never as a reload in the middle of a game.
|
|
16
|
+
- Reloading keeps you on the page you were on, such as a shard's own link, instead of going back to the main menu.
|
|
17
|
+
- When the title's loading bar stalls, it says what it is waiting for, and tapping reload fetches a fresh copy past the cache.
|
|
18
|
+
|
|
19
|
+
## v0.1.23 (2026-11-15)
|
|
20
|
+
|
|
21
|
+
- New and updated shards are cooked for the world again: since Saturday the cook refused every upload as over its space.
|
|
22
|
+
- Lamps carried by players and creatures move their light with them, and the 16 nearest lamps light the scene.
|
|
23
|
+
- Brasscap Mesa keeps its far view from the road, and a shard's creatures respawn where they were placed.
|
|
24
|
+
- You can take a melee weapon from its rack, and creatures in a shared shard stay in their own cell.
|
|
25
|
+
- The game's files now come from our content network, so the page is smaller and loads faster, and cached files survive a release.
|
|
26
|
+
|
|
12
27
|
## v0.1.22 (2026-11-15)
|
|
13
28
|
|
|
14
29
|
- Brasscap Mesa: you walk in with the lever-action in hand, its rack restocks your rounds, and every bandit and beast in the cell is drawn.
|
package/index.html
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
if (homeParams.size === 0) document.documentElement.classList.add('title-first');
|
|
224
224
|
if (document.documentElement.classList.contains('title-first')) {
|
|
225
225
|
const hero = document.createElement('link');
|
|
226
|
-
hero.rel = 'preload'; hero.as = 'image'; hero.
|
|
226
|
+
hero.rel = 'preload'; hero.as = 'image'; hero.setAttribute('fetchpriority', 'low');
|
|
227
227
|
// PZ19: the shell's hero is the ~30 kB first cut, so it no longer outruns the entry's code on a slow line; the title's
|
|
228
228
|
// own hero (mainMenu.ts) brings the full image in over it once the title is up
|
|
229
229
|
hero.href = titleAssetURLs['/assets/title/main-crossroads-' + (matchMedia('(orientation: portrait)').matches ? 'square' : 'landscape') + '-first.jpg'];
|
|
@@ -589,6 +589,16 @@ html[data-ws-keyboard] #game, html[data-ws-keyboard] #hud { top: var(--ws-kb-top
|
|
|
589
589
|
</head>
|
|
590
590
|
<body>
|
|
591
591
|
<script>
|
|
592
|
+
// STALESHELL (QA 11-15 row 32): the static shell's own reloads (its pill, the 12 s self-reload) go past the service worker,
|
|
593
|
+
// so a shell that worker can't finish booting is never served again: drop the registration (1.5 s at most), then reload this
|
|
594
|
+
// exact URL (Jake, 11-15: a reload keeps /slug/<x>). Offline it is a plain reload, so the cached build still answers.
|
|
595
|
+
globalThis.__wsShellReload = () => {
|
|
596
|
+
let gone = false;
|
|
597
|
+
const leave = () => { if (!gone) { gone = true; location.reload(); } };
|
|
598
|
+
if (!navigator.serviceWorker || navigator.onLine === false) return leave();
|
|
599
|
+
setTimeout(leave, 1500);
|
|
600
|
+
navigator.serviceWorker.getRegistrations().then(all => Promise.all(all.map(one => one.unregister()))).then(leave, leave);
|
|
601
|
+
};
|
|
592
602
|
// iOS Safari: no rubber-band scroll of the fixed page, no pinch zoom — the game owns every gesture.
|
|
593
603
|
document.addEventListener('touchmove', (e) => { if (!e.target.closest('[data-scroll]')) e.preventDefault(); }, { passive: false });
|
|
594
604
|
document.addEventListener('gesturestart', (e) => e.preventDefault());
|
|
@@ -610,7 +620,7 @@ html[data-ws-keyboard] #game, html[data-ws-keyboard] #hud { top: var(--ws-kb-top
|
|
|
610
620
|
<div class="ws-launch-hero" aria-hidden="true"></div>
|
|
611
621
|
<div class="ws-launch-brand">WILDSHARD</div>
|
|
612
622
|
<!-- plain HTML: a reload that works when every bundle failed; pointerup too, as iOS drops a jittered tap's click (Update.ts) -->
|
|
613
|
-
<button type="button" class="ws-launch-pill" data-launch-reload onclick="this.dataset.reloading='';location.reload()" onpointerup="this.dataset.reloading='';location.reload()"><i></i><span data-launch-version>reload</span></button>
|
|
623
|
+
<button type="button" class="ws-launch-pill" data-launch-reload onclick="this.dataset.reloading='';(globalThis.__wsShellReload||location.reload.bind(location))()" onpointerup="this.dataset.reloading='';(globalThis.__wsShellReload||location.reload.bind(location))()"><i></i><span data-launch-version>reload</span></button>
|
|
614
624
|
<div class="ws-launch-load" role="progressbar" aria-label="Loading" aria-valuemin="0" aria-valuemax="100" data-launch-load><div class="ws-launch-bar"><i data-launch-fill></i></div><span data-launch-step>Loading</span></div>
|
|
615
625
|
</div><!-- /title-shell -->
|
|
616
626
|
<script data-launch-progress>
|
|
@@ -642,7 +652,10 @@ html[data-ws-keyboard] #game, html[data-ws-keyboard] #hud { top: var(--ws-kb-top
|
|
|
642
652
|
const stalled = now - changed > 8000;
|
|
643
653
|
fill.style.width = pct + '%'; load.setAttribute('aria-valuenow', String(pct));
|
|
644
654
|
if (shell.hasAttribute('data-stalled') !== stalled) { shell.toggleAttribute('data-stalled', stalled); version.textContent = name(stalled); }
|
|
645
|
-
|
|
655
|
+
// STALESHELL: a stall names what it waits on, a file this document names (its hash dropped) or the code it starts
|
|
656
|
+
const missing = started ? undefined : [...files].find(href => !(t?.resources || []).some(row => row.url === href && row.responseStatus !== 0));
|
|
657
|
+
const waitingOn = opening ? 'the menu' : missing === undefined ? 'the game code' : (missing.split('/').pop() || '').replace(/-[A-Za-z0-9_-]{8}(?=\.\w+$)/u, '');
|
|
658
|
+
step.textContent = (stalled ? 'Still waiting on ' + waitingOn + ' · tap reload' : opening ? 'Opening the menu' : started ? 'Starting'
|
|
646
659
|
: got > 0 ? 'Loading · ' + got + ' of ' + files.size + ' files' : 'Loading') + ' · ' + (now / 1000).toFixed(1) + ' s';
|
|
647
660
|
};
|
|
648
661
|
const timer = setInterval(tick, 100); tick();
|
|
@@ -694,7 +707,7 @@ html[data-ws-keyboard] #game, html[data-ws-keyboard] #hud { top: var(--ws-kb-top
|
|
|
694
707
|
if (doc.keys?.['boot.selfReload']) return;
|
|
695
708
|
(doc.keys ??= {})['boot.selfReload'] = { v: 1, data: String(Date.now()) }; sessionStorage.setItem('wildshard.save.v2@1.session', JSON.stringify(doc));
|
|
696
709
|
} catch { return; }
|
|
697
|
-
location.reload();
|
|
710
|
+
(globalThis.__wsShellReload || location.reload.bind(location))();
|
|
698
711
|
}, 12000);
|
|
699
712
|
</script>
|
|
700
713
|
<script data-loading-clock>
|
package/lint/engine-sides.json
CHANGED
|
@@ -649,6 +649,7 @@
|
|
|
649
649
|
"src/client/game/grid/frameLook.ts": "client",
|
|
650
650
|
"src/client/game/grid/frameModel.ts": "client",
|
|
651
651
|
"src/client/game/grid/gridHud.ts": "client",
|
|
652
|
+
"src/client/game/grid/gateCard.ts": "client",
|
|
652
653
|
"src/client/game/grid/hazeBand.ts": "client",
|
|
653
654
|
"src/client/game/grid/homeCheckpoint.ts": "client",
|
|
654
655
|
"src/client/game/grid/homeMetadata.ts": "client",
|
|
@@ -701,6 +702,7 @@
|
|
|
701
702
|
"src/client/game/grid/roadGrain.ts": "client",
|
|
702
703
|
"src/client/game/grid/roadGrain.worker.ts": "client",
|
|
703
704
|
"src/client/game/grid/roadGrainPreparation.ts": "client",
|
|
705
|
+
"src/client/game/grid/roadCompressedSurfaces.ts": "client",
|
|
704
706
|
"src/client/game/grid/roadLook.ts": "client",
|
|
705
707
|
"src/client/game/grid/roadLookPlatform.ts": "client",
|
|
706
708
|
"src/client/game/grid/roadResources.ts": "client",
|
|
@@ -711,6 +713,7 @@
|
|
|
711
713
|
"src/client/game/grid/roadSignScale.ts": "client",
|
|
712
714
|
"src/client/game/grid/roadSky.ts": "client",
|
|
713
715
|
"src/client/game/grid/roadSolid.ts": "client",
|
|
716
|
+
"src/client/game/grid/roadSurfaceMaps.ts": "client",
|
|
714
717
|
"src/client/game/grid/roadTileArchive.ts": "client",
|
|
715
718
|
"src/client/game/grid/roadTileBacking.ts": "client",
|
|
716
719
|
"src/client/game/grid/roadTileCapture.worker.ts": "client",
|
|
@@ -1016,6 +1019,7 @@
|
|
|
1016
1019
|
"src/client/game/shardfile/skinLayerPlayback.ts": "client",
|
|
1017
1020
|
"src/client/game/shardfile/skinPlayback.ts": "client",
|
|
1018
1021
|
"src/client/game/shardfile/slabLibrary.ts": "client",
|
|
1022
|
+
"src/client/game/shardfile/slabRanges.ts": "client",
|
|
1019
1023
|
"src/client/game/shardfile/stillImage.ts": "client",
|
|
1020
1024
|
"src/client/game/shardfile/streamingView.ts": "client",
|
|
1021
1025
|
"src/client/game/shardfile/tileBufferedDraws.ts": "client",
|
|
@@ -1219,6 +1223,7 @@
|
|
|
1219
1223
|
"src/server/game/boss/slotsNative.ts": "server",
|
|
1220
1224
|
"src/server/game/boss/windEliteNative.ts": "server",
|
|
1221
1225
|
"src/server/game/grapple/native.ts": "server",
|
|
1226
|
+
"src/server/game/grid/cellHome.ts": "server",
|
|
1222
1227
|
"src/server/game/grid/durability.ts": "server",
|
|
1223
1228
|
"src/server/game/grid/room.ts": "server",
|
|
1224
1229
|
"src/server/game/grid/roomNet.ts": "server",
|
|
@@ -1285,6 +1290,7 @@
|
|
|
1285
1290
|
"src/server/game/shardfile/borrowedDecisions.ts": "server",
|
|
1286
1291
|
"src/server/game/shardfile/bossRow.ts": "server",
|
|
1287
1292
|
"src/server/game/shardfile/brainRuntime.ts": "server",
|
|
1293
|
+
"src/server/game/shardfile/dataRespawn.ts": "server",
|
|
1288
1294
|
"src/server/game/shardfile/decisions.ts": "server",
|
|
1289
1295
|
"src/server/game/shardfile/declaredClimate.ts": "server",
|
|
1290
1296
|
"src/server/game/shardfile/declaredKitItems.ts": "server",
|
|
@@ -1664,6 +1670,8 @@
|
|
|
1664
1670
|
"src/shared/game/grid/platformInputs.ts": "shared",
|
|
1665
1671
|
"src/shared/game/grid/postPairs.ts": "shared",
|
|
1666
1672
|
"src/shared/game/grid/readinessEdges.ts": "shared",
|
|
1673
|
+
"src/shared/game/grid/zoneWalls.ts": "shared",
|
|
1674
|
+
"src/shared/game/grid/gateCount.ts": "shared",
|
|
1667
1675
|
"src/shared/game/grid/recovery.ts": "shared",
|
|
1668
1676
|
"src/shared/game/grid/roadLayout.ts": "shared",
|
|
1669
1677
|
"src/shared/game/grid/roadRecovery.ts": "shared",
|
|
@@ -1691,6 +1699,7 @@
|
|
|
1691
1699
|
"src/shared/game/loot/exchange.ts": "shared",
|
|
1692
1700
|
"src/shared/game/loot/Owned.ts": "shared",
|
|
1693
1701
|
"src/shared/game/loot/ownedRows.ts": "shared",
|
|
1702
|
+
"src/shared/game/loot/platformCatalogue.ts": "shared",
|
|
1694
1703
|
"src/shared/game/loot/Purse.ts": "shared",
|
|
1695
1704
|
"src/shared/game/loot/tableRows.ts": "shared",
|
|
1696
1705
|
"src/shared/game/newGame.ts": "shared",
|
package/lint/sim-players.json
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"about": "P1-E5.2a: per-file reads of a one-player SimHost member (`members`, which ended at 0) and leadPlayer binds (`lead`: systems not yet per-player) in non-test source, by type, not by spelling (scripts/check-sim-players.mjs). They never rise.",
|
|
3
3
|
"members": 0,
|
|
4
|
-
"lead":
|
|
5
|
-
"files": {
|
|
6
|
-
"src/server/engine/net/simWorld.ts": 1,
|
|
7
|
-
"src/shared/engine/sim/snapshot.ts": 3,
|
|
8
|
-
"src/client/game/grid/copyPrompts.ts": 1,
|
|
9
|
-
"src/client/game/grid/neighbourPanels.ts": 1,
|
|
10
|
-
"src/server/game/grid/simulation.ts": 1,
|
|
11
|
-
"src/server/game/plugin/mover.ts": 2,
|
|
12
|
-
"src/server/host/bake/headlessWorker.ts": 1,
|
|
13
|
-
"src/shared/host/headlessJourney.ts": 1,
|
|
14
|
-
"src/server/host/headlessRuntime.ts": 1,
|
|
15
|
-
"src/shared/host/headlessTape.ts": 1
|
|
16
|
-
}
|
|
4
|
+
"lead": 0,
|
|
5
|
+
"files": {}
|
|
17
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
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.
|
|
70
|
+
"@wildshard/format": "npm:@wildshard/shard-format@^0.5.10",
|
|
71
71
|
"@wildshard/wire": "^0.1.0",
|
|
72
72
|
"ajv": "6.15.0",
|
|
73
73
|
"fflate": "0.8.3",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@types/three": "*",
|
|
86
86
|
"@typescript/typescript6": "6.0.2",
|
|
87
|
+
"playwright": "1.65.0",
|
|
87
88
|
"sharp": "0.35.5",
|
|
88
89
|
"vite": "8.3.0"
|
|
89
90
|
},
|
|
@@ -91,6 +92,9 @@
|
|
|
91
92
|
"@types/three": {
|
|
92
93
|
"optional": true
|
|
93
94
|
},
|
|
95
|
+
"playwright": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
94
98
|
"sharp": {
|
|
95
99
|
"optional": true
|
|
96
100
|
}
|
|
@@ -267,6 +271,7 @@
|
|
|
267
271
|
"./script/inputInboxV2": "./src/server/engine/script/inputInboxV2.ts",
|
|
268
272
|
"./render/programRetention": "./src/client/engine/render/programRetention.ts",
|
|
269
273
|
"./render/drawnEnvironment": "./src/client/engine/render/drawnEnvironment.ts",
|
|
274
|
+
"./render/drawNeutral": "./src/client/engine/render/drawNeutral.ts",
|
|
270
275
|
"./models/modelPose": "./src/client/engine/models/modelPose.ts",
|
|
271
276
|
"./models/ownedGeometry": "./src/client/engine/models/ownedGeometry.ts",
|
|
272
277
|
"./entities/bodyClear": "./src/server/engine/entities/bodyClear.ts",
|
|
@@ -820,6 +825,9 @@
|
|
|
820
825
|
"./game/population/perchBody": "./src/server/game/population/perchBody.ts",
|
|
821
826
|
"./game/population/productCreatures": "./src/client/game/population/productCreatures.ts",
|
|
822
827
|
"./game/quest/ledger": "./src/shared/game/quest/ledger.ts",
|
|
828
|
+
"./game/ledger": "./src/shared/game/ledger.ts",
|
|
829
|
+
"./game/grid/cellHome": "./src/server/game/grid/cellHome.ts",
|
|
830
|
+
"./game/loot/platformCatalogue": "./src/shared/game/loot/platformCatalogue.ts",
|
|
823
831
|
"./game/quest/legacyRecords": "./src/shared/game/quest/legacyRecords.ts",
|
|
824
832
|
"./game/shardfile/pageWater": "./src/client/game/shardfile/pageWater.ts",
|
|
825
833
|
"./game/shardfile/pagePreparation": "./src/client/game/shardfile/pagePreparation.ts",
|
|
@@ -893,6 +901,7 @@
|
|
|
893
901
|
"./game/grid/pageMode": "./src/shared/game/grid/pageMode.ts",
|
|
894
902
|
"./game/grid/gridCollision": "./src/shared/game/grid/gridCollision.ts",
|
|
895
903
|
"./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
|
|
904
|
+
"./game/grid/zoneWalls": "./src/shared/game/grid/zoneWalls.ts",
|
|
896
905
|
"./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
|
|
897
906
|
"./game/grid/rules": "./src/shared/game/grid/rules.ts",
|
|
898
907
|
"./game/devColliders": "./src/shared/game/devColliders.ts",
|
|
@@ -1293,7 +1302,31 @@
|
|
|
1293
1302
|
"./net/webSocketTransport": "./src/client/engine/net/webSocketTransport.ts",
|
|
1294
1303
|
"./net/otherPlayers": "./src/client/engine/net/otherPlayers.ts",
|
|
1295
1304
|
"./net/hurtOther": "./src/client/engine/net/hurtOther.ts",
|
|
1296
|
-
"./game/plugin/playerSeats": "./src/server/game/plugin/playerSeats.ts"
|
|
1305
|
+
"./game/plugin/playerSeats": "./src/server/game/plugin/playerSeats.ts",
|
|
1306
|
+
"./test/headless-native": "./src/test/game/headlessNative.ts",
|
|
1307
|
+
"./test/headless/checkedReplayPipeline": "./src/test/game/headless/checkedReplayPipeline.ts",
|
|
1308
|
+
"./test/headless/nativeBounds": "./src/test/game/headless/nativeBounds.ts",
|
|
1309
|
+
"./test/headless/ropeBodies": "./src/test/game/headless/ropeBodies.ts",
|
|
1310
|
+
"./test/headless/processUsage": "./src/test/game/headless/processUsage.ts",
|
|
1311
|
+
"./test/builtProduct": "./src/test/game/builtProduct.ts",
|
|
1312
|
+
"./test/simState": "./src/test/engine/simState.ts",
|
|
1313
|
+
"./test/headless-worker": "./src/test/game/headlessWorker.ts",
|
|
1314
|
+
"./test/headless/productSession": "./src/test/game/headless/productSession.ts",
|
|
1315
|
+
"./game/boss/headlessCloudBody": "./src/server/game/boss/headlessCloudBody.ts",
|
|
1316
|
+
"./game/riding/companions": "./src/shared/game/riding/companions.ts",
|
|
1317
|
+
"./game/boss/patrolNative": "./src/server/game/boss/patrolNative.ts",
|
|
1318
|
+
"./game/quest/chapterFlow": "./src/shared/game/quest/chapterFlow.ts",
|
|
1319
|
+
"./practice/lineup": "./src/client/engine/practice/lineup.ts",
|
|
1320
|
+
"./game/quest/effectPresentation": "./src/shared/game/quest/effectPresentation.ts",
|
|
1321
|
+
"./game/shardfile/nativeAssemblyHosts": "./src/server/game/shardfile/nativeAssemblyHosts.ts",
|
|
1322
|
+
"./game/boss/slotsNative": "./src/server/game/boss/slotsNative.ts",
|
|
1323
|
+
"./game/population/encounterBook": "./src/server/game/population/encounterBook.ts",
|
|
1324
|
+
"./game/population/encounterIntake": "./src/server/game/population/encounterIntake.ts",
|
|
1325
|
+
"./game/quest/chapterDecision": "./src/shared/game/quest/chapterDecision.ts",
|
|
1326
|
+
"./game/quest/questObservation": "./src/shared/game/quest/questObservation.ts",
|
|
1327
|
+
"./game/quest/chapterRecords": "./src/server/game/quest/chapterRecords.ts",
|
|
1328
|
+
"./game/boss/arenaCollision": "./src/shared/game/boss/arenaCollision.ts",
|
|
1329
|
+
"./game/boss/arenaGround": "./src/shared/game/boss/arenaGround.ts"
|
|
1297
1330
|
},
|
|
1298
1331
|
"sideEffects": [
|
|
1299
1332
|
"./src/client/**/*",
|
package/scripts/apfs-clone.mjs
CHANGED
|
@@ -48,10 +48,11 @@ function copyPair(source,target){
|
|
|
48
48
|
* Clone each `[source, target]` pair. Returns `clone` when every pair is an APFS clone, `copy` when some were copied.
|
|
49
49
|
* Throws when a source is a link, missing or neither a file nor a directory, or a target exists; a pair cloned before
|
|
50
50
|
* the failure stays.
|
|
51
|
-
*
|
|
51
|
+
* `copy:false` refuses unsupported cloning instead of allocating a full copy.
|
|
52
|
+
* @param {readonly (readonly [string,string])[]} pairs @param {{platform?:string,copy?:boolean}} [options]
|
|
52
53
|
* @returns {'clone'|'copy'|'none'}
|
|
53
54
|
*/
|
|
54
|
-
export function clonePaths(pairs,{platform=process.platform}={}){
|
|
55
|
+
export function clonePaths(pairs,{platform=process.platform,copy=true}={}){
|
|
55
56
|
if(pairs.length===0)return 'none';
|
|
56
57
|
let rest=pairs;
|
|
57
58
|
if(platform==='darwin'){
|
|
@@ -62,6 +63,8 @@ export function clonePaths(pairs,{platform=process.platform}={}){
|
|
|
62
63
|
if(!/Operation not supported|Cross-device link/u.test(reason))throw new Error(`clonefile: ${reason}`);
|
|
63
64
|
rest=pairs.filter(([,target])=>{try{lstatSync(target);return false;}catch{return true;}});
|
|
64
65
|
}
|
|
66
|
+
if(!copy&&rest.length>0)throw new Error('clonefile unavailable; copy disabled');
|
|
67
|
+
if(!copy)return 'clone';
|
|
65
68
|
for(const [source,target] of rest)copyPair(source,target);
|
|
66
69
|
return 'copy';
|
|
67
70
|
}
|
|
@@ -39,11 +39,14 @@ const readTitleRows = (outDir: string): readonly TitleManifest[] => {
|
|
|
39
39
|
};
|
|
40
40
|
const hash8 = (bytes: Uint8Array): string => createHash('sha256').update(bytes).digest('hex').slice(0, 8);
|
|
41
41
|
/** A title row from a shard's discovery document: `home` is an origin for a shard cooked to R2 (J138). */
|
|
42
|
-
export function titleRowOf(bytes: Uint8Array, home = ''): TitleManifest {
|
|
42
|
+
export function titleRowOf(bytes: Uint8Array, home = '', resourceSlug?: string): TitleManifest {
|
|
43
43
|
const {data} = JSON.parse(new TextDecoder().decode(bytes)) as {readonly data: TitleManifest};
|
|
44
|
-
const
|
|
44
|
+
const base = home.replace(/\/$/u, ''), from = `/shardfiles/${data.slug}/`, to = `/shardfiles/${resourceSlug ?? data.slug}/`;
|
|
45
|
+
// A stored cook serves blobs under its canonical identity (template),
|
|
46
|
+
// while an older discovery can still name its authored folder (_template).
|
|
47
|
+
const at = (url: string): string => (url.startsWith(from) ? `${base}${to}${url.slice(from.length)}` : url.startsWith('/shardfiles/') ? `${base}${url}` : url);
|
|
45
48
|
const {thumb, portrait, landscape} = data.card;
|
|
46
|
-
return {...titleMetadata(data), card: {thumb: at(thumb), portrait: at(portrait), landscape: at(landscape)}, discovery: `${
|
|
49
|
+
return {...titleMetadata(data), ...(data.shardfile === undefined ? {} : {shardfile: at(data.shardfile)}), card: {thumb: at(thumb), portrait: at(portrait), landscape: at(landscape)}, discovery: `${base}/shardfiles/${data.slug}/discovery.json?v=${hash8(bytes)}`};
|
|
47
50
|
}
|
|
48
51
|
/** Every built product's title row, in title order. */
|
|
49
52
|
export function productTitleRows(products: string, outDir?: string): readonly TitleManifest[] {
|
|
@@ -141,14 +144,42 @@ export function addCookedShards(outDir: string, shards: readonly CookedShard[],
|
|
|
141
144
|
writeFileSync(serverFile, JSON.stringify(servers));
|
|
142
145
|
}
|
|
143
146
|
html = html.replace(expression, () => `<script type="application/json" id="boot-module-files">${JSON.stringify(bank).replaceAll('<', String.raw`\u003c`)}</script>`);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
writeFileSync(file, appendValidationVerdicts(html, verdicts));
|
|
148
|
+
const added = shards.flatMap(row => {
|
|
149
|
+
if (row.discovery === undefined) return [];
|
|
150
|
+
const stored = home?.shards.includes(row.slug) === true;
|
|
151
|
+
return [titleRowOf(row.discovery, stored ? home.base : '', stored ? row.slug : undefined)];
|
|
152
|
+
});
|
|
149
153
|
if (added.length > 0) writeTitleRows(outDir, [...readTitleRows(outDir).filter(row => !added.some(next => next.slug === row.slug)), ...added]);
|
|
150
154
|
}
|
|
151
155
|
|
|
156
|
+
/** The verdict array shares a script with build labels and other stamps.
|
|
157
|
+
* Find its JSON boundary without consuming or executing those assignments. */
|
|
158
|
+
export function appendValidationVerdicts(html: string, verdicts: readonly unknown[]): string {
|
|
159
|
+
const marker = 'globalThis.__WS_SHARDFILE_VERDICTS__=', start = html.indexOf(marker);
|
|
160
|
+
if (start === -1) throw new Error('Missing validation verdicts');
|
|
161
|
+
const from = start + marker.length;
|
|
162
|
+
let depth = 0, quoted = false, escaped = false;
|
|
163
|
+
for (let at = from; at < html.length; at++) {
|
|
164
|
+
const char = html[at];
|
|
165
|
+
if (quoted) {
|
|
166
|
+
if (escaped) escaped = false;
|
|
167
|
+
else if (char === '\\') escaped = true;
|
|
168
|
+
else if (char === '"') quoted = false;
|
|
169
|
+
} else if (char === '"') quoted = true;
|
|
170
|
+
else if (char === '[' || char === '{') depth++;
|
|
171
|
+
else if (char === ']' || char === '}') {
|
|
172
|
+
depth--;
|
|
173
|
+
if (depth === 0) {
|
|
174
|
+
const before: unknown = JSON.parse(html.slice(from, at + 1));
|
|
175
|
+
if (!Array.isArray(before)) throw new Error('Invalid validation verdicts');
|
|
176
|
+
return html.slice(0, from) + JSON.stringify([...before, ...verdicts]).replaceAll('<', String.raw`\u003c`) + html.slice(at + 1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
throw new Error('Unclosed validation verdicts');
|
|
181
|
+
}
|
|
182
|
+
|
|
152
183
|
/** What a page takes on trust for one tarball: a verdict is earned here, by this build's format validator, whichever validator
|
|
153
184
|
* stamped its receipt, because a page trusts it by its index hash. */
|
|
154
185
|
export async function productVerdict(tarball: Uint8Array, out: string): Promise<{readonly verdict: unknown; readonly discovery?: Uint8Array}> {
|
|
@@ -8,6 +8,7 @@ import { ASSET_CACHE_NAME } from '../../src/client/engine/pwa/cacheNames';
|
|
|
8
8
|
import { serverPackBookPath } from '../../src/shared/game/shardfile/serverPack';
|
|
9
9
|
import { packsBookPath } from '../../src/shared/game/shardfile/spawnManifest';
|
|
10
10
|
import { titleAssetURLs } from '../title-assets.mjs';
|
|
11
|
+
import { staticAssetHashes, contentNamed } from './assetHashes';
|
|
11
12
|
import { documentIsolation } from './isolation.mjs';
|
|
12
13
|
import { writtenBundle, type EmittedFile } from './writtenBundle';
|
|
13
14
|
|
|
@@ -101,11 +102,13 @@ export async function serviceWorkerCore(bundle: Readonly<Record<string, EmittedF
|
|
|
101
102
|
content = [...new Set(moved)].map(path => new URL(`.${path}`, base).href);
|
|
102
103
|
files = files.filter(path => !isContentPath(path)); shellList = shellList.filter(path => !isContentPath(path));
|
|
103
104
|
}
|
|
105
|
+
const versions = base === '' ? {} : Object.fromEntries(Object.entries(staticAssetHashes(root)).filter(([path]) => isContentPath(path) && !contentNamed(path)));
|
|
106
|
+
digest.update(JSON.stringify(versions));
|
|
104
107
|
const build = `${buildId}-${digest.digest('hex').slice(0, 10)}`;
|
|
105
108
|
const core = source.replaceAll('__BUILD_ID__', build).replaceAll('__ASSET_CACHE__', ASSET_CACHE_NAME)
|
|
106
109
|
.replace(/['"]__FILES__['"]/u, () => JSON.stringify(JSON.stringify(files)))
|
|
107
110
|
.replace(/['"]__SHELL_FILES__['"]/u, () => JSON.stringify(JSON.stringify(shellList)))
|
|
108
|
-
.replace(/['"]__CONTENT__['"]/u, () => JSON.stringify(JSON.stringify({ base, files: content })))
|
|
111
|
+
.replace(/['"]__CONTENT__['"]/u, () => JSON.stringify(JSON.stringify({ base, files: content, ...base === '' ? {} : {versions} })))
|
|
109
112
|
.replace(/['"]__DOCUMENT__['"]/u, () => JSON.stringify(html))
|
|
110
113
|
// PZ12: the page origin's COOP and COEP on the baked document, so a load the worker serves is isolated like the network's
|
|
111
114
|
.replace(/['"]__DOCUMENT_HEADERS__['"]/u, () => JSON.stringify(JSON.stringify(documentHeaders)));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// joins before it packages, and the jobs that serve the whole game from dist (nightly, hover contract) join too.
|
|
7
7
|
//
|
|
8
8
|
// node scripts/app-build/splitOutput.mjs [dist] [--join]
|
|
9
|
-
import {existsSync, lstatSync, mkdirSync, readdirSync, renameSync, rmSync, rmdirSync, writeFileSync} from 'node:fs';
|
|
9
|
+
import {existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, rmdirSync, writeFileSync} from 'node:fs';
|
|
10
10
|
import {dirname, join, resolve} from 'node:path';
|
|
11
11
|
import {pathToFileURL} from 'node:url';
|
|
12
12
|
import {carriedPaths, classify, shardNames} from '../page-size.mjs';
|
|
@@ -38,12 +38,21 @@ function files(root) {
|
|
|
38
38
|
|
|
39
39
|
/** Move each path from one root to the other, then drop the folders the moves emptied.
|
|
40
40
|
* @param {string} from @param {string} to @param {readonly {path: string, bytes: number}[]} rows */
|
|
41
|
-
function move(from, to, rows) {
|
|
41
|
+
function move(from, to, rows, reuse = false) {
|
|
42
42
|
for (const {path} of rows) {
|
|
43
|
-
const target = join(to, path);
|
|
44
|
-
|
|
43
|
+
const source = join(from, path), target = join(to, path);
|
|
44
|
+
let old;
|
|
45
|
+
try { old = lstatSync(target); } catch { /* A new generated path. */ }
|
|
46
|
+
if (old) {
|
|
47
|
+
if (!reuse) throw new Error(`splitOutput: ${target} already exists`);
|
|
48
|
+
const next = lstatSync(source);
|
|
49
|
+
const same = old.isFile() && next.isFile() && old.size === next.size && readFileSync(target).equals(readFileSync(source))
|
|
50
|
+
|| old.isSymbolicLink() && next.isSymbolicLink() && readlinkSync(target) === readlinkSync(source);
|
|
51
|
+
if (same) { rmSync(source); continue; }
|
|
52
|
+
rmSync(target, {recursive: true, force: true});
|
|
53
|
+
}
|
|
45
54
|
mkdirSync(dirname(target), {recursive: true});
|
|
46
|
-
renameSync(
|
|
55
|
+
renameSync(source, target);
|
|
47
56
|
}
|
|
48
57
|
const folders = new Set(rows.flatMap(({path}) => path.split('/').slice(0, -1).map((_, at, parts) => parts.slice(0, at + 1).join('/'))));
|
|
49
58
|
for (const folder of [...folders].sort((a, b) => b.length - a.length)) {
|
|
@@ -61,22 +70,35 @@ function disjoint(root, content) {
|
|
|
61
70
|
if (root === content || content.startsWith(`${root}/`) || root.startsWith(`${content}/`)) throw new Error(`splitOutput: ${content} and ${root} overlap`);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
/** Split a freshly built page.
|
|
73
|
+
/** Split a freshly built page. Unchanged content retains its inode/APFS blocks; stale paths are replaced. An interrupted split
|
|
65
74
|
* left (the page still holds SPLITTING) is kept and finished. A page that holds no content is already split.
|
|
66
75
|
* @param {string} dist @param {string} [content] @returns {{files: number, bytes: number}} */
|
|
67
76
|
export function splitOutput(dist, content = contentDirOf(dist)) {
|
|
68
77
|
const root = resolve(dist), target = resolve(content), mark = join(root, SPLITTING);
|
|
69
78
|
disjoint(root, target);
|
|
79
|
+
try {
|
|
80
|
+
if (!lstatSync(target).isDirectory() || lstatSync(target).isSymbolicLink()) throw new Error('splitOutput: content root must be a real directory');
|
|
81
|
+
} catch (error) { if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) throw error; }
|
|
70
82
|
if (!existsSync(join(root, 'index.html'))) throw new Error(`splitOutput: ${root} holds no index.html; give a built page`);
|
|
71
83
|
// a kept build's content (MF2 carry, PZ5: an unmarked build reads it from the page) stays on the page until it ages out
|
|
72
84
|
const carried = carriedPaths(root)?.paths ?? new Set();
|
|
73
|
-
const shards = shardNames(root), rows = files(root).filter(row => row.path !== SPLITTING && !carried.has(row.path) && isContent(row.path, shards));
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
const shards = shardNames(root), rows = files(root).filter(row => row.path !== SPLITTING && row.path !== `${SPLITTING}.tmp` && !carried.has(row.path) && isContent(row.path, shards));
|
|
86
|
+
// The full desired path list makes pruning resumable too. An empty mark
|
|
87
|
+
// from the previous implementation already had its old target removed.
|
|
88
|
+
if (rows.length > 0 && !existsSync(mark)) {
|
|
89
|
+
writeFileSync(`${mark}.tmp`, JSON.stringify(rows.map(row => row.path)));
|
|
90
|
+
renameSync(`${mark}.tmp`, mark);
|
|
91
|
+
}
|
|
92
|
+
if (existsSync(mark) && readFileSync(mark, 'utf8') !== '') {
|
|
93
|
+
let paths;
|
|
94
|
+
try { paths = JSON.parse(readFileSync(mark, 'utf8')); } catch { throw new Error('splitOutput: invalid interrupted path list; inspect output and remove .splitting to restart'); }
|
|
95
|
+
if (!Array.isArray(paths) || !paths.every(path => typeof path === 'string')) throw new Error('splitOutput: invalid interrupted path list; inspect output and remove .splitting to restart');
|
|
96
|
+
const desired = new Set(paths);
|
|
97
|
+
for (const {path} of files(target)) if (!desired.has(path)) rmSync(join(target, path));
|
|
77
98
|
}
|
|
78
|
-
const moved = move(root, target, rows);
|
|
99
|
+
const moved = move(root, target, rows, true);
|
|
79
100
|
rmSync(mark, {force: true});
|
|
101
|
+
rmSync(`${mark}.tmp`, {force: true});
|
|
80
102
|
return moved;
|
|
81
103
|
}
|
|
82
104
|
|
|
@@ -3,11 +3,11 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* PZ18 (meta PAGE-SIZE, QA 11-13 row 29): the title's code comes in the first wave. The entry imports the grid's page
|
|
6
|
-
* entry (`src/client/game/grid/pageEntry.ts`) dynamically, so its
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* entry (`src/client/game/grid/pageEntry.ts`) dynamically, so its title chunks were only requested once the entry had
|
|
7
|
+
* run: two serial round trips after the module graph (preview, throttled: 1.07 to 1.29 s of a 1.53 s title). The built
|
|
8
|
+
* document now names the root's static closure and every `title-0-` sibling chunk as `modulepreload` beside the entry's
|
|
9
|
+
* own. The siblings are dynamic imports from the title slice, so the static closure alone leaves a later title request
|
|
10
|
+
* on the wire after the first wave.
|
|
11
11
|
*/
|
|
12
12
|
export const TITLE_PRELOAD_ROOT = 'src/client/game/grid/pageEntry.ts';
|
|
13
13
|
|
|
@@ -38,6 +38,9 @@ export function titlePreloadFiles(report, html, root = TITLE_PRELOAD_ROOT) {
|
|
|
38
38
|
for (const next of row.imports) visit(next);
|
|
39
39
|
};
|
|
40
40
|
for (const [file, row] of Object.entries(report)) if (row.moduleIds.some(id => clean(id) === root)) visit(file);
|
|
41
|
+
// Rolldown places title-only dynamic imports in the same `title-0-` slice but not in the root's static import graph.
|
|
42
|
+
// They still have to join the document's first wave: the title cannot paint until all of them are available.
|
|
43
|
+
for (const chunk of Object.keys(report).filter(path => path.includes('/title-0-')).sort()) visit(chunk);
|
|
41
44
|
return order.filter(file => !loaded.has(file) && file.endsWith('.js'));
|
|
42
45
|
}
|
|
43
46
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {junctionTextureSteps, roadTextureSteps} from '../src/client/game/grid/roadSurfaceMaps';
|
|
2
|
+
|
|
3
|
+
async function paint(kind: 'asphalt' | 'junction'): Promise<{kind: string; width: number; height: number; png: number[]}> {
|
|
4
|
+
const steps = kind === 'asphalt' ? roadTextureSteps() : junctionTextureSteps();
|
|
5
|
+
let next = steps.next();
|
|
6
|
+
while (next.done !== true) next = steps.next();
|
|
7
|
+
const texture = next.value, image: unknown = texture.image;
|
|
8
|
+
if (!(image instanceof HTMLCanvasElement)) throw new Error('Road painter must produce a canvas');
|
|
9
|
+
// Compressed textures upload without WebGL flipY; preserve the canvas texture sampler orientation.
|
|
10
|
+
const output = document.createElement('canvas'); output.width = image.width; output.height = image.height;
|
|
11
|
+
const context = output.getContext('2d'); if (context === null) throw new Error('No road bake context');
|
|
12
|
+
context.translate(0, image.height); context.scale(1, -1); context.drawImage(image, 0, 0);
|
|
13
|
+
const blob = await new Promise<Blob>((resolve, reject) => { output.toBlob(value => { if (value === null) reject(new Error('Road PNG encode failed')); else resolve(value); }, 'image/png'); });
|
|
14
|
+
const result = {kind, width: image.width, height: image.height, png: Array.from(new Uint8Array(await blob.arrayBuffer()))};
|
|
15
|
+
texture.dispose();
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(globalThis, '__bakeRoadSurfaces', {value: () => Promise.all([paint('asphalt'), paint('junction')])});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// PZ24d1: reproduce the existing procedural surface maps, then encode phone ASTC 6x6.
|
|
2
|
+
// Run through scripts/browser-lane.sh; scratch and output paths are explicit.
|
|
3
|
+
import {execFileSync} from 'node:child_process';
|
|
4
|
+
import {createHash} from 'node:crypto';
|
|
5
|
+
import {mkdirSync, readFileSync, writeFileSync} from 'node:fs';
|
|
6
|
+
import {join, resolve} from 'node:path';
|
|
7
|
+
import {parseArgs} from 'node:util';
|
|
8
|
+
import {chromium, devices} from 'playwright';
|
|
9
|
+
import {KEYCHAIN_ARGS} from './chromium-keychain.mjs';
|
|
10
|
+
|
|
11
|
+
const {values} = parseArgs({options: {scratch: {type: 'string'}, out: {type: 'string'}}});
|
|
12
|
+
if (values.scratch === undefined || values.out === undefined) throw new Error('Use --scratch=<owned lane folder> --out=<asset folder>');
|
|
13
|
+
const scratch = resolve(values.scratch), out = resolve(values.out);
|
|
14
|
+
mkdirSync(scratch, {recursive: true}); mkdirSync(out, {recursive: true});
|
|
15
|
+
const bundle = join(scratch, 'road-painters.js');
|
|
16
|
+
execFileSync('node_modules/.bin/rolldown', ['scripts/bake-road-surfaces.entry.ts', '--file', bundle, '--format', 'iife'], {stdio: 'ignore'});
|
|
17
|
+
const browser = await chromium.launch({headless: true, args: [...KEYCHAIN_ARGS]});
|
|
18
|
+
/** @type {{kind: string, width: number, height: number, png: number[]}[]} */
|
|
19
|
+
let images;
|
|
20
|
+
try {
|
|
21
|
+
const context = await browser.newContext({...devices['iPhone 16 Pro']});
|
|
22
|
+
const page = await context.newPage();
|
|
23
|
+
await page.addScriptTag({content: readFileSync(bundle, 'utf8')});
|
|
24
|
+
images = await page.evaluate('globalThis.__bakeRoadSurfaces()');
|
|
25
|
+
} finally { await browser.close(); }
|
|
26
|
+
const hash = (/** @type {Uint8Array} */ bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
27
|
+
const encoderVersion = execFileSync('basisu', ['-version'], {encoding: 'utf8'}).split('\n')[0].trim();
|
|
28
|
+
const encoderOptions = ['-ktx2', '-ldr_6x6', '-effort', '4', '-srgb', '-mipmap'];
|
|
29
|
+
const sourcePaths = ['src/client/game/grid/roadSurfaceMaps.ts', 'src/client/game/grid/roadGrain.ts',
|
|
30
|
+
'src/shared/game/grid/roadLayout.ts', 'scripts/bake-road-surfaces.entry.ts', 'scripts/bake-road-surfaces.mjs'];
|
|
31
|
+
const assets = [];
|
|
32
|
+
for (const image of images) {
|
|
33
|
+
const source = join(scratch, `${image.kind}.png`), target = join(out, `road-${image.kind}-phone.ktx2`);
|
|
34
|
+
writeFileSync(source, Buffer.from(image.png));
|
|
35
|
+
execFileSync('basisu', [...encoderOptions, source, '-output_file', target], {stdio: 'ignore'});
|
|
36
|
+
const bytes = readFileSync(target), levels = bytes.readUInt32LE(40);
|
|
37
|
+
let gpuBytes = 0;
|
|
38
|
+
for (let level = 0; level < levels; level++) gpuBytes += Number(bytes.readBigUInt64LE(80 + level * 24 + 16));
|
|
39
|
+
assets.push({kind: image.kind, file: `road-${image.kind}-phone.ktx2`, width: image.width, height: image.height, levels, bytes: bytes.length, gpuBytes, sha256: hash(bytes)});
|
|
40
|
+
console.log(`${image.kind}: ${image.width}x${image.height}, ${bytes.length} bytes, ${gpuBytes} GPU bytes`);
|
|
41
|
+
}
|
|
42
|
+
writeFileSync(join(out, 'road-surfaces.json'), `${JSON.stringify({format: 2, vkFormat: 166,
|
|
43
|
+
sourcesSHA256: Object.fromEntries(sourcePaths.map(path => [path, hash(readFileSync(path))])),
|
|
44
|
+
encoder: {version: encoderVersion, options: encoderOptions}, assets}, null, 2)}\n`);
|
package/scripts/changelog.mjs
CHANGED
|
@@ -113,7 +113,8 @@ export function pushProblems(lines, cwd = process.cwd()) {
|
|
|
113
113
|
if (/^0+$/u.test(local)) return [];
|
|
114
114
|
const tag = /^refs\/tags\/(v\d+\.\d+\.\d+)$/u.exec(remote)?.[1];
|
|
115
115
|
if (tag !== undefined) return problemsAt(`${local}^{commit}`, tag, cwd).map(p => `${tag}: ${p}`);
|
|
116
|
-
return remote === 'refs/heads/main'
|
|
116
|
+
return remote === 'refs/heads/main' || remote.startsWith('refs/heads/release/')
|
|
117
|
+
? problemsAt(local, undefined, cwd).map(p => `${remote.slice('refs/heads/'.length)}: ${p}`) : [];
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
|
package/scripts/ci-pack.mjs
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
// in its job. With more than one job it starts the last job (EV3), so it never lands behind job 1's
|
|
16
16
|
// shards (that made job 1 the long pole, p50 12.6 min against 9.1); the other units pack over every job,
|
|
17
17
|
// and the last takes shards once it is the least loaded (EV3b: alone it ran 5.2-8.1 min against 9.6-11.3).
|
|
18
|
-
// boundaries engine-boundaries' push half, cook-to-play on Ring 1's products
|
|
18
|
+
// boundaries engine-boundaries' push half, cook-to-play on Ring 1's products; blocking after TS15's green soak.
|
|
19
19
|
// It needs the full pins (its Ring 1 cook reads raw tarballs only `pnpm pins` fetches, run 43303094170),
|
|
20
20
|
// then installs Ring 1's and Chromium itself and builds its own tree, so it needs no other unit: ci.yml
|
|
21
|
-
// runs it as its own
|
|
21
|
+
// runs it as its own blocking job from t=0 (TS15/EV3b; after products in job 6 it took that job to 13.7
|
|
22
22
|
// min). Packed with products, it still follows products into products' job
|
|
23
23
|
// Phases run in order: before pins (up to C units at once), `pnpm pins && pnpm gen:inputs`, the shards ONE AT A TIME,
|
|
24
24
|
// then products and boundaries. A shard has the runner to itself, as its plan assumes: two at once on the 4-vCPU runner
|
|
@@ -46,7 +46,7 @@ const FOLLOWS=Object.freeze(/** @type {Record<string,string>} */({boundaries:'pr
|
|
|
46
46
|
* 2026-11-12): that job then packs like the rest, so the shards fill the 2-4 min products leaves free there. Alone it ran
|
|
47
47
|
* 5.2-8.1 min while jobs 1-5 ran 9.6-11.3 (runs 43313302390 .. 43315974456). Its shards still run before products. */
|
|
48
48
|
const OWN_JOB=new Set(['products']);
|
|
49
|
-
const NONBLOCKING=new Set(['quarantine'
|
|
49
|
+
const NONBLOCKING=new Set(['quarantine']);
|
|
50
50
|
const SHARD_LIMIT_MS=300_000;
|
|
51
51
|
/** @typedef {{name:string,phase:number,seconds:number,blocking:boolean}} Unit */
|
|
52
52
|
/** @typedef {{name:string,phase:number,blocking:boolean,started:number,charged:number,ended:number,seconds:number,code:number}} UnitResult */
|
|
@@ -10,10 +10,21 @@ const index=Number(process.env.WS_CI_SHARD),shard=plan.shards[index-1];
|
|
|
10
10
|
if(shard===undefined)throw new Error('Missing matrix shard');
|
|
11
11
|
const started=Date.now();let failed=false;
|
|
12
12
|
mkdirSync('tmp/engine-ci',{recursive:true});
|
|
13
|
+
// TS8: warm the selected browser once outside the file's native deadlines.
|
|
14
|
+
// Its I/O remains charged to this shard, including the final wall check.
|
|
15
|
+
const warmStarted=Date.now();
|
|
16
|
+
const chrome=shard.native.includes('test/tooling/parity/browser-escape.test.mjs')
|
|
17
|
+
?await import('./warm-native-chrome.mjs').then(({nativeChromeExecutable,warmNativeChrome})=>warmNativeChrome(nativeChromeExecutable())):null;
|
|
18
|
+
if(chrome!==null)console.log(JSON.stringify({preparation:'native Chrome files read',shard:index,milliseconds:Date.now()-warmStarted,bytes:chrome.bytes}));
|
|
13
19
|
for(const phase of /** @type {const} */ (['native','ordinary'])){
|
|
14
20
|
if(shard[phase].length===0)continue;
|
|
15
21
|
const report=resolve(`tmp/engine-ci/shard-${index}-${phase}.json`);
|
|
16
22
|
/** @type {NodeJS.ProcessEnv} */ const env={...process.env,WS_CI_PHASE:phase,WS_CI_TIMINGS:report};
|
|
23
|
+
if(chrome!==null){
|
|
24
|
+
env.WS_CI_NATIVE_CHROME_WARM=chrome.executable;
|
|
25
|
+
if(phase==='native')env.CHROME_PATH=chrome.executable;
|
|
26
|
+
}
|
|
27
|
+
else Reflect.deleteProperty(env,'WS_CI_NATIVE_CHROME_WARM');
|
|
17
28
|
if(plan.ring==='1')env.WILDSHARD_RING='1';else Reflect.deleteProperty(env,'WILDSHARD_RING');
|
|
18
29
|
const result=spawnSync('python3',['scripts/heavy-lane.py','full-test','--',process.execPath,'scripts/vitest-tmp.ts','run','--config','scripts/engine-ci.config.ts','--reporter=default','--reporter=./scripts/engine-ci-budget.ts'],{env,stdio:'inherit',timeout:300000});
|
|
19
30
|
if(result.error!==undefined||result.status!==0)failed=true;
|