@wildshard/engine 0.1.15 → 0.1.17
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 +157 -11
- package/lint/engine-sides.json +16 -0
- package/lint/host-register.json +496 -0
- package/lint/ratchet.json +2 -2
- package/lint/shard-imports.d.mts +1 -0
- package/lint/shard-imports.mjs +56 -8
- package/lint/wildshard-plugin.js +22 -4
- package/package.json +16 -5
- package/scripts/app-build/buildIdentity.d.mts +3 -1
- package/scripts/app-build/buildIdentity.mjs +25 -5
- package/scripts/app-build/builtAt.d.mts +4 -0
- package/scripts/app-build/builtAt.mjs +21 -0
- package/scripts/app-build/serviceWorker.ts +16 -2
- package/scripts/app-build/versionFiles.ts +2 -1
- package/scripts/app-build-pipeline.mjs +4 -1
- package/scripts/audio-download-proof.mjs +843 -0
- package/scripts/build-app.mjs +4 -0
- package/scripts/build-mirror.d.mts +2 -0
- package/scripts/build-mirror.mjs +5 -4
- package/scripts/built-product.mjs +3 -3
- package/scripts/cell-mem/metrics-preload.mjs +65 -0
- package/scripts/cell-mem-bench.mjs +130 -0
- package/scripts/check-chunks.mjs +2 -1
- package/scripts/devserver-client.d.mts +5 -0
- package/scripts/devserver-client.mjs +68 -0
- package/scripts/engine-ci-budget.ts +7 -1
- package/scripts/format-lock.mjs +20 -11
- package/scripts/generate-title-launch.mjs +3 -2
- package/scripts/grid-crossing-walk-proof.mjs +16 -8
- package/scripts/heavy-lane.py +25 -1
- package/scripts/host-ruler/register-migrate.mjs +242 -0
- package/scripts/host-ruler/register.d.mts +36 -0
- package/scripts/host-ruler/register.mjs +116 -0
- package/scripts/host-ruler/roots.d.mts +29 -0
- package/scripts/host-ruler/roots.mjs +333 -0
- package/scripts/host-ruler/server-roots.d.mts +23 -0
- package/scripts/host-ruler/server-roots.mjs +272 -0
- package/scripts/main-watch.d.mts +1 -1
- package/scripts/main-watch.mjs +10 -6
- package/scripts/map-hash.mjs +3 -6
- package/scripts/mmo-bots.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +1 -0
- package/scripts/offline-proof-rules.mjs +22 -1
- package/scripts/online-rig.mjs +4 -4
- package/scripts/page-release/flow.d.mts +1 -0
- package/scripts/page-release/flow.mjs +6 -2
- package/scripts/page-release.mjs +5 -1
- package/scripts/physics-route.json +0 -71
- package/scripts/pins-catalogue.ts +103 -0
- package/scripts/pins-reuse.mjs +3 -1
- package/scripts/pins.ts +22 -14
- package/scripts/preview-grid.ts +203 -0
- package/scripts/road-preload-proof.mjs +167 -0
- package/scripts/server-release/publish.mjs +2 -2
- package/scripts/server-release/served-slug.d.mts +2 -0
- package/scripts/server-release/served-slug.mjs +10 -0
- package/scripts/server-release/sign.d.mts +1 -0
- package/scripts/server-release/sign.mjs +3 -7
- package/scripts/shard-components.mjs +0 -2
- package/scripts/shard-outputs.d.mts +8 -0
- package/scripts/shard-outputs.mjs +45 -11
- package/scripts/side-parity.d.mts +2 -1
- package/scripts/side-parity.mjs +25 -4
- package/scripts/test-amber.d.mts +1 -0
- package/scripts/test-amber.mjs +10 -0
- package/scripts/test-products.json +3 -3
- package/scripts/tracked-public.d.mts +1 -0
- package/scripts/tracked-public.mjs +17 -0
- package/src/cli/engine.mjs +8 -0
- package/src/client/app/bootRoute.ts +4 -1
- package/src/client/app/dropModal.ts +15 -2
- package/src/client/app/entry.ts +67 -11
- package/src/client/app/slugPath.ts +5 -0
- package/src/client/engine/audio/Audio.ts +20 -2
- package/src/client/engine/boot/bakedTextures.ts +3 -2
- package/src/client/engine/boot/bootTrace.ts +6 -1
- package/src/client/engine/boot/bytes.ts +4 -3
- package/src/client/engine/boot/clearDownloads.ts +1 -1
- package/src/client/engine/boot/contentRead.ts +4 -0
- package/src/client/engine/boot/dropNotice.ts +20 -6
- package/src/client/engine/boot/gpuFiles.ts +25 -2
- package/src/client/engine/boot/lastEnd.ts +8 -2
- package/src/client/engine/boot/shardPrefetch.ts +7 -1
- package/src/client/engine/boot/sw.ts +19 -0
- package/src/client/engine/core/Game.ts +11 -3
- package/src/client/engine/core/GpuRecovery.ts +7 -0
- package/src/client/engine/core/Volumetrics.ts +5 -0
- package/src/client/engine/core/assets.ts +27 -20
- package/src/client/engine/core/bootstrap.ts +1 -2
- package/src/client/engine/core/ktx2.ts +84 -11
- package/src/client/engine/explore/Compare.ts +2 -2
- package/src/client/engine/explore/TouchFly.ts +3 -5
- package/src/client/engine/input/dom.ts +12 -0
- package/src/client/engine/net/predictor.ts +6 -2
- package/src/client/engine/player/Player.ts +10 -2
- package/src/client/engine/player/TouchControls.ts +12 -4
- package/src/client/engine/pwa/sw.js +47 -8
- package/src/client/engine/render/drawCheck.ts +96 -0
- package/src/client/engine/saves/staleBuildNote.ts +46 -0
- package/src/client/engine/telemetry/browserErrors.ts +157 -20
- package/src/client/engine/telemetry/screenOutbox.ts +61 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
- package/src/client/engine/ui/DeathFade.ts +99 -11
- package/src/client/engine/ui/ErrorModal.ts +13 -6
- package/src/client/engine/ui/Feedback.ts +2 -1
- package/src/client/engine/ui/Loading.ts +10 -6
- package/src/client/engine/ui/Map.ts +2 -1
- package/src/client/engine/ui/WeaponStrip.ts +2 -1
- package/src/client/engine/ui/backGuard.ts +104 -0
- package/src/client/engine/ui/hudAdapters.ts +30 -4
- package/src/client/engine/ui/loading.css +17 -0
- package/src/client/engine/ui/namePrompt.ts +6 -5
- package/src/client/engine/ui/styles/combat.css +12 -0
- package/src/client/engine/ui/styles/namePrompt.css +4 -2
- package/src/client/game/boot/audio.generated.ts +0 -294
- package/src/client/game/boot/bytes.generated.ts +0 -11
- package/src/client/game/boot/versions.generated.ts +0 -11
- package/src/client/game/compendium/keepsakes.ts +16 -6
- package/src/client/game/grapple/tool.ts +10 -7
- package/src/client/game/grid/cellLoading.ts +23 -12
- package/src/client/game/grid/cellScreens.ts +39 -74
- package/src/client/game/grid/liveSession.ts +40 -7
- package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
- package/src/client/game/grid/nearPlaceholderView.ts +9 -3
- package/src/client/game/grid/oneWayIn.ts +92 -27
- package/src/client/game/grid/pageEntry.ts +19 -0
- package/src/client/game/grid/pageShell.ts +1 -1
- package/src/client/game/grid/plotAudio.ts +114 -0
- package/src/client/game/grid/products.ts +55 -5
- package/src/client/game/grid/roadLookPlatform.ts +2 -2
- package/src/client/game/grid/session.ts +38 -22
- package/src/client/game/grid/spawnGround.ts +68 -0
- package/src/client/game/grid/voidLook.ts +29 -23
- package/src/client/game/loot/runtime.ts +3 -1
- package/src/client/game/mainMenu.ts +14 -6
- package/src/client/game/riding/hud.ts +6 -4
- package/src/client/game/session/finish.ts +17 -3
- package/src/client/game/session/play.ts +8 -2
- package/src/client/game/session/session.ts +4 -1
- package/src/client/game/shardfile/clientWorker.ts +41 -12
- package/src/client/game/shardfile/serverRoute.ts +10 -22
- package/src/client/game/slugPage.css +11 -0
- package/src/client/game/slugPage.ts +84 -0
- package/src/client/game/systems/viewmodel/heldView.ts +6 -3
- package/src/client/game/titleDeck.ts +55 -32
- package/src/client/host/online/doctor.ts +7 -6
- package/src/client/host/online/linkScreens.ts +16 -0
- package/src/client/host/online/release.ts +51 -5
- package/src/client/host/online/shell.ts +48 -27
- package/src/client/host/standalone/shell.ts +7 -3
- package/src/cook/game/audioReport.ts +57 -0
- package/src/cook/game/entryTotals.ts +26 -6
- package/src/cook/game/installedRuntimeReads.ts +3 -0
- package/src/server/engine/sim/respawn.ts +6 -1
- package/src/server/engine/sim.ts +3 -0
- package/src/server/game/grid/simulation.ts +35 -0
- package/src/server/game/loot/harvest.ts +2 -0
- package/src/server/game/loot/keepsakeProgression.ts +40 -0
- package/src/server/game/loot/playerOwned.ts +5 -1
- package/src/server/game/plugin/simulation.ts +4 -0
- package/src/server/game/population/nativeBake.ts +2 -1
- package/src/server/game/quest/chapterRecords.ts +2 -0
- package/src/server/game/quest/serverChapters.ts +4 -0
- package/src/server/game/quest/serverDoors.ts +11 -5
- package/src/server/game/roomRespawn.ts +4 -0
- package/src/server/game/shardfile/installedSides.ts +18 -0
- package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
- package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
- package/src/server/host/bake/headlessWorker.ts +5 -1
- package/src/server/host/dedicated/cellHost.ts +98 -29
- package/src/server/host/dedicated/cellProtocol.ts +11 -1
- package/src/server/host/dedicated/cellWorker.ts +9 -3
- package/src/server/host/dedicated/crossing.ts +6 -2
- package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
- package/src/server/host/dedicated/gridCells.ts +52 -9
- package/src/server/host/dedicated/main.ts +31 -12
- package/src/server/host/dedicated/placementFile.ts +72 -0
- package/src/server/host/dedicated/releaseFile.ts +17 -10
- package/src/server/host/dedicated/roadRoom.ts +21 -5
- package/src/server/host/dedicated/workerTable.ts +13 -1
- package/src/server/host/dedicated/world.ts +81 -9
- package/src/server/host/headlessRuntime.ts +10 -5
- package/src/server/host/installers.ts +62 -0
- package/src/server/host/openWorld.ts +59 -0
- package/src/server/host/ropeDecks.ts +2 -0
- package/src/server/host/standalone/cellWorld.ts +25 -19
- package/src/server/host/standalone/fallFloor.ts +2 -2
- package/src/server/host/standalone/gridServer.ts +7 -4
- package/src/server/host/standalone/roadWorld.ts +41 -4
- package/src/shared/engine/audio/bootAudio.ts +33 -0
- package/src/shared/engine/level/spec.ts +3 -3
- package/src/shared/engine/net/acts.ts +3 -0
- package/src/shared/engine/physics/query.ts +27 -0
- package/src/shared/engine/physics/terrain.ts +19 -28
- package/src/shared/engine/saves/saves.lock.json +15 -0
- package/src/shared/engine/sim/actRoutes.ts +2 -0
- package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
- package/src/shared/game/grid/catalogue.ts +12 -5
- package/src/shared/game/grid/catalogueSlot.ts +11 -0
- package/src/shared/game/grid/farProxy.ts +6 -5
- package/src/shared/game/grid/pageMode.ts +1 -1
- package/src/shared/game/grid/roadLayout.ts +26 -3
- package/src/shared/game/grid/singleplayer.json +0 -13
- package/src/shared/game/grid/voidFloor.ts +122 -0
- package/src/shared/game/strings.ts +15 -0
- package/src/shared/host/standalone/netInput.ts +2 -1
package/scripts/side-parity.mjs
CHANGED
|
@@ -83,7 +83,7 @@ export function ownerGroup(owner) {
|
|
|
83
83
|
const groupOf = row => row.material === 'flesh' ? 'actor' : ownerGroup(row.owner);
|
|
84
84
|
/** The key two colliders must share to match: owner group, material, sensor or solid. */
|
|
85
85
|
/** The match key `row` would have under the owner group `group`. */
|
|
86
|
-
const keyAs = (row, group) => `${row.sensor ? 'sensor:' : ''}${group}|${
|
|
86
|
+
const keyAs = (row, group, material = row.material) => `${row.sensor ? 'sensor:' : ''}${group}|${material ?? '-'}`;
|
|
87
87
|
const matchKey = row => keyAs(row, groupOf(row));
|
|
88
88
|
/** The allow key: owner group, sensors apart. */
|
|
89
89
|
const allowKey = row => `${row.sensor ? 'sensor:' : ''}${groupOf(row)}`;
|
|
@@ -119,12 +119,33 @@ export const MEASURED_SHAPES = Object.freeze([0, 1, 2, 4, 6, 7, 9, 10, 11, 12, 1
|
|
|
119
119
|
* `allow` maps an allow key (owner, `sensor:` prefixed for a sensor) to why it may differ; it is skipped both ways.
|
|
120
120
|
* `same` (SS10) maps a server owner group to the page owner group that may name the same pieces (a gate named for its door,
|
|
121
121
|
* a bake's 150-collider chunk): a collider with no match under its own name may match one under that name, still one to
|
|
122
|
-
* one and by material and shape.
|
|
122
|
+
* one and by material and shape. `sameMaterial` (HS7's owed SS1 line) maps such a server owner group to `{ server, page }`, the
|
|
123
|
+
* material each side names it by (Driftwood's boat: `wood` on the server, `planks` on the page); any other material still differs.
|
|
124
|
+
* `chunked` lists page owner groups a chunked page registers once per chunk a piece spans (Driftwood's pier deck): exact
|
|
125
|
+
* copies of one of their pieces (owner group, material, kind, box) are that one solid.
|
|
123
126
|
* A static page solid with no server match that lies inside a server edge wall (`edge`) is no finding: the wall stands there.
|
|
124
127
|
*/
|
|
125
|
-
|
|
128
|
+
/** A `chunked` page piece's identity: one solid whatever chunk registered it (boxes are whole metres, so two thin pieces in one
|
|
129
|
+
* metre cell of different chunks would read as one; none do today). */
|
|
130
|
+
export const chunkCopyKey = row => `${matchKey(row)}|${row.dynamic}|${row.shape}|${row.box.join(',')}`;
|
|
131
|
+
/** The material `row` goes by under the other side's name for it: `named` is a `sameMaterial` entry, `{ server, page }`. */
|
|
132
|
+
function materialAs(row, side, named) {
|
|
133
|
+
if (named === undefined) return row.material;
|
|
134
|
+
const [mine, theirs] = side === 'page' ? [named.page, named.server] : [named.server, named.page];
|
|
135
|
+
return row.material === mine ? theirs : row.material;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function sideParityDiff(paged, server, at, allow = {}, { slack = 1, same = {}, sameMaterial = {}, chunked = [] } = {}) {
|
|
126
139
|
// without the page's player, the server-to-page half would check nothing and pass
|
|
127
140
|
if (at === null || at.length !== 3) throw new Error('Side parity needs the page player position its half was recorded at');
|
|
141
|
+
// a copy is the same piece under another chunk's owner; two in one chunk are still two
|
|
142
|
+
const copies = new Map(), page = paged.filter(row => {
|
|
143
|
+
if (!chunked.includes(groupOf(row))) return true;
|
|
144
|
+
const key = chunkCopyKey(row), owners = copies.get(key);
|
|
145
|
+
if (owners === undefined) { copies.set(key, new Set([row.owner])); return true; }
|
|
146
|
+
if (owners.has(row.owner)) return true;
|
|
147
|
+
owners.add(row.owner); return false;
|
|
148
|
+
});
|
|
128
149
|
const index = rows => { const map = new Map(); for (const row of rows) { const key = matchKey(row); let list = map.get(key); if (list === undefined) map.set(key, list = []); list.push(row); } return map; };
|
|
129
150
|
const pages = index(page), servers = index(server), findings = new Map();
|
|
130
151
|
// the example is the smallest box, so a line does not change with the order a world lists its colliders
|
|
@@ -139,7 +160,7 @@ export function sideParityDiff(page, server, at, allow = {}, { slack = 1, same =
|
|
|
139
160
|
let best = null;
|
|
140
161
|
// its own name first; then the other side's name for it that `same` declares (a page owner may have several server names)
|
|
141
162
|
const names = side === 'page' ? Object.keys(same).filter(name => same[name] === groupOf(row)) : Object.hasOwn(same, groupOf(row)) ? [same[groupOf(row)]] : [];
|
|
142
|
-
for (const key of [matchKey(row), ...names.map(name => keyAs(row, name))]) {
|
|
163
|
+
for (const key of [matchKey(row), ...names.map(name => keyAs(row, name, materialAs(row, side, side === 'page' ? sameMaterial[name] : sameMaterial[groupOf(row)])))]) {
|
|
143
164
|
for (const other of others.get(key) ?? []) if (!used.has(other) && close(row, other) && (best === null || spread(row, other) < spread(row, best))) best = other;
|
|
144
165
|
if (best !== null) break;
|
|
145
166
|
}
|
package/scripts/test-amber.d.mts
CHANGED
|
@@ -9,3 +9,4 @@ export function amberLine(verdict:AmberVerdict,run:string|null|undefined):string
|
|
|
9
9
|
export function parseAmber(text:string):{file:string;ms:number;budget:number}[];
|
|
10
10
|
export function nextLedger(previous:AmberLedger|undefined,files:readonly {file:string;durationMs:number}[],options:{run:string;at:number;inventory:Set<string>|null;budget?:number}):AmberLedger;
|
|
11
11
|
export function judgeWall(shard:string,ms:number,budget:number,limits?:AmberLimits):AmberVerdict;
|
|
12
|
+
export function parseAudioAmber(text:string):{shard:string;tier:string;bytes:number;budget:number;red:number;level:string}[];
|
package/scripts/test-amber.mjs
CHANGED
|
@@ -88,3 +88,13 @@ export function nextLedger(previous,files,options){
|
|
|
88
88
|
* from run to run; the files that made it slow carry their own. Pure.
|
|
89
89
|
* @param {string} shard @param {number} ms @param {number} budget @param {typeof AMBER} [limits] @returns {Verdict} */
|
|
90
90
|
export const judgeWall=(shard,ms,budget,limits=AMBER)=>judgeFile(`shard-${shard}-wall`,ms,budget,undefined,0,limits);
|
|
91
|
+
|
|
92
|
+
/** AUDIO AU6 (J303): every shard-audio AMBER line in some text (`audioAmberLine` in src/cook/game/audioReport.ts, which
|
|
93
|
+
* CI's budget reporter annotates), one per shard and tier. Never red on main: `level=red` says only how far over (J295).
|
|
94
|
+
* @param {string} text @returns {{shard:string,tier:string,bytes:number,budget:number,red:number,level:string}[]} */
|
|
95
|
+
export function parseAudioAmber(text){
|
|
96
|
+
const out=new Map();
|
|
97
|
+
for(const match of text.matchAll(/\bAMBER audio shard=(\S+) tier=(\S+) bytes=(\d+) budget=(\d+) red=(\d+) level=(\S+)/gu))
|
|
98
|
+
out.set(`${match[1]} ${match[2]}`,{shard:match[1],tier:match[2],bytes:Number(match[3]),budget:Number(match[4]),red:Number(match[5]),level:match[6]});
|
|
99
|
+
return [...out.values()];
|
|
100
|
+
}
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"test/cook-hostile-pins.test.ts": ["_template"],
|
|
50
50
|
"test/net-hostile-play.test.ts": ["sunscar-dunes", "pine-hollow"],
|
|
51
51
|
"test/pinned-restore-play.test.ts": ["_template", "blender-template", "sunscar-dunes", "far-reach", "driftwood-isle", "nalati-grasslands", "pine-hollow", "nine-dragon-stack"],
|
|
52
|
-
"test/shard-stands-alone.test.ts": ["_template","blender-template","driftwood-isle","far-reach","ink-cel-valley","nalati-grasslands","nine-dragon-stack","open-plot-alien-plain","open-plot-clockwork-canyon","open-plot-coral-drift","open-plot-desert-ruin","open-plot-ember-forge","open-plot-fossil-badlands","open-plot-frostline-peaks","open-plot-jungle-ziggurat","open-plot-lantern-bayou","open-plot-mosslight-ruins","open-plot-night-market","open-plot-patchwork-fairground","open-plot-saltwind-lighthouse","open-plot-
|
|
52
|
+
"test/shard-stands-alone.test.ts": ["_template","blender-template","driftwood-isle","far-reach","ink-cel-valley","nalati-grasslands","nine-dragon-stack","open-plot-alien-plain","open-plot-clockwork-canyon","open-plot-coral-drift","open-plot-desert-ruin","open-plot-ember-forge","open-plot-fossil-badlands","open-plot-frostline-peaks","open-plot-jungle-ziggurat","open-plot-lantern-bayou","open-plot-mosslight-ruins","open-plot-night-market","open-plot-patchwork-fairground","open-plot-saltwind-lighthouse","open-plot-sky-harbor","open-plot-sky-race","open-plot-starfall-observatory","open-plot-thin-ice","pastel-plain","pine-hollow","sunscar-dunes"],
|
|
53
53
|
"test/registered-quest-catalogues.test.ts": ["pine-hollow","nalati-grasslands"],
|
|
54
54
|
"test/registered-native-population.test.ts": ["driftwood-isle","pine-hollow"],
|
|
55
|
-
"test/shipped-graph-cost.test.ts": ["_template","blender-template","driftwood-isle","far-reach","ink-cel-valley","nalati-grasslands","nine-dragon-stack","open-plot-alien-plain","open-plot-clockwork-canyon","open-plot-coral-drift","open-plot-desert-ruin","open-plot-ember-forge","open-plot-fossil-badlands","open-plot-frostline-peaks","open-plot-jungle-ziggurat","open-plot-lantern-bayou","open-plot-mosslight-ruins","open-plot-night-market","open-plot-patchwork-fairground","open-plot-saltwind-lighthouse","open-plot-
|
|
55
|
+
"test/shipped-graph-cost.test.ts": ["_template","blender-template","driftwood-isle","far-reach","ink-cel-valley","nalati-grasslands","nine-dragon-stack","open-plot-alien-plain","open-plot-clockwork-canyon","open-plot-coral-drift","open-plot-desert-ruin","open-plot-ember-forge","open-plot-fossil-badlands","open-plot-frostline-peaks","open-plot-jungle-ziggurat","open-plot-lantern-bayou","open-plot-mosslight-ruins","open-plot-night-market","open-plot-patchwork-fairground","open-plot-saltwind-lighthouse","open-plot-sky-harbor","open-plot-sky-race","open-plot-starfall-observatory","open-plot-thin-ice","pastel-plain","pine-hollow","sunscar-dunes"],
|
|
56
56
|
"test/nalati-chapter-binding.test.ts": ["nalati-grasslands"],
|
|
57
57
|
"test/nalati-headless-population.test.ts": ["nalati-grasslands"],
|
|
58
58
|
"test/nine-headless-assembly.test.ts": ["nine-dragon-stack"],
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"test/physics-nalati-headless.test.ts": ["nalati-grasslands"],
|
|
211
211
|
"test/physics-open-plots-headless.test.ts": ["open-plot-frostline-peaks", "open-plot-lantern-bayou", "open-plot-ember-forge", "open-plot-mosslight-ruins", "open-plot-coral-drift", "open-plot-fossil-badlands"],
|
|
212
212
|
"test/physics-open-plots-headless-2.test.ts": ["open-plot-patchwork-fairground", "open-plot-desert-ruin", "open-plot-sky-harbor", "open-plot-starfall-observatory", "open-plot-thin-ice", "open-plot-clockwork-canyon"],
|
|
213
|
-
"test/physics-open-plots-headless-3.test.ts": ["open-plot-saltwind-lighthouse", "open-plot-jungle-ziggurat", "open-plot-sky-race", "open-plot-alien-plain"
|
|
213
|
+
"test/physics-open-plots-headless-3.test.ts": ["open-plot-saltwind-lighthouse", "open-plot-jungle-ziggurat", "open-plot-sky-race", "open-plot-alien-plain"],
|
|
214
214
|
"test/shard-headless.test.ts": [
|
|
215
215
|
"_template",
|
|
216
216
|
"pastel-plain",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function trackedPublic(env?: NodeJS.ProcessEnv, cwd?: string): ReadonlySet<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The engine's tracked public/ files, which a pinned product's KTX2 table may name (pins.ts, S11). In a checkout git reads them
|
|
2
|
+
// from the work tree's index. A build-mirror slot (build-mirror.mjs) has no .git and stops git discovery at the slot on purpose,
|
|
3
|
+
// so `git ls-files` there failed and the set came back empty: every tracked engine KTX2 a product names looked missing, and a
|
|
4
|
+
// `serve-build.sh --head` build refused Driftwood (`lm-ao.phone-9f6766dc.ktx2`). The mirror names its own index, which holds
|
|
5
|
+
// exactly the commit it synced, and that is read instead.
|
|
6
|
+
import { execFileSync } from 'node:child_process';
|
|
7
|
+
|
|
8
|
+
/** @param {NodeJS.ProcessEnv} [env] @param {string} [cwd] @returns {ReadonlySet<string>} */
|
|
9
|
+
export function trackedPublic(env = process.env, cwd = process.cwd()) {
|
|
10
|
+
const { WS_MIRROR_REPO: repo, WS_MIRROR_INDEX: index } = env;
|
|
11
|
+
const mirror = repo !== undefined && repo !== '' && index !== undefined && index !== '';
|
|
12
|
+
try {
|
|
13
|
+
return new Set(execFileSync('git', ['ls-files', '-z', 'public'], { cwd: mirror ? repo : cwd, env: mirror ? { ...env, GIT_INDEX_FILE: index } : env, encoding: 'utf8', maxBuffer: 1 << 28, stdio: ['ignore', 'pipe', 'ignore'] }).split('\0').filter(Boolean));
|
|
14
|
+
} catch {
|
|
15
|
+
return new Set();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The npm bin. Node refuses to strip types under node_modules, so an installed engine could not run main.ts itself.
|
|
3
|
+
// The format hook strips our own @wildshard packages' .ts there (J82). main.ts is a dynamic import: a static one
|
|
4
|
+
// would link its whole graph before the hook registers.
|
|
5
|
+
// oxlint-disable-next-line import/no-unassigned-import -- the hook must register before main.ts loads (J82)
|
|
6
|
+
import '../../scripts/format-hook.mjs'
|
|
7
|
+
|
|
8
|
+
await import('./main.ts')
|
|
@@ -22,6 +22,9 @@ export function bootRoute(search: URLSearchParams, previous: { readonly line: st
|
|
|
22
22
|
* already skips the title asks for it. A reopened tab, a bookmark or a crashed session lands on the title, and nothing joins.
|
|
23
23
|
*/
|
|
24
24
|
export function onlineTitleFirst(search: URLSearchParams, online: boolean, tapped: boolean): boolean {
|
|
25
|
-
|
|
25
|
+
// ?glreload is the engine's own reload back into the world (GPU recovery, RELOAD HERE, the reload prompt; play.ts strips it once
|
|
26
|
+
// read, so a reopened tab has none): QA-FEEDBACK-2026-11-13 rows 6 and 13 (WILDSHARD-GAME-8H), a GPU process restart on an
|
|
27
|
+
// Android phone sent the player to the title instead
|
|
28
|
+
if (!online || tapped || search.has('skipintro') || search.has('tour') || search.has('glreload')) return false;
|
|
26
29
|
return !bootRoute(search, { line: '', level: '' }).titleOnly;
|
|
27
30
|
}
|
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
import type { Scope } from '@wildshard/engine/app/scope';
|
|
7
7
|
import type { Drop } from '@wildshard/engine/boot/dropNotice';
|
|
8
8
|
import { mountUi } from '@wildshard/engine/ui/ownership';
|
|
9
|
+
import { captureBrowserError } from '@wildshard/engine/telemetry/browserErrors';
|
|
10
|
+
|
|
11
|
+
/** SENTRY-TRIAGE S13: the drop modal's one Sentry event (`screen:title-drop`), durable through the screen outbox */
|
|
12
|
+
export function reportDrop(drop: Drop, report: typeof captureBrowserError = captureBrowserError): void {
|
|
13
|
+
try {
|
|
14
|
+
const error = new Error(`${drop.what}: ${drop.reason}`);
|
|
15
|
+
if (drop.stack !== '') error.stack = drop.stack;
|
|
16
|
+
report(error, { system: 'title-drop', build: drop.build, shard: drop.world, bootStage: drop.step, fatal: true, screen: 'title-drop',
|
|
17
|
+
diagnostic: { kind: drop.kind, message: drop.message, code: drop.code, end: drop.end, trail: drop.trail, route: drop.routeStack.slice(0, 1500) } });
|
|
18
|
+
} catch { /* telemetry never stops the modal */ }
|
|
19
|
+
}
|
|
9
20
|
|
|
10
21
|
const STYLE = `
|
|
11
22
|
#wsdrop { position: fixed; inset: 0; z-index: var(--ws-layer-error, 2147482500); display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); background: rgba(4, 9, 14, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #e6f2f8; font: 12px/1.5 "JetBrains Mono", ui-monospace, Menlo, monospace; }
|
|
@@ -48,8 +59,10 @@ function make<K extends keyof HTMLElementTagNameMap>(tag: K, className: string,
|
|
|
48
59
|
return el;
|
|
49
60
|
}
|
|
50
61
|
|
|
51
|
-
/** Show the drop over the title. `dev`: the real error too. Returns the close. */
|
|
52
|
-
export function showDropModal(drop: Drop, scope: Scope, options: { readonly dev: boolean; readonly extra?: readonly string[]; readonly parent?: HTMLElement
|
|
62
|
+
/** Show the drop over the title and report it (S13). `dev`: the real error too. `report`: a test's own. Returns the close. */
|
|
63
|
+
export function showDropModal(drop: Drop, scope: Scope, options: { readonly dev: boolean; readonly extra?: readonly string[]; readonly parent?: HTMLElement;
|
|
64
|
+
readonly report?: typeof captureBrowserError }): () => void {
|
|
65
|
+
reportDrop(drop, options.report);
|
|
53
66
|
if (document.getElementById('wsdrop-style') === null) {
|
|
54
67
|
const style = make('style', ''); style.id = 'wsdrop-style'; style.textContent = STYLE; document.head.append(style);
|
|
55
68
|
}
|
package/src/client/app/entry.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { lastEnd } from '@wildshard/engine/boot/lastEnd';
|
|
|
37
37
|
import { installDropNotes, markDropStep, recordDrop, takeDrop } from '@wildshard/engine/boot/dropNotice';
|
|
38
38
|
import { consumeCrashResume, type CrashResume } from '@wildshard/engine/game/session/crashResume';
|
|
39
39
|
import { bootAwait, bootMark, bootTask, bootTiming, endBootOperation } from '@wildshard/engine/boot/timing';
|
|
40
|
+
import { slugOfPath } from './slugPath';
|
|
40
41
|
|
|
41
42
|
|
|
42
43
|
declare const __BUILD_ID__: string;
|
|
@@ -52,6 +53,7 @@ const entryScope = new Scope('entry');
|
|
|
52
53
|
let crashResume: CrashResume | null = null;
|
|
53
54
|
let selectedImages: Scope | undefined;
|
|
54
55
|
const task = (): Promise<void> => new Promise((resolve) => { entryScope.timeout(0, resolve); });
|
|
56
|
+
const UNLISTED = 'This world is not listed. Choose a world from the list.';
|
|
55
57
|
/** The plain home URL paints only the title. No renderer, world, or Three.js is imported until a shard is chosen. */
|
|
56
58
|
// RL3: the static module graph has arrived and run; index.html's 12 s self-reload stands down (only a hung module
|
|
57
59
|
// fetch, which never gets here, reloads by itself; anything after this is guardBoot's)
|
|
@@ -98,11 +100,16 @@ function serverSites(): Promise<readonly { readonly site: string | null | undefi
|
|
|
98
100
|
}
|
|
99
101
|
async function enterPage(): Promise<unknown> {
|
|
100
102
|
const requested = search.get('chunk');
|
|
103
|
+
// SA36: a `/slug/<slug>` link opens that one shard's page; its PLAY leaves for `/?chunk=<slug>`, so a world never boots here
|
|
104
|
+
// Preview only until SA37 (a build with no world: the worker serves any navigation the cached page, so the Worker's gate alone
|
|
105
|
+
// would open it on staging and production to a returning player)
|
|
106
|
+
const slugged = slugOfPath(location.pathname);
|
|
107
|
+
if (slugged !== null && requested === null && (globalThis as { __WS_WORLD__?: unknown }).__WS_WORLD__ === undefined) return showSlugPage(slugged);
|
|
101
108
|
// An embedded author product has its own admission. A game URL must name a
|
|
102
109
|
// listed world before any discovery, tables or renderer can be prepared.
|
|
103
110
|
if (requested !== null && document.getElementById('ws-shardfile') === null && findTitleManifest(requested) === undefined) {
|
|
104
111
|
document.documentElement.classList.add('title-first');
|
|
105
|
-
return showPageTitle(
|
|
112
|
+
return showPageTitle(UNLISTED);
|
|
106
113
|
}
|
|
107
114
|
await waitFor('Startup stylesheets', waitForLoadingStyles(entryScope), 'file');
|
|
108
115
|
const { consumeGridRecovery, gridRecoveryRefused, pageGridRecovery, pendingGridEntry } = await bootTask('app:page-entry-import', () => import('@wildshard/engine/game/grid/pageEntry'));
|
|
@@ -118,6 +125,21 @@ async function enterPage(): Promise<unknown> {
|
|
|
118
125
|
document.documentElement.classList.add('title-first');
|
|
119
126
|
return showPageTitle();
|
|
120
127
|
}
|
|
128
|
+
// OFFLINE OF3 (J298): a world build never enters a shard its world doesn't open (the grid doesn't place it, or the world's word leaves
|
|
129
|
+
// it out: the one heard on this page, else the device's kept one). The world would seat the page in another cell, so a link to it, a
|
|
130
|
+
// tap or a harness URL lands on the title with "Not in this world yet". Asked before the title-first rule, so a bare link says why too.
|
|
131
|
+
const world = (globalThis as { __WS_WORLD__?: unknown }).__WS_WORLD__;
|
|
132
|
+
const notInWorld = async (): Promise<boolean> => online && requested !== null && document.getElementById('ws-shardfile') === null
|
|
133
|
+
&& !(await bootTask('app:one-way-in-import', () => import('@wildshard/engine/game/grid/oneWayIn'))).worldOpens(world)(requested);
|
|
134
|
+
const notInWorldTitle = async (slug: string): Promise<void> => {
|
|
135
|
+
consumeTitleArrival(slug);
|
|
136
|
+
history.replaceState(history.state, '', new URL('/', location.origin));
|
|
137
|
+
document.documentElement.classList.add('title-first');
|
|
138
|
+
const { dropGridEntry, notInWorldLine } = await import('@wildshard/engine/game/grid/oneWayIn');
|
|
139
|
+
dropGridEntry(slug);
|
|
140
|
+
return showPageTitle(notInWorldLine(findTitleManifest(slug)?.name ?? slug));
|
|
141
|
+
};
|
|
142
|
+
if (requested !== null && await notInWorld()) return notInWorldTitle(requested);
|
|
121
143
|
const tapped = requested !== null && (pendingTitleArrival(requested) !== null || pendingGridEntry(requested));
|
|
122
144
|
if (document.getElementById('ws-shardfile') === null && onlineTitleFirst(search, online, tapped)) {
|
|
123
145
|
history.replaceState(history.state, '', new URL('/', location.origin));
|
|
@@ -130,7 +152,9 @@ async function enterPage(): Promise<unknown> {
|
|
|
130
152
|
// a harness URL still opens the shard alone.
|
|
131
153
|
if ((online || pendingTitleArrival(requested ?? '') !== null) && requested !== null && document.getElementById('ws-shardfile') === null) {
|
|
132
154
|
const { enterByShard } = await bootTask('app:one-way-in-import', () => import('@wildshard/engine/game/grid/oneWayIn'));
|
|
133
|
-
await bootTask('app:one-way-in', () => enterByShard({ online, slug: requested, kept: search.has('explore') || pendingGridEntry(requested) },
|
|
155
|
+
await bootTask('app:one-way-in', () => enterByShard({ online, slug: requested, kept: search.has('explore') || pendingGridEntry(requested) }, world));
|
|
156
|
+
// OF3 again: the one way in may have heard the world's word just now, and it may leave this shard out
|
|
157
|
+
if (await notInWorld()) return notInWorldTitle(requested);
|
|
134
158
|
}
|
|
135
159
|
const end = lastEnd();
|
|
136
160
|
const named = search.get('chunk');
|
|
@@ -217,6 +241,41 @@ async function showPageTitle(refusal = ''): Promise<void> {
|
|
|
217
241
|
void startTitleWarmup(import('@wildshard/engine/boot/earlyPrograms'), entryScope, window);
|
|
218
242
|
}
|
|
219
243
|
|
|
244
|
+
/**
|
|
245
|
+
* SA36 (Jake, grill Q14 to Q16): the `/slug/<slug>` page, one shard's card and hero (src/client/game/slugPage.ts). PLAY travels to
|
|
246
|
+
* `/?chunk=<slug>` as a Shard select tap does, so that page enters the grid at the shard's cell (grid/oneWayIn.ts); a shard the
|
|
247
|
+
* grid doesn't place keeps PLAY disabled. A slug no title row names goes to the title with the unlisted line.
|
|
248
|
+
*/
|
|
249
|
+
async function showSlugPage(slug: string): Promise<void> {
|
|
250
|
+
document.documentElement.classList.add('title-first');
|
|
251
|
+
const manifest = findTitleManifest(slug);
|
|
252
|
+
// the page's query (`?sw=0`, `?tier=`, …) rides along to `/`, as a Shard select tap keeps it
|
|
253
|
+
const home = (): URL => new URL(`/${location.search}`, location.origin);
|
|
254
|
+
if (manifest === undefined) {
|
|
255
|
+
history.replaceState(history.state, '', home());
|
|
256
|
+
return showPageTitle(UNLISTED);
|
|
257
|
+
}
|
|
258
|
+
const [{ showStartTitle }, { buildSlugPage }, { installGridTitle }, { shardCell }, { travel }] = await Promise.all([
|
|
259
|
+
import('@wildshard/engine/ui/StartTitle'), import('@wildshard/engine/game/slugPage'), import('@wildshard/engine/game/mainMenu'),
|
|
260
|
+
import('@wildshard/engine/game/grid/oneWayIn'), import('@wildshard/engine/game/travel/travel')]);
|
|
261
|
+
const grid = installGridTitle();
|
|
262
|
+
const placed = shardCell(manifest.slug) !== undefined;
|
|
263
|
+
const leave = (mode: 'enter' | 'explore') => (card: { readonly slug: string }): void => {
|
|
264
|
+
// the shard's page is `/?chunk=`: travel keeps this document's path, so the link's path goes first
|
|
265
|
+
history.replaceState(history.state, '', home());
|
|
266
|
+
travel({ to: card.slug, mode });
|
|
267
|
+
};
|
|
268
|
+
showStartTitle(({ settings, notice }) => {
|
|
269
|
+
const lines = [notice ?? '', grid.note].filter((line) => line !== '').join('\n');
|
|
270
|
+
return buildSlugPage({ manifest, placed, onEnter: leave('enter'), onExplore: leave('explore'),
|
|
271
|
+
onSettings: () => { void (async () => { const { openTitleSettings } = await import('./titleSettings'); await openTitleSettings(settings); })(); },
|
|
272
|
+
...(lines === '' ? {} : { notice: lines }) });
|
|
273
|
+
});
|
|
274
|
+
showDropOnTitle();
|
|
275
|
+
startTitleLowPowerProbe();
|
|
276
|
+
void startTitleWarmup(import('@wildshard/engine/boot/earlyPrograms'), entryScope, window);
|
|
277
|
+
}
|
|
278
|
+
|
|
220
279
|
/**
|
|
221
280
|
* The drop modal (Jake, 2026-11-12): a title the player did not ask for says why, once. Plain words for everyone, the real error
|
|
222
281
|
* with Developer on; every drop also goes to Sentry where the page reports there (src/client/engine/boot/dropNotice.ts).
|
|
@@ -227,13 +286,8 @@ function showDrop(drop: ReturnType<typeof takeDrop>): void {
|
|
|
227
286
|
void (async () => {
|
|
228
287
|
const [{ showDropModal }, { isDev }] = await Promise.all([import('./dropModal'), import('@wildshard/engine/core/devMode')]);
|
|
229
288
|
const abrupt = previousBootLine();
|
|
289
|
+
// Jake (17:52): every title nobody asked for is an error, so the modal's open reports it (SENTRY-TRIAGE S13, `screen:title-drop`)
|
|
230
290
|
showDropModal(drop, entryScope, { dev: isDev(), ...(abrupt === '' ? {} : { extra: [abrupt] }) });
|
|
231
|
-
// Jake (17:52): every title nobody asked for is an error, so every drop goes to Sentry
|
|
232
|
-
const { captureBrowserError } = await import('@wildshard/engine/telemetry/browserErrors');
|
|
233
|
-
const error = new Error(`${drop.what}: ${drop.reason}`);
|
|
234
|
-
if (drop.stack !== '') error.stack = drop.stack;
|
|
235
|
-
captureBrowserError(error, { system: 'title-drop', build: drop.build, shard: drop.world, bootStage: drop.step, fatal: true,
|
|
236
|
-
diagnostic: { kind: drop.kind, message: drop.message, code: drop.code, end: drop.end, trail: drop.trail, route: drop.routeStack.slice(0, 1500) } });
|
|
237
291
|
})().catch(() => undefined);
|
|
238
292
|
}
|
|
239
293
|
|
|
@@ -304,7 +358,9 @@ async function startSelected(): Promise<void> {
|
|
|
304
358
|
setSpawnPacks(runtimePacksOn()); // DL16: Debug ▸ Loading & memory ▸ Level download
|
|
305
359
|
// DL21: a read the whole-set hold stalls is named on the card as the spawn download, in its step
|
|
306
360
|
observeSpawnHolds((held, path) => waitFor('Spawn download', held, 'file', `spawn-download:${path}`));
|
|
307
|
-
|
|
361
|
+
// SA15: `wildshard dev`'s page carries the author's shard inline; the catalogue shard's spawn set isn't its download
|
|
362
|
+
const authored = DEVSERVER && document.getElementById('ws-shardfile') !== null;
|
|
363
|
+
const spawnMode = gridMode(DEVSERVER), spawnJob = authored ? null : startSpawnDownload(arrival.slug, earlyPath === 'grid' ? 'grid' : 'client', TIER,
|
|
308
364
|
`${Number(spawnMode.developer)}${Number(spawnMode.devserver)}${Number(spawnMode.nineDragon)}`);
|
|
309
365
|
if (spawnJob !== null) void loading.setDownloadSource(spawnJob);
|
|
310
366
|
// Read mandatory primary declarations while services and the yielding memory
|
|
@@ -357,7 +413,7 @@ async function startSelected(): Promise<void> {
|
|
|
357
413
|
try {
|
|
358
414
|
imports.check();
|
|
359
415
|
loading.setPrefetchSource(gridPrefetchStatus);
|
|
360
|
-
const source = pageGridRecovery() === null ? await bootTask('app:product-source-and-read', () => configuredShardfile(document, browserShardfileOptions(document.baseURI))) : null;
|
|
416
|
+
const source = pageGridRecovery() === null ? await bootTask('app:product-source-and-read', () => configuredShardfile(document, browserShardfileOptions(document.baseURI, DEVSERVER))) : null;
|
|
361
417
|
page = preparePageResidency(arrival, source?.identity.slug);
|
|
362
418
|
// The script memory bank, sized by route: each reserve can cost JSC a full GC (e472f34069), so a grid page reserves
|
|
363
419
|
// the full-ALL route's demand for its cell activations in play, and a standalone page, which builds its one world under
|
|
@@ -397,7 +453,7 @@ async function startSelected(): Promise<void> {
|
|
|
397
453
|
if (spawnJob !== null) await waitFor('Spawn download', spawnJob.listed ?? spawnJob.ready, 'file');
|
|
398
454
|
const manifest = await bootAwait('app:product-admission', source === null
|
|
399
455
|
? installManifestShardfile(arrival, { ...browserShardfileOptions(document.baseURI, true), memory: page.memory, progress: (progress) => { loading.paintAdmission(progress); } }, bindings, imports.ready)
|
|
400
|
-
: installShardfileProduct(source, { ...browserShardfileOptions(document.baseURI), memory: page.memory, progress: (progress) => { loading.paintAdmission(progress); } }, bindings, imports.ready));
|
|
456
|
+
: installShardfileProduct(source, { ...browserShardfileOptions(document.baseURI, DEVSERVER), memory: page.memory, progress: (progress) => { loading.paintAdmission(progress); } }, bindings, imports.ready));
|
|
401
457
|
// Keep the seam out of code and descriptor admission; world construction
|
|
402
458
|
// can overlap this read and retains its original full-geometry barrier.
|
|
403
459
|
if (page.mode === 'grid') gridSelection.startGridEntryContent(page.instance ?? pageGridRecovery()?.instance ?? gridSelection.gridHome().instance);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** SA36: the slug a `/slug/<slug>` path names (src/client/game/slugPage.ts is its page), or null for any other path. A leaf, so
|
|
2
|
+
* the entry reads it before anything loads; pages/worker.ts serves the page for the same paths. */
|
|
3
|
+
export function slugOfPath(pathname: string): string | null {
|
|
4
|
+
return /^\/slug\/([\w-]+)\/?$/u.exec(pathname)?.[1] ?? null;
|
|
5
|
+
}
|
|
@@ -142,6 +142,21 @@ export class Audio extends PlayerVoices {
|
|
|
142
142
|
scope.onDispose(() => { this.levelBankFns.delete(fn); });
|
|
143
143
|
if (this.levelBank) fn(this.levelBank);
|
|
144
144
|
}
|
|
145
|
+
/** Lend `bank` as the level bank while `scope` lives (AU20: an Open Plot cell's own bank on the grid page). When the scope
|
|
146
|
+
* ends, unless another bank was installed meanwhile, what the lend replaced comes back: the level bank, the sample maps
|
|
147
|
+
* and the music's title bank (a page with no level bank, or a bank with no title, keeps its own). */
|
|
148
|
+
lendLevelBank(bank: LevelAudioBank, scope: Scope): void {
|
|
149
|
+
if (scope.disposed) return;
|
|
150
|
+
const previous = this.levelBank, loops = this.loops, shots = this.shots, title = this.music?.residentBank();
|
|
151
|
+
this.useLevelBank(bank);
|
|
152
|
+
scope.onDispose(() => {
|
|
153
|
+
if (this.levelBank !== bank) return;
|
|
154
|
+
this.levelBank = previous;
|
|
155
|
+
if (bank.samples !== undefined) this.applySamples(loops, shots);
|
|
156
|
+
if (bank.title !== undefined && title !== undefined) this.music?.useBank(title);
|
|
157
|
+
if (previous !== undefined) for (const fn of this.levelBankFns) fn(previous);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
145
160
|
useLevelBank(bank: LevelAudioBank): void {
|
|
146
161
|
this.levelBank = bank;
|
|
147
162
|
if (bank.samples) this.useSamples(bank.samples);
|
|
@@ -268,9 +283,12 @@ export class Audio extends PlayerVoices {
|
|
|
268
283
|
* set) where they sound; before the first gesture it only fills the maps, and resume() starts the bed from them */
|
|
269
284
|
useSamples(bank: SfxBank): void {
|
|
270
285
|
if (bank.set !== this.sfxSet) return; // another set was picked while this one decoded
|
|
271
|
-
const hadBed = this.sampleBed, hadUnder = this.underSample, hadHum = this.hum?.sample === true;
|
|
272
|
-
this.loops = new Map(bank.loops); this.shots = new Map(bank.shots);
|
|
273
286
|
if (bank.credit !== undefined) setSfxCredit(this.sfxSet, bank.credit);
|
|
287
|
+
this.applySamples(new Map(bank.loops), new Map(bank.shots));
|
|
288
|
+
}
|
|
289
|
+
private applySamples(loops: Map<LoopName, SampleLoop>, shots: Map<string, { bufs: AudioBuffer[]; gain: number }>): void {
|
|
290
|
+
const hadBed = this.sampleBed, hadUnder = this.underSample, hadHum = this.hum?.sample === true;
|
|
291
|
+
this.loops = loops; this.shots = shots;
|
|
274
292
|
if (!this.g) return;
|
|
275
293
|
if (this.started && (hadBed || this.loops.has(this.bed))) { this.stopBed(); this.startBed(); }
|
|
276
294
|
if (this.underGain && (hadUnder || this.loops.has('underwater'))) this.feedUnder();
|
|
@@ -17,7 +17,7 @@ import { bootFileList } from './filePolicy';
|
|
|
17
17
|
import * as THREE from 'three';
|
|
18
18
|
import { fetchImage, tierUrl, versionedUrl } from './bytes';
|
|
19
19
|
import { TIER } from '../core/tier';
|
|
20
|
-
import { ktx2Texture } from '../core/ktx2';
|
|
20
|
+
import { ktx2Texture, readHeldForm } from '../core/ktx2';
|
|
21
21
|
import { activeLevel } from '../../../shared/engine/level/selection';
|
|
22
22
|
import { levelBakedId } from '../../../shared/engine/level/spec';
|
|
23
23
|
import { labelAsset, labelClone } from '../render/gpuLabels';
|
|
@@ -59,7 +59,8 @@ export async function preloadBakedTextures(): Promise<number> {
|
|
|
59
59
|
} catch (e) { console.warn(`[baked] ${u}: ${(e as Error).message}`); }
|
|
60
60
|
}), ...urls.map(async (u) => {
|
|
61
61
|
// E157: the KTX2 stand-in when there is one (Y-flipped at encode, like fetchImage's bitmap)
|
|
62
|
-
|
|
62
|
+
// OF17: a form that fails to read gives way to the other when the cache holds it
|
|
63
|
+
try { const served = tierUrl(u); loaded.set(u, await readHeldForm(served, tex => ktx2Texture(served, Infinity, tex), instead => fetchImage(u, Infinity, true, false, instead))); }
|
|
63
64
|
catch (e) { console.warn(`[baked] ${u}: ${(e as Error).message}`); }
|
|
64
65
|
})]);
|
|
65
66
|
return urls.length + common.length;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { pageScope } from '../../../shared/engine/app/resources';
|
|
2
2
|
import { saveStorage } from '../saves/slots';
|
|
3
3
|
/** A small durable breadcrumb for an enabled level boot. A terminated WebContent process cannot run a final handler. */
|
|
4
|
-
import { deliverBrowserError } from '../telemetry/browserErrors';
|
|
4
|
+
import { deliverBrowserError, flushScreenReports, screenReportsEnabled } from '../telemetry/browserErrors';
|
|
5
|
+
import { reportStaleBuild } from '../telemetry/staleBuildReport';
|
|
5
6
|
import type { ProgressView } from './plan';
|
|
6
7
|
import { markDropStep } from './dropNotice';
|
|
7
8
|
|
|
@@ -205,6 +206,10 @@ export function createBootTrace(transports: BootTraceTransports = PAGE_TRANSPORT
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
void flushBootReports();
|
|
209
|
+
// SENTRY-TRIAGE S13: an error screen an earlier page opened and could not deliver goes now, off the boot's hot path (title too).
|
|
210
|
+
// STALE-BUILD SB6: a stale-build screen an earlier page showed (index.html's note) joins the outbox first.
|
|
211
|
+
// No DSN (dev, tests): nothing can be sent, so no timer joins the page's own (the sw tests count them).
|
|
212
|
+
if (typeof window !== 'undefined' && screenReportsEnabled()) pageScope.timeout(8000, () => { reportStaleBuild(); flushScreenReports(); });
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
/** Shown in the loader and the Loading & memory Debug row after a restart. */
|
|
@@ -23,7 +23,7 @@ import { pageScope } from '../../../shared/engine/app/resources';
|
|
|
23
23
|
import { presenting } from '../../../shared/engine/core/framePacing';
|
|
24
24
|
import { workSlice } from '../../../shared/engine/core/workSlice';
|
|
25
25
|
import { demandTextureResponse } from './texturePack';
|
|
26
|
-
import { readContent } from './contentRead';
|
|
26
|
+
import { readContent, type ContentReadOptions } from './contentRead';
|
|
27
27
|
import { contentURL } from './contentBase';
|
|
28
28
|
|
|
29
29
|
export type ChunkFiles = Readonly<Record<ByteKey, readonly string[]>>;
|
|
@@ -218,11 +218,12 @@ function installCounter(): void {
|
|
|
218
218
|
* ImageBitmapLoader (then texture.flipY must be false); pass false for canvas work that keeps the
|
|
219
219
|
* file's orientation.
|
|
220
220
|
*/
|
|
221
|
-
export async function fetchImage(file: string, maxSize: typeof Infinity = Infinity, flip = true, exact = false): Promise<ImageBitmap | HTMLImageElement> {
|
|
221
|
+
export async function fetchImage(file: string, maxSize: typeof Infinity = Infinity, flip = true, exact = false, instead?: ContentReadOptions['instead']): Promise<ImageBitmap | HTMLImageElement> {
|
|
222
222
|
const url = tierUrl(file);
|
|
223
223
|
let type = '';
|
|
224
|
+
// `instead` (OF17, core/assets.ts loadTexture): a failed read may throw rather than wait on RETRY (contentRead.ts)
|
|
224
225
|
const bytes = await readContent(url, 25_000_000, {fetch: (address, init) => fetch(address, init),
|
|
225
|
-
response: response => {type = response.headers.get('content-type') ?? '';}});
|
|
226
|
+
response: response => {type = response.headers.get('content-type') ?? '';}, ...(instead === undefined ? {} : {instead})});
|
|
226
227
|
const blob = new Blob([bytes], {type});
|
|
227
228
|
if (typeof createImageBitmap === 'function') {
|
|
228
229
|
try {
|
|
@@ -91,7 +91,7 @@ export async function clearDownloads(): Promise<ClearReport> {
|
|
|
91
91
|
try {
|
|
92
92
|
const slot = jsonSlot('ktx2set', 'device');
|
|
93
93
|
const value = slot.read();
|
|
94
|
-
markers = typeof value === 'object' && value !== null ? Object.keys(value).length : 0;
|
|
94
|
+
markers = typeof value === 'object' && value !== null ? Object.keys(value).filter(key => !key.endsWith('.read')).length : 0; // OF17's notes are not markers
|
|
95
95
|
slot.write({});
|
|
96
96
|
} catch { /* storage off: no markers were written either */ }
|
|
97
97
|
// 5. the HTTP cache (Clear-Site-Data: "cache"): offline this fails, and the reload is cold for Cache Storage only
|
|
@@ -26,6 +26,9 @@ export interface ContentReadOptions {
|
|
|
26
26
|
response?: (response: Response) => void;
|
|
27
27
|
/** An optional file: a server that answers it is not there (404, the HTML fallback) throws at once instead of RETRY. */
|
|
28
28
|
missingThrows?: boolean;
|
|
29
|
+
/** OF17: asked when the read has failed twice, before it waits on RETRY. True throws the error instead: the caller has
|
|
30
|
+
* another copy to read (a texture's other form, held in the cache). */
|
|
31
|
+
instead?: (error: ContentReadError) => Promise<boolean>;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
function html(bytes: Uint8Array): boolean {
|
|
@@ -139,6 +142,7 @@ export async function readContent(url: string, maximum: number, options: Content
|
|
|
139
142
|
if (error.missing && options.missingThrows === true) throw error;
|
|
140
143
|
if (!retried) { retried = true; }
|
|
141
144
|
else {
|
|
145
|
+
if (options.instead !== undefined && await options.instead(error)) throw error;
|
|
142
146
|
// RL8 (Jake's phone, 2026-11-09: an old cached build sat at "0.00 MB of 28.4 MB"): a deploy keeps only the live
|
|
143
147
|
// build's hashed files, so a missing first-party file on a build the server no longer serves can never arrive.
|
|
144
148
|
// Instead of RETRY forever, the page reloads past its worker into the live build (once per build and tab).
|
|
@@ -70,7 +70,7 @@ export interface DropStore {
|
|
|
70
70
|
write: (key: DropKey, value: Json) => void;
|
|
71
71
|
clear: (key: DropKey) => void;
|
|
72
72
|
}
|
|
73
|
-
type DropKey = 'step' | 'stepOnce' | 'pending' | 'pendingOnce' | 'expect';
|
|
73
|
+
type DropKey = 'step' | 'stepOnce' | 'pending' | 'pendingOnce' | 'expect' | 'seen';
|
|
74
74
|
|
|
75
75
|
/** the step a world page names once it is playing */
|
|
76
76
|
export const PLAYING = 'Playing';
|
|
@@ -184,9 +184,9 @@ export class DropNotes {
|
|
|
184
184
|
if (end.player === true) return null;
|
|
185
185
|
const said = end.kind === 'fresh' ? '' : end.reason;
|
|
186
186
|
if (pending !== null && time(pending, 'at') >= time(expected, 't')) {
|
|
187
|
-
return { kind: 'error', what: text(pending, 'what'), reason: text(pending, 'reason'), step: text(pending, 'step'), world: text(pending, 'world'),
|
|
187
|
+
return this.once({ kind: 'error', what: text(pending, 'what'), reason: text(pending, 'reason'), step: text(pending, 'step'), world: text(pending, 'world'),
|
|
188
188
|
name: text(pending, 'name'), message: text(pending, 'message'), code: text(pending, 'code'), stack: text(pending, 'stack'), end: said,
|
|
189
|
-
trail: text(pending, 'trail'), routeStack: text(pending, 'routeStack'), at: time(pending, 'at'), build: text(pending, 'build') };
|
|
189
|
+
trail: text(pending, 'trail'), routeStack: text(pending, 'routeStack'), at: time(pending, 'at'), build: text(pending, 'build') });
|
|
190
190
|
}
|
|
191
191
|
// the first boot of a visit, and a title after a title: no world page came before it in this tab
|
|
192
192
|
if (step === null) return null;
|
|
@@ -195,7 +195,7 @@ export class DropNotes {
|
|
|
195
195
|
if (end.kind === 'intentional' && PLAYER_EXITS.some((exit) => end.reason.startsWith(exit))) return null;
|
|
196
196
|
const name = first(step.name, step.world), trail = step.trail.join(' → ');
|
|
197
197
|
const via = trail === '' ? '' : ` It was sent here by a redirect: ${trail} → ${name} at ${step.step}.`;
|
|
198
|
-
return {
|
|
198
|
+
return this.once({
|
|
199
199
|
kind: 'restart',
|
|
200
200
|
what: unexpected ? 'The game restarted unexpectedly' : 'Unexpectedly back at the title',
|
|
201
201
|
reason: unexpected ? `The page stopped${name === '' ? '' : ` while ${name} was loading or running`}, without an error the game could catch. On a phone this is most often the system closing the page to free memory.${via}`
|
|
@@ -203,7 +203,21 @@ export class DropNotes {
|
|
|
203
203
|
: `The page left ${name === '' ? 'the world' : name} for the title without the game or you asking (a browser back or reload, or an unmarked navigation).${via}`,
|
|
204
204
|
step: step.step, world: step.world, name: step.name, message: step.error, code: '', stack: step.errorStack, end: first(said, step.route),
|
|
205
205
|
trail, routeStack: step.routeStack, at: step.t, build: step.build,
|
|
206
|
-
};
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* A drop shows once (Jake, 2026-11-13 ~10:05: the 14:48 Driftwood drop came back word for word, same time, after other play).
|
|
211
|
+
* The device copies outlive a quiet take (another tab's copies are its own, so they stay), and a later page that died read the
|
|
212
|
+
* old Playing step back; the device's `seen` mark names the last drop shown, and the same drop (its world and time) never shows again.
|
|
213
|
+
*/
|
|
214
|
+
private once(drop: Drop): Drop | null {
|
|
215
|
+
let seen: Json = null;
|
|
216
|
+
try { seen = this.store.read('seen'); } catch { /* storage blocked: show it */ }
|
|
217
|
+
if (drop.at === 0) return drop; // no time to know it by
|
|
218
|
+
if (time(seen, 'at') === drop.at && text(seen, 'world') === drop.world) return null;
|
|
219
|
+
try { this.store.write('seen', { at: drop.at, world: drop.world }); } catch { /* storage blocked */ }
|
|
220
|
+
return drop;
|
|
207
221
|
}
|
|
208
222
|
|
|
209
223
|
private step(device: boolean): DropStep | null {
|
|
@@ -231,7 +245,7 @@ export class DropNotes {
|
|
|
231
245
|
const SLOT: Readonly<Record<DropKey, () => ReturnType<typeof jsonSlot>>> = {
|
|
232
246
|
step: () => jsonSlot('drop.step', 'session'), stepOnce: () => jsonSlot('drop.step.once', 'device'),
|
|
233
247
|
pending: () => jsonSlot('drop.pending', 'session'), pendingOnce: () => jsonSlot('drop.pending.once', 'device'),
|
|
234
|
-
expect: () => jsonSlot('drop.expect', 'session'),
|
|
248
|
+
expect: () => jsonSlot('drop.expect', 'session'), seen: () => jsonSlot('drop.seen', 'device'),
|
|
235
249
|
};
|
|
236
250
|
const slotOf = (key: DropKey): ReturnType<typeof jsonSlot> => SLOT[key]();
|
|
237
251
|
const PAGE_STORE: DropStore = {
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
* A harness pin still wins; desktop is unchanged.
|
|
30
30
|
* Whatever picks KTX2, the KTX2 capability probe (src/client/engine/render/ktx2Probe.ts) runs once first and turns it into Images
|
|
31
31
|
* when this GPU samples mipmapped compressed textures wrong in every compressed format the transcoder could target.
|
|
32
|
+
* OF17 (one form per device and tier): a shard this device has read as KTX2 stays KTX2 on every page of this tier, where the
|
|
33
|
+
* page's own rule would pick images (a grid page's over-cap estimate counts its residents, a one-shard page's doesn't, so
|
|
34
|
+
* the two disagreed on Nine Dragon and the offline page asked for images it never cached). Only towards KTX2: it is never
|
|
35
|
+
* the bigger form. And when one form of a file fails to read and the cache holds the other, the loader reads the held
|
|
36
|
+
* one (core/ktx2.ts `readHeldForm`), so a form the warm visit never read can't park LOAD on RETRY.
|
|
32
37
|
* Resolved once per SHARD BUILD, on the build's first question (`texMode()`), and never changed inside it: no swap in a
|
|
33
38
|
* running resident. A grid page can build multiple residents, each with its own TexturePolicyBinding.
|
|
34
39
|
* The harness pin applies to that page's build. The
|
|
@@ -80,6 +85,8 @@ interface TexturePolicyState {
|
|
|
80
85
|
readonly level: string | undefined;
|
|
81
86
|
readonly policy: { mode: TexMode; why: string } | undefined;
|
|
82
87
|
resolved: { mode: TexMode; why: string } | null;
|
|
88
|
+
/** OF17: this build's KTX2 read is already in the device's memory */
|
|
89
|
+
kept?: boolean;
|
|
83
90
|
}
|
|
84
91
|
let pagePolicy: TexturePolicyState = { level: undefined, policy: undefined, resolved: null };
|
|
85
92
|
const policyFrames: { state: TexturePolicyState }[] = [];
|
|
@@ -91,6 +98,11 @@ let autoReady: ((slug: string) => boolean) | null = null;
|
|
|
91
98
|
/** shardPrefetch.ts: how Auto learns that a shard's KTX2 set is cached (the marker check) */
|
|
92
99
|
export function setAutoKtx2Check(fn: (slug: string) => boolean): void { autoReady = fn; }
|
|
93
100
|
|
|
101
|
+
/** OF17: the device's memory of the shards it has read as KTX2 on this tier (shardPrefetch.ts keeps it with the markers) */
|
|
102
|
+
export interface DeviceTexForm { read: (slug: string) => boolean; keep: (slug: string) => void }
|
|
103
|
+
let deviceForm: DeviceTexForm | null = null;
|
|
104
|
+
export function setDeviceTexForm(memory: DeviceTexForm | null): void { deviceForm = memory; }
|
|
105
|
+
|
|
94
106
|
/** G188's automatic tier policy: measured over-cap phone builds use KTX2 before the first visit, never desktop. */
|
|
95
107
|
export function autoTexturePolicy(mode: TexMode | undefined, imagesFirstPlayingBytes?: number): { mode: TexMode; why: string } | undefined {
|
|
96
108
|
if (imagesFirstPlayingBytes !== undefined && (!Number.isSafeInteger(imagesFirstPlayingBytes) || imagesFirstPlayingBytes < 0)) throw new RangeError('Invalid images-first playing estimate');
|
|
@@ -124,7 +136,7 @@ let resolving = false;
|
|
|
124
136
|
* zeroes sRGB mips). No verdict (no page, or a measurement pin) changes nothing. The transcoder reads this same probe. */
|
|
125
137
|
const noRawAstc = (probe: Ktx2Probe): boolean => probe.ran && probe.families.astc !== true;
|
|
126
138
|
/** S4: an overlay's raw ASTC 6×6 files have no transcode, so a phone-tier GPU that can't sample ASTC loads images. */
|
|
127
|
-
function rawAstcVeto(probe: Ktx2Probe): string | null {
|
|
139
|
+
export function rawAstcVeto(probe: Ktx2Probe): string | null {
|
|
128
140
|
if (TIER !== 'phone' || !noRawAstc(probe) || ![...registered.phone].some(url => url.includes('/astc6/'))) return null;
|
|
129
141
|
return 'this table names raw ASTC 6×6 and the GPU has no ASTC';
|
|
130
142
|
}
|
|
@@ -147,6 +159,8 @@ export function texModeWhy(): { mode: TexMode; why: string } {
|
|
|
147
159
|
// DL17 (G1000): textures are in their final format at control, so a shard with a KTX2 set boots with it from the first
|
|
148
160
|
// visit (its stand-ins download with the boot) instead of drawing images and swapping on the next visit
|
|
149
161
|
else state.resolved = autoReady?.(slug) === true ? { mode: 'ktx2', why: `auto: ${slug} has a KTX2 set (its final format from the first visit)` } : { mode: 'img', why: `auto: ${slug} has no KTX2 set for this tier` };
|
|
162
|
+
// OF17: a shard this device has read as KTX2 keeps that form on this page too (the grid's choice on a one-shard page)
|
|
163
|
+
if (state.resolved.mode === 'img' && deviceForm?.read(slug) === true) state.resolved = { mode: 'ktx2', why: `auto: this device read ${slug} as KTX2 (OF17)` };
|
|
150
164
|
}
|
|
151
165
|
// last, whatever picked KTX2 (a harness pin included): a GPU that samples the transcoder's only compressed targets
|
|
152
166
|
// wrong when mipmapped loads images (render/ktx2Probe.ts — the iOS Simulator's zeroed sRGB ASTC / ETC2 mips; a
|
|
@@ -172,5 +186,14 @@ export function standIn(served: string, tex: TexMode): string | undefined {
|
|
|
172
186
|
}
|
|
173
187
|
/** the KTX2 stand-in of a file this tier fetches, when this page loads KTX2 */
|
|
174
188
|
export function gpuFile(served: string): string | undefined {
|
|
175
|
-
|
|
189
|
+
const file = standIn(served, texMode());
|
|
190
|
+
if (file !== undefined) keepKtx2Read();
|
|
191
|
+
return file;
|
|
192
|
+
}
|
|
193
|
+
/** OF17: this build reads a KTX2 stand-in under Auto: the device remembers the shard's form (once per build) */
|
|
194
|
+
function keepKtx2Read(): void {
|
|
195
|
+
const state = activePolicy();
|
|
196
|
+
if (state.kept === true || deviceForm === null || texturePin() !== 'auto') return;
|
|
197
|
+
state.kept = true;
|
|
198
|
+
deviceForm.keep(state.level ?? PAGE_LEVEL);
|
|
176
199
|
}
|