@wildshard/engine 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lint/engine-sides.json +4 -0
- package/lint/shardfile-boundaries.mjs +4 -2
- package/lint/wildshard-plugin.js +1 -1
- package/package.json +3 -1
- package/scripts/audio-download-proof.mjs +1 -1
- package/scripts/chaos-proxy-core.mjs +14 -1
- package/scripts/chaos-proxy-proof.mjs +22 -0
- package/scripts/check-spelled-paths.mjs +6 -3
- package/scripts/committed-fast-checks.mjs +2 -2
- package/scripts/failmode-cases.d.mts +8 -0
- package/scripts/failmode-cases.mjs +97 -0
- package/scripts/failmode-proof.mjs +556 -0
- package/scripts/grid-crossing-nightly.mjs +5 -4
- package/scripts/grid-crossing-report.mjs +5 -2
- package/scripts/grid-crossing-tour.mjs +25 -8
- package/scripts/grid-crossing-walk-proof.mjs +3 -3
- package/scripts/hover-speed-probe.mjs +136 -0
- package/scripts/mmo-bots.mjs +7 -3
- package/scripts/net-lag-proof.mjs +4 -3
- package/scripts/online-rig.mjs +11 -9
- package/scripts/parity/boot-smoke.mjs +1 -1
- package/scripts/release-cook.mjs +113 -0
- package/scripts/test-products.json +0 -21
- 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 +120 -26
- package/scripts/vps/wildshard-apply.mjs +5 -1
- package/scripts/vps/wildshard-config +117 -3
- package/src/client/app/entry.ts +2 -3
- package/src/client/engine/boot/contentRead.ts +78 -9
- package/src/client/engine/boot/downloadGiveUp.ts +34 -0
- package/src/client/engine/boot/gpuFiles.ts +3 -3
- package/src/client/engine/boot/leaveAfterPaint.ts +4 -1
- package/src/client/engine/combat/EquipmentService.ts +2 -0
- package/src/client/engine/core/Game.ts +6 -2
- package/src/client/engine/core/shadowLayer.ts +18 -0
- package/src/client/engine/explore/pick.ts +13 -1
- package/src/client/engine/net/predictor.ts +12 -4
- package/src/client/engine/player/TouchControls.ts +3 -2
- package/src/client/engine/render/families/sceneSurface.ts +3 -1
- package/src/client/engine/telemetry/browserErrors.ts +3 -1
- package/src/client/engine/ui/ErrorModal.ts +1 -1
- package/src/client/engine/ui/Loading.ts +14 -2
- package/src/client/engine/ui/downloadFailed.ts +54 -0
- package/src/client/engine/ui/errorScreen.ts +51 -9
- package/src/client/engine/ui/hoverBoost.ts +31 -4
- package/src/client/engine/ui/styles/touch.css +6 -0
- package/src/client/game/boot/spawnDownload.ts +56 -7
- package/src/client/game/grid/copyPrompts.ts +3 -4
- package/src/client/game/grid/dataCellKit.ts +91 -0
- package/src/client/game/grid/enteredEquipment.ts +11 -2
- package/src/client/game/grid/live.ts +11 -301
- package/src/client/game/grid/liveSession.ts +33 -10
- package/src/client/game/grid/neighbourLife.ts +50 -32
- package/src/client/game/grid/reveal.ts +7 -2
- package/src/client/game/grid/session.ts +6 -70
- package/src/client/game/grid/shardfileFar.ts +13 -2
- package/src/client/game/plugin/weaponFamily.ts +6 -0
- package/src/client/game/shardfile/clientSource.ts +7 -3
- package/src/client/game/shardfile/clientWorker.ts +17 -7
- package/src/client/game/shardfile/groundMerge.ts +5 -3
- package/src/client/host/online/linkScreens.ts +12 -6
- package/src/client/host/online/reconnectStrip.ts +3 -2
- package/src/client/host/online/release.ts +87 -16
- package/src/client/host/online/releaseScreens.ts +108 -0
- package/src/client/host/online/shell.ts +46 -12
- package/src/client/host/online/voice.ts +45 -1
- package/src/client/host/online/voiceUi.ts +24 -6
- package/src/server/engine/sim/playerSim.ts +1 -1
- package/src/server/game/grid/room.ts +2 -38
- package/src/server/game/grid/simulation.ts +12 -6
- package/src/server/game/shardfile/declaredKitItems.ts +8 -2
- package/src/server/host/dedicated/cellHost.ts +9 -2
- package/src/server/host/dedicated/cellProtocol.ts +1 -1
- package/src/server/host/dedicated/cellWorker.ts +2 -2
- package/src/server/host/dedicated/dedicatedRoom.ts +22 -4
- package/src/server/host/dedicated/gridCells.ts +5 -3
- package/src/server/host/dedicated/main.ts +6 -4
- package/src/server/host/dedicated/roadRoom.ts +3 -0
- package/src/server/host/dedicated/workerTable.ts +0 -10
- package/src/server/host/dedicated/world.ts +39 -5
- package/src/server/host/standalone/cellWorld.ts +1 -1
- package/src/server/host/standalone/gridServer.ts +1 -1
- package/src/shared/engine/boot/loadingWaits.ts +10 -2
- package/src/shared/engine/core/config.ts +3 -0
- package/src/shared/engine/player/hoverSpeed.ts +3 -3
- package/src/shared/engine/saves/shape.ts +17 -2
- package/src/shared/engine/strings.ts +22 -1
- package/src/shared/game/grid/placementRows.ts +4 -3
- package/src/shared/game/grid/rules.ts +12 -0
- package/src/client/game/grid/cellLoading.ts +0 -110
- package/src/client/game/grid/cellScreens.ts +0 -48
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A cell's client life (SHARD-PLATFORM SF25 render side):
|
|
3
|
-
*
|
|
2
|
+
* A cell's client life (SHARD-PLATFORM SF25 render side): a shardfile cell gets its creatures drawn in its cell root (the
|
|
3
|
+
* SF9c skins, following its regional host's authoritative entities): the ones its `clientScripts` bind, and in a data cell
|
|
4
|
+
* (no runtime, no declared client page: the templates) every spawn with a skin look, bound or not (TEMPLATE-E2E TC-E1a:
|
|
5
|
+
* Brasscap binds only particles, so its bandits were never drawn). A cell that declares `clientScripts` also gets its own
|
|
4
6
|
* isolated client lane (`createShardfileClientScripts`, sp-x5) stepped on the page's fixed tick; `ClientScriptViews`
|
|
5
|
-
* composes its frames on top of the views and draws its particles.
|
|
7
|
+
* composes its frames on top of the views and draws its particles. A lane that fails to build leaves the creatures drawn.
|
|
8
|
+
* Nothing here writes a simulation.
|
|
6
9
|
*
|
|
7
10
|
* Only while the traveller is inside the cell (G663, tile streaming T7: a neighbour is scene-graph level of detail, with
|
|
8
11
|
* no logic or runtime; it replaced G66's "frozen, but alive-looking" neighbours): a frozen cell's lane never steps and its
|
|
@@ -15,6 +18,7 @@ import type { ClientScriptTarget } from '@wildshard/format/clientScripts';
|
|
|
15
18
|
import { loadClientSkins, SkinDriver, type ClientSkin, type SkinDriveState } from '../shardfile/clientSkins';
|
|
16
19
|
import { ClientScriptViews, type ClientScriptViewTarget, type ClientScriptViewState } from "../plugin/ui";
|
|
17
20
|
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
21
|
+
import { hasDeclaredClientPage } from '@wildshard/format/runtimeBinds';
|
|
18
22
|
import type { GridCell } from '../../../shared/game/grid/assembly';
|
|
19
23
|
|
|
20
24
|
/** One creature as a view draws it (E6): a page reads the region's sim entity, a client reads its row. */
|
|
@@ -37,7 +41,8 @@ export interface NeighbourLifeCell { readonly instance: string; readonly creatur
|
|
|
37
41
|
interface CreatureView { readonly id: string; readonly mesh: SkinnedMesh; readonly driver: SkinDriver; readonly spawn: { at: readonly [number, number, number]; yaw: number; scale: number }; readonly bodyY: number; t: number; phase: number }
|
|
38
42
|
interface CellLife {
|
|
39
43
|
readonly cell: GridCell; readonly root: Group; readonly creatures: ReadonlyMap<string, CreatureView>;
|
|
40
|
-
|
|
44
|
+
/** null: the cell binds no script (or its lane failed to build, `failed` says why); its creatures still draw */
|
|
45
|
+
lane: { readonly scripts: ReturnType<typeof createShardfileClientScripts>; readonly views: ClientScriptViews } | null; failed: string | null;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
/** A static view of one skin: the factory's bone layout (positions relative to the parent), bound once. */
|
|
@@ -68,17 +73,19 @@ export class NeighbourLife {
|
|
|
68
73
|
|
|
69
74
|
/** Admit one neighbour's life once its product and materials are ready (the session's shared per-slug load). */
|
|
70
75
|
async admit(cell: GridCell, root: Group, source: Shardfile, assets: ReadonlyMap<string, Uint8Array>, compile: Parameters<typeof loadClientSkins>[2], skinsBySlug: Map<string, Promise<ReadonlyMap<string, ClientSkin>>>): Promise<void> {
|
|
71
|
-
const declared = source.clientScripts;
|
|
72
|
-
|
|
76
|
+
const declared = source.clientScripts, data = source.runtime === null && !hasDeclaredClientPage(source);
|
|
77
|
+
// the creatures this page draws: the script-bound ones, and in a data cell every spawn (its runtime draws a native cell's)
|
|
78
|
+
const drawn = [...new Set([...declared.bindings.flatMap((binding) => binding.target.kind === 'creature' ? [binding.target.id] : []),
|
|
79
|
+
...(data ? source.creatures.spawns.map((row) => row.id) : [])])];
|
|
80
|
+
if ((declared.bindings.length === 0 && drawn.length === 0) || this.cells.has(cell.instance)) return;
|
|
73
81
|
const scope = this.ports.scope;
|
|
74
82
|
let loading = skinsBySlug.get(cell.slug);
|
|
75
83
|
if (loading === undefined) { loading = loadClientSkins(source, assets, compile, scope); skinsBySlug.set(cell.slug, loading); }
|
|
76
84
|
const skins = await loading;
|
|
77
85
|
if (scope.disposed) return;
|
|
78
86
|
const creatures = new Map<string, CreatureView>();
|
|
79
|
-
for (const
|
|
80
|
-
|
|
81
|
-
const id = binding.target.id, spawn = source.creatures.spawns.find((row) => row.id === id);
|
|
87
|
+
for (const id of drawn) {
|
|
88
|
+
const spawn = source.creatures.spawns.find((row) => row.id === id);
|
|
82
89
|
const species = spawn === undefined ? undefined : source.rows.species.find((row) => row.id === spawn.species);
|
|
83
90
|
const look = species === undefined ? undefined : source.rows.looks.find((row) => row.species === species.id);
|
|
84
91
|
const skin = look === undefined ? undefined : skins.get(look.id);
|
|
@@ -89,6 +96,20 @@ export class NeighbourLife {
|
|
|
89
96
|
root.add(mesh); creatures.set(id, view);
|
|
90
97
|
}
|
|
91
98
|
const instance = cell.instance;
|
|
99
|
+
const life: CellLife = { cell, root, creatures, lane: null, failed: null };
|
|
100
|
+
if (declared.bindings.length > 0) {
|
|
101
|
+
try { life.lane = this.lane(instance, source, assets, root, creatures); } catch (error) { life.failed = error instanceof Error ? error.message : String(error); }
|
|
102
|
+
}
|
|
103
|
+
this.cells.set(instance, life);
|
|
104
|
+
scope.onDispose(() => {
|
|
105
|
+
life.lane?.scripts.dispose();
|
|
106
|
+
for (const view of creatures.values()) { view.mesh.removeFromParent(); view.mesh.skeleton.dispose(); const m = view.mesh.material; if (!Array.isArray(m)) m.dispose(); }
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The cell's own client lane and the views its frames compose on (throws when its scripts are refused). */
|
|
111
|
+
private lane(instance: string, source: Shardfile, assets: ReadonlyMap<string, Uint8Array>, root: Group, creatures: ReadonlyMap<string, CreatureView>): NonNullable<CellLife['lane']> {
|
|
112
|
+
const declared = source.clientScripts;
|
|
92
113
|
const observe = (target: ClientScriptTarget): { position: readonly [number, number, number]; frozen: boolean } => {
|
|
93
114
|
const frozen = !this.ports.active(instance);
|
|
94
115
|
if (target.kind === 'particles') return { position: target.at, frozen };
|
|
@@ -97,39 +118,36 @@ export class NeighbourLife {
|
|
|
97
118
|
const p = view.mesh.position; return { position: [p.x, p.y, p.z], frozen };
|
|
98
119
|
};
|
|
99
120
|
const scripts = createShardfileClientScripts(source, assets, { actorId: 'actor.neighbour', observe });
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
scope.onDispose(() => {
|
|
115
|
-
scripts.dispose();
|
|
116
|
-
for (const view of creatures.values()) { view.mesh.removeFromParent(); view.mesh.skeleton.dispose(); const m = view.mesh.material; if (!Array.isArray(m)) m.dispose(); }
|
|
117
|
-
});
|
|
121
|
+
try {
|
|
122
|
+
const targets = scripts.targets.map(({ entity, target }): ClientScriptViewTarget => {
|
|
123
|
+
const view = target.kind === 'creature' ? creatures.get(target.id) : undefined;
|
|
124
|
+
const emitters = declared.bindings.find((b) => b.entity === entity)?.emitters.map((e) => ({ id: e.id, live: e.live, colour: e.colour, size: e.size, velocity: e.velocity, gravity: e.gravity })) ?? [];
|
|
125
|
+
const anchor = (out: Vector3): Vector3 => {
|
|
126
|
+
if (target.kind === 'particles') return out.fromArray(target.at);
|
|
127
|
+
if (view === undefined) return out.set(0, 0, 0);
|
|
128
|
+
return out.copy(view.mesh.position).setY(view.mesh.position.y + view.bodyY * 1.6);
|
|
129
|
+
};
|
|
130
|
+
const object: Object3D | null = view?.mesh ?? null;
|
|
131
|
+
return { entity, object, anchor, emitters };
|
|
132
|
+
});
|
|
133
|
+
return { scripts, views: new ClientScriptViews(scripts.lane, targets, { root, scope: this.ports.scope }) };
|
|
134
|
+
} catch (error) { scripts.dispose(); throw error; }
|
|
118
135
|
}
|
|
119
136
|
|
|
120
137
|
/** The page's fixed step: the entered cell's lane advances on the page tick. */
|
|
121
138
|
fixed(): void {
|
|
122
139
|
const tick = this.tick++;
|
|
123
140
|
for (const life of this.cells.values()) {
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
const { lane } = life;
|
|
142
|
+
if (lane === null || life.failed !== null || !this.ports.active(life.cell.instance)) continue; // G663: no neighbour logic
|
|
143
|
+
try { lane.scripts.step(tick); } catch (error) { life.failed = error instanceof Error ? error.message : String(error); lane.views.restore(); }
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
146
|
|
|
129
147
|
/** The page's late phase: views back to base, follow the region (if admitted), then compose the scripts on top. */
|
|
130
148
|
late(dt: number): void {
|
|
131
149
|
for (const life of this.cells.values()) {
|
|
132
|
-
life.views.restore();
|
|
150
|
+
life.lane?.views.restore();
|
|
133
151
|
const region = this.ports.simulation(life.cell.instance), live = this.ports.active(life.cell.instance);
|
|
134
152
|
// G663: a frozen cell draws none of its creatures and composes no lane
|
|
135
153
|
if (!live) { for (const view of life.creatures.values()) view.mesh.visible = false; continue; }
|
|
@@ -141,11 +159,11 @@ export class NeighbourLife {
|
|
|
141
159
|
view.phase = (view.phase + dt * Math.hypot(speed, strafe) * 0.6) % 1;
|
|
142
160
|
view.driver.step({ dt, t: view.t, alive: sim?.alive ?? true, flinch: 0, attack: sim?.attackPhase ?? -1, speed, strafe, scale: sim?.scale ?? view.spawn.scale, phase: view.phase, state: sim?.state ?? 'idle' });
|
|
143
161
|
}
|
|
144
|
-
if (life.failed === null) life.views.apply(dt);
|
|
162
|
+
if (life.failed === null) life.lane?.views.apply(dt);
|
|
145
163
|
}
|
|
146
164
|
}
|
|
147
165
|
|
|
148
166
|
state(): readonly NeighbourLifeCell[] {
|
|
149
|
-
return [...this.cells.values()].map((life) => ({ instance: life.cell.instance, creatures: life.creatures.size, frozen: !this.ports.active(life.cell.instance), views: life.views.state(), failed: life.failed }));
|
|
167
|
+
return [...this.cells.values()].map((life) => ({ instance: life.cell.instance, creatures: life.creatures.size, frozen: !this.ports.active(life.cell.instance), views: life.lane?.views.state() ?? { targets: 0, posed: 0, particles: 0, capacity: 0, tick: 0 }, failed: life.failed }));
|
|
150
168
|
}
|
|
151
169
|
}
|
|
@@ -70,7 +70,10 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
70
70
|
let pathEnd: number | null = null, ringsAt: number | null = null, homeAt: number | null = null, endedAt: number | null = null;
|
|
71
71
|
let layer: HTMLElement | null = null;
|
|
72
72
|
let viewmodelWas = true;
|
|
73
|
-
|
|
73
|
+
// read when the reveal begins; the end gives them back only if nothing turned them on meanwhile: the title's ENTER turns the
|
|
74
|
+
// weapons on after `entered` starts the reveal, and an end that restored the earlier "off" left them off for good (TEMPLATE-E2E
|
|
75
|
+
// TC-E1b: Brasscap's lever never fired on the grid; bare hands never showed it)
|
|
76
|
+
let wasEnabled = host.weapons.enabled, wasVisible = host.weapons.visible;
|
|
74
77
|
const land = new Vector3(), landQ = new Quaternion(), sky = new Vector3(), skyQ = new Quaternion(), look = new Vector3(), fwd = new Vector3(), m = new Matrix4();
|
|
75
78
|
const now = (): number => app.clock.mode === 'capture' ? app.clock.real * 1000 : diagnosticNow();
|
|
76
79
|
const publish = (): void => {
|
|
@@ -82,7 +85,8 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
82
85
|
host.hudRoot.classList.remove('ws-grid-revealing', 'ws-grid-live');
|
|
83
86
|
if (layer !== null) hudSlots.discard(layer);
|
|
84
87
|
layer = null;
|
|
85
|
-
host.weapons.
|
|
88
|
+
if (!host.weapons.enabled) host.weapons.setEnabled(wasEnabled);
|
|
89
|
+
if (!host.weapons.visible) host.weapons.visible = wasVisible;
|
|
86
90
|
host.viewmodel.visible = viewmodelWas;
|
|
87
91
|
publish();
|
|
88
92
|
scope.dispose();
|
|
@@ -90,6 +94,7 @@ export function installGridReveal(host: GridRevealHost): () => boolean {
|
|
|
90
94
|
const begin = (at: number): void => {
|
|
91
95
|
started = at;
|
|
92
96
|
host.canvas.style.visibility = ''; // this frame draws the sky pose (the late phase runs before the render)
|
|
97
|
+
wasEnabled = host.weapons.enabled; wasVisible = host.weapons.visible;
|
|
93
98
|
host.weapons.setEnabled(false); host.weapons.visible = false;
|
|
94
99
|
viewmodelWas = host.viewmodel.visible;
|
|
95
100
|
host.hudRoot.classList.add('ws-grid-revealing');
|
|
@@ -107,10 +107,8 @@ import { leaseMapImage } from '../shardfile/mapImage';
|
|
|
107
107
|
import { crossingSaveStatus, installBorderShimmer, type BorderShimmerState, type CrossingSaveStatus } from './borderShimmer';
|
|
108
108
|
import { refusalReporter, saveFailedReporter } from './screenReports';
|
|
109
109
|
import { GAME_STRINGS } from '../../../shared/game/strings';
|
|
110
|
-
import {
|
|
110
|
+
import { classifyRefusal, pageShardRefusals, type ShardRefusal } from './refusal';
|
|
111
111
|
import { tileRing } from '../shardfile/tileDriver';
|
|
112
|
-
import { CellLoading, type CellLoadingInput } from './cellLoading';
|
|
113
|
-
import { CellLoadingCard } from './cellScreens';
|
|
114
112
|
import { readGridSeamData, type GridSeamAddress } from '../../../shared/game/grid/seamData';
|
|
115
113
|
import { readCompiledGridStrips } from '../../../shared/game/grid/compiledStrips';
|
|
116
114
|
import { startRoadGrain } from './roadGrainPreparation';
|
|
@@ -392,11 +390,6 @@ export class GridSession {
|
|
|
392
390
|
private readonly farMissing = new Set<string>();
|
|
393
391
|
/** each slug's shown name */
|
|
394
392
|
private readonly names = new Map<string, string>();
|
|
395
|
-
/** G555: the one step-by-step loading screen over a cell entry or re-entry that waits */
|
|
396
|
-
private readonly cellLoading: CellLoading;
|
|
397
|
-
private cellLoadingPolled = 0;
|
|
398
|
-
/** when each cell's current wait began, so its screen counts only the hooks of this load */
|
|
399
|
-
private readonly loadingSince = new Map<string, number>();
|
|
400
393
|
|
|
401
394
|
/** Overlap only this page's actual initial-home metadata with remaining page setup. */
|
|
402
395
|
startInitialHomeMetadata(): void {
|
|
@@ -690,10 +683,8 @@ export class GridSession {
|
|
|
690
683
|
// GC12: drawn only while the traveller stands at that edge (the feet in the home frame)
|
|
691
684
|
ports: { closed: (id) => this.live === null || !this.live.live.ready(id),
|
|
692
685
|
feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; } } });
|
|
693
|
-
// QA 2026-11-13: a waiting cell's loading steps on SHARD SELECT's loading card, inset over the live world
|
|
694
|
-
this.cellLoading = new CellLoading(new CellLoadingCard(), (waiting) => this.neighbours.some(row => row.instance === waiting));
|
|
695
686
|
setParkedMatricesFrozen(true); // G580 T2: a hidden parked world skips matrix updates during its warm-up
|
|
696
|
-
host.scope.onDispose(() => {
|
|
687
|
+
host.scope.onDispose(() => { if (host.heldFrame !== undefined) host.heldFrame.enabled = false; setWarmUpHeld(false); setParkedMatricesFrozen(false); setBuildHeldTimed(false); setBuildUrgent(false); });
|
|
697
688
|
// G78: a shimmer line at every shard border on its real ground; G119: SAVING… / SAVE FAILED, RETRY while a crossing waits
|
|
698
689
|
const rows = new Map((edges ?? []).map((cell) => [cell.instance, cell.edges]));
|
|
699
690
|
let status: CrossingSaveStatus = null, polled = 0;
|
|
@@ -890,6 +881,8 @@ export class GridSession {
|
|
|
890
881
|
const homeClaim = residency.home(), homeResidency = (): { instance: string; bytes: number } => ({ instance: homeClaim.instance, bytes: homeClaim.bytes });
|
|
891
882
|
host.scope.onDispose(app.debug.scopedExpose('grid', { state: () => this.state(), roadView: () => this.roadBudget.view(), roadResident: () => this.roadBudget.resident(),
|
|
892
883
|
roadTileResidency: () => this.roadTiles?.state() ?? null,
|
|
884
|
+
// GC6: the hybrid hooks' timings (each entry's world, kit, play and their after-hooks), for the crossing tour
|
|
885
|
+
hookTimings: () => this.live?.hookTimings() ?? null,
|
|
893
886
|
// G144 admission receipts read the same allocator, without reserving or changing any claim.
|
|
894
887
|
residency: () => ({ cost: this.allocator.cost(), claims: this.allocator.entries(), home: homeResidency() }),
|
|
895
888
|
// Per-frame travel needs the same fresh live/crossing facts, without the
|
|
@@ -970,62 +963,6 @@ export class GridSession {
|
|
|
970
963
|
this.reportRefusal(cell.instance, cell.slug, refusal, error);
|
|
971
964
|
this.refusals.set(cell.instance, refusal); this.issues.set(cell.instance, error instanceof Error ? error.message : String(error)); pageShardRefusals().note(cell.slug, refusal);
|
|
972
965
|
}
|
|
973
|
-
/**
|
|
974
|
-
* G555's read-only port: the cell whose entry waits (the one the traveller is in before its gameplay is ready, else the
|
|
975
|
-
* nearest unready cell within 12 m of its edge), with its readiness fences, its claims, its entered hooks since this wait
|
|
976
|
-
* began and its refusal; null when none waits.
|
|
977
|
-
*/
|
|
978
|
-
private cellLoadingInput(): CellLoadingInput | null {
|
|
979
|
-
const live = this.live; if (live === null) return null;
|
|
980
|
-
// GC6: a world built ahead whose entry still prepares holds its crossing on the road: the screen shows it
|
|
981
|
-
const current = live.live.current(), ready = (id: string): boolean => live.live.ready(id) && !live.entryPending(id) && (current !== id || live.gameplayReady());
|
|
982
|
-
let target: GridCell | undefined = current !== null && !ready(current) ? this.assembly.cell(current) : undefined;
|
|
983
|
-
if (target === undefined) {
|
|
984
|
-
const at = this.world();
|
|
985
|
-
let best = 12;
|
|
986
|
-
for (const cell of this.assembly.cells) {
|
|
987
|
-
if (ready(cell.instance)) continue;
|
|
988
|
-
const d = Math.hypot(Math.max(0, Math.abs(at.x - cell.origin.x) - CHUNK_HALF), Math.max(0, Math.abs(at.z - cell.origin.z) - CHUNK_HALF));
|
|
989
|
-
if (d <= best) { best = d; target = cell; }
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
if (target === undefined) { this.loadingSince.clear(); return null; }
|
|
993
|
-
const id = target.instance, since = this.loadingSince.get(id) ?? diagnosticNow(); this.loadingSince.set(id, since);
|
|
994
|
-
const raw = live.refusal(id), refusal = this.refusal(id);
|
|
995
|
-
const reason = refusal !== null ? refusalReason(refusal)
|
|
996
|
-
: raw instanceof GridCellWaitingError ? GAME_STRINGS.grid.waiting(this.shardName(id)) : null;
|
|
997
|
-
let claimed = 0, product = false;
|
|
998
|
-
for (const entry of this.allocator.claims()) {
|
|
999
|
-
if (entry.owner === id) claimed += entry.bytes;
|
|
1000
|
-
if (entry.owner === 'grid' && entry.id === `product:grid:${target.slug}`) { claimed += entry.bytes; product = true; }
|
|
1001
|
-
}
|
|
1002
|
-
// its entered hooks of this run: from its latest beforeWorld (a road-prepared world ran some before the screen opened)
|
|
1003
|
-
const stages = live.live.readiness.status(id), timings = live.hookTimings(), own = timings.completed.filter(row => row.instance === id);
|
|
1004
|
-
let run = -1; own.forEach((row, index) => { if (row.hook === 'beforeWorld') run = index; });
|
|
1005
|
-
const hooks = new Set((run === -1 ? own.filter(row => row.start >= since) : own.slice(run)).map(row => row.hook));
|
|
1006
|
-
const hook = timings.current?.instance === id ? timings.current.hook : null;
|
|
1007
|
-
return { instance: id, slug: target.slug, name: this.shardName(id), refusal: reason, product: product || stages.runtime || stages.ready,
|
|
1008
|
-
claimedMB: claimed / 1e6, requested: stages.requested, runtime: stages.runtime, colliders: stages.colliders, sim: stages.sim,
|
|
1009
|
-
hooks, hook, hybrid: hooks.size > 0 || hook !== null, entered: current === id, gameplayReady: current === id && live.gameplayReady(),
|
|
1010
|
-
warm: live.warmPreparation(id) };
|
|
1011
|
-
}
|
|
1012
|
-
/** At most four times a second: the loading screen reads the allocator and the live session. */
|
|
1013
|
-
private stepCellLoading(): void {
|
|
1014
|
-
const now = diagnosticNow(); if (now - this.cellLoadingPolled < 250) return;
|
|
1015
|
-
this.cellLoadingPolled = now; this.cellLoading.step(this.cellLoadingInput());
|
|
1016
|
-
// G580 T2 (Developer): the traveller waits at the wall while its screen shows, so its warm-up may issue more a frame
|
|
1017
|
-
// G580 T2 / T5: a held traveller's warm-up issues more programs a frame and its builds run a bigger budget
|
|
1018
|
-
setWarmUpHeld(this.cellLoading.open !== null);
|
|
1019
|
-
setBuildHeldTimed(this.cellLoading.open !== null);
|
|
1020
|
-
// GC6: a world the traveller heads into, or the road (where its entry prepares), builds with the urgent budget
|
|
1021
|
-
const live = this.live;
|
|
1022
|
-
setBuildUrgent(live !== null && (live.live.building() || live.entriesPending()));
|
|
1023
|
-
}
|
|
1024
|
-
private refusal(instance: string): ShardRefusal | null {
|
|
1025
|
-
const live = this.live?.refusal(instance);
|
|
1026
|
-
return this.refusals.get(instance) ?? (live === undefined ? null : classifyRefusal(live));
|
|
1027
|
-
}
|
|
1028
|
-
private shardName(instance: string): string { const slug = this.assembly.cell(instance).slug; return this.names.get(slug) ?? slug; }
|
|
1029
966
|
|
|
1030
967
|
/** Complete deferred native seams before a distant entry or road recovery. One page promise, no second scheduler. */
|
|
1031
968
|
prepareOuterStrips(): Promise<void> {
|
|
@@ -1186,8 +1123,7 @@ export class GridSession {
|
|
|
1186
1123
|
if (!this.initialFarReady && this.host.backgroundReady?.() !== false && this.rings.ready()) this.initialFarReady = true;
|
|
1187
1124
|
this.roadTiles?.step({ x: at.x, z: at.z, vx: this.velocity.x * clamp, vz: this.velocity.z * clamp });
|
|
1188
1125
|
for (const cell of this.neighbours) if (this.placeholderBlocksTiles(cell.instance)) this.rings.retireRefinement(cell.instance);
|
|
1189
|
-
this.
|
|
1190
|
-
if (this.host.heldFrame !== undefined) this.host.heldFrame.enabled = this.cellLoading.open !== null && this.live?.travelState().crossing.phase === 'preparing';
|
|
1126
|
+
if (this.host.heldFrame !== undefined) this.host.heldFrame.enabled = false;
|
|
1191
1127
|
this.shimmer.step();
|
|
1192
1128
|
const active = this.live === null ? this.home.instance : this.live.live.current();
|
|
1193
1129
|
const eye = this.host.eye?.();
|
|
@@ -1256,7 +1192,7 @@ export class GridSession {
|
|
|
1256
1192
|
pitch: this.assembly.pitch,
|
|
1257
1193
|
home: this.home.instance, inside: gridCells.cell?.instance ?? null, feet: { x: Math.round(at.x * 100) / 100, z: Math.round(at.z * 100) / 100 },
|
|
1258
1194
|
cells: this.assembly.cells.map((cell) => { const d = drawn(cell.instance); return { instance: cell.instance, slug: cell.slug, cell: cell.cell, shows: shows(cell.instance, d), drawn: d }; }),
|
|
1259
|
-
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading:
|
|
1195
|
+
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: null, cellStage: null, cellStep: null, hybrid: this.live?.hybridState() ?? null, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
|
|
1260
1196
|
residentMB: Math.round(cost.accounted / 1e4) / 100, playingMB: Math.round(cost.playing / 1e4) / 100, envelopeMB: Math.round(this.allocator.envelope() / 1e4) / 100,
|
|
1261
1197
|
accountedBytes: cost.accounted,
|
|
1262
1198
|
rings: { frame: stats.frame, far: stats.resident.far, l1: stats.resident.l1, l0: stats.resident.l0, refused: stats.refused, inFlight: stats.inFlight, queued: stats.queued,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mesh, type BufferGeometry, type Object3D } from 'three';
|
|
1
|
+
import { Matrix4, Mesh, type BufferGeometry, type Object3D } from 'three';
|
|
2
2
|
import { prepareRigLoader } from '@wildshard/engine/anim/rig';
|
|
3
3
|
import { workSlice } from '@wildshard/engine/core/workSlice';
|
|
4
4
|
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
@@ -52,6 +52,17 @@ function shardfileHaze(fog: ShardfileFarRows['fog']): FarPrepared['look'] {
|
|
|
52
52
|
return { family: 'pbr', haze: { colour: fog ?? [1, 1, 1] } };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
const IDENTITY = new Matrix4();
|
|
56
|
+
/** GC6: a mesh's geometry in its scene pose. The loader's accessor bounds would be recomputed from every vertex by
|
|
57
|
+
* `applyMatrix4` (two passes; ~45 % of the near bake's main-thread time on Driftwood to Nalati, where the neighbours' near
|
|
58
|
+
* views load on the road beside the entry's preparation), and nothing reads a part's bounds: the merged draw computes its
|
|
59
|
+
* own once. An identity pose is no transform at all. */
|
|
60
|
+
export function bakePose(node: Mesh): BufferGeometry {
|
|
61
|
+
const geometry = node.geometry;
|
|
62
|
+
geometry.boundingBox = null; geometry.boundingSphere = null;
|
|
63
|
+
return node.matrixWorld.equals(IDENTITY) ? geometry : geometry.applyMatrix4(node.matrixWorld);
|
|
64
|
+
}
|
|
65
|
+
|
|
55
66
|
/**
|
|
56
67
|
* G348: any shardfile's own near placeholder (its admitted `near` row, which `wildshard build` bakes for every terrain
|
|
57
68
|
* shardfile, an unknown uploaded one included): its content GLBs' meshes merged into the near view's one draw, masked by
|
|
@@ -77,7 +88,7 @@ export async function loadShardfileNear(rows: ShardfileNearRows, read: (ref: str
|
|
|
77
88
|
await slice.check();
|
|
78
89
|
for (const material of Array.isArray(node.material) ? node.material : [node.material]) material.dispose();
|
|
79
90
|
// NM13: the light layer stays apart from the lit draw (drawn additively, unlit)
|
|
80
|
-
(node.name === NEAR_LIGHT ? lights : node.name === NEAR_COLOUR ? colours : parts).push(
|
|
91
|
+
(node.name === NEAR_LIGHT ? lights : node.name === NEAR_COLOUR ? colours : parts).push(bakePose(node));
|
|
81
92
|
}
|
|
82
93
|
}
|
|
83
94
|
} catch (error) { for (const part of [...parts, ...lights, ...colours]) part.dispose(); throw error; }
|
|
@@ -403,6 +403,12 @@ export function registerWeaponFamily(registry: Map<string, ItemFamily>, id: stri
|
|
|
403
403
|
registry.set(id, family);
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
/** The icons a declared item row may name (`ui.icon`), as the page's catalogue draws them. */
|
|
407
|
+
export const DECLARED_ITEM_ICONS = ['lock', 'check', 'poi', 'you', 'map', 'pack', 'star', 'book', 'heart', 'pin', 'laurel', 'sword', 'glyph', 'coin', 'purse', 'crossbow', 'rifle', 'lever', 'longbow', 'grapple', 'horse'] as const;
|
|
408
|
+
/** A declared item row's icon, refused when the catalogue draws no such icon. */
|
|
409
|
+
export function declaredItemIcon(name: string): (typeof DECLARED_ITEM_ICONS)[number] {
|
|
410
|
+
const id = DECLARED_ITEM_ICONS.find((entry) => entry === name); if (id === undefined) throw new Error(`Unknown catalogue item icon ${name}`); return id;
|
|
411
|
+
}
|
|
406
412
|
/** Explicit built-in item family registry, injected into the full loader; importing does not install content. */
|
|
407
413
|
export function declaredKitItemFamilies(): ReadonlyMap<string, ItemFamily> {
|
|
408
414
|
return new Map<string, ItemFamily>([
|
|
@@ -10,11 +10,12 @@ import { isOutputIndex } from '@wildshard/format/outputAddress';
|
|
|
10
10
|
import { SHARDFILE_ADMISSION_LIMITS as limits } from '@wildshard/format/admissionLimits';
|
|
11
11
|
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
12
12
|
import { isDev } from '@wildshard/engine/core/devMode';
|
|
13
|
-
import { CONTENT_CAPS, _applyChunkConstants } from '@wildshard/engine/core/config';
|
|
13
|
+
import { CONTENT_CAPS, PHONE_PLAYING_BYTES, _applyChunkConstants } from '@wildshard/engine/core/config';
|
|
14
14
|
import { configureLevel } from '@wildshard/engine/level/selection';
|
|
15
15
|
import { pageGridInstance, sourceManifest, compiledPageBoot, type PageMode } from '../plugin/context';
|
|
16
16
|
import { PageResidency } from '../grid/pageResidency';
|
|
17
17
|
import { ResidencyAllocator } from '../../../shared/game/grid/allocator';
|
|
18
|
+
import { TIER, type Tier } from '@wildshard/engine/core/tier';
|
|
18
19
|
import type { GridRecoveryRecord } from '../../../shared/game/grid/recovery';
|
|
19
20
|
import { bootPageMode, pageGridRecovery } from '../grid/pageEntry';
|
|
20
21
|
import { currentPageMode } from '../../../shared/game/grid/pageMode';
|
|
@@ -51,13 +52,16 @@ export interface PageResidencyBoot {
|
|
|
51
52
|
* against their declared sim cost, then their actual library and tile claims. The root disposes failed hydration; the
|
|
52
53
|
* successful session installs the owner's level lifetime.
|
|
53
54
|
*/
|
|
55
|
+
/** GC13: the page's playing envelope: the phone tier's 1.0 GB (G65), else the shared caps' */
|
|
56
|
+
export function pagePlayingBytes(tier: Tier = TIER): number { return tier === 'phone' ? PHONE_PLAYING_BYTES : CONTENT_CAPS.playing; }
|
|
57
|
+
|
|
54
58
|
export function preparePageResidency(manifest: Pick<ShardManifest, 'slug' | 'shardfile' | 'runtimeCost'>, configuredSlug?: string, memory: MemoryAdmission = new MemoryAdmission(() => MEMORY_GATES.reportOnly || isDev())): PageResidencyBoot {
|
|
55
59
|
const mode = bootPageMode(configuredSlug ?? manifest.slug);
|
|
56
60
|
const measuredHome = configuredSlug === undefined && manifest.shardfile === undefined;
|
|
57
61
|
if (mode !== 'grid' && (!measuredHome || manifest.runtimeCost === undefined)) return { mode, instance: null, memory };
|
|
58
62
|
const instance = mode === 'grid' ? pageGridInstance() : manifest.slug;
|
|
59
63
|
if (instance === null) throw new Error('Grid residency requires the consumed home instance');
|
|
60
|
-
const residency = new PageResidency(new ResidencyAllocator({ memory }));
|
|
64
|
+
const residency = new PageResidency(new ResidencyAllocator({ memory, playing: pagePlayingBytes() }));
|
|
61
65
|
try {
|
|
62
66
|
if (measuredHome) {
|
|
63
67
|
if (manifest.runtimeCost === undefined) throw new Error('Grid runtime home requires reviewed memory measurements before bootstrap');
|
|
@@ -100,7 +104,7 @@ function clientSource(admitted: AdmittedProduct, options: ProductOptions, bindin
|
|
|
100
104
|
const sections = outputDescriptor(source)?.sections;
|
|
101
105
|
if (sections !== undefined) prepareClientModuleGroups(source, sections);
|
|
102
106
|
const ownedBindings = { ...bindings,
|
|
103
|
-
...(bindings.allocator === undefined && bindings.residency === undefined && options.memory !== undefined ? { allocator: new ResidencyAllocator({ memory: options.memory }) } : {}),
|
|
107
|
+
...(bindings.allocator === undefined && bindings.residency === undefined && options.memory !== undefined ? { allocator: new ResidencyAllocator({ memory: options.memory, playing: pagePlayingBytes() }) } : {}),
|
|
104
108
|
...(options.firstParty ? {} : { instance: admitted.instance ?? '' }) };
|
|
105
109
|
const residency = clientResidency(source, ownedBindings);
|
|
106
110
|
const assets = new ClientAssets(source, admitted.assets, options);
|
|
@@ -15,7 +15,8 @@ import { saveEnvironment } from '@wildshard/engine/saves/environment';
|
|
|
15
15
|
import { jsonSlot } from '@wildshard/engine/saves/slots';
|
|
16
16
|
import { syncPageRewards } from '../../../shared/game/saves';
|
|
17
17
|
import type { SaveStorage } from '@wildshard/engine/saves/store';
|
|
18
|
-
import { atMostLeaveWait, holdLeaving } from '@wildshard/engine/boot/lastEnd';
|
|
18
|
+
import { atMostLeaveWait, holdLeaving, markUnload } from '@wildshard/engine/boot/lastEnd';
|
|
19
|
+
import { dropTabArrival, setTitleArrival } from '@wildshard/engine/boot/titleArrival';
|
|
19
20
|
import { countedWait } from '@wildshard/engine/boot/waits';
|
|
20
21
|
import { contentURL } from '@wildshard/engine/boot/contentBase';
|
|
21
22
|
import { diagnosticNow } from '@wildshard/engine/core/clock';
|
|
@@ -128,7 +129,16 @@ function releaseKeep(): ReleaseKeep {
|
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
/** E7.2d: the page's seat in the one world, in a shell of the same shape. */
|
|
131
|
-
|
|
132
|
+
/** FM3 mode 23: how the online shell leaves this document on purpose, through the page's own saves (shell.ts `OnlineLeaving`). */
|
|
133
|
+
interface OnlineLeaving { readonly arrive: (slug: string) => void; readonly unarrive: () => void; readonly unload: (reason: string) => void;
|
|
134
|
+
readonly reloadStale: () => Promise<boolean>; readonly reloadByHand: () => Promise<void>; readonly settle: () => void }
|
|
135
|
+
const onlineLeaving: OnlineLeaving = {
|
|
136
|
+
arrive: slug => { setTitleArrival({ slug, mode: 'enter' }, { tab: true }); }, unarrive: dropTabArrival, unload: reason => { markUnload(reason); },
|
|
137
|
+
reloadStale: async () => (await import('@wildshard/engine/boot/browserChunkRecovery')).reloadRefusedBuild(true),
|
|
138
|
+
reloadByHand: async () => { await (await import('@wildshard/engine/boot/browserChunkRecovery')).reloadPastWorker(); },
|
|
139
|
+
settle: () => { void (async () => { (await import('@wildshard/engine/boot/browserChunkRecovery')).settleRefusedBuild(); })(); },
|
|
140
|
+
};
|
|
141
|
+
interface OnlineModule { readonly startOnline: (config: BuildWorld & { keep: ReleaseKeep; leaving: OnlineLeaving; loaded: string; build: string; identity: (name?: string) => NetIdentity; grid?: { readonly cell: string; readonly cells: readonly string[]; readonly placed: (cell: string, at: { readonly x: number; readonly y: number; readonly z: number; readonly yaw: number }) => void; readonly reenter: (cell: string) => void; readonly goto?: boolean } }) => Promise<Shell> }
|
|
132
142
|
interface Shell { readonly redials?: true; devColliders?: (name: string, boxes: readonly DevBox[]) => void; pause: () => void; hold: (on: boolean) => void; bossGod: () => void; raise: (flag: string) => void; join: (id: string, x: number, y: number, z: number) => { readonly client: NetClient; readonly move: (x: number, y: number, z: number) => void }; readonly client: NetClient; readonly booted: Promise<{ readonly restored: boolean }>; place: (x: number, y: number, z: number, yaw: number) => void; hardHits: (by: number) => void; ready: () => void; leave?: () => Promise<void>; save: () => Promise<{ readonly tick: number; readonly ok: boolean }>; probe: () => Promise<{ readonly tickMs: number }>; dispose: () => void }
|
|
133
143
|
|
|
134
144
|
const SAVE_EVERY_MS = 30_000;
|
|
@@ -162,8 +172,8 @@ export interface WorkerClientReport {
|
|
|
162
172
|
retired: Readonly<Record<string, number>>;
|
|
163
173
|
/** The longest a row of each kind took to spawn, in ms: a model built late shows here. */
|
|
164
174
|
spawnMs: Readonly<Record<string, number>>;
|
|
165
|
-
/** What
|
|
166
|
-
missed: Readonly<NetPlayer['predictor']['missed']>; misses: readonly (readonly number[])[];
|
|
175
|
+
/** What corrections disagreed on, and server-owned transitions that were deliberately not corrections. */
|
|
176
|
+
missed: Readonly<NetPlayer['predictor']['missed']>; misses: readonly (readonly number[])[]; authoritative: Readonly<NetPlayer['predictor']['authoritative']>;
|
|
167
177
|
}
|
|
168
178
|
/** A fight as a proof reads it: its row, where its body stands and the server's name for it. */
|
|
169
179
|
export type WorkerClientFight = EncounterRow & { readonly at: { readonly x: number; readonly y: number; readonly z: number } | null; readonly name: string | null };
|
|
@@ -351,7 +361,7 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
|
|
|
351
361
|
// a page that left while it asked never joins (Codex review): a cancelled load must not take the device's seat
|
|
352
362
|
if (!answered || scope.disposed) throw new Error('The page left before it joined the world');
|
|
353
363
|
const { grid } = ports, booted = grid?.booted;
|
|
354
|
-
return startOnline({ ...world, keep: releaseKeep(), loaded: slug, build, identity: name => deviceIdentity(storage, savePrefix, name),
|
|
364
|
+
return startOnline({ ...world, keep: releaseKeep(), leaving: onlineLeaving, loaded: slug, build, identity: name => deviceIdentity(storage, savePrefix, name),
|
|
355
365
|
...(grid === null || booted === undefined ? {} : { grid: { cell: booted, cells: grid.cells.map(cell => cell.instance), placed: (cell, at) => { grid.serverPlace?.(cell, at); }, reenter: cell => { grid.reenter?.(cell); },
|
|
356
366
|
...(pageGoto() === booted ? { goto: true } : {}) } }) });
|
|
357
367
|
};
|
|
@@ -465,7 +475,7 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
|
|
|
465
475
|
if (shell.redials === true) others = new (await import('@wildshard/engine/net/otherPlayers')).OtherPlayers(client, ports.scene, scope, player.position);
|
|
466
476
|
if (new URLSearchParams(location.search).has('bossGod')) shell.bossGod();
|
|
467
477
|
bootMark('server:ready-send'); shell.ready();
|
|
468
|
-
const started = diagnosticNow(), report: WorkerClientReport = { drawn: wirePage.drawn, frames: 0, framesPerSecond: 0, ticksPerSecond: 0, correctionsPerMinute: 0, corrections: 0, retired: {}, spawnMs: {}, missed: net.predictor.missed, misses: net.predictor.misses, worstOffset: 0, queue: 0, replaysPerFrame: 0, delayMs: 0, jitterMs: 0, interpHeld: 0, interpStarved: 0, mainMsP95: 0, workerTickMs: 0, rows: 0, attacks: 0, hits: 0, kills: 0, refused: 0, held: 0, dropped: 0, hp: 0, falls: 0, closed: null, x: 0, z: 0, cell: 0, serverX: 0, serverZ: 0, restored, savedTick: -1, savedOk: false, receipts: [], quests: {}, flags: [], paid: 0, fights: [], owned: {}, sky: null, day: null, clawed: false, own: null, movers: 0, posed: 0, sand: 0 };
|
|
478
|
+
const started = diagnosticNow(), report: WorkerClientReport = { drawn: wirePage.drawn, frames: 0, framesPerSecond: 0, ticksPerSecond: 0, correctionsPerMinute: 0, corrections: 0, retired: {}, spawnMs: {}, missed: net.predictor.missed, misses: net.predictor.misses, authoritative: net.predictor.authoritative, worstOffset: 0, queue: 0, replaysPerFrame: 0, delayMs: 0, jitterMs: 0, interpHeld: 0, interpStarved: 0, mainMsP95: 0, workerTickMs: 0, rows: 0, attacks: 0, hits: 0, kills: 0, refused: 0, held: 0, dropped: 0, hp: 0, falls: 0, closed: null, x: 0, z: 0, cell: 0, serverX: 0, serverZ: 0, restored, savedTick: -1, savedOk: false, receipts: [], quests: {}, flags: [], paid: 0, fights: [], owned: {}, sky: null, day: null, clawed: false, own: null, movers: 0, posed: 0, sand: 0 };
|
|
469
479
|
if (unseated) void shell.booted.then(answer => { report.restored = answer.restored; bootMark('server:seated-late'); return undefined; }, () => undefined);
|
|
470
480
|
scope.onDispose(client.onLedger(receipt => { report.receipts.push(`${receipt.grant}:${receipt.name}`); }));
|
|
471
481
|
const contacts: NetCombatEvent[] = [];
|
|
@@ -556,7 +566,7 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
|
|
|
556
566
|
report.frames++;
|
|
557
567
|
if (firstTick === -1 && tick > 0) firstTick = tick;
|
|
558
568
|
report.ticksPerSecond = firstTick === -1 ? 0 : (tick - firstTick) / ((now - ticksFrom) / 1000); // each world keeps its own clock
|
|
559
|
-
report.missed = predictor.missed; report.corrections = predictor.corrections; report.correctionsPerMinute = predictor.corrections / seconds * 60; report.worstOffset = net.worstOffset; report.queue = predictor.pending;
|
|
569
|
+
report.missed = predictor.missed; report.authoritative = predictor.authoritative; report.corrections = predictor.corrections; report.correctionsPerMinute = predictor.corrections / seconds * 60; report.worstOffset = net.worstOffset; report.queue = predictor.pending;
|
|
560
570
|
report.replaysPerFrame = predictor.replays / report.frames; report.delayMs = client.clock.delayMs; report.jitterMs = client.clock.jitterMs; report.interpHeld = client.interpolator.held; report.interpStarved = client.interpolator.starved;
|
|
561
571
|
report.refused = net.attacks.refused; report.attacks = net.attacks.pending; report.held = net.heldSlot;
|
|
562
572
|
if (report.closed === null && client.closed !== null && !ended && client.closed !== 'reload' && shell.redials !== true) showError(`The game's server stopped (${client.closed})`);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { Box3, BufferAttribute, BufferGeometry, InterleavedBufferAttribute, Matrix3, Matrix4, Mesh, Sphere, Vector3, type Material, type Object3D } from 'three';
|
|
22
22
|
import type { Scope } from '@wildshard/engine/app/scope';
|
|
23
|
-
import { SHADOW_LAYER } from '@wildshard/engine/core/shadowLayer';
|
|
23
|
+
import { MERGED_COPY, MERGED_VIEW, SHADOW_LAYER } from '@wildshard/engine/core/shadowLayer';
|
|
24
24
|
|
|
25
25
|
const HALF = 250, COARSE = 125, BLOCK = 250;
|
|
26
26
|
/** an attribute's change count (an interleaved one counts on its buffer) */
|
|
@@ -270,7 +270,7 @@ export function propMerge(parent: Object3D, material: Material, draw: PropDraw):
|
|
|
270
270
|
const key = `${String(draw.receive)}|${String(draw.order)}`;
|
|
271
271
|
let merge = byDraw.get(key);
|
|
272
272
|
if (merge === undefined) {
|
|
273
|
-
merge = new GroundMerge(parent, material,
|
|
273
|
+
merge = new GroundMerge(parent, material, MERGED_COPY, (mesh) => { mesh.castShadow = false; mesh.receiveShadow = draw.receive; mesh.renderOrder = draw.order; }, 'block');
|
|
274
274
|
byDraw.set(key, merge);
|
|
275
275
|
}
|
|
276
276
|
return merge;
|
|
@@ -280,5 +280,7 @@ export function propMerge(parent: Object3D, material: Material, draw: PropDraw):
|
|
|
280
280
|
export function mergeView(parent: Object3D, mesh: Mesh, material: Material, scope: Scope): void {
|
|
281
281
|
if (mesh.material !== material) throw new Error('Prop merge member draws another material');
|
|
282
282
|
propMerge(parent, material, { receive: mesh.receiveShadow, order: mesh.renderOrder }).add(mesh, scope);
|
|
283
|
-
|
|
283
|
+
// SHARD-SOURCE ss4d: still the World Explorer's to pick (explore/pick.ts reads this mark), though it draws on SHADOW_LAYER
|
|
284
|
+
mesh.visible = true; mesh.layers.set(SHADOW_LAYER); mesh.userData[MERGED_VIEW] = true;
|
|
285
|
+
scope.onDispose(() => { mesh.userData[MERGED_VIEW] = false; });
|
|
284
286
|
}
|
|
@@ -69,18 +69,25 @@ const CSS = `
|
|
|
69
69
|
.ws-link details p{margin:8px 0 0;font-size:10.5px;color:rgba(230,242,248,.55);overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}
|
|
70
70
|
@keyframes ws-link-fade{from{opacity:0}}@keyframes ws-link-rise{from{opacity:0;transform:translateY(8px)}}
|
|
71
71
|
.ws-link-notice{animation-name:ws-link-fade}
|
|
72
|
+
.ws-link-page{background:#05101a;animation:ws-link-fade .2s ease-out}.ws-link-page .ws-link-box{animation:none}
|
|
73
|
+
.ws-link-mark{position:fixed;left:50%;bottom:calc(6px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:2147482200;padding:3px 10px;pointer-events:none;background:rgba(13,27,38,.78);border:1px solid rgba(255,181,71,.5);font-size:10px;letter-spacing:.22em;text-transform:uppercase;color:var(--a)}
|
|
72
74
|
@media (max-width:420px){.ws-link-banner{max-width:calc(100% - 220px);padding-left:12px;padding-right:12px}.ws-link-banner b{letter-spacing:.08em}}
|
|
73
75
|
@media (min-width:700px){.ws-link-banner{max-width:min(620px,calc(100% - 440px))}.ws-link-box{padding:28px 26px 20px}.ws-link h1{font-size:28px}}
|
|
74
76
|
@media (prefers-reduced-motion:reduce){.ws-link,.ws-link *{animation:none!important;transition:none!important}}
|
|
75
77
|
`;
|
|
76
78
|
|
|
77
|
-
const make = <K extends keyof HTMLElementTagNameMap>(tag: K, className = '', text = ''): HTMLElementTagNameMap[K] => {
|
|
79
|
+
export const make = <K extends keyof HTMLElementTagNameMap>(tag: K, className = '', text = ''): HTMLElementTagNameMap[K] => {
|
|
78
80
|
const node = document.createElement(tag);
|
|
79
81
|
if (className !== '') node.className = className;
|
|
80
82
|
if (text !== '') node.textContent = text;
|
|
81
83
|
return node;
|
|
82
84
|
};
|
|
83
|
-
const ring = (): HTMLElement => { const node = make('span', 'ring'); node.setAttribute('aria-hidden', 'true'); return node; };
|
|
85
|
+
export const ring = (): HTMLElement => { const node = make('span', 'ring'); node.setAttribute('aria-hidden', 'true'); return node; };
|
|
86
|
+
|
|
87
|
+
/** The screens' stylesheet. It lives as long as the document: a second shell (a reload in place) shares it. */
|
|
88
|
+
export function linkStyle(): void {
|
|
89
|
+
if (document.getElementById('ws-link-style') === null) { const style = make('style'); style.id = 'ws-link-style'; style.textContent = CSS; document.head.append(style); }
|
|
90
|
+
}
|
|
84
91
|
|
|
85
92
|
/** What the screens ask of the link and the page. */
|
|
86
93
|
export interface LinkScreenHooks {
|
|
@@ -130,7 +137,7 @@ const awayFor = (ms: number): string => ms < 90_000 ? `${String(Math.round(ms /
|
|
|
130
137
|
const blockedIds = (ids: string): string => ids.split(' ').map(id => `${id}-blocked`).join(' ');
|
|
131
138
|
|
|
132
139
|
/** A card's frame: the scrim, the box, a tag and a title. The caller fills the rest. */
|
|
133
|
-
function card(scope: Scope, ids: string, tone: 'info' | 'warn' | 'bad', tag: string, title: string): { root: HTMLElement; box: HTMLElement } {
|
|
140
|
+
export function card(scope: Scope, ids: string, tone: 'info' | 'warn' | 'bad', tag: string, title: string): { root: HTMLElement; box: HTMLElement } {
|
|
134
141
|
const root = scope.ownNode(make('div', 'ws-link ws-link-scrim')), box = make('div', 'ws-link-box');
|
|
135
142
|
root.dataset['failmode'] = ids; root.dataset['tone'] = tone; root.setAttribute('role', 'alertdialog'); root.setAttribute('aria-modal', 'true'); root.setAttribute('aria-label', title);
|
|
136
143
|
box.append(make('p', 'ws-link-tag', tag), make('h1', '', title)); root.append(box);
|
|
@@ -147,7 +154,7 @@ function card(scope: Scope, ids: string, tone: 'info' | 'warn' | 'bad', tag: str
|
|
|
147
154
|
});
|
|
148
155
|
return { root, box };
|
|
149
156
|
}
|
|
150
|
-
function buttons(scope: Scope, actions: readonly { readonly label: string; readonly primary?: true; readonly busy?: string; readonly act: () => void }[]): HTMLElement {
|
|
157
|
+
export function buttons(scope: Scope, actions: readonly { readonly label: string; readonly primary?: true; readonly busy?: string; readonly act: () => void }[]): HTMLElement {
|
|
151
158
|
const column = make('div', 'ws-link-col');
|
|
152
159
|
for (const action of actions) {
|
|
153
160
|
const button = make('button', action.primary === true ? 'go' : '', action.label);
|
|
@@ -169,8 +176,7 @@ function buttons(scope: Scope, actions: readonly { readonly label: string; reado
|
|
|
169
176
|
*/
|
|
170
177
|
export function linkScreens(scope: Scope, hooks: LinkScreenHooks, parent: HTMLElement = document.body): LinkScreens {
|
|
171
178
|
const report = hooks.report ?? captureBrowserError;
|
|
172
|
-
|
|
173
|
-
if (document.getElementById('ws-link-style') === null) { const style = make('style'); style.id = 'ws-link-style'; style.textContent = CSS; document.head.append(style); }
|
|
179
|
+
linkStyle();
|
|
174
180
|
// the banner keeps the old strip's id, so the online proofs still find it
|
|
175
181
|
const banner = scope.ownNode(make('div', 'ws-link ws-link-banner')), head = make('b'), line = make('span');
|
|
176
182
|
banner.id = 'ws-reconnect-strip'; banner.setAttribute('role', 'status'); banner.hidden = true; banner.append(head, line);
|
|
@@ -11,8 +11,9 @@ const NEW_BUILD_BUTTON = 'min-height:44px;padding:8px 32px;border:1px solid #8fe
|
|
|
11
11
|
export function newBuildPanel(scope: Scope, again: () => Promise<boolean>, reload: () => void, parent: HTMLElement = document.body): void {
|
|
12
12
|
if (document.getElementById('ws-new-build') !== null) return;
|
|
13
13
|
const panel = scope.ownNode(document.createElement('div')), words = document.createElement('p'), go = document.createElement('button');
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// FM5 mode 23 (`version-skew`): the page's build and the world's differ, and the one automatic reload didn't land
|
|
15
|
+
panel.id = 'ws-new-build'; panel.dataset['failmode'] = 'version-skew'; panel.setAttribute('role', 'alertdialog'); panel.style.cssText = NEW_BUILD;
|
|
16
|
+
words.textContent = 'A new version is out. Reload to play on.'; words.style.margin = '0';
|
|
16
17
|
go.type = 'button'; go.textContent = 'Reload'; go.style.cssText = NEW_BUILD_BUTTON;
|
|
17
18
|
// RL3: the panel is already full-page; the tap's own turn turns it and its button into RELOADING
|
|
18
19
|
scope.listen(go, 'click', () => { go.disabled = true; go.setAttribute('aria-busy', 'true'); go.textContent = 'Reloading…'; words.textContent = 'Reloading'; reload(); });
|