@wildshard/engine 0.1.21 → 0.1.23
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 +16 -0
- package/lint/engine-sides.json +5 -0
- package/lint/shardfile-boundaries.mjs +4 -2
- package/lint/sim-players.json +2 -13
- package/lint/wildshard-plugin.js +1 -1
- package/package.json +10 -2
- 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/audio-download-proof.mjs +1 -1
- package/scripts/check-spelled-paths.mjs +6 -3
- package/scripts/ci-pack.mjs +3 -3
- package/scripts/committed-fast-checks.mjs +2 -2
- package/scripts/engine-ci-shard.mjs +11 -0
- package/scripts/failmode-cases.mjs +1 -1
- package/scripts/failmode-proof.mjs +35 -11
- package/scripts/fight-page-census.mjs +131 -0
- package/scripts/goldens/board.py +44 -11
- package/scripts/goldens/native-residency.d.mts +1 -0
- package/scripts/goldens/native-residency.mjs +18 -4
- package/scripts/grid-crossing-walk-proof.mjs +3 -3
- package/scripts/hover-speed-probe.mjs +2 -2
- package/scripts/keep-copy.mjs +120 -0
- package/scripts/land.mjs +36 -6
- 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 +57 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- package/scripts/mmo-bots.mjs +11 -5
- package/scripts/mmo-grid-proof.mjs +74 -0
- package/scripts/mmo-seat-proof.mjs +43 -0
- package/scripts/net-lag-proof.mjs +1 -1
- package/scripts/nightly-heads.ts +13 -13
- package/scripts/nightly-model.ts +26 -12
- package/scripts/nightly.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- package/scripts/online-rig.mjs +7 -7
- package/scripts/parity/boot-smoke.mjs +1 -1
- 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/release-cook.mjs +6 -2
- package/scripts/ring3.proof.ts +71 -0
- package/scripts/ring3.ts +100 -0
- package/scripts/scratch-dir.mjs +31 -12
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +9 -1
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -21
- package/scripts/tsconfig.json +2 -0
- package/scripts/vitest-ci-files.ts +5 -1
- package/scripts/vps/cook-follow.d.mts +6 -0
- package/scripts/vps/cook-follow.mjs +45 -0
- package/scripts/vps/harden-apply.sh +10 -1
- package/scripts/vps/rebuild.sh +104 -36
- package/scripts/vps/wildshard-config +106 -3
- package/scripts/warm-native-chrome.mjs +9 -3
- package/scripts/worker-client-fights.mjs +9 -3
- package/scripts/worktree-reap.mjs +15 -131
- package/scripts/worktree.mjs +92 -12
- package/src/client/app/entry.ts +2 -3
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/contentRead.ts +24 -4
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/boot/downloadGiveUp.ts +34 -0
- package/src/client/engine/combat/EquipmentService.ts +2 -0
- package/src/client/engine/core/Game.ts +6 -2
- package/src/client/engine/core/ktx2.ts +5 -3
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/pwa/sw.js +26 -8
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/downloadFailed.ts +54 -0
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/game/audio/cueDirector.ts +2 -1
- package/src/client/game/boot/spawnDownload.ts +12 -1
- 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/copyPrompts.ts +3 -4
- package/src/client/game/grid/dataCellKit.ts +99 -0
- package/src/client/game/grid/enteredEquipment.ts +11 -2
- package/src/client/game/grid/live.ts +9 -299
- package/src/client/game/grid/liveSession.ts +31 -8
- package/src/client/game/grid/neighbourLife.ts +50 -32
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/reveal.ts +7 -2
- package/src/client/game/grid/session.ts +10 -74
- package/src/client/game/plugin/weaponFamily.ts +6 -0
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientWorker.ts +35 -9
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- 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 +37 -13
- 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/room.ts +2 -38
- package/src/server/game/grid/simulation.ts +5 -4
- package/src/server/game/plugin/mover.ts +18 -14
- package/src/server/game/shardfile/declaredKitItems.ts +39 -9
- package/src/server/host/bake/headlessWorker.ts +3 -3
- package/src/server/host/dedicated/cellHost.ts +2 -2
- package/src/server/host/dedicated/cellProtocol.ts +1 -1
- package/src/server/host/dedicated/cellWorker.ts +5 -3
- package/src/server/host/dedicated/dedicatedRoom.ts +8 -3
- package/src/server/host/dedicated/gridCells.ts +5 -3
- package/src/server/host/dedicated/main.ts +12 -7
- package/src/server/host/dedicated/packReader.ts +15 -2
- package/src/server/host/dedicated/playerStore.ts +1 -1
- package/src/server/host/dedicated/workerTable.ts +0 -10
- package/src/server/host/dedicated/world.ts +39 -5
- package/src/server/host/headlessRuntime.ts +11 -6
- package/src/server/host/standalone/cellWorld.ts +21 -7
- package/src/server/host/standalone/gridServer.ts +3 -1
- package/src/server/host/standalone/roadWorld.ts +6 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/saves/shape.ts +17 -2
- package/src/shared/engine/sim/snapshot.ts +5 -5
- package/src/shared/engine/strings.ts +10 -0
- package/src/shared/game/grid/placementRows.ts +4 -3
- 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/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
- package/src/client/game/grid/cellLoading.ts +0 -110
- package/src/client/game/grid/cellScreens.ts +0 -48
|
@@ -40,6 +40,8 @@ import { workSlice } from '../../../shared/engine/core/workSlice';
|
|
|
40
40
|
import { TIER } from './tier';
|
|
41
41
|
import { prepareKtx2Zstd, unsupercompressKtx2 } from './ktx2Zstd';
|
|
42
42
|
import { parseKtx2 } from '@wildshard/format/ktx2Cost';
|
|
43
|
+
import { waitFor } from '../../../shared/engine/boot/waits';
|
|
44
|
+
import { bootTask } from '../../../shared/engine/boot/timing';
|
|
43
45
|
|
|
44
46
|
/** where scripts/app-build/basis.ts copies three's transcoder: versioned by three's revision, so the SW / HTTP caches never mix two */
|
|
45
47
|
/** Before transcoding `files`: start what their parses will need (the raw-texel zstd decoder) from the caller's stack. */
|
|
@@ -307,16 +309,16 @@ export function loadKtx2(target: Pick<KTX2Loader, 'manager' | 'path' | 'requestH
|
|
|
307
309
|
const resolved = target.manager.resolveURL(target.path + url);
|
|
308
310
|
let bytes = reading.get(resolved);
|
|
309
311
|
if (bytes === undefined) {
|
|
310
|
-
bytes = fetch(resolved, { headers: target.requestHeader, credentials: target.withCredentials ? 'include' : 'same-origin' }).then(response => {
|
|
312
|
+
bytes = bootTask(`texture:read ${resolved}`, () => waitFor('Reading texture', fetch(resolved, { headers: target.requestHeader, credentials: target.withCredentials ? 'include' : 'same-origin' }).then(response => {
|
|
311
313
|
if (response.status !== 200 && response.status !== 0) throw new Error(`fetch for "${response.url}" responded with ${String(response.status)}: ${response.statusText}`);
|
|
312
314
|
return response.arrayBuffer();
|
|
313
|
-
});
|
|
315
|
+
}), 'file', resolved));
|
|
314
316
|
reading.set(resolved, bytes);
|
|
315
317
|
const read = bytes;
|
|
316
318
|
const clear = (): void => { if (reading.get(resolved) === read) reading.delete(resolved); };
|
|
317
319
|
read.finally(clear).catch(() => undefined);
|
|
318
320
|
}
|
|
319
|
-
return bytes.then(buffer => new Promise<THREE.CompressedTexture>((resolve, reject) => { target.parse(buffer, resolve, reject); }));
|
|
321
|
+
return bytes.then(buffer => bootTask(`texture:decode ${resolved}`, () => waitFor('Preparing texture', new Promise<THREE.CompressedTexture>((resolve, reject) => { target.parse(buffer, resolve, reject); }), 'worker', resolved)));
|
|
320
322
|
}
|
|
321
323
|
function load(url: string, keep: boolean): Promise<THREE.CompressedTexture> {
|
|
322
324
|
let p = transcoded.get(url);
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { pageScope } from '../../../shared/engine/app/resources';
|
|
10
10
|
import type { Scope } from '../../../shared/engine/app/scope';
|
|
11
|
+
import { waitFor } from '../../../shared/engine/boot/waits';
|
|
11
12
|
|
|
12
13
|
const HEADER = 80, LEVEL = 24, SCHEME_ZSTD = 2;
|
|
13
14
|
/** level data starts at a multiple of this in the rewritten file (the spec's lcm(texel block size, 4) for every format) */
|
|
@@ -143,7 +144,7 @@ export async function unsupercompressKtx2(buffer: ArrayBuffer): Promise<ArrayBuf
|
|
|
143
144
|
const bytes = new Uint8Array(buffer), levels = zstdLevels(bytes);
|
|
144
145
|
if (levels === null) return buffer;
|
|
145
146
|
try {
|
|
146
|
-
const decoded = await decodeLevels(levels.map(level => ({ data: bytes.slice(level.offset, level.offset + level.length), size: level.size })));
|
|
147
|
+
const decoded = await waitFor('Preparing texture data', decodeLevels(levels.map(level => ({ data: bytes.slice(level.offset, level.offset + level.length), size: level.size }))), 'worker');
|
|
147
148
|
if (decoded.length !== levels.length || decoded.some((data, i) => data.byteLength !== levels[i]?.size)) return buffer;
|
|
148
149
|
const plain = plainKtx2(bytes, levels, decoded);
|
|
149
150
|
return plain.buffer instanceof ArrayBuffer ? plain.buffer : buffer;
|
|
@@ -52,11 +52,11 @@ const immutable = url => NAMED.has(url.pathname) || url.pathname.startsWith('/b/
|
|
|
52
52
|
|| /^[a-f0-9]{8,64}$/.test(url.searchParams.get('v') ?? '');
|
|
53
53
|
const isHtml = response => /\btext\/html\b/i.test(response.headers.get('content-type') ?? '');
|
|
54
54
|
/* PAGE-SIZE PZ10 (J276): content on the content base (`https://packs.wildshard.io/content/<set>/`, baked from the boot
|
|
55
|
-
* bank by serviceWorker.ts; '' when content is on the page) lives in one cross-build cache
|
|
56
|
-
*
|
|
55
|
+
* bank by serviceWorker.ts; '' when content is on the page) lives in one cross-build cache. NB11 removes the set folder
|
|
56
|
+
* only from content-named or per-file-versioned keys; mutable files retain their release URL. No activate touches it. Only a CORS 200 is
|
|
57
57
|
* kept: an opaque body cannot be checked and is padded against quota, and a range never stands for the whole file. */
|
|
58
|
-
/** @type {{ base: string, files: string[] }} one parsed value: the bundler would fold a literal base into its origin */
|
|
59
|
-
const { base: CONTENT_BASE, files: CONTENT_FILES } = JSON.parse('__CONTENT__');
|
|
58
|
+
/** @type {{ base: string, files: string[], versions?: Record<string, string> }} one parsed value: the bundler would fold a literal base into its origin */
|
|
59
|
+
const { base: CONTENT_BASE, files: CONTENT_FILES, versions: CONTENT_VERSIONS = {} } = JSON.parse('__CONTENT__');
|
|
60
60
|
/** OF5: the server book on the content base is solo-only too (a URL there, its path under the base's folder). */
|
|
61
61
|
const CONTENT_PRECACHE = CONTENT_FILES.filter(href => !WORLD || !SOLO_ONLY.test(new URL(href).pathname));
|
|
62
62
|
const CONTENT_CACHE = cacheName('ws-content-v1', CHANNEL);
|
|
@@ -78,6 +78,23 @@ const keepContent = response => (response.type === 'cors' || SAME_ORIGIN_BASE &&
|
|
|
78
78
|
* @param {Request | string} input @param {RequestInit} init */
|
|
79
79
|
const corsRequest = (input, init = {}) => new Request(input, { ...init, mode: 'cors', credentials: 'omit' });
|
|
80
80
|
|
|
81
|
+
/** NB11: a release's set folder changes when any content changes. Only a
|
|
82
|
+
* content-named file or a build-declared content hash can leave that folder.
|
|
83
|
+
* Mutable metadata keeps its exact release URL; channel stores remain separate. */
|
|
84
|
+
function contentKey(href) {
|
|
85
|
+
if (CONTENT_URL === undefined) return href;
|
|
86
|
+
const address = new URL(href);
|
|
87
|
+
if (address.origin !== CONTENT_URL.origin || !address.pathname.startsWith(CONTENT_URL.pathname)) return href;
|
|
88
|
+
const path = address.pathname.slice(CONTENT_URL.pathname.length - 1);
|
|
89
|
+
const version = CONTENT_VERSIONS[path];
|
|
90
|
+
if (!CONTENT.test(path) && !PAGE_PART.test(path) && !OWN_NAMED.test(path)
|
|
91
|
+
&& !/^[a-f0-9]{8,64}$/.test(address.searchParams.get('v') ?? '') && version === undefined) return href;
|
|
92
|
+
const key = new URL(`/__ws_content__/v1${path}`, CONTENT_URL.origin);
|
|
93
|
+
key.search = address.search;
|
|
94
|
+
if (!key.searchParams.has('v') && version !== undefined) key.searchParams.set('v', version);
|
|
95
|
+
return key.href;
|
|
96
|
+
}
|
|
97
|
+
|
|
81
98
|
// Keep the current worker's hot handles. WebKit can take a second to reopen
|
|
82
99
|
// a cache during navigation; a rejected open must remain retryable.
|
|
83
100
|
const stores = new Map();
|
|
@@ -217,14 +234,14 @@ async function precacheQueue(cache, urls, content = false) {
|
|
|
217
234
|
await whilePaused();
|
|
218
235
|
const path = pending.shift();
|
|
219
236
|
if (path === undefined) return;
|
|
220
|
-
const
|
|
237
|
+
const address = abs(path), key = content ? contentKey(address) : address, control = new AbortController();
|
|
221
238
|
inflight.add(control);
|
|
222
239
|
try {
|
|
223
240
|
const held = await cache.match(key, MATCH);
|
|
224
241
|
if (held !== undefined && !isHtml(held)) continue;
|
|
225
242
|
if (held !== undefined) await cache.delete(key);
|
|
226
243
|
if (content) {
|
|
227
|
-
const response = await fetch(corsRequest(
|
|
244
|
+
const response = await fetch(corsRequest(address, { cache: 'force-cache', signal: control.signal }));
|
|
228
245
|
if (!keepContent(response)) throw new Error(`Precache failed: ${path} (${response.type} ${response.status})`);
|
|
229
246
|
await cache.put(key, response);
|
|
230
247
|
continue;
|
|
@@ -397,10 +414,11 @@ async function networkFirst(request, name, event) {
|
|
|
397
414
|
* @param {Request} request */
|
|
398
415
|
async function contentRead(request) {
|
|
399
416
|
const reload = request.cache === 'reload' || request.cache === 'no-store';
|
|
417
|
+
const key = contentKey(request.url);
|
|
400
418
|
let cache;
|
|
401
419
|
try {
|
|
402
420
|
cache = await store(CONTENT_CACHE);
|
|
403
|
-
const held = reload ? undefined : await cache.match(request.url, MATCH);
|
|
421
|
+
const held = reload ? undefined : await cache.match(key, MATCH) ?? (key === request.url ? undefined : await cache.match(request.url, MATCH));
|
|
404
422
|
if (held !== undefined && !isHtml(held)) return held;
|
|
405
423
|
} catch { stores.delete(CONTENT_CACHE); /* Storage denial keeps online fetch working. */ }
|
|
406
424
|
let response;
|
|
@@ -409,7 +427,7 @@ async function contentRead(request) {
|
|
|
409
427
|
try { response = await fetch(corsRequest(request)); }
|
|
410
428
|
catch { return fetch(request); }
|
|
411
429
|
}
|
|
412
|
-
if (cache !== undefined && keepContent(response)) await cache.put(
|
|
430
|
+
if (cache !== undefined && keepContent(response)) await cache.put(key, response.clone()).catch(() => undefined);
|
|
413
431
|
return response;
|
|
414
432
|
}
|
|
415
433
|
|
|
@@ -66,7 +66,9 @@ export interface DataLookSpec {
|
|
|
66
66
|
readonly light?: {
|
|
67
67
|
readonly rim: LookRim | null; readonly pools: LookPools | null; readonly heightFogDensity: number;
|
|
68
68
|
/** B2: real lamps, a warm bounce and a sky-derived environment; absent or null: none */
|
|
69
|
-
readonly lamps?: readonly LookLamp[] | null;
|
|
69
|
+
readonly lamps?: readonly LookLamp[] | null;
|
|
70
|
+
/** AP28: how many lamps light a frame, the nearest the camera; absent: `DESKTOP_LAMPS` */
|
|
71
|
+
readonly lampsLit?: number; readonly bounce?: LookBounce | null; readonly environment?: LookEnvironment | null;
|
|
70
72
|
/** TEMPLATES-CLEANROOM M4: the sun's shadow look and glow motes; absent or null: the engine's shadows, no motes */
|
|
71
73
|
readonly shadow?: LookShadow | null; readonly motes?: LookMotes | null;
|
|
72
74
|
};
|
|
@@ -237,6 +239,8 @@ function cellTone(spec: { readonly neutral?: boolean; readonly aces?: boolean; r
|
|
|
237
239
|
* A level look from data: the engine's clean chain, the gradient dome, the engine fog, key light and ambient turned by
|
|
238
240
|
* the keys on the engine clock, and the LUT last in the grade. Nothing is patched into another material.
|
|
239
241
|
*/
|
|
242
|
+
const lampEye = new THREE.Vector3();
|
|
243
|
+
|
|
240
244
|
export function dataLook(spec: DataLookSpec): LookStrategy {
|
|
241
245
|
if (spec.keys.length === 0) throw new Error('[look] a data look needs at least one key');
|
|
242
246
|
const linear = spec.keys[0]?.fog.near !== undefined;
|
|
@@ -270,9 +274,9 @@ ${mist ? `
|
|
|
270
274
|
shader.fragmentShader = `#ifdef USE_FOG\nuniform float wsLookFogNear; uniform float wsLookFogFar; uniform float wsLookFogEnabled;\n#endif\n${patched}`;
|
|
271
275
|
};
|
|
272
276
|
const owned: { dome: THREE.Mesh<THREE.SphereGeometry, THREE.Material> | null; lut: LookupTexture | null; pools: THREE.Object3D | null; rim: boolean;
|
|
273
|
-
lamps: ReturnType<typeof lampLights> | null; bounce: ReturnType<typeof bounceLight> | null; environment: THREE.WebGLRenderTarget | null;
|
|
277
|
+
lamps: ReturnType<typeof lampLights> | null; eye: THREE.Camera | null; bounce: ReturnType<typeof bounceLight> | null; environment: THREE.WebGLRenderTarget | null;
|
|
274
278
|
glow: THREE.Object3D[] | null; fx: EngineEffects | null; exposure: ExposureEffect | null; clock: DayCycle | null;
|
|
275
|
-
chain: { vignette: { offset: number; darkness: number }; radius: number } | null } = { dome: null, lut: null, pools: null, rim: false, lamps: null, bounce: null, environment: null, glow: null,
|
|
279
|
+
chain: { vignette: { offset: number; darkness: number }; radius: number } | null } = { dome: null, lut: null, pools: null, rim: false, lamps: null, eye: null, bounce: null, environment: null, glow: null,
|
|
276
280
|
fx: null, exposure: null, clock: null, chain: null };
|
|
277
281
|
// AP17: what `liveLook` last set (the light rows and the LUT are compared with the build's, never set)
|
|
278
282
|
let day = spec.day, dayOverride = spec.dayOverride;
|
|
@@ -312,7 +316,9 @@ ${mist ? `
|
|
|
312
316
|
return true;
|
|
313
317
|
},
|
|
314
318
|
// the sky builds before the composer: the level scope takes the dome and the LUT here
|
|
315
|
-
mode: 'extend', chain: 'clean', compose: ({ engineChain, scene, scope, fx, renderer }) => {
|
|
319
|
+
mode: 'extend', chain: 'clean', compose: ({ engineChain, scene, scope, fx, renderer, camera }) => {
|
|
320
|
+
// AP28: the lamps nearest this camera light
|
|
321
|
+
owned.eye = camera; scope.onDispose(() => { if (owned.eye === camera) owned.eye = null; });
|
|
316
322
|
const rim = spec.light?.rim ?? null, pools = spec.light?.pools ?? null, lamps = spec.light?.lamps ?? null;
|
|
317
323
|
if (rim !== null && !owned.rim) {
|
|
318
324
|
owned.rim = true; scope.onDispose(() => { owned.rim = false; });
|
|
@@ -335,7 +341,7 @@ ${mist ? `
|
|
|
335
341
|
}
|
|
336
342
|
if (lamps !== null && owned.lamps === null) {
|
|
337
343
|
// B2: real lamps, once per look like the pools
|
|
338
|
-
const group = lampLights(lamps);
|
|
344
|
+
const group = lampLights(lamps, spec.light?.lampsLit);
|
|
339
345
|
owned.lamps = group;
|
|
340
346
|
scene.add(group); scope.onDispose(() => { group.removeFromParent(); for (const light of group.children) if (light instanceof THREE.Light) light.dispose(); if (owned.lamps === group) owned.lamps = null; });
|
|
341
347
|
}
|
|
@@ -343,7 +349,8 @@ ${mist ? `
|
|
|
343
349
|
if (owned.glow === null && ((lamps?.some((lamp) => lamp.halo !== undefined) ?? false) || motes !== null)) {
|
|
344
350
|
// M4.8: the lamps' halos (one instanced draw) and the motes (one points draw), once per look like the lamps
|
|
345
351
|
const glow: (THREE.Mesh | THREE.Points)[] = [];
|
|
346
|
-
|
|
352
|
+
// a following lamp's halo would stay at its offset: AP24b lights it, its halo waits
|
|
353
|
+
const halos = lamps === null ? null : lampHalos(lamps.filter((lamp) => lamp.follow === undefined));
|
|
347
354
|
if (halos !== null) glow.push(halos);
|
|
348
355
|
if (motes !== null) glow.push(lookMotes(motes));
|
|
349
356
|
owned.glow = glow;
|
|
@@ -436,7 +443,7 @@ ${mist ? `
|
|
|
436
443
|
owned.lut = await lutTexture(spec.lut);
|
|
437
444
|
return { clock, horizon: now.fog.clone(), lut: owned.lut, clouds: dome,
|
|
438
445
|
bind: (t) => { targets = t; apply(); },
|
|
439
|
-
update: (dt) => { clock.update(dt); apply(); flicker += dt; owned.lamps?.update?.(flicker); if (owned.glow !== null) tickGlow(owned.glow, flicker); },
|
|
446
|
+
update: (dt) => { clock.update(dt); apply(); flicker += dt; owned.lamps?.update?.(flicker, owned.eye?.getWorldPosition(lampEye)); if (owned.glow !== null) tickGlow(owned.glow, flicker); },
|
|
440
447
|
rebuild: () => undefined, attachPost: () => undefined };
|
|
441
448
|
},
|
|
442
449
|
};
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* All of it waits behind Settings ▸ Debug ▸ Look ▸ "Look light" (read at load; default on): with the row off, a look that
|
|
22
22
|
* declares every setting draws as one that declares none. TEMPLATES-CLEANROOM M4.9 gates it per field on the phone tier
|
|
23
23
|
* instead of all or nothing: a phone keeps the environment, bounce, pools, rim, height fog and shadow look, at most
|
|
24
|
-
* `PHONE_LAMPS` lamps, half the motes, and no bloom or AO.
|
|
24
|
+
* `PHONE_LAMPS` lamps lit, the nearest (AP28), half the motes, and no bloom or AO.
|
|
25
25
|
*/
|
|
26
26
|
import * as THREE from 'three';
|
|
27
27
|
import type { LookBounce, LookEnvironment, LookLamp, LookLight, LookPools, LookRim } from '@wildshard/format/look-light';
|
|
@@ -42,6 +42,8 @@ export interface LookLightResolved {
|
|
|
42
42
|
readonly rim: LookRim | null;
|
|
43
43
|
readonly pools: LookPools | null;
|
|
44
44
|
readonly lamps: readonly LookLamp[] | null;
|
|
45
|
+
/** AP28: how many of `lamps` light a frame, the nearest the eye (`PHONE_LAMPS` on a phone, `DESKTOP_LAMPS` else) */
|
|
46
|
+
readonly lampsLit: number;
|
|
45
47
|
readonly bounce: LookBounce | null;
|
|
46
48
|
readonly environment: LookEnvironment | null;
|
|
47
49
|
/** M4.2: the sun's shadow look; null: the engine's */
|
|
@@ -61,10 +63,12 @@ const NO_HEIGHT_FOG = { fogHeight: -20, fogHeightFalloff: 0, fogHeightDensity: 0
|
|
|
61
63
|
|
|
62
64
|
/** M4.9: at most this many of a look's lamps light on the phone tier (each costs every lit draw a light-loop step) */
|
|
63
65
|
export const PHONE_LAMPS = 4;
|
|
66
|
+
/** SHARD-SOURCE AP28: at most this many of a look's lamps light a desktop frame (shard-format `LOOK_LIGHT_LIT_MAX`) */
|
|
67
|
+
export const DESKTOP_LAMPS = 16;
|
|
64
68
|
|
|
65
69
|
/**
|
|
66
70
|
* Resolve a look's light settings; `on` is the Debug row ("Look light"), `tier` the page's. Off, or nothing declared: as
|
|
67
|
-
* before. The phone tier keeps the cheap fields (M4.9): no bloom or AO, the
|
|
71
|
+
* before. The phone tier keeps the cheap fields (M4.9): no bloom or AO, the nearest `PHONE_LAMPS` lamps lit (AP28), half the motes.
|
|
68
72
|
*/
|
|
69
73
|
export function lookLightManifest(look: LookLightSource, on: boolean, tier = 'desktop'): LookLightResolved {
|
|
70
74
|
const phone = tier === 'phone';
|
|
@@ -76,7 +80,8 @@ export function lookLightManifest(look: LookLightSource, on: boolean, tier = 'de
|
|
|
76
80
|
ao: light?.ao === undefined || phone ? null : { intensity: light.ao.intensity, radius: light.ao.radius },
|
|
77
81
|
rim: light?.rim ?? null,
|
|
78
82
|
pools: light?.pools ?? null,
|
|
79
|
-
lamps: light?.lamps
|
|
83
|
+
lamps: light?.lamps ?? null,
|
|
84
|
+
lampsLit: phone ? PHONE_LAMPS : DESKTOP_LAMPS,
|
|
80
85
|
bounce: light?.bounce ?? null,
|
|
81
86
|
environment: light?.environment ?? null,
|
|
82
87
|
shadow: light?.shadow ?? null,
|
|
@@ -156,29 +161,68 @@ export function bounceLight(bounce: LookBounce): { light: THREE.DirectionalLight
|
|
|
156
161
|
return { light, aim };
|
|
157
162
|
}
|
|
158
163
|
|
|
164
|
+
/** SHARD-SOURCE AP24b: what a following lamp rides (`lamps[].follow`), or null while that actor is not in the world. */
|
|
165
|
+
export type LampFollowResolve = (actor: string, bone: string | undefined) => THREE.Object3D | null;
|
|
166
|
+
const lampFollows = new WeakMap<THREE.Object3D, LampFollowResolve>();
|
|
167
|
+
/** The page's actor lookup for the following lamps drawn under `root` (its scene); returns the undo. */
|
|
168
|
+
export function setLampFollow(root: THREE.Object3D, resolve: LampFollowResolve): () => void {
|
|
169
|
+
lampFollows.set(root, resolve);
|
|
170
|
+
return () => { if (lampFollows.get(root) === resolve) lampFollows.delete(root); };
|
|
171
|
+
}
|
|
172
|
+
const rootOf = (object: THREE.Object3D): THREE.Object3D => { let at = object; while (at.parent !== null) at = at.parent; return at; };
|
|
173
|
+
|
|
174
|
+
/** a lamp group's frame step: `time` drives the flicker, `eye` (world) picks the nearest lamps when more than `lit` exist */
|
|
175
|
+
export type LampUpdate = (time: number, eye?: THREE.Vector3Like) => void;
|
|
176
|
+
|
|
159
177
|
/**
|
|
160
|
-
* The look's lamps (B2):
|
|
161
|
-
*
|
|
162
|
-
*
|
|
178
|
+
* The look's lamps (B2): a pool of at most `lit` shadowless point lights (AP28: 16 on a desktop, `PHONE_LAMPS` on a phone),
|
|
179
|
+
* physical decay unless a lamp sets its own (M4.3). The pool's size never changes, so no shader recompiles as lamps come and
|
|
180
|
+
* go: `update` gives its lights to the lamps nearest `eye`, places each following lamp (AP24b) at its offset in its actor's
|
|
181
|
+
* or bone's frame (dark while that actor is absent), and flickers the lamps that declare a flicker (two incommensurate sines
|
|
182
|
+
* per lamp, so no two pulse together). It is null when nothing moves: at most `lit` fixed lamps and no flicker, drawn
|
|
183
|
+
* exactly as before.
|
|
163
184
|
*/
|
|
164
|
-
export function lampLights(lamps: readonly LookLamp[]): THREE.Group & { update:
|
|
165
|
-
const group = Object.assign(new THREE.Group(), { update: null as
|
|
185
|
+
export function lampLights(lamps: readonly LookLamp[], lit: number = DESKTOP_LAMPS): THREE.Group & { update: LampUpdate | null } {
|
|
186
|
+
const group = Object.assign(new THREE.Group(), { update: null as LampUpdate | null });
|
|
166
187
|
group.name = 'look-light-lamps';
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
light.
|
|
188
|
+
const rows = lamps.map((lamp, i) => ({ lamp, phase: i * 2.399, at: new THREE.Vector3(...lamp.at), place: new THREE.Vector3(...lamp.at), live: lamp.follow === undefined,
|
|
189
|
+
colour: new THREE.Color().setRGB(lamp.colour[0], lamp.colour[1], lamp.colour[2], THREE.LinearSRGBColorSpace) }));
|
|
190
|
+
const pool = rows.slice(0, Math.max(0, Math.min(rows.length, lit))).map((row) => {
|
|
191
|
+
const light = new THREE.PointLight(row.colour, row.live ? row.lamp.intensity : 0, row.lamp.distance, row.lamp.decay ?? 2);
|
|
192
|
+
light.position.copy(row.place); light.castShadow = false;
|
|
171
193
|
group.add(light);
|
|
172
|
-
|
|
194
|
+
return light;
|
|
173
195
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
const following = rows.filter((row) => row.lamp.follow !== undefined), crowded = rows.length > pool.length;
|
|
197
|
+
const flickers = rows.some((row) => (row.lamp.flicker?.amount ?? 0) > 0);
|
|
198
|
+
if (following.length === 0 && !crowded && !flickers) return group;
|
|
199
|
+
const eyeLocal = new THREE.Vector3(), chosen: typeof rows = [];
|
|
200
|
+
group.update = (time, eye) => {
|
|
201
|
+
if (following.length > 0) {
|
|
202
|
+
const resolve = lampFollows.get(rootOf(group));
|
|
203
|
+
for (const row of following) {
|
|
204
|
+
const follow = row.lamp.follow, target = follow === undefined || resolve === undefined ? null : resolve(follow.actor, follow.bone);
|
|
205
|
+
row.live = target !== null;
|
|
206
|
+
// the bone's world matrix is renewed only inside render: renew it here, or the lamp trails a frame behind (review)
|
|
207
|
+
if (target !== null) { target.updateWorldMatrix(true, false); group.updateWorldMatrix(true, false); group.worldToLocal(target.localToWorld(row.place.copy(row.at))); }
|
|
179
208
|
}
|
|
180
|
-
}
|
|
181
|
-
|
|
209
|
+
}
|
|
210
|
+
chosen.length = 0;
|
|
211
|
+
for (const row of rows) if (row.live) chosen.push(row);
|
|
212
|
+
if (crowded && eye !== undefined) {
|
|
213
|
+
group.worldToLocal(eyeLocal.copy(eye));
|
|
214
|
+
chosen.sort((a, b) => a.place.distanceToSquared(eyeLocal) - b.place.distanceToSquared(eyeLocal));
|
|
215
|
+
}
|
|
216
|
+
pool.forEach((light, i) => {
|
|
217
|
+
const row = chosen[i];
|
|
218
|
+
if (row === undefined) { light.intensity = 0; return; }
|
|
219
|
+
const flicker = row.lamp.flicker;
|
|
220
|
+
light.color.copy(row.colour); light.distance = row.lamp.distance; light.decay = row.lamp.decay ?? 2; light.position.copy(row.place);
|
|
221
|
+
if (flicker === undefined || flicker.amount <= 0) { light.intensity = row.lamp.intensity; return; }
|
|
222
|
+
const w = Math.sin(time * flicker.rate * 2.1 + row.phase) * 0.6 + Math.sin(time * flicker.rate * 5.3 + row.phase * 1.7) * 0.4;
|
|
223
|
+
light.intensity = row.lamp.intensity * (1 - flicker.amount * 0.5 + flicker.amount * 0.5 * w);
|
|
224
|
+
});
|
|
225
|
+
};
|
|
182
226
|
return group;
|
|
183
227
|
}
|
|
184
228
|
|
|
@@ -19,7 +19,7 @@ import { loadingCacheText, loadingDownloadText, loadingDownloadFraction, loading
|
|
|
19
19
|
import { LoadingTimeline, installLoadingTimeline, type LoadingPath, type LoadingRow, type LoadingGap } from '../../../shared/engine/boot/timeline';
|
|
20
20
|
import {loadingFraction} from '../boot/weights';
|
|
21
21
|
import {TimeLeftClock,timeLeftSeconds,timeLeftText} from '../boot/timeLeft';
|
|
22
|
-
import {diagnosticBuild,diagnosticStep
|
|
22
|
+
import {compactBootDiagnostics,diagnosticBuild,diagnosticStep} from '../boot/diagnostics';
|
|
23
23
|
import { isDev, onDev } from '../core/devMode';
|
|
24
24
|
import { getSetting, onSetting } from './Settings';
|
|
25
25
|
import { listenTap } from '../input/dom';
|
|
@@ -715,14 +715,13 @@ export class Loading {
|
|
|
715
715
|
for (const [key, ms] of Object.entries(times)) setData(this.root, `${key}Ms`, String(Math.round(ms)));
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
/** LS4:
|
|
718
|
+
/** LS4/NB15: the card facts and a compact LS1 digest for Jake to paste. */
|
|
719
719
|
diagnosticsText(): string {
|
|
720
|
-
const localTiming = bootTiming()?.read(), timing=
|
|
721
|
-
const all = this.timeline.snapshot()
|
|
720
|
+
const localTiming = bootTiming()?.read(), timing=compactBootDiagnostics(localTiming), transfer = this.downloadProgress(), times = this.phaseTimes();
|
|
721
|
+
const all = this.timeline.snapshot();
|
|
722
722
|
const lines = [
|
|
723
723
|
`Wildshard boot diagnostics · ${new Date().toISOString()}`,
|
|
724
|
-
|
|
725
|
-
...(Array.isArray(summary) ? summary.filter((line): line is string => typeof line === 'string') : []),
|
|
724
|
+
...timing.summary,
|
|
726
725
|
`build ${diagnosticBuild(localTiming?.build)} · ${this.tierText()} · ${innerWidth}x${innerHeight} @${devicePixelRatio}x · ${this.lowPowerLine()}`,
|
|
727
726
|
`total ${seconds(times.total)} · start ${seconds(times.start)} · download ${seconds(times.download)} · load ${seconds(times.load)}${this.finished ? '' : ' · not ready'}`,
|
|
728
727
|
`download ${loadingCacheText(transfer)} · files ${transfer.filesDone} of ${transfer.filesTotal} · ${transfer.complete ? 'complete' : 'open'}${transfer.error === null ? '' : ' · error (private text omitted)'}`,
|
|
@@ -732,8 +731,7 @@ export class Loading {
|
|
|
732
731
|
...all.rows.map(row => ` ${row.number}. ${diagnosticStep(row.key,row.number)} · ${row.state} · ${Math.round(row.ms)} ms`),
|
|
733
732
|
...all.gaps.map(gap => ` gap · ${gap.state} · ${Math.round(gap.ms)} ms`),
|
|
734
733
|
'This page\'s files are named by path; other URLs use local report IDs; free text, details and errors are omitted.',
|
|
735
|
-
|
|
736
|
-
JSON.stringify(timing ?? null),
|
|
734
|
+
...timing.timeline,
|
|
737
735
|
];
|
|
738
736
|
return lines.join('\n');
|
|
739
737
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// FM6 mode 36 (meta docs/plans/MMO-FAILURE-MODES-PLAN.md): "The world didn't download". A page (the plan's first style) over the
|
|
2
|
+
// loading card, shown while a read the given-up download fell through to waits on RETRY. Try again is that same RETRY (the existing
|
|
3
|
+
// recovery path, no new counter); the downloaded files are kept, so it is quicker. It closes when the wait it belongs to settles.
|
|
4
|
+
// Primary copy has no address or status: Details and Copy diagnostics hold them.
|
|
5
|
+
import type { Scope } from '../../../shared/engine/app/scope';
|
|
6
|
+
import type { DownloadGiveUp } from '../boot/downloadGiveUp';
|
|
7
|
+
import { copyText, diagnosticsSource } from './diagnosticsCopy';
|
|
8
|
+
import { mountUi } from './ownership';
|
|
9
|
+
import { engineString } from '../../../shared/engine/strings';
|
|
10
|
+
|
|
11
|
+
const PAGE = 'position:fixed;inset:0;z-index:2147482600;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(4,9,14,.86);color:#e6f2f8;font:12px/1.5 "JetBrains Mono",Menlo,monospace';
|
|
12
|
+
const BOX = 'width:min(440px,100%);padding:22px 18px 16px;background:rgba(13,27,38,.92);border:1px solid rgba(255,120,120,.45);border-top:2px solid #ff7878;display:flex;flex-direction:column;gap:10px';
|
|
13
|
+
const BUTTON = 'min-height:48px;padding:13px 16px;cursor:pointer;font:700 12px/1 "JetBrains Mono",Menlo,monospace;letter-spacing:.22em;text-transform:uppercase;border:1px solid rgba(143,227,255,.35);background:rgba(13,27,38,.6);color:#e6f2f8';
|
|
14
|
+
|
|
15
|
+
/** The one page on screen: a second waiting read shares it, and takes it over if the first read's wait ends alone (a cancel). */
|
|
16
|
+
let open: Scope | null = null;
|
|
17
|
+
const queued: (() => void)[] = [];
|
|
18
|
+
|
|
19
|
+
/** Show the page for `owner`'s wait (its disposal closes it). `retry` is the card's RETRY; `measured` is the read's own failure. */
|
|
20
|
+
export function downloadFailedPage(owner: Scope, given: DownloadGiveUp, measured: string, retry: () => void): void {
|
|
21
|
+
if (open !== null && !open.disposed) {
|
|
22
|
+
const again = (): void => { if (!owner.disposed) downloadFailedPage(owner, given, measured, retry); };
|
|
23
|
+
queued.push(again);
|
|
24
|
+
owner.onDispose(() => { const at = queued.indexOf(again); if (at !== -1) queued.splice(at, 1); });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const page = owner.child('download-failed');
|
|
28
|
+
open = page;
|
|
29
|
+
const root = document.createElement('div'), box = document.createElement('div'), tag = document.createElement('p'), title = document.createElement('h1'), body = document.createElement('p');
|
|
30
|
+
const again = document.createElement('button'), check = document.createElement('button'), copy = document.createElement('button');
|
|
31
|
+
const details = document.createElement('details'), summary = document.createElement('summary'), fact = document.createElement('p');
|
|
32
|
+
root.dataset['failmode'] = 'download-failed'; root.dataset['tone'] = 'bad'; root.setAttribute('role', 'alertdialog'); root.setAttribute('aria-modal', 'true');
|
|
33
|
+
root.setAttribute('aria-label', engineString('s_download_failed_title')); root.style.cssText = PAGE; box.style.cssText = BOX;
|
|
34
|
+
tag.textContent = engineString('s_download_failed_tag'); tag.style.cssText = 'margin:0;font-size:10.5px;letter-spacing:.3em;text-transform:uppercase;color:#ff9a9a';
|
|
35
|
+
title.textContent = engineString('s_download_failed_title'); title.style.cssText = 'margin:0;font:700 24px/1.1 Rajdhani,Bahnschrift,sans-serif;letter-spacing:.1em;text-transform:uppercase;color:#fff';
|
|
36
|
+
body.textContent = engineString('s_download_failed_body', [given.attempts]);
|
|
37
|
+
body.style.margin = '0';
|
|
38
|
+
again.type = 'button'; again.className = 'go'; again.textContent = engineString('s_download_failed_retry'); again.style.cssText = `${BUTTON};border-color:#8fe3ff;background:rgba(143,227,255,.18)`;
|
|
39
|
+
check.type = 'button'; check.textContent = engineString('s_download_failed_check'); check.style.cssText = BUTTON;
|
|
40
|
+
copy.type = 'button'; copy.textContent = engineString('s_download_failed_copy'); copy.style.cssText = BUTTON;
|
|
41
|
+
const said = `${given.detail}${given.status === null ? ' · no HTTP response' : ` · HTTP ${String(given.status)}`} × ${String(given.attempts)}; then ${measured}`;
|
|
42
|
+
summary.textContent = engineString('s_download_failed_details'); fact.textContent = said; fact.style.cssText = 'margin:8px 0 0;opacity:.6;overflow-wrap:anywhere';
|
|
43
|
+
details.append(summary, fact);
|
|
44
|
+
page.listen(again, 'click', () => { again.disabled = true; again.textContent = engineString('s_download_failed_trying'); retry(); });
|
|
45
|
+
page.listen(check, 'click', () => { document.dispatchEvent(new CustomEvent('ws:doctor', { detail: 'download-failed' })); });
|
|
46
|
+
page.listen(copy, 'click', () => {
|
|
47
|
+
const report = diagnosticsSource();
|
|
48
|
+
void (async () => { copy.textContent = await copyText(`${said}\n\n${report === null ? '' : report()}`) ? engineString('s_download_failed_copied') : engineString('s_download_failed_refused'); })();
|
|
49
|
+
});
|
|
50
|
+
page.onDispose(() => { root.remove(); if (open === page) open = null; queued.shift()?.(); });
|
|
51
|
+
box.append(tag, title, body, again, check, copy, details); root.append(box);
|
|
52
|
+
mountUi(root, page, document.body);
|
|
53
|
+
again.focus();
|
|
54
|
+
}
|
|
@@ -19,7 +19,7 @@ export function lookLightSaved(): boolean {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Whether the settings draw on this page: the row on. TEMPLATES-CLEANROOM M4.9: the phone tier draws them too, gated per
|
|
22
|
-
* field (`lookLightManifest`: no bloom or AO,
|
|
22
|
+
* field (`lookLightManifest`: no bloom or AO, the nearest 4 lamps lit, half the motes), not all or nothing; `tier` stays for callers.
|
|
23
23
|
*/
|
|
24
24
|
export function lookLightOn(_tier: string = TIER): boolean { return lookLightSaved(); }
|
|
25
25
|
/** Save the row's value (the page reloads to apply it). */
|
|
@@ -4,6 +4,7 @@ import { parse } from 'valibot';
|
|
|
4
4
|
import type { Game } from '@wildshard/engine/core/Game';
|
|
5
5
|
import type { Scope } from '@wildshard/engine/app/scope';
|
|
6
6
|
import type { CombatCues } from '@wildshard/engine/combat/cues';
|
|
7
|
+
import { audioLog } from '@wildshard/engine/audio/audioLog';
|
|
7
8
|
import { Impacts } from '@wildshard/engine/fx/Impacts';
|
|
8
9
|
import { effectField, type EffectField } from '@wildshard/engine/fx/effectField';
|
|
9
10
|
import { ParticlePool, pointScale } from '@wildshard/engine/fx/ParticlePool';
|
|
@@ -151,7 +152,7 @@ export class CueDirector {
|
|
|
151
152
|
}
|
|
152
153
|
if (row.sound !== undefined) {
|
|
153
154
|
if (this.sounds === undefined) throw new Error('Cue sound owner is absent');
|
|
154
|
-
this.sounds.cue(row.sound as `cue.${string}`, row.soundPhase === undefined ? {} : { phase: row.soundPhase });
|
|
155
|
+
audioLog('cue', row.id, this.sounds.cue(row.sound as `cue.${string}`, row.soundPhase === undefined ? {} : { phase: row.soundPhase }), row.sound);
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
}
|
|
@@ -6,6 +6,7 @@ import { beginLoadingWait, finishLoadingWait } from '@wildshard/engine/boot/load
|
|
|
6
6
|
import { diagnosticNow } from '@wildshard/engine/core/clock';
|
|
7
7
|
import { Scope } from '@wildshard/engine/app/scope';
|
|
8
8
|
import {contentBase, contentURL, isContentOrigin, pageURL} from '@wildshard/engine/boot/contentBase';
|
|
9
|
+
import { clearDownloadGiveUp, noteDownloadGiveUp } from '@wildshard/engine/boot/downloadGiveUp';
|
|
9
10
|
import {bareSlug} from '../../../shared/game/grid/catalogueSlot';
|
|
10
11
|
import {placedLoose, placedSpawn} from './placedSpawn';
|
|
11
12
|
|
|
@@ -389,6 +390,9 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
|
|
|
389
390
|
let markListed = (): void => undefined, markStopped = (_reason: unknown): void => undefined;
|
|
390
391
|
const listedOnly = new Promise<void>(resolve => { markListed = resolve; });
|
|
391
392
|
const stopped = new Promise<never>((_resolve, reject) => { markStopped = reject; });
|
|
393
|
+
// FM6 mode 36: a part that ran out of reads, and the last status a part answered (no HTTP response: null)
|
|
394
|
+
const exhausted: { fact: { readonly status: number | null; readonly detail: string } | null } = { fact: null };
|
|
395
|
+
clearDownloadGiveUp();
|
|
392
396
|
const work = (async () => {
|
|
393
397
|
try {
|
|
394
398
|
// OVERNIGHT 6e: the manifest and its code list, read together. The list is the build's own, read from the content base
|
|
@@ -606,9 +610,13 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
|
|
|
606
610
|
const file = files[index]; if (file === undefined) continue;
|
|
607
611
|
members.set(file.url, new Promise(resolve => {settle.set(index, resolve); memberSettles.add(resolve);}));
|
|
608
612
|
}
|
|
613
|
+
// FM6 mode 36: this part's last failed HTTP status (null: no response, or a body that broke)
|
|
614
|
+
let status: number | null = null;
|
|
609
615
|
// One read of the part. A read after a failure starts over and skips what landed, so no member counts twice.
|
|
610
616
|
const read = async (init: RequestInit | undefined): Promise<void> => {
|
|
617
|
+
status = null;
|
|
611
618
|
const response = await ports.fetch(onPacks(part.url, packs), controller.signal, init);
|
|
619
|
+
if (!response.ok) status = response.status;
|
|
612
620
|
if (!response.ok || response.body === null) throw new Error(`Spawn part unavailable: ${part.url}`);
|
|
613
621
|
const body = new Uint8Array(part.bytes), reader = response.body.getReader();
|
|
614
622
|
let at = 0, next = 0;
|
|
@@ -650,7 +658,7 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
|
|
|
650
658
|
const last = attempt >= PART_READS || controller.signal.aborted;
|
|
651
659
|
if (last) for (const [index] of order) { const file = files[index]; if (file !== undefined) landed(file.url); }
|
|
652
660
|
controller.signal.throwIfAborted();
|
|
653
|
-
if (attempt >= PART_READS) throw failure; // the job's failure answers every read still waiting
|
|
661
|
+
if (attempt >= PART_READS) { exhausted.fact ??= { status, detail: failure instanceof Error ? failure.message : String(failure) }; throw failure; } // the job's failure answers every read still waiting
|
|
654
662
|
if (attempt > 1) { await partPause(); controller.signal.throwIfAborted(); }
|
|
655
663
|
}
|
|
656
664
|
}
|
|
@@ -689,6 +697,9 @@ export function downloadSpawnManifest(address: SpawnManifestAddress, ports: Spaw
|
|
|
689
697
|
} catch (failure) {
|
|
690
698
|
// A read waiting on a file this download will not store falls through to the network.
|
|
691
699
|
releaseWaits();
|
|
700
|
+
// FM6 mode 36: a part out of reads refused the job (a cancel is no refusal); a read that falls through and fails too shows
|
|
701
|
+
// the download-failed page, not RETRY's line alone (contentRead.ts)
|
|
702
|
+
if (!controller.signal.aborted && exhausted.fact !== null) noteDownloadGiveUp({ attempts: PART_READS, ...exhausted.fact });
|
|
692
703
|
error = failure instanceof Error ? failure.message : String(failure); publish(); controller.abort(); nudge(); throw failure;
|
|
693
704
|
}
|
|
694
705
|
})();
|
|
@@ -87,9 +87,10 @@ export function pageArenaRoomFight(ctx: ShardContext, dungeon: BossArenaRoom, in
|
|
|
87
87
|
const { animals } = play, owner = bindRuntimeBoss(ctx, ctx.product.shardfile, rows.body, undefined, { identity: rows.identity }), binding = views(rows.presentation);
|
|
88
88
|
// The server's fight runs, and its looks reach this room as it told them. A room nobody has entered has nothing built to draw on.
|
|
89
89
|
wirePage.whenLive(ctx.scope, client => client.onView(({ name, args }) => {
|
|
90
|
-
if (!dungeon.built) return;
|
|
90
|
+
if (!dungeon.built) { if (binding[name] !== undefined) wirePage.unbuilt(name); return; }
|
|
91
91
|
if (name === 'boss.glow') dungeon.actor = animals.animals.find(actor => actor.rowDriven && actor.kind === owner.row.kind) ?? null; // the server's body is the row's
|
|
92
|
-
binding[name]
|
|
92
|
+
const draw = binding[name];
|
|
93
|
+
if (draw !== undefined) { draw(...args); wirePage.drew(name); }
|
|
93
94
|
}));
|
|
94
95
|
return rowFightScript({ rewardPoint: () => new Vector3().fromArray(rows.reward), respawnPoint: () => ({ pos: new Vector3().fromArray(rows.respawn), yaw: rows.yaw }) });
|
|
95
96
|
}
|
|
@@ -204,7 +205,7 @@ export class ArenaRoomEncounter {
|
|
|
204
205
|
if(encounter.boss.rewardTaken)kit.upgradeBow('bow-reward',play.weapons);
|
|
205
206
|
}else{
|
|
206
207
|
if(this.prompt===null||this.projection===null)throw new Error('Missing open arena projection');runtime.interactables.push(this.prompt);
|
|
207
|
-
{const word=arenaTieWord(this.data.definition.id),lines=this.data.tieLines,heard=this.projection;wirePage.whenLive(ctx.scope,client=>client.onView(({name,args})=>{const line=name===word?lines[args[0]??-1]:undefined;if(line!==undefined)play.hud.toast(line);if(name.startsWith('open-arena.')){heard.hear(name,args);wirePage.drew(name);}}));}
|
|
208
|
+
{const word=arenaTieWord(this.data.definition.id),lines=this.data.tieLines,heard=this.projection;wirePage.whenLive(ctx.scope,client=>client.onView(({name,args})=>{const line=name===word?lines[args[0]??-1]:undefined;if(line!==undefined){play.hud.toast(line);wirePage.drew(name);}if(name.startsWith('open-arena.')){heard.hear(name,args);wirePage.drew(name);}}));}
|
|
208
209
|
if(encounter.boss.rewardTaken){if(blade===null)throw new Error('Missing open arena power');kit.upgradeBlade('blade-reward',play.weapons,blade);}
|
|
209
210
|
page.boundary(ctx.scope,this.projection.boundary);page.lendOpenView(this.projection,ctx.scope);
|
|
210
211
|
}
|
|
@@ -101,7 +101,7 @@ function followRoamingFight(context: ShardContext, { rows, ring, hazard, cues, l
|
|
|
101
101
|
hazardFrom.set(fromX, fromY, fromZ); hazard(index, { x, y, z, fallT }, t, beat);
|
|
102
102
|
},
|
|
103
103
|
};
|
|
104
|
-
wirePage.whenLive(context.scope, client => client.onView(({ name, args }) => { actions[name]
|
|
104
|
+
wirePage.whenLive(context.scope, client => client.onView(({ name, args }) => { const act = actions[name]; if (act !== undefined) { act(args); wirePage.drew(name); } }));
|
|
105
105
|
context.system({ id: 'roaming.followed', phase: 'update', run: (dt, t) => {
|
|
106
106
|
room(dt, t);
|
|
107
107
|
for (const [slot, row] of lanes.entries()) {
|
|
@@ -241,7 +241,7 @@ export function createDevHook(ports: DevHookPorts): DevHook & { readonly root: T
|
|
|
241
241
|
group.add(lamps);
|
|
242
242
|
owned.push({ dispose: () => { for (const light of lamps.children) if (light instanceof THREE.Light) light.dispose(); } });
|
|
243
243
|
const { update } = lamps;
|
|
244
|
-
if (update !== null) { let time = 0; partScope.onDispose(ports.watchFrames(dt => { time += dt; update(time); })); }
|
|
244
|
+
if (update !== null) { let time = 0; partScope.onDispose(ports.watchFrames(dt => { time += dt; update(time, ports.player?.()?.position); })); }
|
|
245
245
|
}
|
|
246
246
|
// the client's own water surfaces, under this part's scope
|
|
247
247
|
installClientWater(part.water, { root: group, scope: partScope, frame: run => { partScope.onDispose(ports.watchFrames(run)); } });
|
|
@@ -16,6 +16,6 @@ export function shardfileLiveLook(look: Shardfile['look'], light: boolean = look
|
|
|
16
16
|
return { day: look.day ?? DATA_LOOK_DAY, dayOverride: look.dayOverride, keys: look.keys, lut: look.grade.lut === null ? null : shardfileFileUrl(look.grade.lut),
|
|
17
17
|
neutral: look.grade.tone === 'neutral', aces: look.grade.tone === 'aces', exposure: look.grade.exposure, vignette: look.grade.vignette ?? null, bloomRadius: resolved.bloom.radius,
|
|
18
18
|
bloom: resolved.bloom,
|
|
19
|
-
light: { rim: resolved.rim, pools: resolved.pools, heightFogDensity: resolved.atmosphere.fogHeightDensity, lamps: resolved.lamps, bounce: resolved.bounce, environment: resolved.environment,
|
|
19
|
+
light: { rim: resolved.rim, pools: resolved.pools, heightFogDensity: resolved.atmosphere.fogHeightDensity, lamps: resolved.lamps, lampsLit: resolved.lampsLit, bounce: resolved.bounce, environment: resolved.environment,
|
|
20
20
|
shadow: resolved.shadow, motes: resolved.motes } };
|
|
21
21
|
}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* which runs the scene. The page offers them only while the feet stand in the entered copy (`enteredCopy`), and they go
|
|
7
7
|
* with the region (built at admission, dropped at its disposal).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* An item scene's prompt (`targets.itemActions`: Brasscap's rack) is offered too (TEMPLATE-E2E TC-E1b): an entered copy holds
|
|
10
|
+
* its declared kit (`dataCellKit.ts`), and the server runs the scene on the held item, as it does a standalone page's.
|
|
11
11
|
*/
|
|
12
12
|
import { Vector3 } from 'three';
|
|
13
13
|
import type { ShardRuntime } from '../../../shared/game/shard/runtime';
|
|
@@ -17,8 +17,7 @@ type Interactable = ShardRuntime['interactables'][number];
|
|
|
17
17
|
|
|
18
18
|
/** The copy's declared interactions as frame-local prompts the server answers. */
|
|
19
19
|
export function copyPrompts(source: Pick<Shardfile, 'targets'>): Interactable[] {
|
|
20
|
-
|
|
21
|
-
return source.targets.interactions.filter((row) => !items.has(row.scene)).map((row) => ({
|
|
20
|
+
return source.targets.interactions.map((row) => ({
|
|
22
21
|
position: new Vector3(...row.at), radius: row.radius, label: row.label, wireId: row.id, onInteract: () => undefined,
|
|
23
22
|
}));
|
|
24
23
|
}
|