@wildshard/engine 0.1.15 → 0.1.18
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 +23 -0
- package/index.html +157 -11
- package/lint/engine-sides.json +23 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/host-register.json +496 -0
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +2 -2
- package/lint/shard-imports.d.mts +1 -0
- package/lint/shard-imports.mjs +60 -13
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +44 -27
- package/package.json +24 -6
- 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/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +31 -0
- package/scripts/app-build/serviceWorker.ts +16 -2
- package/scripts/app-build/versionFiles.ts +2 -1
- package/scripts/app-build-pipeline.mjs +7 -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/check-devserver.mjs +1 -1
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/cook.mjs +7 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +7 -0
- package/scripts/devserver-client.mjs +85 -0
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -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 +30 -11
- 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/memory-proof.mjs +158 -0
- package/scripts/mmo-bots.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -2
- package/scripts/offline-proof-rules.mjs +43 -6
- package/scripts/offline-proof.mjs +15 -6
- 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/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +60 -0
- package/scripts/tracked-public.d.mts +1 -0
- package/scripts/tracked-public.mjs +17 -0
- package/scripts/tsconfig.json +1 -0
- package/scripts/vps/wildshard-config +79 -23
- package/scripts/worker-client-play.mjs +1 -0
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -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 +96 -13
- 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/parsedPages.ts +127 -58
- package/src/client/engine/boot/shardPrefetch.ts +7 -1
- package/src/client/engine/boot/sw.ts +19 -0
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +29 -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 +5 -3
- package/src/client/engine/core/ktx2.ts +84 -11
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/explore/Compare.ts +2 -2
- package/src/client/engine/explore/TouchFly.ts +3 -5
- package/src/client/engine/fx/LightPool.ts +41 -1
- 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 +59 -11
- package/src/client/engine/render/drawCheck.ts +96 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/staleBuildNote.ts +46 -0
- package/src/client/engine/telemetry/browserErrors.ts +161 -21
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- 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 -396
- package/src/client/game/boot/bytes.generated.ts +42 -71
- package/src/client/game/boot/versions.generated.ts +0 -13
- package/src/client/game/compendium/keepsakes.ts +16 -6
- package/src/client/game/grapple/tool.ts +10 -7
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +23 -12
- package/src/client/game/grid/cellScreens.ts +39 -74
- package/src/client/game/grid/live.ts +28 -2
- package/src/client/game/grid/liveSession.ts +54 -10
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
- package/src/client/game/grid/nearPlaceholderView.ts +9 -3
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- 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/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +131 -0
- package/src/client/game/grid/plotAudio.ts +114 -0
- package/src/client/game/grid/products.ts +55 -5
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/roadLookPlatform.ts +2 -2
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/session.ts +47 -22
- package/src/client/game/grid/shardfileFar.ts +9 -3
- 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 +22 -4
- package/src/client/game/session/play.ts +8 -2
- package/src/client/game/session/session.ts +4 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/clientWorker.ts +43 -13
- 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 +56 -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 +62 -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/cook/game/shardCook.ts +38 -8
- package/src/cook/game/tierTextures.ts +276 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- 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 +56 -0
- package/src/server/host/dedicated/releaseFile.ts +17 -10
- package/src/server/host/dedicated/roadRoom.ts +21 -5
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +13 -1
- package/src/server/host/dedicated/world.ts +111 -10
- 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/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- 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 +18 -0
- package/src/shared/game/grid/farProxy.ts +6 -5
- package/src/shared/game/grid/pageMode.ts +1 -1
- package/src/shared/game/grid/placementRows.ts +33 -0
- 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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PINE-FLASH (opus-pineflash, 2026-11-13): control never arrives over the entered cell's coarse far proxy.
|
|
3
|
+
*
|
|
4
|
+
* Pine's runtime draws its pines, grass and road, but its ground is the cell's own L1 / L0 ring tiles (D189). Since engine
|
|
5
|
+
* 93e50340 the entered cell admits them, but only once the grid's background opens (T10: 3 s of play after control), so the
|
|
6
|
+
* first seconds of control showed the far proxy's tan canyon walls around the spawn (opus-rel16's GC spawn shots, v0.1.16).
|
|
7
|
+
*
|
|
8
|
+
* The loader's `spawnDetail` step now holds for that ground: the cell's tile views are admitted at once, every L1 quadrant
|
|
9
|
+
* (the far proxy hides region by region as each uploads) and the spawn's L0 ring are pinned, and the step ends when they
|
|
10
|
+
* are published or after `SPAWN_GROUND_LIMIT_MS`, so a slow tile never hangs the load (the rings keep masking the proxy as
|
|
11
|
+
* the rest arrives in play). A cell whose runtime draws its own ground (Nalati's `cellGround: 'world'`, a runtime holding the
|
|
12
|
+
* tile registration) or a page with no runtime-drawn cell holds nothing: today's path. Driftwood's ground is its ring tiles
|
|
13
|
+
* too (its hill showed the proxy's smooth mound, no stairs, at control), so it holds as well: 0.4 s headless, Pine 0.6 s.
|
|
14
|
+
*/
|
|
15
|
+
import type { TileRequirement } from '@wildshard/engine/world/tileStreamer';
|
|
16
|
+
|
|
17
|
+
/** The hold's ceiling (ms). Pine's whole wait measured 0.6 s in a headless preview; past this the loader goes on and the rings finish
|
|
18
|
+
* the ground in play, as they did before the hold. */
|
|
19
|
+
export const SPAWN_GROUND_LIMIT_MS = 8000;
|
|
20
|
+
/** The far proxy's 4 x 4 L1 quadrants (`z * 4 + x`), each hiding one far region when it uploads. */
|
|
21
|
+
export const L1_QUADRANTS: readonly number[] = Array.from({ length: 16 }, (_, key) => key);
|
|
22
|
+
|
|
23
|
+
/** How the hold ended: nothing to hold, ground published, the ceiling, or an admission that failed (the proxy stays). */
|
|
24
|
+
export type SpawnGround = 'none' | 'ready' | 'timeout' | 'failed';
|
|
25
|
+
|
|
26
|
+
/** The entered cell to hold for: drawn by its regional runtime, whose ground is its ring tiles. Null: nothing to hold. */
|
|
27
|
+
export function spawnGroundCell(drawn: string | null, registered: boolean, ownGround: boolean): string | null {
|
|
28
|
+
return drawn !== null && !registered && !ownGround ? drawn : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** What one hold needs from the grid session. */
|
|
32
|
+
export interface SpawnGroundPorts {
|
|
33
|
+
readonly instance: string;
|
|
34
|
+
/** offer the cell's tile views to the rings (false: its inputs are deferred, so no tile can come) */
|
|
35
|
+
readonly admit: () => Promise<boolean>;
|
|
36
|
+
/** pin tiles on the page's one streamer (`TileStreamer.require`) */
|
|
37
|
+
readonly require: (instance: string, keys: Iterable<number>, level: 'l1') => TileRequirement;
|
|
38
|
+
/** pin the spawn's L0 ring until `release` (the registration's `prepareOffered`), if the page has one */
|
|
39
|
+
readonly spawn?: () => Promise<void>;
|
|
40
|
+
/** step the rings while `entry` waits and no page frame steps them (`stepRingsUntil`) */
|
|
41
|
+
readonly pump: (entry: Promise<unknown>) => Promise<unknown>;
|
|
42
|
+
/** resolve after `ms` on the page's scope */
|
|
43
|
+
readonly after: (ms: number) => Promise<void>;
|
|
44
|
+
readonly limitMs?: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Hold until the entered cell's ground covers its far proxy and its spawn ring is published, or the ceiling. The caller
|
|
48
|
+
* releases what the hold pinned (its scope) once this settles. */
|
|
49
|
+
export async function holdSpawnGround(ports: SpawnGroundPorts, held: (requirement: TileRequirement) => void): Promise<SpawnGround> {
|
|
50
|
+
let over = false;
|
|
51
|
+
const ground = (async (): Promise<SpawnGround> => {
|
|
52
|
+
try {
|
|
53
|
+
if (!await ports.admit()) return 'none';
|
|
54
|
+
if (over) return 'timeout'; // admitted after the ceiling: the caller has released its pins, so pin nothing new
|
|
55
|
+
const coarse = ports.require(ports.instance, L1_QUADRANTS, 'l1'); held(coarse);
|
|
56
|
+
await Promise.all([coarse.ready, ports.spawn?.()]);
|
|
57
|
+
return 'ready';
|
|
58
|
+
} catch (error: unknown) {
|
|
59
|
+
// past the ceiling the caller's release rejects the pins: that is the hold ending, not a failure
|
|
60
|
+
if (!over) console.warn(`[grid] ${ports.instance} spawn ground not held`, error);
|
|
61
|
+
return 'failed';
|
|
62
|
+
}
|
|
63
|
+
})();
|
|
64
|
+
const ceiling = (async (): Promise<SpawnGround> => { await ports.after(ports.limitMs ?? SPAWN_GROUND_LIMIT_MS); return 'timeout'; })();
|
|
65
|
+
const ended = Promise.race([ground, ceiling]);
|
|
66
|
+
void ports.pump(ended);
|
|
67
|
+
try { return await ended; } finally { over = true; }
|
|
68
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The VR void past the outer road (SHARD-PLATFORM SF17b look, G77 / G89 "A: Tron grid + rail"): a black unlit floor with
|
|
3
|
-
* cyan grid lines to the horizon, starting
|
|
4
|
-
*
|
|
5
|
-
* the rail
|
|
3
|
+
* cyan grid lines to the horizon, starting on the outer road's shoulder, and the thin glowing cyan rail itself on short
|
|
4
|
+
* posts. SA34: the floor is walkable out to the rail on the 7 × 7's outer shoulder (`voidFloor.ts`), and an empty cell inside
|
|
5
|
+
* the placed rectangle is a square of the same floor. The rail is where the grid's closed rim walls stand (`session.ts`
|
|
6
|
+
* `rimEdges`), so the wall you bump is the rail you see.
|
|
6
7
|
*
|
|
7
|
-
* Cheap by construction: the floor is one square annulus (8 triangles) with a grid shader (no textures, no lights, no fog);
|
|
8
|
+
* Cheap by construction: the floor is one square annulus (8 triangles) plus two per empty-cell square, with a grid shader (no textures, no lights, no fog);
|
|
8
9
|
* the rail and posts are part of the road system's one solid material (`roadSolid.ts`). Lines are anti-aliased with screen derivatives and fade
|
|
9
10
|
* as they shrink under a pixel, so the horizon stays clean instead of shimmering.
|
|
10
11
|
*/
|
|
11
12
|
import { BufferAttribute, BufferGeometry, Color, Group, Mesh, type Object3D, ShaderMaterial } from 'three';
|
|
12
13
|
import { uniformPart, type SolidPart } from './roadSolid';
|
|
13
14
|
import type { GridCell } from '../../../shared/game/grid/assembly';
|
|
14
|
-
import type { LookScope, RailBox } from '../../../shared/game/grid/roadLayout';
|
|
15
|
+
import type { CellSquare, LookScope, RailBox } from '../../../shared/game/grid/roadLayout';
|
|
15
16
|
import type { PlatformRenderAdmission, PlatformRenderBytePlan } from './renderResidency';
|
|
16
17
|
|
|
17
|
-
/** The void floor's reach past
|
|
18
|
+
/** The void floor's reach past its edge (to the grid camera's 6 km far plane, `FAR_RING.drawDistance`). */
|
|
18
19
|
const REACH = 6000;
|
|
19
20
|
/** The floor sits a hair above road level so it covers the outer strip beyond the rail. */
|
|
20
21
|
const FLOOR_Y = 0.04;
|
|
@@ -75,28 +76,33 @@ function voidFloorMaterial(home: GridCell, rail: readonly [number, number, numbe
|
|
|
75
76
|
return material;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
/** The void floor: a square annulus from the
|
|
79
|
-
function floorGeometry(box: RailBox, home: GridCell): BufferGeometry {
|
|
79
|
+
/** The void floor: a square annulus from the floor's edge box out to REACH, and one square per empty cell (SA34), in the home frame. */
|
|
80
|
+
function floorGeometry(box: RailBox, holes: readonly CellSquare[], home: GridCell): BufferGeometry {
|
|
80
81
|
const x0 = box.minX - home.origin.x, x1 = box.maxX - home.origin.x, z0 = box.minZ - home.origin.z, z1 = box.maxZ - home.origin.z;
|
|
81
82
|
const X0 = x0 - REACH, X1 = x1 + REACH, Z0 = z0 - REACH, Z1 = z1 + REACH;
|
|
82
|
-
// inner ring 0..3 (sw, se, ne, nw), outer ring 4..7
|
|
83
|
+
// inner ring 0..3 (sw, se, ne, nw), outer ring 4..7, then four corners per hole
|
|
83
84
|
const p = [x0, z0, x1, z0, x1, z1, x0, z1, X0, Z0, X1, Z0, X1, Z1, X0, Z1];
|
|
84
|
-
const
|
|
85
|
-
|
|
85
|
+
for (const hole of holes) {
|
|
86
|
+
const hx0 = hole.x - hole.hx - home.origin.x, hx1 = hole.x + hole.hx - home.origin.x, hz0 = hole.z - hole.hz - home.origin.z, hz1 = hole.z + hole.hz - home.origin.z;
|
|
87
|
+
p.push(hx0, hz0, hx1, hz0, hx1, hz1, hx0, hz1);
|
|
88
|
+
}
|
|
89
|
+
const count = p.length / 2, position = new Float32Array(count * 3);
|
|
90
|
+
for (let k = 0; k < count; k++) { position[k * 3] = p[k * 2] ?? 0; position[k * 3 + 1] = FLOOR_Y; position[k * 3 + 2] = p[k * 2 + 1] ?? 0; }
|
|
86
91
|
// each side a quad between inner edge (a, b) and outer edge (A, B), wound to face up
|
|
87
|
-
const
|
|
88
|
-
for (let k = 0; k <
|
|
92
|
+
const ring = [0, 4, 5, 0, 5, 1, 1, 5, 6, 1, 6, 2, 2, 6, 7, 2, 7, 3, 3, 7, 4, 3, 4, 0];
|
|
93
|
+
for (let k = 0; k < ring.length; k += 3) { const b = ring[k + 1] ?? 0; ring[k + 1] = ring[k + 2] ?? 0; ring[k + 2] = b; }
|
|
94
|
+
// a hole's square (sw, se, ne, nw), wound to face up
|
|
95
|
+
for (let h = 0; h < holes.length; h++) { const o = 8 + h * 4; ring.push(o, o + 2, o + 1, o, o + 3, o + 2); }
|
|
96
|
+
const index = new Uint16Array(ring);
|
|
89
97
|
const g = new BufferGeometry().setAttribute('position', new BufferAttribute(position, 3)).setIndex(new BufferAttribute(index, 1));
|
|
90
98
|
g.computeBoundingSphere();
|
|
91
99
|
return g;
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*
|
|
98
|
-
export function voidFloorPlan(): PlatformRenderBytePlan {
|
|
99
|
-
const bytes = FLOOR_VERTICES * 3 * Float32Array.BYTES_PER_ELEMENT + FLOOR_INDICES * Uint16Array.BYTES_PER_ELEMENT;
|
|
102
|
+
/** G144's preflight for the void: the floor's retained position and index buffers (CPU + GPU; no texture): the annulus's 8
|
|
103
|
+
* corners and 24 indices, and 4 corners and 6 indices per empty-cell square. The rail and its posts belong to the deck's plan. */
|
|
104
|
+
export function voidFloorPlan(holes = 0): PlatformRenderBytePlan {
|
|
105
|
+
const bytes = (8 + 4 * holes) * 3 * Float32Array.BYTES_PER_ELEMENT + (24 + 6 * holes) * Uint16Array.BYTES_PER_ELEMENT;
|
|
100
106
|
return { id: 'road.void', jsBytes: bytes, gpuBytes: bytes };
|
|
101
107
|
}
|
|
102
108
|
|
|
@@ -140,21 +146,21 @@ class SolidMesher {
|
|
|
140
146
|
* (unlit cyan, in ≤ 50 m beams so the per-view cull can drop what is out of view) and its posts go to `solid`, the road
|
|
141
147
|
* system's one solid material (SF17b per-view budget).
|
|
142
148
|
*/
|
|
143
|
-
export function installVoidLook(input: { readonly rail: RailBox; readonly home: GridCell; readonly scene: Object3D; readonly scope: LookScope; readonly solid: (part: SolidPart) => void; readonly admission?: PlatformRenderAdmission }): VoidLookState {
|
|
144
|
-
const { rail: box, home, scene, scope } = input, group = new Group();
|
|
149
|
+
export function installVoidLook(input: { readonly rail: RailBox; readonly edge: RailBox; readonly holes: readonly CellSquare[]; readonly home: GridCell; readonly scene: Object3D; readonly scope: LookScope; readonly solid: (part: SolidPart) => void; readonly admission?: PlatformRenderAdmission }): VoidLookState {
|
|
150
|
+
const { rail: box, edge, holes, home, scene, scope } = input, group = new Group();
|
|
145
151
|
group.name = 'grid-void';
|
|
146
152
|
const x0 = box.minX - home.origin.x, x1 = box.maxX - home.origin.x, z0 = box.minZ - home.origin.z, z1 = box.maxZ - home.origin.z;
|
|
147
153
|
const owned = { value: 0 };
|
|
148
154
|
let drawn: Mesh | null = null;
|
|
149
155
|
const build = (owner: LookScope): void => {
|
|
150
156
|
const floorMaterial = voidFloorMaterial(home, [x0, x1, z0, z1], owned);
|
|
151
|
-
const floor = new Mesh(floorGeometry(
|
|
157
|
+
const floor = new Mesh(floorGeometry(edge, holes, home), floorMaterial);
|
|
152
158
|
floor.visible = owned.value < 1; drawn = floor;
|
|
153
159
|
floor.name = 'grid-void-floor'; floor.frustumCulled = false;
|
|
154
160
|
floor.castShadow = false; floor.receiveShadow = false; floor.matrixAutoUpdate = false; floor.updateMatrix(); group.add(floor);
|
|
155
161
|
owner.onDispose(() => { if (drawn === floor) drawn = null; floor.removeFromParent(); floor.geometry.dispose(); floorMaterial.dispose(); });
|
|
156
162
|
};
|
|
157
|
-
if (input.admission === undefined) build(scope); else input.admission.allocate(voidFloorPlan(), build);
|
|
163
|
+
if (input.admission === undefined) build(scope); else input.admission.allocate(voidFloorPlan(holes.length), build);
|
|
158
164
|
// the rail: thin beams along the four sides (unlit, the HUD's cyan); short dark posts carry it
|
|
159
165
|
const sides: readonly [number, number, number, number][] = [[x0, z0, x1, z0], [x1, z0, x1, z1], [x1, z1, x0, z1], [x0, z1, x0, z0]];
|
|
160
166
|
const rail = new SolidMesher(), posts = new SolidMesher(), cyan = CYAN.clone().multiplyScalar(1.6), dark = new Color(0x2b3036);
|
|
@@ -22,6 +22,7 @@ import type { CreatureDeathSource } from '../../../shared/game/loot/deaths';
|
|
|
22
22
|
import type { ShardContext } from "../plugin/context";
|
|
23
23
|
import { installEnteredRuntimeService } from '../shard/retainedHooks';
|
|
24
24
|
import { DynamicBodySlots } from '@wildshard/engine/physics/bodies';
|
|
25
|
+
import { framedPoint } from '@wildshard/engine/ui/hudAdapters';
|
|
25
26
|
|
|
26
27
|
export interface LootShop { readonly isOpen: boolean; render: () => void; dispose: () => void }
|
|
27
28
|
export interface LootPresentation {
|
|
@@ -78,7 +79,8 @@ export function installLoot<A extends LootBody>(h: ScopedLootHost<A>): ScopedLoo
|
|
|
78
79
|
const offPayouts = feed.onPayout(({ at, coins: n }) => {
|
|
79
80
|
if (!live) return;
|
|
80
81
|
burst.spawn(fell.set(at.x, at.y, at.z), n, () => undefined, () => { flush(); view.chime(); });
|
|
81
|
-
|
|
82
|
+
// the payout point is frame-local: at the grid frame's offset like the HUD pins (QA 2026-11-13 row 28)
|
|
83
|
+
framedPoint(projected.set(at.x, at.y + 1.5, at.z), projected).project(h.camera);
|
|
82
84
|
if (chip !== null && projected.z < 1 && Math.abs(projected.x) < 1.1 && Math.abs(projected.y) < 1.1) chip.pop((projected.x + 1) * 0.5 * window.innerWidth, (1 - projected.y) * 0.5 * window.innerHeight, n);
|
|
83
85
|
});
|
|
84
86
|
lifetime.onDispose(offPayouts);
|
|
@@ -17,7 +17,7 @@ import { mobileDevice } from '@wildshard/engine/boot/titleArrival';
|
|
|
17
17
|
import { dropFirstPlay, firstPlayDone, startFirstPlay } from '@wildshard/engine/boot/firstPlayMark';
|
|
18
18
|
import { lowPowerOn } from '@wildshard/engine/core/graphicsMode';
|
|
19
19
|
import { askNameOnce, nameAskDue } from '@wildshard/engine/ui/namePrompt';
|
|
20
|
-
import { lastEnd } from '@wildshard/engine/boot/lastEnd';
|
|
20
|
+
import { lastEnd, type LastEnd } from '@wildshard/engine/boot/lastEnd';
|
|
21
21
|
import { setDev } from '@wildshard/engine/core/devMode';
|
|
22
22
|
import { buildTitleDeck, titleCards, type TitleDeck, type TitleDeckOptions } from './titleDeck';
|
|
23
23
|
import { gridEntryShown, menuMode, gridMode } from './grid/menu';
|
|
@@ -204,6 +204,9 @@ export function buildTitleMenu(opts: TitleMenuOptions): TitleMenu {
|
|
|
204
204
|
const startPrefetch = (): void => {
|
|
205
205
|
if (started || opts.active !== null) return;
|
|
206
206
|
started = true;
|
|
207
|
+
// OFFLINE OF5a: a title that stays 10 s asks the worker to hold this build's code, so an update seen only here still
|
|
208
|
+
// launches offline; the worker does it only on a device that held an older build (a first visit reads nothing, S2)
|
|
209
|
+
owner.timeout(10_000, () => { if (!leavingTitle) { document.documentElement.dataset['wsTitleSettled'] = '1'; document.dispatchEvent(new Event('ws:title-settled')); } });
|
|
207
210
|
owner.raf(() => {
|
|
208
211
|
const choice = titlePrefetchChoice(saves), selectedMode = gridMode(mode().devserver, mode());
|
|
209
212
|
const target = titlePrefetchTarget(choice.read(), titleManifests(), mode().developer);
|
|
@@ -258,11 +261,16 @@ export interface GridTitle { readonly onGrid: () => void; readonly note: string;
|
|
|
258
261
|
/** Return the installed title action and note for the grid entry. */
|
|
259
262
|
export function installGridTitle(): GridTitle {
|
|
260
263
|
dropGridIntent();
|
|
261
|
-
const end = lastEnd();
|
|
262
264
|
const loop = gridRecoveryLoop();
|
|
263
|
-
|
|
265
|
+
return { onGrid: enterGrid, note: endedNote(lastEnd(), loop), ...(loop ? { screen: 'select' } : {}) };
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** The title's one line about the previous page's unexpected end: the grid's, or a standalone world's by its name (QB6).
|
|
269
|
+
* OF14: the world's name wins over the grid's recovery loop, which a one-shard page's crash inside the grid's 10-minute
|
|
270
|
+
* recovery guard trips too (Signal Dunes' offline failure said "Infinite Wildshard ended unexpectedly last time"). */
|
|
271
|
+
export function endedNote(end: Pick<LastEnd, 'kind' | 'mode' | 'slug'>, loop: boolean, find: (slug: string) => { readonly name: string } | undefined = findTitleManifest): string {
|
|
264
272
|
const world = end.kind === 'unexpected' && end.mode !== 'grid' ? end.slug : '';
|
|
265
|
-
const name = world.length === 0 ? '' :
|
|
266
|
-
|
|
267
|
-
|
|
273
|
+
const name = world.length === 0 ? '' : find(world)?.name ?? world;
|
|
274
|
+
if (name !== '') return GAME_STRINGS.grid.shardEnded(name);
|
|
275
|
+
return loop || (end.kind === 'unexpected' && end.mode === 'grid') ? GAME_STRINGS.grid.ended : '';
|
|
268
276
|
}
|
|
@@ -2,6 +2,7 @@ import { diagnosticNow } from '@wildshard/engine/core/clock';
|
|
|
2
2
|
import type { TouchVerbSpec } from '@wildshard/engine/input/InputService';
|
|
3
3
|
import type { LevelContext } from '@wildshard/engine/level/context';
|
|
4
4
|
import { hudSlots, type DiscOpts } from '@wildshard/engine/ui/hudSlots';
|
|
5
|
+
import { frameEye, framedPoint } from '@wildshard/engine/ui/hudAdapters';
|
|
5
6
|
import { uiScope } from '@wildshard/engine/ui/ownership';
|
|
6
7
|
import * as THREE from 'three';
|
|
7
8
|
import './ride.css';
|
|
@@ -36,7 +37,7 @@ const arcPath = (cx: number, cy: number, r: number, a0: number, a1: number): str
|
|
|
36
37
|
return `M${p0x.toFixed(1)} ${p0y.toFixed(1)} A${r} ${r} 0 0 1 ${p1x.toFixed(1)} ${p1y.toFixed(1)}`;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
const _p = new THREE.Vector3();
|
|
40
|
+
const _p = new THREE.Vector3(), _eye = new THREE.Vector3();
|
|
40
41
|
|
|
41
42
|
export class RideHUD {
|
|
42
43
|
readonly scope: ReturnType<typeof uiScope> = uiScope('RideHUD');
|
|
@@ -236,7 +237,8 @@ export class RideHUD {
|
|
|
236
237
|
}
|
|
237
238
|
if (tg.name.textContent !== mt.name) tg.name.textContent = mt.name;
|
|
238
239
|
const tag = tg.el;
|
|
239
|
-
|
|
240
|
+
// a horse stands in the frame's own coordinates; the eye there is the camera less the grid frame's offset (QA 11-13 row 28)
|
|
241
|
+
const d = _p.fromArray(mt.position).distanceTo(frameEye(this.camera, _eye));
|
|
240
242
|
_p.fromArray(mt.position); _p.y += this.profile.tagHeight * mt.scale;
|
|
241
243
|
const vis = m.horse !== mt.id && !mt.hidden && d < this.profile.tagRange && d > 2 && this.project(_p);
|
|
242
244
|
if (vis) tag.style.transform = `translate(${_p.x.toFixed(1)}px, ${_p.y.toFixed(1)}px) translate(-50%, -100%)`;
|
|
@@ -244,9 +246,9 @@ export class RideHUD {
|
|
|
244
246
|
}
|
|
245
247
|
}
|
|
246
248
|
|
|
247
|
-
/**
|
|
249
|
+
/** a frame-local point → CSS px in `_p` (in place), at the grid frame's offset like the HUD pins; false when behind the camera */
|
|
248
250
|
private project(w: THREE.Vector3): boolean {
|
|
249
|
-
|
|
251
|
+
framedPoint(w, _p).project(this.camera);
|
|
250
252
|
if (_p.z > 1 || _p.z < -1) return false;
|
|
251
253
|
const r = this.root.getBoundingClientRect();
|
|
252
254
|
_p.set((_p.x * 0.5 + 0.5) * r.width, (-_p.y * 0.5 + 0.5) * r.height, 0);
|
|
@@ -5,7 +5,7 @@ import { sustainedFrames } from '@wildshard/engine/core/sustainedFrames';
|
|
|
5
5
|
import { Rng } from '@wildshard/engine/core/rng';
|
|
6
6
|
import { gridCells } from '../plugin/context';
|
|
7
7
|
import { initialHomeMetadataRequired } from '../grid/homeMetadata';
|
|
8
|
-
import { reenterGrid, showGridDestination } from '../grid/pageEntry';
|
|
8
|
+
import { reenterGrid, reenterShard, showGridDestination } from '../grid/pageEntry';
|
|
9
9
|
import type { playStage } from './play';
|
|
10
10
|
import type { WorkerClientGrid } from '../shardfile/clientWorker';
|
|
11
11
|
import { asShell } from '@wildshard/engine/app/ownership';
|
|
@@ -14,6 +14,7 @@ import { releaseByteCounter } from '@wildshard/engine/boot/bytes';
|
|
|
14
14
|
import { hasLateAudio, startAudioPreload, startLateAudio, type AudioBanks } from '@wildshard/engine/boot/extras';
|
|
15
15
|
import { macrotask } from '@wildshard/engine/boot/plan';
|
|
16
16
|
import { loadingStage, loadingUnits, waitFor } from '@wildshard/engine/boot/waits';
|
|
17
|
+
import { beginLoadingWait, finishLoadingWait } from '@wildshard/engine/boot/loadingWaits';
|
|
17
18
|
import { currentLoadingTimeline } from '@wildshard/engine/boot/timeline';
|
|
18
19
|
import { startShardPrefetch } from '@wildshard/engine/boot/shardPrefetch';
|
|
19
20
|
import { afterControl, reachControl } from '@wildshard/engine/boot/prefetch';
|
|
@@ -28,6 +29,7 @@ import { textureBytes } from '@wildshard/engine/render/textureBytes';
|
|
|
28
29
|
import { setPoseProvider } from '@wildshard/engine/ui/ReloadPrompt';
|
|
29
30
|
import { lastEnd, registerBeforeReload } from '@wildshard/engine/boot/lastEnd';
|
|
30
31
|
import { gridPrefetchOrder, startGridPrefetch } from '../grid/prefetch';
|
|
32
|
+
import { shardArea } from '../grid/area';
|
|
31
33
|
import { admittedRuntimeProduct, completeManifestCache, releaseManifestTransport } from '../shardfile/runtimeProduct';
|
|
32
34
|
import { enterSkyClock } from './clockSettings';
|
|
33
35
|
import { settleEntryPrograms } from './settlePrograms';
|
|
@@ -45,7 +47,7 @@ function workerGrid({ grid, gridLive }: Pick<Awaited<ReturnType<typeof playStage
|
|
|
45
47
|
return grid === null || gridLive === null ? null : { cells: grid.assembly.cells, bindWire: wire => { gridLive.bindWire(wire); }, frame: () => gridLive.frame(), animals: () => gridLive.enteredAnimals(), items: () => gridLive.enteredItems(), saveLocation: () => { gridLive.saveLocation(); },
|
|
46
48
|
// GO5: the server's place is the save; the hint and the loading card follow it.
|
|
47
49
|
serverPlace: (instance, at) => { gridLive.serverPlace(instance, at); const cell = grid.assembly.cells.find(row => row.instance === instance); if (cell !== undefined) showGridDestination(cell.slug); },
|
|
48
|
-
reenter: instance => { reenterGrid(instance); }, booted: gridLive.booted };
|
|
50
|
+
reenter: instance => { reenterGrid(instance); }, reshard: instance => { reenterShard(instance); }, booted: gridLive.booted };
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/** how often the in-play warm-up asks whether an arrival's Explorer has closed, and how long it waits for one to open */
|
|
@@ -58,6 +60,17 @@ const BOOT_SHADER_SLICE_MS = 48;
|
|
|
58
60
|
* frame starts with narrow slices (Game FIRST_DRAW_NARROW). Measured on Driftwood at 4x CPU, 2026-11-09: SwiftShader 34 ms,
|
|
59
61
|
* this Mac's Metal GPU 7 ms, WebKit 2.4 ms a program. */
|
|
60
62
|
const SLOW_SHADER_MS_PER_PROGRAM = 15;
|
|
63
|
+
/** PINE-FLASH: the spawn ground hold, named on the loading card while it waits; its outcome and time go in a boot mark. */
|
|
64
|
+
async function holdSpawnGround(grid: Awaited<ReturnType<typeof playStage>>['grid']): Promise<void> {
|
|
65
|
+
if (grid === null) return;
|
|
66
|
+
const timeline = currentLoadingTimeline(), at = diagnosticNow();
|
|
67
|
+
const wait = beginLoadingWait('Spawn ground', { kind: 'work', step: timeline?.snapshot().current ?? null, owner: timeline?.waitOwner ?? null });
|
|
68
|
+
// best-effort: a hold that throws leaves the ground to the rings in play, as before it, and never fails the load
|
|
69
|
+
try { const outcome = await grid.prepareSpawnGround(); bootMark('app:spawn-ground', { outcome, ms: Math.round(diagnosticNow() - at) }); }
|
|
70
|
+
catch (error: unknown) { console.warn('[grid] spawn ground hold stopped', error); bootMark('app:spawn-ground', { outcome: 'failed', ms: Math.round(diagnosticNow() - at) }); }
|
|
71
|
+
finally { finishLoadingWait(wait); }
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
/** QA8: link the world's programs the spawn view did not draw before the reveal, nearest first, at the in-play pace (a few
|
|
62
75
|
* programs a frame, each link polled). Only completion or owner retirement ends this loading step. */
|
|
63
76
|
async function linkWorldUnderLoader(game: Awaited<ReturnType<typeof playStage>>['game'], unbuilt = false): Promise<void> {
|
|
@@ -137,7 +150,9 @@ export async function finishStage(ctx: Awaited<ReturnType<typeof playStage>>): P
|
|
|
137
150
|
// so the shaders below link the fine pieces and the reveal shows them; only what lies outside it refines in play
|
|
138
151
|
// The camera is posed by the shader step below. Keep the player reference
|
|
139
152
|
// for this first fence; the final readyFrame fence uses the posed camera.
|
|
140
|
-
|
|
153
|
+
// PINE-FLASH (grid/spawnGround.ts): first the entered cell's own ground where its ring tiles are that ground (Pine), so
|
|
154
|
+
// control never arrives over its far proxy; bounded, and nothing for a cell that draws its own ground (Nalati)
|
|
155
|
+
await loadingStage('spawnDetail', async () => { await holdSpawnGround(ctx.grid); await prepareSpawnView(undefined, undefined, 'player'); });
|
|
141
156
|
try {
|
|
142
157
|
// LS8 (J204): the shaders step's measured cost per program decides how the first frame slices its draws
|
|
143
158
|
const shadersAt = diagnosticNow(), programsBefore = game.renderer.info.programs?.length ?? 0;
|
|
@@ -378,7 +393,10 @@ export async function finishStage(ctx: Awaited<ReturnType<typeof playStage>>): P
|
|
|
378
393
|
ctx.session.residency?.bindComposer(game, game.engineScope, TIER);
|
|
379
394
|
game.captureLevelResources();
|
|
380
395
|
game.levelScope.onDispose(() => { windupWarn?.dispose(); weapons.setEnabled(false); boot.runtime.hooks.dispose?.(); audio.unloadLevel(); });
|
|
381
|
-
|
|
396
|
+
const grid = ctx.grid;
|
|
397
|
+
installProbe(handle, { leakPhysics, health: () => playerHealth.attributes.health, quest: () => ({ adventure: boot.runtime.hooks.adventureFlags?.() ?? [], quest: boot.runtime.hooks.questFlags?.() ?? [] }),
|
|
398
|
+
// T2E-1b: a grid page's area is the cell the player is in, not the shell
|
|
399
|
+
area: () => grid === null ? shardArea(slug, app.debug.snapshot()['shardfile'], boot.runtime.hooks.questFlags?.() ?? []) : grid.area() });
|
|
382
400
|
ctx.startExplore?.();
|
|
383
401
|
document.dispatchEvent(new Event('ws:ready')); // booted to the title
|
|
384
402
|
const completeOfflineCopy = async (): Promise<void> => {
|
|
@@ -106,7 +106,7 @@ import { HAPTIC, buzz } from '@wildshard/engine/ui/haptics';
|
|
|
106
106
|
import { hudSlots } from '@wildshard/engine/ui/hudSlots';
|
|
107
107
|
import { installPlayerDeath } from '@wildshard/engine/ui/playerDeath';
|
|
108
108
|
import { installUnstuck } from '@wildshard/engine/ui/unstuck';
|
|
109
|
-
import { UNSTUCK_ACT } from '@wildshard/engine/net/acts';
|
|
109
|
+
import { RESPAWN_NOW_ACT, UNSTUCK_ACT } from '@wildshard/engine/net/acts';
|
|
110
110
|
import { PlayerHurt } from '@wildshard/engine/ui/playerHurt';
|
|
111
111
|
import { onReview, queuedCount, quickNote } from '@wildshard/engine/ui/review';
|
|
112
112
|
import { installBounds, playBounds } from '@wildshard/engine/world/bounds';
|
|
@@ -446,7 +446,8 @@ async function buildPlay(ctx: Awaited<ReturnType<typeof loadoutStage>>) : Promis
|
|
|
446
446
|
// ── death (E295): a fade to dark with a "Mauled by a brown bear / respawning at Wreck Cove" card (src/client/engine/ui/DeathFade.ts),
|
|
447
447
|
// the respawn under the dark at the last named place you reached (src/game/LastPlace.ts; Driftwood's places, the spawn
|
|
448
448
|
// when none), input frozen and no hit taken until the view is back. A boss fight's death keeps its own checkpoint. ──
|
|
449
|
-
|
|
449
|
+
// QA 11-13 (Jake: "It needs a button, a Respawn now button"): its words live here, in the session, not in the engine table the title carries
|
|
450
|
+
const deathFade = new DeathFade({ now: 'Respawn now', waiting: 'Respawning…' });
|
|
450
451
|
const placePts = boot.runtime.hooks.places;
|
|
451
452
|
const lastPlace = placePts !== undefined ? new LastPlace(placePts) : null;
|
|
452
453
|
if (lastPlace !== null) {
|
|
@@ -481,6 +482,11 @@ async function buildPlay(ctx: Awaited<ReturnType<typeof loadoutStage>>) : Promis
|
|
|
481
482
|
else if (stand !== null) player.spawn(stand.x, stand.z, stand.yaw, stand.y); else toSpawn();
|
|
482
483
|
}, // a server owns its return; a local player uses the last place (the pier is the spawn)
|
|
483
484
|
done: () => { player.carried = false; weapons.setEnabled(!player.swimming); },
|
|
485
|
+
// Respawn now (QA 11-13) and the timer wait for the respawn point: a server has placed the player already (its reconcile
|
|
486
|
+
// carries the move: SERVER-PARITY); a local last place waits for its ground in the page's physics (DeathFade's READY_WAIT caps it)
|
|
487
|
+
ready: () => serverRespawn !== null || stand === null || app.physics === null || floorBelow(app.physics, stand.x, stand.z, stand.y + 0.6, 1.2) !== undefined,
|
|
488
|
+
// a server's world holds the fallen player's commands for its own fade: Respawn now asks it to end it (roomRespawn.ts)
|
|
489
|
+
skipped: () => { if (player.link !== null) weapons.interact(RESPAWN_NOW_ACT); },
|
|
484
490
|
});
|
|
485
491
|
};
|
|
486
492
|
playerHealth.bindLifecycle({ fading: () => deathFade.active, updateFade: (dt) => deathFade.update(dt) });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bagMenu } from '../bag/tabs';
|
|
2
|
+
import { guardPlayBack } from '@wildshard/engine/ui/backGuard';
|
|
2
3
|
import { wirePage } from '../shardfile/wirePage';
|
|
3
4
|
import * as THREE from 'three';
|
|
4
5
|
import { type LevelSequence, bootLevel } from '@wildshard/engine/boot';
|
|
@@ -103,7 +104,8 @@ export async function startSession(manifest: ShardManifest, kit: KitPorts, optio
|
|
|
103
104
|
build: __BUILD_ID__, dispose: () => {
|
|
104
105
|
if (app.render !== null) app.render.hold = true;
|
|
105
106
|
scope.dispose();
|
|
106
|
-
|
|
107
|
+
// SENTRY-TRIAGE S13: a failure whose page the player sees says so (`screen:load-failure`); a recovery's stays a plain report
|
|
108
|
+
}, report: (failure) => reportError(options.recovery === undefined ? { ...failure, tags: { ...failure.tags, screen: 'load-failure' } } : failure),
|
|
107
109
|
show: (failure) => { if (options.recovery !== undefined) return; session.fatalShown = true; showLoadFailure(failure); },
|
|
108
110
|
});
|
|
109
111
|
let memoryAt = -Infinity, memoryMB = 0;
|
|
@@ -114,6 +116,7 @@ export async function startSession(manifest: ShardManifest, kit: KitPorts, optio
|
|
|
114
116
|
};
|
|
115
117
|
app.levelAdapters.residentMemory = memory;
|
|
116
118
|
markDropStep({ step: PLAYING });
|
|
119
|
+
guardPlayBack(); // QA 11-13 row 20: iOS's edge swipe (any back) stays in play
|
|
117
120
|
setAliveSource((): AliveInfo<PageMode> => ({ slug: selected, resident: `${selected} (playing) ~${Math.round(memory(60_000).levels[0]?.textureMB ?? 0)} MB`, mode }));
|
|
118
121
|
} catch (error) {
|
|
119
122
|
options.residency?.dispose(); // Pre-bootstrap failures have no consumers; runShardLoad disposes allocated ones first.
|
|
@@ -58,6 +58,11 @@ export function catalogueManifests():readonly (ShardManifest|TitleManifest)[]{
|
|
|
58
58
|
return [...rows.values()];
|
|
59
59
|
}
|
|
60
60
|
const NO_ART = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3 4"%3E%3Crect width="3" height="4" fill="%23273340"/%3E%3C/svg%3E';
|
|
61
|
+
/** C3, SA46: the plain row of a shard this build has no card for, from what the catalogue says of it (its name). Its art is the
|
|
62
|
+
* plain card until its product is admitted: the API hosts no uploaded shard's images. */
|
|
63
|
+
export function catalogueTitleRow(slug: string, name: string, order: number): TitleManifest {
|
|
64
|
+
return { slug, name, biome: '', status: 'live', order, shardfile: `/shardfiles/${slug}/shard.json`, card: { thumb: NO_ART, portrait: NO_ART, landscape: NO_ART } };
|
|
65
|
+
}
|
|
61
66
|
/** C3: a head with a placement and no card in this build: a shard added to the catalogue after the build. Its name is all
|
|
62
67
|
* the catalogue says, so it wears a plain card until its product is admitted. */
|
|
63
68
|
export function withCatalogueHeads(rows: readonly TitleManifest[]): readonly TitleManifest[] {
|
|
@@ -68,8 +73,7 @@ export function withCatalogueHeads(rows: readonly TitleManifest[]): readonly Tit
|
|
|
68
73
|
const added = heads.filter(head => !known.has(head.slug)).flatMap(head => {
|
|
69
74
|
const placement = placed.get(head.slug);
|
|
70
75
|
if (placement === undefined) return [];
|
|
71
|
-
|
|
72
|
-
return [row];
|
|
76
|
+
return [catalogueTitleRow(placement.slug, head.name, placement.order ?? rows.length)];
|
|
73
77
|
});
|
|
74
78
|
return added.length === 0 ? rows : [...rows, ...added];
|
|
75
79
|
}
|
|
@@ -10,6 +10,7 @@ import { appIdentity } from '@wildshard/engine/app/identity';
|
|
|
10
10
|
import { bootMark, bootTask } from '@wildshard/engine/boot/timing';
|
|
11
11
|
import { importPageSaves, openIndexedSaves, serverSaveDatabase, serverStopsForImport, type IndexedSaves } from '@wildshard/engine/saves/indexed';
|
|
12
12
|
import { saveEnvironment } from '@wildshard/engine/saves/environment';
|
|
13
|
+
import { jsonSlot } from '@wildshard/engine/saves/slots';
|
|
13
14
|
import { syncPageRewards } from '../../../shared/game/saves';
|
|
14
15
|
import type { SaveStorage } from '@wildshard/engine/saves/store';
|
|
15
16
|
import { atMostLeaveWait, holdLeaving } from '@wildshard/engine/boot/lastEnd';
|
|
@@ -52,8 +53,8 @@ import type { EncounterRow } from '../boss/barFeed';
|
|
|
52
53
|
import { wirePage, type DayFollower } from './wirePage';
|
|
53
54
|
import { OWNED_ROW } from '../../../shared/game/loot/ownedRows';
|
|
54
55
|
import { declaredKitSlots } from '../../../shared/game/shardfile/items';
|
|
55
|
-
import { earlyStandalone,
|
|
56
|
-
import {
|
|
56
|
+
import { earlyStandalone, serverRoute } from './serverRoute';
|
|
57
|
+
import { worldHosted } from '../grid/oneWayIn';
|
|
57
58
|
|
|
58
59
|
type Creatures = Pick<RowBodiesView, 'animals' | 'spawn' | 'retire' | 'onWindup' | 'presentHit' | 'presentDeath' | 'presentReward'>;
|
|
59
60
|
/** What a grid page lends: its crossing follows the server, and its creatures are the entered cell's. */
|
|
@@ -70,6 +71,8 @@ export interface WorkerClientGrid {
|
|
|
70
71
|
readonly serverPlace?: (instance: string, at: { readonly x: number; readonly y: number; readonly z: number; readonly yaw: number }) => void;
|
|
71
72
|
/** GO4: the seat is in another cell than this page booted: enter the grid again there (a grid entry, never a `?chunk=` page). */
|
|
72
73
|
readonly reenter?: (instance: string) => void;
|
|
74
|
+
/** OF2: the world hosts one cell: enter this cell again as its one-shard online page, never the solo grid. */
|
|
75
|
+
readonly reshard?: (instance: string) => void;
|
|
73
76
|
/** The cell (instance) this page booted in. */
|
|
74
77
|
readonly booted?: string;
|
|
75
78
|
}
|
|
@@ -108,8 +111,22 @@ export interface WorkerClientPorts {
|
|
|
108
111
|
interface ShellModule { readonly startStandalone: (config: { slug: string; base: string; build: string; savePrefix: string; name?: string; lone?: true; held?: (url: string) => Promise<ArrayBuffer | null> } & IndexedSaves) => Shell }
|
|
109
112
|
/** What `stampBuildDocuments` writes into a build that has a world: its signed release file and the key that signed it. */
|
|
110
113
|
interface BuildWorld { readonly release: string; readonly key: string; readonly recordTag?: string }
|
|
114
|
+
/** OF4: the page's keep for the last verified release file, in its own device saves (online.js's store has no storage). */
|
|
115
|
+
interface ReleaseKeep { readonly read: () => { of: string; at: number; text: string } | null; readonly write: (kept: { of: string; at: number; text: string }) => void }
|
|
116
|
+
function releaseKeep(): ReleaseKeep {
|
|
117
|
+
const slot = jsonSlot('release.kept', 'device');
|
|
118
|
+
return {
|
|
119
|
+
read: () => {
|
|
120
|
+
const kept = slot.read();
|
|
121
|
+
if (typeof kept !== 'object' || kept === null || Array.isArray(kept)) return null;
|
|
122
|
+
const { of, at, text } = kept;
|
|
123
|
+
return typeof of === 'string' && typeof at === 'number' && typeof text === 'string' ? { of, at, text } : null;
|
|
124
|
+
},
|
|
125
|
+
write: kept => { slot.write({ of: kept.of, at: kept.at, text: kept.text }); },
|
|
126
|
+
};
|
|
127
|
+
}
|
|
111
128
|
/** E7.2d: the page's seat in the one world, in a shell of the same shape. */
|
|
112
|
-
interface OnlineModule { readonly
|
|
129
|
+
interface OnlineModule { readonly startOnline: (config: BuildWorld & { keep: ReleaseKeep; 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> }
|
|
113
130
|
interface Shell { readonly redials?: true; 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 }
|
|
114
131
|
|
|
115
132
|
const SAVE_EVERY_MS = 30_000;
|
|
@@ -283,7 +300,7 @@ async function leaveEarly(shell: Promise<Shell>): Promise<void> {
|
|
|
283
300
|
* that step instead, as before. A level left before adoption saves and stops this server as an adopted one would. */
|
|
284
301
|
export function startWorkerServerEarly(options: { readonly slug: string; readonly lone: boolean; readonly scope: Scope }): void {
|
|
285
302
|
// GO4: a build with a world puts every page in it, a grid page too: no in-page server to start early.
|
|
286
|
-
if (!earlyStandalone((globalThis as { __WS_WORLD__?: BuildWorld }).__WS_WORLD__
|
|
303
|
+
if (!earlyStandalone((globalThis as { __WS_WORLD__?: BuildWorld }).__WS_WORLD__)) return;
|
|
287
304
|
if (early !== null && !early.adopted) return;
|
|
288
305
|
const reads: EarlyServer['reads'] = { count: 0, card: null };
|
|
289
306
|
const shell = bootStandalone(options.slug, options.lone, () => { if (reads.card === null) reads.count++; else reads.card.add(); });
|
|
@@ -305,6 +322,12 @@ export function startWorkerServerEarly(options: { readonly slug: string; readonl
|
|
|
305
322
|
closing = leaveEarly(shell);
|
|
306
323
|
});
|
|
307
324
|
}
|
|
325
|
+
/** A device id's storage for a page whose browser keeps nothing (OF2: such a page still joins the world, as a new device each time). */
|
|
326
|
+
function pageOnlyStorage(): SaveStorage {
|
|
327
|
+
const items = new Map<string, string>();
|
|
328
|
+
return { get length() { return items.size; }, key: index => [...items.keys()][index] ?? null, getItem: key => items.get(key) ?? null,
|
|
329
|
+
setItem: (key, value) => { items.set(key, value); }, removeItem: key => { items.delete(key); } };
|
|
330
|
+
}
|
|
308
331
|
async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<typeof countedWait>): Promise<void> {
|
|
309
332
|
const { slug, player, physics, scope, system } = ports, { savePrefix } = appIdentity(), page = saveEnvironment().storage('shard');
|
|
310
333
|
const { root, build } = buildRoot();
|
|
@@ -326,18 +349,24 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
|
|
|
326
349
|
// a page that left while it asked never joins (Codex review): a cancelled load must not take the device's seat
|
|
327
350
|
if (!answered || scope.disposed) throw new Error('The page left before it joined the world');
|
|
328
351
|
const { grid } = ports, booted = grid?.booted;
|
|
329
|
-
return startOnline({ ...world, loaded: slug, build, identity: name => deviceIdentity(storage, savePrefix, name),
|
|
352
|
+
return startOnline({ ...world, keep: releaseKeep(), loaded: slug, build, identity: name => deviceIdentity(storage, savePrefix, name),
|
|
330
353
|
...(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); },
|
|
331
354
|
...(pageGoto() === booted ? { goto: true } : {}) } }) });
|
|
332
355
|
};
|
|
333
356
|
const world = (globalThis as { __WS_WORLD__?: BuildWorld }).__WS_WORLD__;
|
|
334
|
-
//
|
|
335
|
-
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
357
|
+
// OFFLINE OF2 (J298): a build with a world sends every page online; the world's word never picks the server. A grid page whose world
|
|
358
|
+
// is known to host one cell (a word in time, or the device's kept answer; no word takes the grid, J300) re-enters as that cell's
|
|
359
|
+
// one-shard online page, never the solo grid. Shard select's goto already asked, so its grid page doesn't ask again.
|
|
360
|
+
const bootedCell = ports.grid?.booted, reshard = ports.grid?.reshard;
|
|
361
|
+
if (world !== undefined && bootedCell !== undefined && reshard !== undefined && !gotoHosted() && !await bootTask('server:grid-hosted', () => worldHosted(world))) {
|
|
362
|
+
// a page the player left while it asked (back to the title) goes nowhere: the title keeps the document (review MUST)
|
|
363
|
+
if (scope.disposed) throw new Error('The page left before it joined the world');
|
|
364
|
+
reshard(bootedCell);
|
|
365
|
+
// the page is leaving for the one-shard page (or the title): this boot never goes on, as a GO4 regrid's never arrives
|
|
366
|
+
await new Promise<never>(() => { /* settles never: the page unloads */ });
|
|
367
|
+
}
|
|
368
|
+
// A page that can keep nothing still joins, with a device id for this page only.
|
|
369
|
+
const shell = await (world !== undefined && serverRoute(world) === 'online' ? online(world, page ?? pageOnlyStorage()) : standalone()), { client } = shell;
|
|
341
370
|
void shell.booted.catch(() => undefined);
|
|
342
371
|
// QA row 16: a navigation the game chose leaves the world's seat from the moment there is a shell, even mid-load (a returning held
|
|
343
372
|
// body may already be back). Once the page can save, the hold below replaces this one.
|
|
@@ -404,7 +433,8 @@ async function startWorkerClient(ports: WorkerClientPorts, card: ReturnType<type
|
|
|
404
433
|
let opened: number | undefined, renderTick = 0;
|
|
405
434
|
if (grid === null) net.inCell = cell => (opened ??= cell) === cell;
|
|
406
435
|
else {
|
|
407
|
-
grid.bindWire({ site: () => { const cell = client.latest?.cell; return cell === undefined ? undefined : siteOf(cell); }, rebound: next => { net.world.rebind(next); }, rows: netNeighbourRegion(client, () => renderTick)
|
|
436
|
+
grid.bindWire({ site: () => { const cell = client.latest?.cell; return cell === undefined ? undefined : siteOf(cell); }, rebound: next => { net.world.rebind(next); }, rows: netNeighbourRegion(client, () => renderTick),
|
|
437
|
+
flags: () => [...client.phased, ...client.flags()] });
|
|
408
438
|
net.inCell = cell => siteOf(cell) === grid.frame();
|
|
409
439
|
}
|
|
410
440
|
scope.onDispose(() => { player.link = null; ports.weapons.bindWire(null); net.dispose(); });
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
/** Where a page's server is. */
|
|
6
6
|
export type ServerRoute = 'online' | 'standalone';
|
|
7
7
|
|
|
8
|
-
/** The route for a page. `world` is the build's stamp (`__WS_WORLD__`)
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
export function serverRoute(world: unknown
|
|
14
|
-
return world
|
|
8
|
+
/** The route for a page. `world` is the build's stamp (`__WS_WORLD__`). OFFLINE OF2 (J298, Jake 2026-11-12: "staging and prod should
|
|
9
|
+
* never try to play offline versions"): a build with a world sends every page online, whatever its world says or doesn't say. No
|
|
10
|
+
* answer (unreachable, offline), a world that hosts one cell, a shard the grid doesn't place: the page still joins, and a failing link
|
|
11
|
+
* shows the connection screens in the world, never the in-page server. The world's word picks only which page boots (Shard select's
|
|
12
|
+
* one way in, `oneWayIn.ts`), never the server. */
|
|
13
|
+
export function serverRoute(world: unknown): ServerRoute {
|
|
14
|
+
return world === undefined ? 'standalone' : 'online';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/** Whether the door's `world` word (`socketFrames.ts` `WorldWord`, sent on every socket before hello) says it hosts the grid: more
|
|
@@ -21,18 +21,6 @@ export function hostsGrid(world: unknown): boolean {
|
|
|
21
21
|
return typeof cells === 'number' && cells > 1;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/** Whether a
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
* opens Driftwood alone). No word (unreachable, stalled, a door older than the list) keeps the catalogue's answer. It does not seat
|
|
28
|
-
* the page in its own cell: a one-shard page dials the bare address, so a world of several cells still seats it where the device last
|
|
29
|
-
* stood (GO5); a one-cell world, prod's, has nowhere else to put it. */
|
|
30
|
-
export function opensShard(word: unknown, slug: string, catalogued: boolean): boolean {
|
|
31
|
-
if (!catalogued) return false;
|
|
32
|
-
const shards = typeof word === 'object' && word !== null && 'shards' in word ? word.shards : null;
|
|
33
|
-
return !Array.isArray(shards) || !shards.every(shard => typeof shard === 'string') || shards.includes(slug);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** Whether a page may start the in-page server before its Worker boot step. A build with a world never does: its pages join the world,
|
|
37
|
-
* except a one-shard page of a shard the grid doesn't place (`placed` false), which plays solo. */
|
|
38
|
-
export function earlyStandalone(world: unknown, placed = true): boolean { return world === undefined || !placed; }
|
|
24
|
+
/** Whether a page may start the in-page server before its Worker boot step: only on a build with no world (OF2: a world build's pages
|
|
25
|
+
* all join the world). */
|
|
26
|
+
export function earlyStandalone(world: unknown): boolean { return serverRoute(world) === 'standalone'; }
|