@wildshard/engine 0.1.19 → 0.1.21
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/package.json +5 -2
- package/scripts/app-build/gen.ts +11 -0
- package/scripts/cell-mem-bench.mjs +2 -0
- package/scripts/chaos-proxy-core.mjs +14 -1
- package/scripts/chaos-proxy-proof.mjs +22 -0
- package/scripts/check-devserver.mjs +1 -1
- package/scripts/failmode-cases.d.mts +8 -0
- package/scripts/failmode-cases.mjs +97 -0
- package/scripts/failmode-proof.mjs +532 -0
- package/scripts/grid-crossing-nightly.mjs +5 -4
- package/scripts/grid-crossing-report.mjs +5 -2
- package/scripts/grid-crossing-tour.mjs +36 -12
- package/scripts/grid-crossing-walk-proof.mjs +4 -2
- package/scripts/hover-speed-probe.mjs +136 -0
- package/scripts/land.mjs +2 -1
- package/scripts/loading-flow/benchmax.mjs +34 -11
- package/scripts/loading-flow/deskbench.mjs +276 -0
- package/scripts/loading-flow/stalls.d.mts +17 -3
- package/scripts/loading-flow/stalls.mjs +82 -3
- package/scripts/net-lag-proof.mjs +3 -2
- package/scripts/nightly-model.ts +9 -6
- package/scripts/offline-proof.mjs +7 -1
- package/scripts/online-rig.mjs +9 -7
- package/scripts/parity/boot-smoke.mjs +13 -2
- package/scripts/pin-format.ts +5 -2
- package/scripts/pins-reuse.d.mts +1 -0
- package/scripts/pins-reuse.mjs +22 -0
- package/scripts/release-cook.mjs +109 -0
- package/scripts/scratch-dir.mjs +95 -0
- package/scripts/scratch-sweep.mjs +182 -0
- package/scripts/tsconfig.json +2 -12
- package/scripts/vps/harden-prometheus.sh +3 -0
- package/scripts/vps/rebuild.sh +35 -9
- package/scripts/vps/wildshard-apply.mjs +5 -1
- package/scripts/vps/wildshard-config +117 -1
- package/scripts/worktree-reap.mjs +54 -8
- package/scripts/worktree.mjs +19 -5
- package/src/client/engine/anim/rigParser.ts +2 -2
- package/src/client/engine/boot/contentRead.ts +54 -5
- package/src/client/engine/boot/gpuFiles.ts +3 -3
- package/src/client/engine/boot/leaveAfterPaint.ts +4 -1
- package/src/client/engine/core/Game.ts +63 -19
- package/src/client/engine/core/gpuOnly.ts +10 -0
- package/src/client/engine/core/renderBudget.ts +134 -0
- 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/net/redial.ts +40 -5
- package/src/client/engine/player/TouchControls.ts +3 -2
- package/src/client/engine/render/dataLook.ts +70 -7
- package/src/client/engine/render/families/pbr.ts +2 -0
- package/src/client/engine/render/families/registry.ts +11 -2
- package/src/client/engine/render/families/sceneSurface.ts +118 -0
- package/src/client/engine/render/look.ts +7 -1
- package/src/client/engine/render/precompile.ts +4 -2
- package/src/client/engine/render/tiers.ts +4 -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/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/engine/world/declaredProps.ts +5 -1
- package/src/client/engine/world/skyRig.ts +4 -1
- package/src/client/engine/world/terrainTileView.ts +64 -23
- package/src/client/game/boot/spawnDownload.ts +44 -6
- package/src/client/game/devScene/hook.ts +149 -12
- package/src/client/game/devScene/liveLook.ts +21 -0
- package/src/client/game/grid/live.ts +47 -10
- package/src/client/game/grid/liveSession.ts +25 -6
- package/src/client/game/grid/pageEntry.ts +12 -1
- package/src/client/game/grid/productInputs.ts +22 -11
- package/src/client/game/grid/session.ts +15 -4
- package/src/client/game/grid/shardfileFar.ts +13 -2
- package/src/client/game/session/finish.ts +4 -1
- package/src/client/game/shardfile/client.ts +24 -7
- package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
- package/src/client/game/shardfile/clientSource.ts +7 -3
- package/src/client/game/shardfile/clientViews.ts +36 -8
- package/src/client/game/shardfile/clientWorker.ts +4 -4
- package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
- package/src/client/game/shardfile/groundMerge.ts +59 -5
- package/src/client/game/shardfile/hybrid.ts +2 -0
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/slabLibrary.ts +115 -49
- package/src/client/game/shardfile/tileContent.ts +1 -1
- package/src/client/game/shardfile/tileDriver.ts +38 -11
- package/src/client/game/shardfile/wirePage.ts +7 -3
- package/src/client/game/shardfile/worldScenes.ts +17 -10
- package/src/client/host/online/doctor.ts +20 -7
- package/src/client/host/online/doctorView.ts +2 -0
- package/src/client/host/online/linkScreens.ts +95 -11
- 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 +24 -5
- package/src/client/host/online/voice.ts +45 -1
- package/src/client/host/online/voiceUi.ts +24 -6
- package/src/client/host/standalone/shell.ts +37 -1
- package/src/server/engine/sim/playerSim.ts +1 -1
- package/src/server/game/grid/simulation.ts +12 -6
- package/src/server/game/quest/eliteDrops.ts +7 -3
- package/src/server/game/riding/nativeTaming.ts +13 -2
- package/src/server/host/dedicated/cellHost.ts +21 -2
- package/src/server/host/dedicated/cellProtocol.ts +2 -0
- package/src/server/host/dedicated/cellWorker.ts +1 -1
- package/src/server/host/dedicated/dedicatedRoom.ts +38 -8
- package/src/server/host/dedicated/roadRoom.ts +3 -0
- package/src/server/host/dedicated/serverMetrics.ts +9 -0
- package/src/server/host/dedicated/workerTable.ts +31 -24
- package/src/server/host/standalone/gridServer.ts +1 -1
- package/src/server/host/standalone/serverHost.ts +56 -10
- package/src/server/host/standalone/serverProduct.ts +9 -7
- package/src/server/host/standalone/serverRuntime.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/core/framePacing.ts +12 -1
- package/src/shared/engine/physics/terrainTiles.ts +20 -4
- package/src/shared/engine/player/hoverSpeed.ts +3 -3
- package/src/shared/engine/strings.ts +12 -1
- package/src/shared/game/devColliders.ts +60 -0
- package/src/shared/game/devGameplay.ts +41 -0
- package/src/shared/game/grid/rules.ts +12 -0
|
@@ -2,6 +2,8 @@ import type { Scope } from '@wildshard/engine/app/scope';
|
|
|
2
2
|
import { withOwner } from '@wildshard/engine/app/ownership';
|
|
3
3
|
import type { Physics } from '@wildshard/engine/physics/Physics';
|
|
4
4
|
import { groups } from '@wildshard/engine/physics/groups';
|
|
5
|
+
import { swapTerrainCollider } from '@wildshard/engine/physics/terrainTiles';
|
|
6
|
+
import { terrainTileHeight, type TerrainTileData } from '@wildshard/format/terrainTileBytes';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* SHARD-SOURCE AP5 (J347): a watched part's solid boxes, as the dev hook's `swapColliders` hands them to a physics world.
|
|
@@ -45,3 +47,61 @@ export function swapDevBoxes(physics: Physics, owner: Scope, held: Map<string, S
|
|
|
45
47
|
}
|
|
46
48
|
old?.dispose();
|
|
47
49
|
}
|
|
50
|
+
|
|
51
|
+
/** SHARD-SOURCE AP18: a watched shard's whole ground, heights only (row-major, as the wire carries a terrain tile). */
|
|
52
|
+
export type DevGround = Pick<TerrainTileData, 'resolution' | 'x' | 'z' | 'size' | 'heights'>;
|
|
53
|
+
/** The harness-port message that carries the new ground to the in-page server. */
|
|
54
|
+
export interface DevGroundMessage { readonly wildshardDevGround: DevGround }
|
|
55
|
+
|
|
56
|
+
export const isDevGround = (value: unknown): value is DevGroundMessage => {
|
|
57
|
+
if (typeof value !== 'object' || value === null || !('wildshardDevGround' in value)) return false;
|
|
58
|
+
const ground = value.wildshardDevGround;
|
|
59
|
+
if (typeof ground !== 'object' || ground === null || !('resolution' in ground) || !('x' in ground) || !('z' in ground) || !('size' in ground) || !('heights' in ground)) return false;
|
|
60
|
+
const { resolution, x, z, size, heights } = ground;
|
|
61
|
+
return typeof resolution === 'number' && Number.isInteger(resolution) && resolution >= 2 && resolution <= 257 && [x, z, size].every(n => typeof n === 'number' && Number.isFinite(n))
|
|
62
|
+
&& (size as number) > 0 && heights instanceof Float32Array && heights.length === resolution * resolution && heights.every(Number.isFinite);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Where feet at (x, y, z) stand once new solids are in: on the ground when they are under it, or on top of a box they are
|
|
67
|
+
* inside. Null when they are in neither (nothing to lift). A box's top is its highest point, a fair floor for a dev swap.
|
|
68
|
+
*/
|
|
69
|
+
export function liftedFeet(x: number, y: number, z: number, heightAt: ((x: number, z: number) => number) | null, boxes: readonly DevBox[]): number | null {
|
|
70
|
+
let lifted: number | null = null;
|
|
71
|
+
if (heightAt !== null) { const ground = heightAt(x, z); if (y < ground - 0.02) lifted = ground; }
|
|
72
|
+
for (const box of boxes) {
|
|
73
|
+
const [qx, qy, qz, qw] = box.rotation, dx = x - box.centre[0], dy = (lifted ?? y) + 0.05 - box.centre[1], dz = z - box.centre[2];
|
|
74
|
+
// into the box's frame: the conjugate rotation, v + 2w(-q x v) + 2(-q x (-q x v))
|
|
75
|
+
const cx = -qy * dz + qz * dy, cy = -qz * dx + qx * dz, cz = -qx * dy + qy * dx;
|
|
76
|
+
const lx = dx + 2 * (qw * cx + (-qy * cz + qz * cy)), ly = dy + 2 * (qw * cy + (-qz * cx + qx * cz)), lz = dz + 2 * (qw * cz + (-qx * cy + qy * cx));
|
|
77
|
+
if (Math.abs(lx) > box.half[0] || Math.abs(ly) > box.half[1] || Math.abs(lz) > box.half[2]) continue;
|
|
78
|
+
// the box's world y extent: |R row y| . half
|
|
79
|
+
const r1 = 2 * (qx * qy + qw * qz), r2 = 1 - 2 * (qx * qx + qz * qz), r3 = 2 * (qy * qz - qw * qx);
|
|
80
|
+
const top = box.centre[1] + Math.abs(r1) * box.half[0] + Math.abs(r2) * box.half[1] + Math.abs(r3) * box.half[2];
|
|
81
|
+
if (top > (lifted ?? y)) lifted = top;
|
|
82
|
+
}
|
|
83
|
+
return lifted;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** The new ground's height law, as the page's terrain field (`clientGround`) reads a collider: 0 off the lattice. */
|
|
87
|
+
export const devGroundHeight = (ground: DevGround): ((x: number, z: number) => number) => (x, z) => x < ground.x || z < ground.z || x > ground.x + ground.size || z > ground.z + ground.size ? 0 : terrainTileHeight(ground, x, z);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The in-page server's half of a ground swap: the new heightfield (in `held`'s scope, the last swap's going), the new
|
|
91
|
+
* height query, and every player under it lifted onto it (`place`: the wire counts it and the client snaps).
|
|
92
|
+
*/
|
|
93
|
+
export function swapDevGround(physics: Physics, owner: Scope, held: { scope: Scope | null }, ground: DevGround, ports: {
|
|
94
|
+
readonly heightQuery: (heightAt: (x: number, z: number) => number) => void;
|
|
95
|
+
readonly players: () => Iterable<readonly [string, { readonly position: { readonly x: number; readonly y: number; readonly z: number }; readonly yaw: number }]>;
|
|
96
|
+
readonly place: (at: { x: number; y: number; z: number; yaw: number }, player: string) => void;
|
|
97
|
+
}): void {
|
|
98
|
+
const old = held.scope, scope = owner.child('devGround');
|
|
99
|
+
swapTerrainCollider(physics, ground, scope);
|
|
100
|
+
held.scope = scope; old?.dispose();
|
|
101
|
+
const heightAt = (x: number, z: number): number => terrainTileHeight(ground, x, z, { boundary: 'clamp' });
|
|
102
|
+
ports.heightQuery(heightAt);
|
|
103
|
+
for (const [id, player] of ports.players()) {
|
|
104
|
+
const y = liftedFeet(player.position.x, player.position.y, player.position.z, heightAt, []);
|
|
105
|
+
if (y !== null) ports.place({ x: player.position.x, y, z: player.position.z, yaw: player.yaw }, id);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { parseShardfile, type Shardfile } from '@wildshard/format/shardSchema';
|
|
2
|
+
import { carryOutputDescriptor } from '@wildshard/engine/game/shardfile/outputDescriptor';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* SHARD-SOURCE AP19 (J347): `wildshard watch`'s soft restart. A watched shard's quests, encounters, spawns or scripts
|
|
6
|
+
* changed: the in-page server restarts its world on the new sections, from a save it takes first (so progress and the
|
|
7
|
+
* player's place carry over), and the page rebuilds its quest views. These are the sections it takes; anything else (the
|
|
8
|
+
* state schema, the look, the ground) is a new shell or the hook's other calls. DEVSERVER-only on both sides, as
|
|
9
|
+
* `devColliders.ts` is (engine `scripts/check-devserver.mjs` refuses `wildshardDevRestart` in a production bundle).
|
|
10
|
+
*/
|
|
11
|
+
// `questNpcs` and `clientScripts` are not here: only the page reads them and the hook rebuilds only the quest views, so a change
|
|
12
|
+
// to either is a new shell.
|
|
13
|
+
export const DEV_GAMEPLAY_SECTIONS = ['quests', 'questHost', 'encounters', 'directors', 'creatures', 'crowds', 'hooks', 'ledger', 'sim'] as const;
|
|
14
|
+
export type DevGameplaySection = typeof DEV_GAMEPLAY_SECTIONS[number];
|
|
15
|
+
/** The new rows of each section the watched source declares now; a section left out keeps the shell's. */
|
|
16
|
+
export type DevGameplay = Partial<Pick<Shardfile, DevGameplaySection>>;
|
|
17
|
+
/** Where the page's player stands: the restarted world puts its player there. */
|
|
18
|
+
export interface DevPlace { readonly x: number; readonly y: number; readonly z: number; readonly yaw: number }
|
|
19
|
+
/** The harness-port message that restarts the in-page server; its ports are the new game link and the reply's. */
|
|
20
|
+
export interface DevRestartMessage { readonly wildshardDevRestart: DevGameplay; readonly at: DevPlace | null }
|
|
21
|
+
/** The worker's answer on the reply port. */
|
|
22
|
+
export interface DevRestarted { readonly ok: boolean; readonly ms: number; readonly reason?: string }
|
|
23
|
+
|
|
24
|
+
const SECTIONS: ReadonlySet<string> = new Set(DEV_GAMEPLAY_SECTIONS);
|
|
25
|
+
|
|
26
|
+
export const isDevRestart = (value: unknown): value is DevRestartMessage => {
|
|
27
|
+
if (typeof value !== 'object' || value === null || !('wildshardDevRestart' in value) || !('at' in value)) return false;
|
|
28
|
+
const { wildshardDevRestart: gameplay, at } = value;
|
|
29
|
+
if (typeof gameplay !== 'object' || gameplay === null || Array.isArray(gameplay) || !Object.keys(gameplay).every(key => SECTIONS.has(key))) return false;
|
|
30
|
+
return at === null || (typeof at === 'object' && 'x' in at && 'y' in at && 'z' in at && 'yaw' in at && [at.x, at.y, at.z, at.yaw].every(n => typeof n === 'number' && Number.isFinite(n)));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** `shard` with `gameplay`'s sections in place of its own, checked as a whole shardfile; the output descriptor carries over. */
|
|
34
|
+
export function withDevGameplay(shard: Shardfile, gameplay: DevGameplay): Shardfile {
|
|
35
|
+
const merged: Record<string, unknown> = { ...shard };
|
|
36
|
+
for (const section of DEV_GAMEPLAY_SECTIONS) if (gameplay[section] !== undefined) merged[section] = gameplay[section];
|
|
37
|
+
// oxlint-disable-next-line unicorn/prefer-structured-clone -- JSON wire normalization, as the product reader parses it
|
|
38
|
+
const next = parseShardfile(JSON.parse(JSON.stringify(merged)));
|
|
39
|
+
carryOutputDescriptor(shard, next);
|
|
40
|
+
return next;
|
|
41
|
+
}
|
|
@@ -25,6 +25,18 @@ export function gridBoardLimit(state: GridHoverState): number {
|
|
|
25
25
|
const cap = gridHoverSpeed(state.local, state.shardCap, state.speedClass);
|
|
26
26
|
return gridZone(state.local) === 'highway' && !state.onHighwayDeck ? state.shardCap : cap;
|
|
27
27
|
}
|
|
28
|
+
/** What `gridBoardLimitAt` reads of a grid: its pitch and each placed cell's spot and speed class (`GridAssembly`). */
|
|
29
|
+
export interface GridHoverCells { readonly pitch: number; readonly cells: readonly { readonly cell: readonly [number, number]; readonly speedClass?: 'road' }[] }
|
|
30
|
+
/**
|
|
31
|
+
* The board's cap at world-frame feet on this grid: the in-page server's and a dedicated worker's road and cell rooms' one read of
|
|
32
|
+
* it, the same `gridBoardLimit` the page's `installGridHoverSpeed` reads, so prediction and authority agree (QA 11-15 row 8: G60's
|
|
33
|
+
* 30 m/s road, G39's 14 m/s shard, G540's road class).
|
|
34
|
+
*/
|
|
35
|
+
export function gridBoardLimitAt(grid: GridHoverCells, feet: Readonly<GridPoint>, shardCap = 14): number {
|
|
36
|
+
finite(feet);
|
|
37
|
+
const p = grid.pitch, cx = Math.round(feet.x / p), cz = Math.round(feet.z / p), cell = grid.cells.find(row => row.cell[0] === cx && row.cell[1] === cz);
|
|
38
|
+
return gridBoardLimit({ local: { x: feet.x - cx * p, y: feet.y, z: feet.z - cz * p }, shardCap, onHighwayDeck: feet.y < 4, speedClass: cell?.speedClass ?? 'shard' });
|
|
39
|
+
}
|
|
28
40
|
/** Minimal board port for standalone and residency policy; no Player or browser dependency enters here. */
|
|
29
41
|
export interface GridHoverPort { hoverSpeedLimit: (() => number) | null }
|
|
30
42
|
/** A directly opened padding shard uses its same authored road class; ordinary shards retain their existing port. */
|