@wildshard/engine 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/index.html +157 -11
- package/lint/engine-sides.json +16 -0
- package/lint/host-register.json +496 -0
- package/lint/ratchet.json +2 -2
- package/lint/shard-imports.d.mts +1 -0
- package/lint/shard-imports.mjs +56 -8
- package/lint/wildshard-plugin.js +22 -4
- package/package.json +16 -5
- package/scripts/app-build/buildIdentity.d.mts +3 -1
- package/scripts/app-build/buildIdentity.mjs +25 -5
- package/scripts/app-build/builtAt.d.mts +4 -0
- package/scripts/app-build/builtAt.mjs +21 -0
- package/scripts/app-build/serviceWorker.ts +16 -2
- package/scripts/app-build/versionFiles.ts +2 -1
- package/scripts/app-build-pipeline.mjs +4 -1
- package/scripts/audio-download-proof.mjs +843 -0
- package/scripts/build-app.mjs +4 -0
- package/scripts/build-mirror.d.mts +2 -0
- package/scripts/build-mirror.mjs +5 -4
- package/scripts/built-product.mjs +3 -3
- package/scripts/cell-mem/metrics-preload.mjs +65 -0
- package/scripts/cell-mem-bench.mjs +130 -0
- package/scripts/check-chunks.mjs +2 -1
- package/scripts/devserver-client.d.mts +5 -0
- package/scripts/devserver-client.mjs +68 -0
- package/scripts/engine-ci-budget.ts +7 -1
- package/scripts/format-lock.mjs +20 -11
- package/scripts/generate-title-launch.mjs +3 -2
- package/scripts/grid-crossing-walk-proof.mjs +16 -8
- package/scripts/heavy-lane.py +25 -1
- package/scripts/host-ruler/register-migrate.mjs +242 -0
- package/scripts/host-ruler/register.d.mts +36 -0
- package/scripts/host-ruler/register.mjs +116 -0
- package/scripts/host-ruler/roots.d.mts +29 -0
- package/scripts/host-ruler/roots.mjs +333 -0
- package/scripts/host-ruler/server-roots.d.mts +23 -0
- package/scripts/host-ruler/server-roots.mjs +272 -0
- package/scripts/main-watch.d.mts +1 -1
- package/scripts/main-watch.mjs +10 -6
- package/scripts/map-hash.mjs +3 -6
- package/scripts/mmo-bots.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +1 -0
- package/scripts/offline-proof-rules.mjs +22 -1
- package/scripts/online-rig.mjs +4 -4
- package/scripts/page-release/flow.d.mts +1 -0
- package/scripts/page-release/flow.mjs +6 -2
- package/scripts/page-release.mjs +5 -1
- package/scripts/physics-route.json +0 -71
- package/scripts/pins-catalogue.ts +103 -0
- package/scripts/pins-reuse.mjs +3 -1
- package/scripts/pins.ts +22 -14
- package/scripts/preview-grid.ts +203 -0
- package/scripts/road-preload-proof.mjs +167 -0
- package/scripts/server-release/publish.mjs +2 -2
- package/scripts/server-release/served-slug.d.mts +2 -0
- package/scripts/server-release/served-slug.mjs +10 -0
- package/scripts/server-release/sign.d.mts +1 -0
- package/scripts/server-release/sign.mjs +3 -7
- package/scripts/shard-components.mjs +0 -2
- package/scripts/shard-outputs.d.mts +8 -0
- package/scripts/shard-outputs.mjs +45 -11
- package/scripts/side-parity.d.mts +2 -1
- package/scripts/side-parity.mjs +25 -4
- package/scripts/test-amber.d.mts +1 -0
- package/scripts/test-amber.mjs +10 -0
- package/scripts/test-products.json +3 -3
- package/scripts/tracked-public.d.mts +1 -0
- package/scripts/tracked-public.mjs +17 -0
- package/src/cli/engine.mjs +8 -0
- package/src/client/app/bootRoute.ts +4 -1
- package/src/client/app/dropModal.ts +15 -2
- package/src/client/app/entry.ts +67 -11
- package/src/client/app/slugPath.ts +5 -0
- package/src/client/engine/audio/Audio.ts +20 -2
- package/src/client/engine/boot/bakedTextures.ts +3 -2
- package/src/client/engine/boot/bootTrace.ts +6 -1
- package/src/client/engine/boot/bytes.ts +4 -3
- package/src/client/engine/boot/clearDownloads.ts +1 -1
- package/src/client/engine/boot/contentRead.ts +4 -0
- package/src/client/engine/boot/dropNotice.ts +20 -6
- package/src/client/engine/boot/gpuFiles.ts +25 -2
- package/src/client/engine/boot/lastEnd.ts +8 -2
- package/src/client/engine/boot/shardPrefetch.ts +7 -1
- package/src/client/engine/boot/sw.ts +19 -0
- package/src/client/engine/core/Game.ts +11 -3
- package/src/client/engine/core/GpuRecovery.ts +7 -0
- package/src/client/engine/core/Volumetrics.ts +5 -0
- package/src/client/engine/core/assets.ts +27 -20
- package/src/client/engine/core/bootstrap.ts +1 -2
- package/src/client/engine/core/ktx2.ts +84 -11
- package/src/client/engine/explore/Compare.ts +2 -2
- package/src/client/engine/explore/TouchFly.ts +3 -5
- package/src/client/engine/input/dom.ts +12 -0
- package/src/client/engine/net/predictor.ts +6 -2
- package/src/client/engine/player/Player.ts +10 -2
- package/src/client/engine/player/TouchControls.ts +12 -4
- package/src/client/engine/pwa/sw.js +47 -8
- package/src/client/engine/render/drawCheck.ts +96 -0
- package/src/client/engine/saves/staleBuildNote.ts +46 -0
- package/src/client/engine/telemetry/browserErrors.ts +157 -20
- package/src/client/engine/telemetry/screenOutbox.ts +61 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
- package/src/client/engine/ui/DeathFade.ts +99 -11
- package/src/client/engine/ui/ErrorModal.ts +13 -6
- package/src/client/engine/ui/Feedback.ts +2 -1
- package/src/client/engine/ui/Loading.ts +10 -6
- package/src/client/engine/ui/Map.ts +2 -1
- package/src/client/engine/ui/WeaponStrip.ts +2 -1
- package/src/client/engine/ui/backGuard.ts +104 -0
- package/src/client/engine/ui/hudAdapters.ts +30 -4
- package/src/client/engine/ui/loading.css +17 -0
- package/src/client/engine/ui/namePrompt.ts +6 -5
- package/src/client/engine/ui/styles/combat.css +12 -0
- package/src/client/engine/ui/styles/namePrompt.css +4 -2
- package/src/client/game/boot/audio.generated.ts +0 -294
- package/src/client/game/boot/bytes.generated.ts +0 -11
- package/src/client/game/boot/versions.generated.ts +0 -11
- package/src/client/game/compendium/keepsakes.ts +16 -6
- package/src/client/game/grapple/tool.ts +10 -7
- package/src/client/game/grid/cellLoading.ts +23 -12
- package/src/client/game/grid/cellScreens.ts +39 -74
- package/src/client/game/grid/liveSession.ts +40 -7
- package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
- package/src/client/game/grid/nearPlaceholderView.ts +9 -3
- package/src/client/game/grid/oneWayIn.ts +92 -27
- package/src/client/game/grid/pageEntry.ts +19 -0
- package/src/client/game/grid/pageShell.ts +1 -1
- package/src/client/game/grid/plotAudio.ts +114 -0
- package/src/client/game/grid/products.ts +55 -5
- package/src/client/game/grid/roadLookPlatform.ts +2 -2
- package/src/client/game/grid/session.ts +38 -22
- package/src/client/game/grid/spawnGround.ts +68 -0
- package/src/client/game/grid/voidLook.ts +29 -23
- package/src/client/game/loot/runtime.ts +3 -1
- package/src/client/game/mainMenu.ts +14 -6
- package/src/client/game/riding/hud.ts +6 -4
- package/src/client/game/session/finish.ts +17 -3
- package/src/client/game/session/play.ts +8 -2
- package/src/client/game/session/session.ts +4 -1
- package/src/client/game/shardfile/clientWorker.ts +41 -12
- package/src/client/game/shardfile/serverRoute.ts +10 -22
- package/src/client/game/slugPage.css +11 -0
- package/src/client/game/slugPage.ts +84 -0
- package/src/client/game/systems/viewmodel/heldView.ts +6 -3
- package/src/client/game/titleDeck.ts +55 -32
- package/src/client/host/online/doctor.ts +7 -6
- package/src/client/host/online/linkScreens.ts +16 -0
- package/src/client/host/online/release.ts +51 -5
- package/src/client/host/online/shell.ts +48 -27
- package/src/client/host/standalone/shell.ts +7 -3
- package/src/cook/game/audioReport.ts +57 -0
- package/src/cook/game/entryTotals.ts +26 -6
- package/src/cook/game/installedRuntimeReads.ts +3 -0
- package/src/server/engine/sim/respawn.ts +6 -1
- package/src/server/engine/sim.ts +3 -0
- package/src/server/game/grid/simulation.ts +35 -0
- package/src/server/game/loot/harvest.ts +2 -0
- package/src/server/game/loot/keepsakeProgression.ts +40 -0
- package/src/server/game/loot/playerOwned.ts +5 -1
- package/src/server/game/plugin/simulation.ts +4 -0
- package/src/server/game/population/nativeBake.ts +2 -1
- package/src/server/game/quest/chapterRecords.ts +2 -0
- package/src/server/game/quest/serverChapters.ts +4 -0
- package/src/server/game/quest/serverDoors.ts +11 -5
- package/src/server/game/roomRespawn.ts +4 -0
- package/src/server/game/shardfile/installedSides.ts +18 -0
- package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
- package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
- package/src/server/host/bake/headlessWorker.ts +5 -1
- package/src/server/host/dedicated/cellHost.ts +98 -29
- package/src/server/host/dedicated/cellProtocol.ts +11 -1
- package/src/server/host/dedicated/cellWorker.ts +9 -3
- package/src/server/host/dedicated/crossing.ts +6 -2
- package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
- package/src/server/host/dedicated/gridCells.ts +52 -9
- package/src/server/host/dedicated/main.ts +31 -12
- package/src/server/host/dedicated/placementFile.ts +72 -0
- package/src/server/host/dedicated/releaseFile.ts +17 -10
- package/src/server/host/dedicated/roadRoom.ts +21 -5
- package/src/server/host/dedicated/workerTable.ts +13 -1
- package/src/server/host/dedicated/world.ts +81 -9
- package/src/server/host/headlessRuntime.ts +10 -5
- package/src/server/host/installers.ts +62 -0
- package/src/server/host/openWorld.ts +59 -0
- package/src/server/host/ropeDecks.ts +2 -0
- package/src/server/host/standalone/cellWorld.ts +25 -19
- package/src/server/host/standalone/fallFloor.ts +2 -2
- package/src/server/host/standalone/gridServer.ts +7 -4
- package/src/server/host/standalone/roadWorld.ts +41 -4
- package/src/shared/engine/audio/bootAudio.ts +33 -0
- package/src/shared/engine/level/spec.ts +3 -3
- package/src/shared/engine/net/acts.ts +3 -0
- package/src/shared/engine/physics/query.ts +27 -0
- package/src/shared/engine/physics/terrain.ts +19 -28
- package/src/shared/engine/saves/saves.lock.json +15 -0
- package/src/shared/engine/sim/actRoutes.ts +2 -0
- package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
- package/src/shared/game/grid/catalogue.ts +12 -5
- package/src/shared/game/grid/catalogueSlot.ts +11 -0
- package/src/shared/game/grid/farProxy.ts +6 -5
- package/src/shared/game/grid/pageMode.ts +1 -1
- package/src/shared/game/grid/roadLayout.ts +26 -3
- package/src/shared/game/grid/singleplayer.json +0 -13
- package/src/shared/game/grid/voidFloor.ts +122 -0
- package/src/shared/game/strings.ts +15 -0
- package/src/shared/host/standalone/netInput.ts +2 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// E7.3: opening one cell's world, shared by the phone's grid (`gridServer.ts`) and a dedicated room (`DedicatedRoom`). What differs
|
|
2
2
|
// between them is in `CellWorldOptions`: who keeps a player's goods and facts, and whether solids stay near one player.
|
|
3
3
|
import { bootTask } from '@wildshard/engine/boot/timing';
|
|
4
|
-
import { withOwner } from '@wildshard/engine/app/ownership';
|
|
5
4
|
import type { NetTickInput } from '@wildshard/engine/net/room';
|
|
6
5
|
import { NearColliders } from '@wildshard/engine/physics/nearColliders';
|
|
7
|
-
import {
|
|
6
|
+
import { removeChunkEdgeWalls } from '@wildshard/engine/physics/terrain';
|
|
8
7
|
import type { SimHost } from '@wildshard/engine/sim';
|
|
9
8
|
import type { PlayerSim } from '@wildshard/engine/sim/playerSim';
|
|
10
9
|
import { actRoutes } from '@wildshard/engine/sim/actRoutes';
|
|
@@ -26,7 +25,7 @@ import { QUEST_OWNED } from '@wildshard/engine/game/quest/nativeComposition';
|
|
|
26
25
|
import { shardRows } from '@wildshard/engine/sim/shardRows';
|
|
27
26
|
import { createQuestLedger } from '@wildshard/engine/game/quest/ledger';
|
|
28
27
|
import { serverDiscoveries } from '@wildshard/engine/game/quest/serverPlaces';
|
|
29
|
-
import { STORY_ACT, UNSTUCK_ACT } from '@wildshard/engine/net/acts';
|
|
28
|
+
import { RESPAWN_NOW_ACT, STORY_ACT, UNSTUCK_ACT } from '@wildshard/engine/net/acts';
|
|
30
29
|
import { installServerChapters } from '@wildshard/engine/game/quest/serverChapters';
|
|
31
30
|
import { installServerDoors } from '@wildshard/engine/game/quest/serverDoors';
|
|
32
31
|
import { pageOpenDoors } from '@wildshard/engine/game/shardfile/buildingDoor';
|
|
@@ -34,7 +33,8 @@ import { pageRuntimeState } from '@wildshard/engine/game/shardfile/runtimeState'
|
|
|
34
33
|
import { commandsOf } from '@wildshard/engine/game/grid/roomNet';
|
|
35
34
|
import { pageSavedFlags } from '@wildshard/engine/world/interact/flags';
|
|
36
35
|
import { installDeclaredKitItems, type DeclaredKitItems } from '@wildshard/engine/game/shardfile/declaredKitItems';
|
|
37
|
-
import { createTrustedHeadlessResident, type HeadlessRuntimeInput } from '../headlessRuntime';
|
|
36
|
+
import { createTrustedHeadlessResident, type HeadlessRuntimeInput, type TrustedHeadlessResident } from '../headlessRuntime';
|
|
37
|
+
import { registerInstalled } from '@wildshard/engine/game/shardfile/installedSides';
|
|
38
38
|
import { productHeadlessSections } from '@wildshard/engine/host/headlessSections';
|
|
39
39
|
import type { HeadlessEffect } from '../../../shared/host/tickProtocol';
|
|
40
40
|
import { FallFloor, shardFallFloor, shardPlayArea } from './fallFloor';
|
|
@@ -58,10 +58,14 @@ export interface CellWorld extends GridResident {
|
|
|
58
58
|
readonly fallFloor: () => FallFloor;
|
|
59
59
|
/** The first seat's. */
|
|
60
60
|
readonly fall: FallFloor;
|
|
61
|
+
/** HS1: a native world's trusted resident, which a tick adapter steps with the lead's own commands. A data cell has none. */
|
|
62
|
+
readonly resident?: TrustedHeadlessResident;
|
|
61
63
|
}
|
|
62
64
|
/** What a host lends a cell it opens. */
|
|
63
65
|
export interface CellWorldOptions {
|
|
64
66
|
readonly saves: SaveStore;
|
|
67
|
+
/** A cell with no road around it (a one-shard page, `WORLD_CROSSING=off`): its fall floor sets a player back on the ground they last
|
|
68
|
+
* stood on instead of a death. It has no edge walls (GC36, J322), so past its edge a player falls to that floor. */
|
|
65
69
|
readonly lone: boolean;
|
|
66
70
|
/** C6: a room holds every solid, since no one list can follow every player. Left out, a native world keeps its solids near its lead. */
|
|
67
71
|
readonly wholeSolids?: boolean;
|
|
@@ -83,14 +87,13 @@ const leadSeat = (host: SimHost): PlayerSim => {
|
|
|
83
87
|
/** A cell's fall recovery, off what its shard declares. */
|
|
84
88
|
/** SS6: the same area the page reads, the manifest's bounds under its `client/plan` rows. An input with no product can't read
|
|
85
89
|
* those rows, so it keeps the manifest's floor alone and no x/z edge, rather than an edge the page may not have. */
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function addLoneWalls(host: SimHost): void { withOwner(host.scope, () => { addEdgeWalls(host.physics, { reuse: true }); }); }
|
|
90
|
+
function fallFloorOf(input: HeadlessRuntimeInput, host: SimHost, lone: boolean): FallFloor {
|
|
91
|
+
if (input.product !== undefined) registerInstalled(host, 'fallFloor'); // SS3: the page's own `player.enter` / `world.runtime-hooks` area
|
|
92
|
+
return new FallFloor(input.product === undefined ? shardFallFloor(input.shard.manifest?.bounds?.floor) : shardPlayArea(input.shard.manifest?.bounds, input.product), lone, host.level.player.at);
|
|
93
|
+
}
|
|
91
94
|
|
|
92
95
|
/** A cell with no native plan: a data shard, which any host can run from its output. */
|
|
93
|
-
async function openDataCell(input: HeadlessRuntimeInput, snapshot: string | SimSnapshot | undefined, effects: HeadlessEffect[]
|
|
96
|
+
async function openDataCell(input: HeadlessRuntimeInput, snapshot: string | SimSnapshot | undefined, effects: HeadlessEffect[]): Promise<Pick<CellWorld, 'host' | 'dispose'> & { readonly sim: () => ShardfileSimulation | undefined; readonly kit: () => DeclaredKitItems | null }> {
|
|
94
97
|
await Promise.resolve();
|
|
95
98
|
const { shard, assets, rapier } = input;
|
|
96
99
|
// A data shard's decisions, moves and targets ride its product sections (TE-ENG1's boss rows): without them the
|
|
@@ -102,12 +105,13 @@ async function openDataCell(input: HeadlessRuntimeInput, snapshot: string | SimS
|
|
|
102
105
|
const kitOf = (sim: ShardfileSimulation): DeclaredKitItems | null => installDeclaredKitItems(sim.host, shard, sim.itemHooks);
|
|
103
106
|
if (snapshot === undefined) {
|
|
104
107
|
const fresh = createShardfileSim(shard, assets, ports), kit = kitOf(fresh);
|
|
105
|
-
|
|
108
|
+
// SS3: a data shard's simulation builds its declared prop solids; a shard with none built has no server half to claim
|
|
109
|
+
if (fresh.colliders.size > 0) registerInstalled(fresh.host, 'collision');
|
|
106
110
|
return { host: fresh.host, sim: () => fresh, kit: () => kit, dispose: () => { fresh.dispose(); } };
|
|
107
111
|
}
|
|
108
112
|
const probe = createShardfileSim(shard, assets, ports), { level } = probe.host; probe.dispose();
|
|
109
113
|
const installed: { value?: ReturnType<typeof bindShardfileSim>; kit?: DeclaredKitItems | null } = {};
|
|
110
|
-
const host = restoreSimHost(level, { rapier }, typeof snapshot === 'string' ? decodeSimSnapshot(snapshot) : snapshot, restored => { installed.value = bindShardfileSim(restored, shard, assets, { ...ports, restoring: true }); installed.kit = kitOf(installed.value); });
|
|
114
|
+
const host = restoreSimHost(level, { rapier }, typeof snapshot === 'string' ? decodeSimSnapshot(snapshot) : snapshot, restored => { installed.value = bindShardfileSim(restored, shard, assets, { ...ports, restoring: true }); installed.kit = kitOf(installed.value); if (installed.value.colliders.size > 0) registerInstalled(restored, 'collision'); });
|
|
111
115
|
return { host, sim: () => installed.value, kit: () => installed.kit ?? null, dispose: () => { (installed.value ?? { dispose: () => { host.dispose(); } }).dispose(); } };
|
|
112
116
|
}
|
|
113
117
|
|
|
@@ -116,6 +120,7 @@ const SEEN_SLACK = 1.5;
|
|
|
116
120
|
/** A named place is the page's to notice, and the server's to check. One the page resolves against a placed object has no world position here, so its word stands: a `seen:` flag draws a map, and pays nothing. */
|
|
117
121
|
function bindDiscovery(host: SimHost, places: readonly { readonly id: string; readonly area: PlaceArea | null }[]): void {
|
|
118
122
|
const areas = new Map(places.map(place => [`seen:${place.id}`, place.area]));
|
|
123
|
+
if (places.length > 0) registerInstalled(host, 'places'); // SS3: the server checks a player's word for each named place
|
|
119
124
|
actRoutes(host).seen = (player, flag) => {
|
|
120
125
|
const area = areas.get(flag), feet = host.players.get(player)?.position;
|
|
121
126
|
if (area === undefined || feet === undefined || (area !== null && Math.hypot(feet.x - area.x, feet.z - area.z) > area.r * SEEN_SLACK)) return;
|
|
@@ -131,7 +136,7 @@ function ownedOf(host: SimHost, input: HeadlessRuntimeInput, stores: OwnedStores
|
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
/** Whether this output runs on the trusted headless owner. */
|
|
134
|
-
const nativeCell = (input: HeadlessRuntimeInput): boolean => input.product !== undefined && (hasNativeAssembly(input.product) || input.product.has('sim/runtime-plan'));
|
|
139
|
+
export const nativeCell = (input: HeadlessRuntimeInput): boolean => input.product !== undefined && (hasNativeAssembly(input.product) || input.product.has('sim/runtime-plan'));
|
|
135
140
|
|
|
136
141
|
/** Open `cell`'s world from `input`, at `snapshot` if there is one. */
|
|
137
142
|
export async function openCellWorld(cell: Pick<GridCell, 'instance'>, input: HeadlessRuntimeInput, snapshot: string | SimSnapshot | undefined, options: CellWorldOptions, refused?: SimSnapshot): Promise<CellWorld> {
|
|
@@ -141,25 +146,25 @@ export async function openCellWorld(cell: Pick<GridCell, 'instance'>, input: Hea
|
|
|
141
146
|
if (nativeCell(input)) {
|
|
142
147
|
// J68: a native assembly keeps its ground whole and its solids as data. A saved world holds none of them, so a throwaway fresh one lists them.
|
|
143
148
|
const near = options.wholeSolids !== true && input.product !== undefined && hasNativeAssembly(input.product) ? new NearColliders() : undefined;
|
|
144
|
-
|
|
145
|
-
const around = { room: true, ...(lone ? {} : { road: true }), ...(near === undefined ? {} : { near }) };
|
|
149
|
+
const around = { room: true, ...(near === undefined ? {} : { near }) };
|
|
146
150
|
if (near !== undefined && snapshot !== undefined) (await bootTask('server:restore-collision-inventory', () => createTrustedHeadlessResident(input, undefined, around))).dispose();
|
|
147
151
|
// A world with no save of its own takes the page's: the flags and records its fights read as they install.
|
|
148
152
|
const seeded = snapshot === undefined && options.pageless !== true;
|
|
149
153
|
const page = seeded ? { flags: [...new Set([...new Set([input.shard.identity.slug, cell.instance])].flatMap(level => pageSavedFlags(level)).concat(refused?.flags ?? []))], state: pageRuntimeState(options.saves, cell.instance) } : undefined;
|
|
150
154
|
const resident = await bootTask(snapshot === undefined ? 'server:simulation-and-collision-create' : 'server:continuation-restore', () => createTrustedHeadlessResident(input, snapshot, page === undefined ? around : { ...around, page })), { host } = resident;
|
|
151
|
-
|
|
152
|
-
|
|
155
|
+
if (snapshot !== undefined) removeChunkEdgeWalls(host.physics); // GC36: a world saved while lone cells had walls
|
|
156
|
+
bindDiscovery(host, input.product === undefined ? [] : await serverDiscoveries(input.product)); await installServerChapters(host, input.product, input.shard, resident.fact); await installServerDoors(host, input.product, seeded ? pageOpenDoors(options.saves, placed) : undefined, snapshot !== undefined);
|
|
153
157
|
host.respawn.served = true; actRoutes(host).introLocks = true;
|
|
154
158
|
const owned = ownedOf(host, input, options.owned, options.profiles), fallFloor = (): FallFloor => fallFloorOf(input, host, lone);
|
|
155
|
-
return { host, owned, fallFloor, fall: fallFloor(), dispose: () => { resident.dispose(); }, fact, effects: () => resident.effects,
|
|
159
|
+
return { host, owned, fallFloor, fall: fallFloor(), resident, dispose: () => { resident.dispose(); }, fact, effects: () => resident.effects,
|
|
156
160
|
adopt: () => { regionalRuntimeCheckpoint(options.saves, placed, input.shard.identity.revision).restore({ animals: [...host.entities.values()] }); return true; }, step: inputs => {
|
|
157
161
|
const player = leadSeat(host);
|
|
158
162
|
near?.update(player.position.x, player.position.z);
|
|
159
163
|
stepResident(resident, player.id, inputs);
|
|
160
164
|
} };
|
|
161
165
|
}
|
|
162
|
-
const effects: HeadlessEffect[] = [], { host, dispose, sim, kit } = await bootTask(snapshot === undefined ? 'server:data-simulation-and-collision' : 'server:data-continuation-restore', () => openDataCell(input, snapshot, effects
|
|
166
|
+
const effects: HeadlessEffect[] = [], { host, dispose, sim, kit } = await bootTask(snapshot === undefined ? 'server:data-simulation-and-collision' : 'server:data-continuation-restore', () => openDataCell(input, snapshot, effects));
|
|
167
|
+
if (snapshot !== undefined) removeChunkEdgeWalls(host.physics); // GC36: a world saved while lone cells had walls
|
|
163
168
|
installRoomRespawn(host, []);
|
|
164
169
|
installDeclaredClimate(host, input.shard.rows);
|
|
165
170
|
bindDiscovery(host, input.product === undefined ? [] : await serverDiscoveries(input.product));
|
|
@@ -179,6 +184,7 @@ export async function openCellWorld(cell: Pick<GridCell, 'instance'>, input: Hea
|
|
|
179
184
|
if (act.kind === 'interact' && act.id.startsWith('seen:') && routes.seen !== null) routes.seen(player, act.id);
|
|
180
185
|
else if (act.kind === 'interact' && act.id.startsWith(STORY_ACT)) routes.story?.(player, act.id.slice(STORY_ACT.length));
|
|
181
186
|
else if (act.kind === 'interact' && act.id === UNSTUCK_ACT && routes.unstuck !== null) routes.unstuck(player);
|
|
187
|
+
else if (act.kind === 'interact' && act.id === RESPAWN_NOW_ACT && routes.respawnNow !== undefined) routes.respawnNow(player);
|
|
182
188
|
else if (claim !== undefined) claim(player);
|
|
183
189
|
else if (act.kind === 'interact' && sim()?.selectedInteraction(player) === act.id) sim()?.interact(act.id, player);
|
|
184
190
|
else if (act.kind !== 'climate' && act.kind !== 'buy' && act.kind !== 'board' && act.kind !== 'wear') routes.refused++;
|
|
@@ -30,8 +30,8 @@ export const RESIDENT_FALL_GRACE = 0.25;
|
|
|
30
30
|
|
|
31
31
|
type Body = Pick<PlayerSim, 'yaw' | 'led' | 'resetPose'> & { readonly position: { x: number; y: number; z: number }; readonly fall: { readonly grounded: boolean }; readonly board: { readonly on: boolean } };
|
|
32
32
|
/** One cell's fall recovery. `soft` takes a player back; a hard floor is a death. `start` is where they go with no safe ground yet.
|
|
33
|
-
* The floor is the area's at the player's x/z. Its x/z edge is not enforced here: a lone cell
|
|
34
|
-
*
|
|
33
|
+
* The floor is the area's at the player's x/z. Its x/z edge is not enforced here: a lone cell has no walls (GC36, J322), so a
|
|
34
|
+
* player who walks off its edge falls below the floor and comes back (`standalone-grid-lone.test.ts`); the page's x/z reset stays the page's. */
|
|
35
35
|
export class FallFloor {
|
|
36
36
|
private since = 0;
|
|
37
37
|
private spot: { x: number; y: number; z: number } | null = null;
|
|
@@ -33,7 +33,7 @@ import { landedBy } from '@wildshard/engine/combat/damageBook';
|
|
|
33
33
|
import type { HeadlessRuntimeInput } from '../headlessRuntime';
|
|
34
34
|
import { actRoutes } from '@wildshard/engine/sim/actRoutes';
|
|
35
35
|
import { openCellWorld, type CellWorld, type CellWorldOptions } from './cellWorld';
|
|
36
|
-
import { addCellWalls, ROAD } from './roadWorld';
|
|
36
|
+
import { addCellWalls, addVoidFloor, renewVoidFloor, ROAD } from './roadWorld';
|
|
37
37
|
import { netBuys, netWorldInput } from '../../../shared/host/standalone/netInput';
|
|
38
38
|
import { cellDocuments, CONTINUATION, ContinuationSlots, SITE, siteDocuments, type SavedContinuation, type SavedSite } from './continuation';
|
|
39
39
|
import { ledgerFilings } from './ledgerFilings';
|
|
@@ -57,7 +57,8 @@ export interface GridServerOptions {
|
|
|
57
57
|
/** A world's tick finished, in how many milliseconds. */
|
|
58
58
|
readonly stepped: (host: SimHost, ms: number) => void;
|
|
59
59
|
readonly now: () => number;
|
|
60
|
-
/** A one-shard page: this cell alone,
|
|
60
|
+
/** A one-shard page: this cell alone, with no crossing out of it, whether the grid places it or not. It has no walls (GC36, J322): past
|
|
61
|
+
* its edge a player falls and is set back on the ground they last stood on. */
|
|
61
62
|
readonly lone?: boolean;
|
|
62
63
|
/** A proof's way in: start on the road at this world point, as no player can, rather than in the home cell. */
|
|
63
64
|
readonly arrival?: Readonly<GridPoint>;
|
|
@@ -132,7 +133,7 @@ export class StandaloneGrid {
|
|
|
132
133
|
if (home === undefined) throw new Error(`Standalone needs a grid cell: ${options.slug}`);
|
|
133
134
|
const { saves, storage, savePrefix } = options, worlds = new Map<string, CellWorld>(), cells = new Map<string, ContinuationSlots<SavedContinuation>>();
|
|
134
135
|
let settle: (held: ContinuationSlots<SavedContinuation>) => void = () => undefined;
|
|
135
|
-
// A lone cell's world
|
|
136
|
+
// A lone cell's world stands alone and a grid cell's has a rim, so neither can restore the other's continuation. Facts and page progress they share.
|
|
136
137
|
const documents = options.lone === true ? (instance: string): readonly [string, string] => cellDocuments(`lone-${instance}`) : cellDocuments;
|
|
137
138
|
const continuation = saves.define(CONTINUATION), sites = new ContinuationSlots(saves.define(SITE), siteDocuments(options.lone === true ? `lone-${home.instance}` : 'grid'), storage, savePrefix);
|
|
138
139
|
const slots = (instance: string): ContinuationSlots<SavedContinuation> => {
|
|
@@ -195,13 +196,15 @@ export class StandaloneGrid {
|
|
|
195
196
|
private static road(rapier: Rapier, cells: readonly GridCell[], strips: readonly GridCollisionStrip[], saved: string | undefined, arrival: Readonly<GridPoint> | undefined, refused: GridServerOptions['refused']): SimHost {
|
|
196
197
|
if (saved !== undefined) {
|
|
197
198
|
try {
|
|
198
|
-
const restored = restoreSimHost(ROAD, { rapier }, decodeSimSnapshot(saved));
|
|
199
|
+
const restored = restoreSimHost(ROAD, { rapier }, decodeSimSnapshot(saved)), player = sessionPlayer(restored);
|
|
200
|
+
if (renewVoidFloor(restored, cells, player.position, ROAD_SKIN)) player.motor.resetAt(player.position);
|
|
199
201
|
holdStrips(restored, strips.map(strip => strip.mesh));
|
|
200
202
|
return restored;
|
|
201
203
|
} catch (error) { refused?.(error); } // a road holds no progress but where the player stood
|
|
202
204
|
}
|
|
203
205
|
const road = createSimHost(ROAD, { rapier }), [x, y, z] = readableSnapshot(saved ?? '')?.players[0]?.position ?? [], stood = arrival ?? (x === undefined || y === undefined || z === undefined ? undefined : { x, y, z });
|
|
204
206
|
addCellWalls(road, cells);
|
|
207
|
+
addVoidFloor(road, cells);
|
|
205
208
|
holdStrips(road, strips.map(strip => strip.mesh));
|
|
206
209
|
const player = sessionPlayer(road);
|
|
207
210
|
if (stood !== undefined) { player.position.set(stood.x, Math.max(stood.y, ROAD_SKIN), stood.z); player.motor.resetAt(player.position); }
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
// The grid's road as a world of its own: the solo grid server's highway (`gridServer.ts`), and since GC15 a dedicated worker's road room
|
|
2
2
|
// (`dedicated/roadRoom.ts`). Its frame is the world's; the ground lies far below the road's strips, which C2's grid pack carries.
|
|
3
|
+
import type { Collider } from '@dimforge/rapier3d-simd';
|
|
3
4
|
import { withOwner } from '@wildshard/engine/app/ownership';
|
|
4
|
-
import { CHUNK_HALF } from '@wildshard/engine/core/config';
|
|
5
|
+
import { CHUNK_HALF, CONTENT_CAPS } from '@wildshard/engine/core/config';
|
|
5
6
|
import { groups } from '@wildshard/engine/physics/groups';
|
|
6
|
-
import { stripCollider } from '@wildshard/engine/physics/stripColliders';
|
|
7
|
+
import { PLATFORM_COLLIDER_OWNER, stripCollider } from '@wildshard/engine/physics/stripColliders';
|
|
8
|
+
import { tagOf } from '@wildshard/engine/physics/surface';
|
|
7
9
|
import type { Rapier } from '@wildshard/engine/physics/rapier';
|
|
8
10
|
import { createSimHost, type SimHost, type SimLevel } from '@wildshard/engine/sim';
|
|
9
11
|
import { SIM_API_VERSION } from '@wildshard/engine/sim/apiVersion';
|
|
10
12
|
import type { GridCell } from '@wildshard/engine/game/grid/assembly';
|
|
11
13
|
import type { GridCollisionStrip } from '@wildshard/engine/game/grid/gridCollision';
|
|
12
14
|
import { HOST_PROBE } from '@wildshard/engine/game/plugin/simulation';
|
|
15
|
+
import { installVoidFloor, voidFloorBoxes } from '@wildshard/engine/game/grid/voidFloor';
|
|
13
16
|
import { FALL_FLOOR } from './fallFloor';
|
|
14
17
|
|
|
15
18
|
/** Ground under the whole grid, far below the road's strips, and a player's pace on them. */
|
|
@@ -33,17 +36,51 @@ export function addCellWalls(road: SimHost, cells: readonly Pick<GridCell, 'orig
|
|
|
33
36
|
world.createCollider(R.ColliderDesc.cuboid(hx, WALL_HEIGHT, hz).setTranslation(origin.x + x, WALL_HEIGHT, origin.z + z).setCollisionGroups(groups('WORLD')));
|
|
34
37
|
});
|
|
35
38
|
}
|
|
39
|
+
/** Each road world's void floor colliders, so a placement can lift them (SA34a). */
|
|
40
|
+
const floors = new WeakMap<SimHost, readonly Collider[]>();
|
|
41
|
+
/** SA34: the 7 × 7's void, walkable: a road-level floor over every empty cell and out to the rail, and the rim on the rail. */
|
|
42
|
+
export function addVoidFloor(road: SimHost, cells: readonly Pick<GridCell, 'cell'>[], rim = true): void {
|
|
43
|
+
withOwner(road.scope, () => { floors.set(road, installVoidFloor(road.physics, cells, CONTENT_CAPS.pitch, rim)); });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* SA34a: a running road is told of cells placed after it opened (SA33). The void floor is laid again for the grown grid, so none lies over a
|
|
47
|
+
* new cell's square; the new strips go in; and a new cell this worker can't hand a seat to gets the walls every other worker's cell has.
|
|
48
|
+
* The rim stays: it stands on the 7 × 7's rail whatever is placed.
|
|
49
|
+
*/
|
|
50
|
+
export function placeOnRoad(road: SimHost, cells: readonly Pick<GridCell, 'cell'>[], strips: readonly GridCollisionStrip[], walled: readonly Pick<GridCell, 'origin'>[]): void {
|
|
51
|
+
const { world } = road.physics;
|
|
52
|
+
for (const collider of floors.get(road) ?? []) world.removeCollider(collider, false);
|
|
53
|
+
addVoidFloor(road, cells, false);
|
|
54
|
+
buildStrips(road, strips.map(strip => strip.mesh));
|
|
55
|
+
addCellWalls(road, walled);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* SA34: a restored road's save holds the void floor and rim the saving build made (strips are held as data and out of every save,
|
|
59
|
+
* `gridServer.ts` `capture`, so each platform collider in it is the void's). Take them out and install this build's, so a restore
|
|
60
|
+
* never stacks a second floor and a save from the one-slab floor gets the tiles. Feet the slab had sunk below road level over the
|
|
61
|
+
* void stand back on it at `skin`.
|
|
62
|
+
*/
|
|
63
|
+
export function renewVoidFloor(road: SimHost, cells: readonly Pick<GridCell, 'cell'>[], feet: { x: number; y: number; z: number }, skin: number): boolean {
|
|
64
|
+
const { world } = road.physics, saved: Parameters<typeof world.removeCollider>[0][] = [];
|
|
65
|
+
world.forEachCollider(collider => { if (tagOf(collider)?.owner === PLATFORM_COLLIDER_OWNER) saved.push(collider); });
|
|
66
|
+
for (const collider of saved) world.removeCollider(collider, false);
|
|
67
|
+
addVoidFloor(road, cells);
|
|
68
|
+
const overVoid = voidFloorBoxes(cells, CONTENT_CAPS.pitch).some(box => Math.abs(feet.x - box.x) <= box.hx && Math.abs(feet.z - box.z) <= box.hz);
|
|
69
|
+
if (!overVoid || feet.y >= skin || feet.y < -1) return false;
|
|
70
|
+
feet.y = skin; return true;
|
|
71
|
+
}
|
|
36
72
|
/** C6: a room's world builds every strip at once, since no one list can follow every player. */
|
|
37
73
|
export function buildStrips(host: SimHost, meshes: readonly GridCollisionStrip['mesh'][]): void {
|
|
38
74
|
withOwner(host.scope, () => { for (const mesh of meshes) stripCollider(host.physics, mesh); });
|
|
39
75
|
}
|
|
40
76
|
/**
|
|
41
|
-
* GC15: a dedicated worker's road, with nobody on it yet: every strip built, and walls only round `walled`, the cells it can't hand a
|
|
77
|
+
* GC15: a dedicated worker's road, with nobody on it yet: every strip built, the void's floor round `placed` (SA34), and walls only round `walled`, the cells it can't hand a
|
|
42
78
|
* seat to (those on another worker: GC7's one line). Its lead seat is the room's to park.
|
|
43
79
|
*/
|
|
44
|
-
export function openRoad(rapier: Rapier, walled: readonly Pick<GridCell, 'origin'>[], strips: readonly GridCollisionStrip[]): SimHost {
|
|
80
|
+
export function openRoad(rapier: Rapier, walled: readonly Pick<GridCell, 'origin'>[], strips: readonly GridCollisionStrip[], placed: readonly Pick<GridCell, 'cell'>[]): SimHost {
|
|
45
81
|
const road = createSimHost(ROAD, { rapier });
|
|
46
82
|
addCellWalls(road, walled);
|
|
83
|
+
addVoidFloor(road, placed);
|
|
47
84
|
buildStrips(road, strips.map(strip => strip.mesh));
|
|
48
85
|
return road;
|
|
49
86
|
}
|
|
@@ -314,3 +314,36 @@ export function defaultBootAudio(data: AudioData): string[] {
|
|
|
314
314
|
const selection = audioSelection(data, () => DEFAULT_SFX_SET), files = selectedBootAudio(selection.files(), new Set(selection.bootFiles(ENGINE_MUSIC_STYLE)));
|
|
315
315
|
return [...files.music, ...files.sfx];
|
|
316
316
|
}
|
|
317
|
+
|
|
318
|
+
// ---- AU18 (J304): the engine music a level names, and the files the cook derives from those names ----
|
|
319
|
+
|
|
320
|
+
type LevelMusic = NonNullable<AudioData['music']>;
|
|
321
|
+
/** The engine style's slots and stings a level's audio rows name. Slots: `title` when it boots one or plays a score set
|
|
322
|
+
* (whose `setCatalogue.inventory`, `title` or `base`, plays the engine title), and each score slot whose set is `base`
|
|
323
|
+
* (unset means `base`), as shard-format's `engineMusicSlots` reads them (a bank-mode score decodes its boot slots from
|
|
324
|
+
* the engine style; every shard today sets those `base`). Stings: each of `catalogue.extraStings` with no `stingSets`
|
|
325
|
+
* row, when the score's stings come from the engine (`SetScore.sting`: bank mode, or a base slot set `base`). */
|
|
326
|
+
export function engineMusicNames(music: LevelMusic): { slots: string[]; stings: StemSting[] } {
|
|
327
|
+
const base = music.setCatalogue === undefined ? music.slots.filter(slot => (music.sets[slot] ?? 'base') === 'base') : [];
|
|
328
|
+
const title = music.bootSlots.includes('title') || music.setCatalogue !== undefined ? ['title'] : [];
|
|
329
|
+
const catalogue = music.catalogue, engineStings = catalogue !== undefined && (catalogue.mode === 'bank' || (music.sets[music.base] ?? 'base') === 'base');
|
|
330
|
+
const stings = engineStings ? catalogue.extraStings.filter(sting => catalogue.stingSets[sting] === undefined) : [];
|
|
331
|
+
return { slots: [...new Set([...title, ...base])], stings: [...new Set(stings)] };
|
|
332
|
+
}
|
|
333
|
+
/** The names `engineMusicNames` reads that this build's engine style lacks, or ships without one of their files (a slot's
|
|
334
|
+
* calm, tension or layer stem, as the client drops the whole slot to the synth): `slot harbor`, `sting dawn`. Empty when
|
|
335
|
+
* every name resolves. The selection would drop them silently through `shipped`. */
|
|
336
|
+
export function missingEngineMusic(music: LevelMusic): string[] {
|
|
337
|
+
const manifest = musicManifest(ENGINE_MUSIC_STYLE), dir = musicDir(ENGINE_MUSIC_STYLE), { slots, stings } = engineMusicNames(music);
|
|
338
|
+
const has = (files: readonly string[]): boolean => files.every(file => shipped(`${dir}${file}`));
|
|
339
|
+
return [...slots.filter(slot => { const spec = manifest?.slots[slot]; return spec === undefined || !has([spec.calm, ...(spec.tension === undefined ? [] : [spec.tension]), ...spec.layers]); }).map(slot => `slot ${slot}`),
|
|
340
|
+
...stings.filter(sting => { const file = manifest?.stings[sting]; return file === undefined || !has([file]); }).map(sting => `sting ${sting}`)];
|
|
341
|
+
}
|
|
342
|
+
/** AU18: the engine music a level's DOWNLOAD carries, derived from its names: the files of its default boot set
|
|
343
|
+
* (`defaultBootAudio`) under the engine style. Throws, naming each, when the rows name engine music this build lacks. */
|
|
344
|
+
export function engineMusicFiles(data: AudioData): string[] {
|
|
345
|
+
if (data.music === undefined) return [];
|
|
346
|
+
const missing = missingEngineMusic(data.music);
|
|
347
|
+
if (missing.length > 0) throw new Error(`its audio rows name engine music the ${ENGINE_MUSIC_STYLE} style lacks: ${missing.join(', ')}`);
|
|
348
|
+
return data.samples === undefined ? [] : defaultBootAudio(data).filter(url => url.startsWith(musicDir(ENGINE_MUSIC_STYLE)));
|
|
349
|
+
}
|
|
@@ -105,10 +105,10 @@ export interface LevelSpec {
|
|
|
105
105
|
species: readonly string[]; spawns: readonly HerdPlan[]; spawnTables?: readonly string[];
|
|
106
106
|
faunaTuning?: Partial<Record<string, Partial<HuntTuning>>>;
|
|
107
107
|
/**
|
|
108
|
-
* Edge dressing
|
|
109
|
-
*
|
|
108
|
+
* Edge dressing. `visible` hides the drawing only. No level has chunk-edge walls (GRID-CROSSING GC36, J322): past its edge a
|
|
109
|
+
* one-shard page falls to its fall floor, and a grid cell opens onto the road.
|
|
110
110
|
*/
|
|
111
|
-
boundary?: { visible?: boolean
|
|
111
|
+
boundary?: { visible?: boolean };
|
|
112
112
|
trees?: TreeSpec; forest?: ForestSpec; horizon?: HorizonSpec; horizonStrips?: HorizonStrips;
|
|
113
113
|
minimap: MinimapSpec; hud?: HudSpec; pois?: readonly PoiSpec[];
|
|
114
114
|
groundColor?: (x: number, z: number, h: number, slope: number, terrain: TerrainField, out: RGB) => RGB;
|
|
@@ -15,6 +15,9 @@ export interface NetChatReport { readonly kind: 'report'; readonly seq: number;
|
|
|
15
15
|
export const STORY_ACT = 'story:';
|
|
16
16
|
/** The `interact` a page's DEV tab Unstuck sends (Jake, 2026-11-12): the server puts its player back where a fall would, with no fall. */
|
|
17
17
|
export const UNSTUCK_ACT = 'unstuck';
|
|
18
|
+
/** The `interact` the death card's Respawn now sends (QA 11-13, Jake: "It needs a button, a Respawn now button"): the server
|
|
19
|
+
* has already placed its fallen player, and ends that player's fade so their commands move them again. */
|
|
20
|
+
export const RESPAWN_NOW_ACT = 'respawn-now';
|
|
18
21
|
export interface NetClimateAct { readonly kind: 'climate'; readonly seq: number; readonly op: typeof CLIMATE_OPS[number]; readonly name: string; readonly at: number }
|
|
19
22
|
/** Buy one of the shard's goods, by its place in the shard's exchange. The server checks it and takes the price. */
|
|
20
23
|
export interface NetBuyAct { readonly kind: 'buy'; readonly seq: number; readonly good: number }
|
|
@@ -8,6 +8,8 @@ import type { Ball, Collider, Ray } from '@dimforge/rapier3d-simd';
|
|
|
8
8
|
import type { Physics } from './Physics';
|
|
9
9
|
import { GROUP, queryGroups, type GroupName } from './groups';
|
|
10
10
|
import { tagOf, type Material } from './surface';
|
|
11
|
+
import { PLATFORM_COLLIDER_OWNER } from './stripColliders';
|
|
12
|
+
import { CHUNK_HALF } from '../core/config';
|
|
11
13
|
|
|
12
14
|
interface Vec3 { x: number; y: number; z: number }
|
|
13
15
|
|
|
@@ -159,3 +161,28 @@ export function hasStaticGround(physics: Physics): boolean {
|
|
|
159
161
|
});
|
|
160
162
|
return found;
|
|
161
163
|
}
|
|
164
|
+
|
|
165
|
+
/** GC30: the middle of each cell edge, 1 m in (a cell's own frame), where every platform edge has its 8 m entryway. */
|
|
166
|
+
export const CELL_ENTRYWAYS: readonly (readonly [number, number])[] = [[0, CHUNK_HALF - 1], [0, 1 - CHUNK_HALF], [CHUNK_HALF - 1, 0], [1 - CHUNK_HALF, 0]];
|
|
167
|
+
/**
|
|
168
|
+
* GC30: whether a cell's world has its own ground within `reach` of road height (y 0) at all four entryways, so a walker coming off the
|
|
169
|
+
* road stands. Asked of each collider, not the broad phase: a world that has never stepped has an empty one. The road's strips copied
|
|
170
|
+
* into the cell (its seams) don't count. Far Reach's sky islands have none, and a walker set down there fell out of the world.
|
|
171
|
+
*/
|
|
172
|
+
export function entrywaysStand(physics: Physics, reach = 8): boolean {
|
|
173
|
+
const stands = entrywayProbe(physics, reach);
|
|
174
|
+
return CELL_ENTRYWAYS.every(([x, z]) => stands(x, z));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* GC30b: the same probe at the one entryway on the side nearest `x`, `z` (a cell's own frame): whether a walker crossing in there
|
|
178
|
+
* from the road stands. Held solids (`NearColliders`) must be up around that entryway first.
|
|
179
|
+
*/
|
|
180
|
+
export function entrywayStands(physics: Physics, x: number, z: number, reach = 8): boolean {
|
|
181
|
+
const side = Math.abs(x) > Math.abs(z) ? (x > 0 ? 2 : 3) : (z > 0 ? 0 : 1), [ex, ez] = CELL_ENTRYWAYS[side] ?? [0, 0];
|
|
182
|
+
return entrywayProbe(physics, reach)(ex, ez);
|
|
183
|
+
}
|
|
184
|
+
function entrywayProbe(physics: Physics, reach: number): (x: number, z: number) => boolean {
|
|
185
|
+
const ray = new physics.R.Ray({ x: 0, y: reach, z: 0 }, { x: 0, y: -1, z: 0 }), world: Collider[] = [];
|
|
186
|
+
physics.world.forEachCollider(collider => { if (!collider.isSensor() && ((collider.collisionGroups() >>> 16) & GROUP.WORLD) !== 0 && tagOf(collider)?.owner !== PLATFORM_COLLIDER_OWNER) world.push(collider); });
|
|
187
|
+
return (x, z) => { ray.origin = { x, y: reach, z }; return world.some(collider => collider.castRay(ray, reach * 2, true) >= 0); };
|
|
188
|
+
}
|
|
@@ -29,9 +29,6 @@ export function toColumnMajor(grid: Float32Array, res: number): Float32Array {
|
|
|
29
29
|
return out;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** Inner faces of the edge walls sit here; with the player's 0.4 m capsule the centre stops 1.2 m inside the chunk. */
|
|
33
|
-
export const EDGE_WALL_INSET = 0.8;
|
|
34
|
-
|
|
35
32
|
interface Ground { collider: Collider; grid: Float32Array; res: number; size: number; declared?: true }
|
|
36
33
|
const grounds = new WeakMap<Physics, Ground>();
|
|
37
34
|
|
|
@@ -126,30 +123,24 @@ export function cutTerrain(physics: Physics, cuts: readonly TerrainCut[]): numbe
|
|
|
126
123
|
return changed;
|
|
127
124
|
}
|
|
128
125
|
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return found;
|
|
147
|
-
};
|
|
148
|
-
return walls.map(([x, z, hx, hz]) => {
|
|
149
|
-
const old = held(x, z, hx, hz);
|
|
150
|
-
if (old !== undefined) { if (tagOf(old) === undefined) tagCollider(old, 'edge'); return old; }
|
|
151
|
-
const c = world.createCollider(R.ColliderDesc.cuboid(hx, hy, hz).setTranslation(x, cy, z).setCollisionGroups(groups('WORLD')));
|
|
152
|
-
tagCollider(c, 'edge');
|
|
153
|
-
return c;
|
|
126
|
+
/** GRID-CROSSING GC36 (J322, no walls): whether a box is one of the four chunk-edge walls a page used to stand inside (the retired
|
|
127
|
+
* `addEdgeWalls`: 1 m thick, inner face 0.8 m inside the edge, y -60 to 400, unrotated at the cell's own origin). An older bake or
|
|
128
|
+
* a saved world still holds them, some with no material (Nalati's bake), so they are known by their shape. */
|
|
129
|
+
export function isChunkEdgeWall(at: readonly [number, number, number], half: readonly [number, number, number], w: number): boolean {
|
|
130
|
+
const near = (a: number, b: number): boolean => Math.abs(a - b) < 1e-2, reach = CHUNK_HALF - 0.8 + 1, span = CHUNK_HALF + 2;
|
|
131
|
+
if (!near(Math.abs(w), 1) || !near(at[1], 170) || !near(half[1], 230)) return false;
|
|
132
|
+
return near(Math.abs(at[0]), reach) && near(at[2], 0) && near(half[0], 1) && near(half[2], span)
|
|
133
|
+
|| near(Math.abs(at[2]), reach) && near(at[0], 0) && near(half[2], 1) && near(half[0], span);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** GC36: take out the chunk-edge walls a restored world brought back from a save made while lone cells had them. Returns how many. */
|
|
137
|
+
export function removeChunkEdgeWalls(physics: Physics): number {
|
|
138
|
+
const { R, world } = physics, walls: Collider[] = [];
|
|
139
|
+
world.forEachCollider(c => {
|
|
140
|
+
const material = tagOf(c)?.material, h = c.halfExtents(), at = c.translation();
|
|
141
|
+
if ((material !== undefined && material !== 'edge') || c.isSensor() || c.shapeType() !== R.ShapeType.Cuboid || c.parent()?.isDynamic() === true || h === null) return;
|
|
142
|
+
if (isChunkEdgeWall([at.x, at.y, at.z], [h.x, h.y, h.z], c.rotation().w)) walls.push(c);
|
|
154
143
|
});
|
|
144
|
+
for (const wall of walls) world.removeCollider(wall, false);
|
|
145
|
+
return walls.length;
|
|
155
146
|
}
|
|
@@ -423,6 +423,11 @@
|
|
|
423
423
|
"shape": "e3b0c44298fc1c14",
|
|
424
424
|
"migrations": []
|
|
425
425
|
},
|
|
426
|
+
"json:device/'drop.seen'": {
|
|
427
|
+
"version": 1,
|
|
428
|
+
"shape": "e3b0c44298fc1c14",
|
|
429
|
+
"migrations": []
|
|
430
|
+
},
|
|
426
431
|
"json:device/'drop.step.once'": {
|
|
427
432
|
"version": 1,
|
|
428
433
|
"shape": "e3b0c44298fc1c14",
|
|
@@ -468,6 +473,16 @@
|
|
|
468
473
|
"shape": "e3b0c44298fc1c14",
|
|
469
474
|
"migrations": []
|
|
470
475
|
},
|
|
476
|
+
"json:device/'release.kept'": {
|
|
477
|
+
"version": 1,
|
|
478
|
+
"shape": "e3b0c44298fc1c14",
|
|
479
|
+
"migrations": []
|
|
480
|
+
},
|
|
481
|
+
"json:device/'screen.reports'": {
|
|
482
|
+
"version": 1,
|
|
483
|
+
"shape": "e3b0c44298fc1c14",
|
|
484
|
+
"migrations": []
|
|
485
|
+
},
|
|
471
486
|
"json:device/'storage.persisted'": {
|
|
472
487
|
"version": 1,
|
|
473
488
|
"shape": "e3b0c44298fc1c14",
|
|
@@ -40,6 +40,8 @@ export interface ActRoutes {
|
|
|
40
40
|
wear: ((player: string, id: string) => void) | null;
|
|
41
41
|
/** A player's Unstuck (UNSTUCK_ACT): back to their last place or the spawn, as a fall would put them, with no fall. */
|
|
42
42
|
unstuck: ((player: string) => void) | null;
|
|
43
|
+
/** A fallen player's Respawn now (RESPAWN_NOW_ACT): their fade ends at once. Absent where no room respawn is installed. */
|
|
44
|
+
respawnNow?: (player: string) => void;
|
|
43
45
|
/** A boss's intro holds whoever stands in its arena. Only a page's session asks: a tape's steps run on through one. */
|
|
44
46
|
introLocks?: boolean;
|
|
45
47
|
/** A Developer asked that a fight's blows not land: a lair's script sees it, as a page's did. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The keepsakes' law, shared by the page (compendium/keepsakes.ts) and the room (server/game/loot/keepsakeProgression.ts,
|
|
2
|
+
* SERVER-PARITY SS3b): how many of the economy's progression flags a player holds picks one admitted state, and that state
|
|
3
|
+
* names everything earned so far (Driftwood's sea glass charms). And whose book a taken pickup lands in (HS4). */
|
|
4
|
+
import { isCosmetic, type CosmeticId, type Owned, type OwnedId } from '../loot/Owned';
|
|
5
|
+
|
|
6
|
+
/** The admitted state for a player who holds `has`'s flags. A table with no state for that count is refused. */
|
|
7
|
+
export function progressionState<S>(progression: { readonly flags: readonly string[]; readonly states: readonly S[] }, has: (flag: string) => boolean): S {
|
|
8
|
+
const state = progression.states[progression.flags.filter(has).length];
|
|
9
|
+
if (state === undefined) throw new Error('Missing admitted reward state');
|
|
10
|
+
return state;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** What a page reads and asks of the room it plays in: whether the server's book has a cosmetic on, and a wear act to flip it. */
|
|
14
|
+
export interface KeepsakeRoom { readonly worn: (id: CosmeticId) => boolean; readonly wear: (id: CosmeticId) => void }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A keepsake pickup the player took (Driftwood's trophies and the captain's hat). Off a room the page owns the book: it grants
|
|
18
|
+
* the item and puts on what its drop wears. In a room the server granted it at the kill (personal loot, a filed item) and keeps
|
|
19
|
+
* what is worn (SERVER-PARITY HS4), so the page grants nothing and asks the room to put a worn drop on, unless its book already has.
|
|
20
|
+
*/
|
|
21
|
+
export function takeKeepsake(owned: Owned, id: OwnedId, wear: boolean, room: KeepsakeRoom | null): void {
|
|
22
|
+
if (room === null) { owned.grant(id); if (wear && isCosmetic(id)) owned.wear(id); return; }
|
|
23
|
+
if (wear && isCosmetic(id) && !room.worn(id)) room.wear(id);
|
|
24
|
+
}
|
|
@@ -4,7 +4,14 @@ import { GRID_RADIUS, GRID_CELL_COUNT } from '@wildshard/format/contentBounds';
|
|
|
4
4
|
import { AccentSchema } from '@wildshard/format/accent';
|
|
5
5
|
|
|
6
6
|
const id = v.pipe(v.string(), v.regex(/^_?[a-z0-9]+(?:-[a-z0-9]+)*$/u));
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The grid radius the engine places and draws: the format's 7 × 7 (shard-format v0.4.7 `GRID_RADIUS` 3, SA29). SA34 drew it:
|
|
9
|
+
* the sightline, the far ring's reach and the road sky's dome are sized from it (`farProxy.ts`), the rail stands on its outer
|
|
10
|
+
* shoulder and every empty cell is walkable void floor (`voidFloor.ts`). J305's 25 keep their cells; ring 3 starts empty.
|
|
11
|
+
*/
|
|
12
|
+
export const DRAWN_GRID_RADIUS: number = GRID_RADIUS;
|
|
13
|
+
if (DRAWN_GRID_RADIUS > GRID_RADIUS) throw new RangeError('DRAWN_GRID_RADIUS exceeds the format grid');
|
|
14
|
+
const signed = v.pipe(v.number(), v.integer(), v.minValue(-DRAWN_GRID_RADIUS), v.maxValue(DRAWN_GRID_RADIUS));
|
|
8
15
|
const local = v.pipe(v.number(), v.finite(), v.minValue(-250), v.maxValue(250));
|
|
9
16
|
/** one number panel: a cell-local spot (metres, x east, y up, z north) on the copy's own structures, facing `yaw` (0 = +z) */
|
|
10
17
|
const mark = v.strictObject({ x: local, y: v.pipe(v.number(), v.finite(), v.minValue(0), v.maxValue(250)), z: local, yaw: v.pipe(v.number(), v.finite()), size: v.pipe(v.number(), v.minValue(0.5), v.maxValue(12)) });
|
|
@@ -30,10 +37,10 @@ export const GridCatalogueSchema: v.GenericSchema<BoundedGridCatalogueInput, Bou
|
|
|
30
37
|
fog: v.pipe(v.strictObject({ colour, near: distance, far: distance }), v.check((row) => row.far > row.near, 'increasing fog distance')) }),
|
|
31
38
|
}), v.check((rows) => {
|
|
32
39
|
const valid = (entries: readonly { instance: string; cell: readonly [number, number] }[]): boolean => new Set(entries.map((row) => row.instance)).size === entries.length && new Set(entries.map((row) => row.cell.join(','))).size === entries.length;
|
|
33
|
-
// One
|
|
34
|
-
|
|
35
|
-
return valid(
|
|
36
|
-
}, 'unique stable instance identities and
|
|
40
|
+
// One layout for every audience (G972). shard-format v0.4.7 (SA29) made GRID_CELL_COUNT the 7 × 7's 49 as a maximum
|
|
41
|
+
// and lets any cell stay empty, so J305's 25 still reads; `maxLength` above and `signed` cap the count.
|
|
42
|
+
return valid(rows.cells);
|
|
43
|
+
}, 'unique stable instance identities and cells'));
|
|
37
44
|
/** Admitted assembly input; a cell remains a mutable placement attribute, never a save namespace. */
|
|
38
45
|
export type GridCatalogue = v.InferOutput<typeof GridCatalogueSchema>;
|
|
39
46
|
/** A copy's declared identity: its accent and its number panels (copyIdentity.ts). */
|
|
@@ -51,3 +51,14 @@ export function titleStatus(row: {readonly slug: string; readonly status?: strin
|
|
|
51
51
|
export function playerHidden(row: {readonly slug: string; readonly status?: string}): boolean {
|
|
52
52
|
return titleStatus(row) === 'hidden' || (row.slug.startsWith('_') && placedStatus(row) === undefined);
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* SA34 (J314, grill Q12): an auto-placed shard gets no Shard Select card; you cross in from a neighbour. Auto-placed means the
|
|
56
|
+
* installed catalogue's grid places the slug and its `placements` (the title's rows) don't name it: api-server's first-upload
|
|
57
|
+
* placement (SA30, `grid-autoplace.ts`) writes only a `grid.cells` row, never a placement, while every carded shard (J305's
|
|
58
|
+
* grid shards and the off-grid ones) has a placement row. A page with no installed catalogue has nothing auto-placed.
|
|
59
|
+
*/
|
|
60
|
+
export function autoPlaced(row: {readonly slug: string}): boolean {
|
|
61
|
+
const catalogue = installedCatalogue();
|
|
62
|
+
if (catalogue === undefined || catalogue.placements.some(placed => bareSlug(placed.slug) === bareSlug(row.slug))) return false;
|
|
63
|
+
return catalogue.grid.cells.some(cell => bareSlug(cell.slug) === bareSlug(row.slug));
|
|
64
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The far view (SHARD-PLATFORM SF23): one baked low-poly proxy per shard, drawn in the render rings' bounded far ring
|
|
3
3
|
* (`RenderRings`, at most `CONTENT_CAPS.farCount` proxies, charged through the one `ResidencyAllocator` as category `far`).
|
|
4
|
-
* The
|
|
4
|
+
* The drawn 7 × 7 grid's longest sightline is ≈ 5.6 km (`GRID_SIGHTLINE`, from `DRAWN_GRID_RADIUS`, SA34); every cell keeps
|
|
5
|
+
* its proxy across it (SF88c).
|
|
5
6
|
*
|
|
6
7
|
* A proxy is the shard's baked terrain (its `terrain.bin` heights and splat) resampled onto 4 × 4 regions, one per L1
|
|
7
8
|
* footprint (125 m), each a 12 × 12 quad lattice with skirts on all four sides, plus a water sheet where the ground dips
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
*/
|
|
16
17
|
import { Color } from 'three';
|
|
17
18
|
import { CHUNK_HALF, CONTENT_CAPS } from '@wildshard/engine/core/config';
|
|
18
|
-
import {
|
|
19
|
+
import { DRAWN_GRID_RADIUS } from './catalogue';
|
|
19
20
|
|
|
20
21
|
/** Linear RGB, 0..1. */
|
|
21
22
|
export type FarRgb = readonly [number, number, number];
|
|
@@ -97,11 +98,11 @@ export const FAR_SKIRT = 8;
|
|
|
97
98
|
* Nalati's snow-ring berm) reads as a solid cliff down past road level from a neighbour, never as ground over a void.
|
|
98
99
|
*/
|
|
99
100
|
export const FAR_EDGE_FLOOR = -20;
|
|
100
|
-
/** SF88c (G526): the platform's corner-to-corner sightline across its outer road (the
|
|
101
|
-
export const GRID_SIGHTLINE: number = 2 * (
|
|
101
|
+
/** SF88c (G526): the platform's corner-to-corner sightline across its outer road (`DRAWN_GRID_RADIUS`, the 7 × 7: ≈ 5.6 km). */
|
|
102
|
+
export const GRID_SIGHTLINE: number = 2 * (DRAWN_GRID_RADIUS + 0.5) * CONTENT_CAPS.pitch * Math.SQRT2;
|
|
102
103
|
/**
|
|
103
104
|
* The far ring (SF23 owns its parameters; SF18b's `RenderRings` owns the scheduler). SF88c: the ring wants a proxy for
|
|
104
|
-
* every cell within `reach` (the grid's whole sightline, so no cell of the
|
|
105
|
+
* every cell within `reach` (the grid's whole sightline, so no cell of the 7 × 7 pops in or out while you drive the
|
|
105
106
|
* outer road), nearest first while the proxies' own bytes fit `count` charges of `CONTENT_CAPS.far.resident` (14.4 MB;
|
|
106
107
|
* a baked proxy is ≈ 0.48–0.71 MB, so every cell fits). `viewDistance` (1.5 pitches) is still what the loader waits for.
|
|
107
108
|
* `drawDistance` is the grid camera's far plane (G607, Jake's round-36 D: 6 km, every cell drawn near and unhazed) and
|
|
@@ -28,5 +28,5 @@ export function gridPage(): boolean { return mode === 'grid'; }
|
|
|
28
28
|
/** Grid-owned walls and horizon yield to the platform; standalone keeps the original spec identity. */
|
|
29
29
|
export function gridLevel(spec: LevelSpec): LevelSpec {
|
|
30
30
|
if (currentPageMode() !== 'grid') return spec;
|
|
31
|
-
return { ...spec, boundary: { ...spec.boundary, visible: false
|
|
31
|
+
return { ...spec, boundary: { ...spec.boundary, visible: false }, ...(spec.horizon === undefined ? {} : { horizon: { rings: [], cloudSea: false } }) };
|
|
32
32
|
}
|