@wildshard/engine 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/budgets/shard-size-baseline.json +10 -4
- package/index.html +6 -4
- package/lint/engine-sides.json +21 -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/no-base64.mjs +3 -1
- package/lint/ratchet.json +0 -68
- package/lint/ratchet.mjs +1 -4
- package/lint/shard-imports.mjs +6 -7
- 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 +22 -23
- package/package.json +25 -16
- package/scripts/agent-sync.mjs +27 -8
- package/scripts/app-build/appCook.ts +8 -2
- package/scripts/app-build/catalogue.ts +10 -7
- package/scripts/app-build/gen.ts +22 -2
- package/scripts/app-build/isolation.d.mts +10 -0
- package/scripts/app-build/isolation.mjs +47 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +35 -0
- package/scripts/app-build/previousDeploy.d.mts +2 -0
- package/scripts/app-build/previousDeploy.mjs +10 -1
- package/scripts/app-build/serviceWorker.ts +10 -3
- package/scripts/app-build/splitOutput.mjs +4 -2
- package/scripts/app-build/standaloneOutput.d.mts +1 -1
- package/scripts/app-build/standaloneOutput.mjs +5 -3
- package/scripts/app-build/titlePreloads.d.mts +8 -0
- package/scripts/app-build/titlePreloads.mjs +69 -0
- package/scripts/app-build/worldMapAtlas.ts +10 -6
- package/scripts/app-build-pipeline.mjs +34 -3
- package/scripts/built-product.mjs +1 -1
- package/scripts/cell-mem-bench.mjs +81 -23
- package/scripts/check-custom-sections-zero.mjs +1 -1
- package/scripts/check-devserver.mjs +3 -1
- package/scripts/check-models.mjs +2 -0
- package/scripts/check-paths.allow.json +0 -115
- package/scripts/check-paths.mjs +2 -2
- package/scripts/check-platform-ratchets.mjs +2 -3
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.d.mts +1 -1
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/ci-static.sh +1 -1
- package/scripts/committed-fast-checks.mjs +0 -2
- package/scripts/content-sw-proof.mjs +2 -1
- package/scripts/cook-worker.mjs +9 -3
- package/scripts/cook.mjs +20 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +4 -2
- package/scripts/devserver-client.mjs +25 -8
- package/scripts/docs-inputs-proof.mjs +6 -6
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- package/scripts/e7-voice-staging-proof.mjs +1 -1
- package/scripts/gate-related-tests.mjs +1 -1
- package/scripts/git-source-view.mjs +1 -1
- package/scripts/goldens/capture.mjs +17 -5
- package/scripts/grid-crossing-nightly.mjs +59 -0
- package/scripts/grid-crossing-qa.mjs +44 -0
- package/scripts/grid-crossing-ratchet.d.mts +6 -0
- package/scripts/grid-crossing-ratchet.mjs +52 -0
- package/scripts/grid-crossing-report.mjs +122 -0
- package/scripts/grid-crossing-stages.mjs +47 -0
- package/scripts/grid-crossing-tour.mjs +277 -0
- package/scripts/grid-crossing-walk-proof.mjs +136 -18
- package/scripts/host-ruler/roots.mjs +2 -2
- package/scripts/host-ruler.d.mts +91 -0
- package/scripts/host-ruler.mjs +565 -0
- package/scripts/live-prepush.py +3 -5
- package/scripts/loading-flow/benchmax.mjs +3 -1
- package/scripts/look-loop/test_look_loop.py +1 -38
- package/scripts/memory-proof.mjs +213 -0
- package/scripts/mmo-bots.mjs +8 -2
- package/scripts/net-lag-proof.mjs +219 -0
- package/scripts/night-market-kit-budget.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -3
- package/scripts/offline-proof-rules.mjs +34 -7
- package/scripts/offline-proof.mjs +88 -18
- package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
- package/scripts/page-release/content.d.mts +9 -1
- package/scripts/page-release/content.mjs +131 -17
- package/scripts/page-release/flow.mjs +36 -10
- package/scripts/page-release/stamp-content.mjs +24 -0
- package/scripts/page-release.mjs +28 -6
- package/scripts/page-size.mjs +2 -1
- package/scripts/pin-packs.ts +1 -1
- package/scripts/pins.ts +4 -4
- package/scripts/precommit-checks.mjs +1 -7
- package/scripts/precommit-jobs.mjs +0 -1
- package/scripts/precommit-source.py +1 -9
- package/scripts/program-discovery.mjs +1 -1
- package/scripts/ring-cook.mjs +2 -1
- package/scripts/ring-step.ts +1 -1
- package/scripts/script-scenario-metrics.mjs +1 -1
- package/scripts/shard-output-content.d.mts +1 -1
- package/scripts/shard-output-content.mjs +2 -2
- package/scripts/shard-outputs.mjs +1 -1
- package/scripts/shard-public.mjs +1 -1
- package/scripts/shard-wire-meter.mjs +24 -9
- package/scripts/side-parity.mjs +4 -2
- package/scripts/standalone-smoke.mjs +8 -3
- package/scripts/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +78 -0
- package/scripts/tile-bake-report.mjs +1 -1
- package/scripts/tile-bakes.mjs +1 -1
- package/scripts/title-assets.generated.json +2 -0
- package/scripts/tsconfig.json +1 -2
- package/scripts/vendor/basisu/LICENSE +201 -0
- package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
- package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
- package/scripts/vitest-push-guards.config.ts +1 -1
- package/scripts/vps/harden-apply.sh +4 -1
- package/scripts/vps/harden-prometheus.sh +176 -0
- package/scripts/vps/harden.sh +16 -0
- package/scripts/vps/rebuild.sh +18 -0
- package/scripts/vps/wildshard-config +84 -24
- package/scripts/worker-client-play.mjs +7 -2
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/scripts/worktree-reap.mjs +5 -5
- package/src/.oxlintrc.json +3 -182
- package/src/client/app/entry.ts +47 -12
- package/src/client/engine/boot/bootCache.ts +2 -2
- package/src/client/engine/boot/bootTrace.ts +12 -4
- package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
- package/src/client/engine/boot/clearDownloads.ts +5 -2
- package/src/client/engine/boot/contentRead.ts +11 -0
- package/src/client/engine/boot/gpuFiles.ts +4 -2
- package/src/client/engine/boot/lastEnd.ts +99 -12
- package/src/client/engine/boot/parsedPages.ts +127 -58
- package/src/client/engine/boot/texturePack.ts +2 -2
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +18 -0
- package/src/client/engine/core/bootstrap.ts +4 -1
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/fx/LightPool.ts +41 -1
- package/src/client/engine/net/netPlayer.ts +19 -2
- package/src/client/engine/net/otherPlayers.ts +55 -8
- package/src/client/engine/net/predictor.ts +33 -9
- package/src/client/engine/net/redial.ts +29 -6
- package/src/client/engine/pwa/cacheNames.ts +58 -1
- package/src/client/engine/pwa/sw.js +53 -14
- package/src/client/engine/render/dataLook.ts +152 -40
- package/src/client/engine/render/families/detail.ts +89 -0
- package/src/client/engine/render/families/pbr.ts +7 -1
- package/src/client/engine/render/look.ts +6 -0
- package/src/client/engine/render/lookLight.ts +103 -11
- package/src/client/engine/render/lookRender.ts +105 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/indexed.ts +2 -2
- package/src/client/engine/telemetry/browserErrors.ts +28 -4
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
- package/src/client/engine/ui/debugOptions.ts +1 -1
- package/src/client/engine/ui/lookLightOption.ts +10 -6
- package/src/client/engine/ui/namePrompt.ts +7 -0
- package/src/client/game/boot/audio.generated.ts +114 -216
- package/src/client/game/boot/bytes.generated.ts +118 -238
- package/src/client/game/boot/placedSpawn.ts +35 -0
- package/src/client/game/boot/spawnDownload.ts +25 -6
- package/src/client/game/boot/versions.generated.ts +7 -7
- package/src/client/game/devScene/hook.ts +291 -0
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +12 -2
- package/src/client/game/grid/live.ts +134 -12
- package/src/client/game/grid/liveSession.ts +47 -5
- package/src/client/game/grid/mapAtlas.ts +18 -4
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/minimapBlend.ts +15 -5
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +5 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +233 -0
- package/src/client/game/grid/placedContent.ts +85 -0
- package/src/client/game/grid/prefetch.ts +9 -1
- package/src/client/game/grid/productInputs.ts +3 -1
- package/src/client/game/grid/productLeases.ts +4 -1
- package/src/client/game/grid/products.ts +8 -4
- 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/roadLook.ts +24 -15
- package/src/client/game/grid/roadLookPlatform.ts +4 -2
- package/src/client/game/grid/roadResources.ts +24 -0
- package/src/client/game/grid/roadSign.worker.ts +4 -3
- package/src/client/game/grid/roadSignPaint.ts +16 -5
- package/src/client/game/grid/roadSignPreparation.ts +4 -3
- package/src/client/game/grid/roadSignScale.ts +8 -0
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
- package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
- package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
- package/src/client/game/grid/roadTileWriter.ts +2 -1
- package/src/client/game/grid/screenReports.ts +39 -0
- package/src/client/game/grid/session.ts +29 -4
- package/src/client/game/grid/shardfileFar.ts +9 -3
- package/src/client/game/grid/softWallLook.ts +25 -8
- package/src/client/game/mainMenu.ts +6 -2
- package/src/client/game/plugin/context.ts +2 -1
- package/src/client/game/plugin/followedMovers.ts +7 -1
- package/src/client/game/quest/figures.ts +2 -0
- package/src/client/game/session/finish.ts +11 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/assetCache.ts +4 -4
- package/src/client/game/shardfile/client.ts +4 -1
- package/src/client/game/shardfile/clientAssets.ts +9 -5
- package/src/client/game/shardfile/clientLibrary.ts +1 -1
- package/src/client/game/shardfile/clientWater.ts +51 -9
- package/src/client/game/shardfile/clientWorker.ts +21 -8
- package/src/client/game/shardfile/look.ts +8 -3
- package/src/client/game/shardfile/product.ts +34 -7
- package/src/client/game/shardfile/productChecks.ts +2 -2
- package/src/client/game/shardfile/productCost.ts +2 -2
- package/src/client/game/shardfile/readAsset.ts +2 -2
- package/src/client/game/shardfile/reflectingWater.ts +73 -0
- package/src/client/game/shardfile/seatGrace.ts +9 -0
- package/src/client/game/shardfile/skinPlayback.ts +1 -1
- package/src/client/game/systems/npc/figureRows.ts +9 -0
- package/src/client/game/titleDeck.ts +4 -3
- package/src/client/host/online/doctor.ts +2 -0
- package/src/client/host/online/linkScreens.ts +30 -4
- package/src/client/host/online/shell.ts +14 -0
- package/src/client/host/standalone/shell.ts +4 -0
- package/src/cook/game/astc6Encode.ts +55 -0
- package/src/cook/game/astc6Wasm.ts +176 -0
- package/src/cook/game/cookJob.ts +30 -6
- package/src/cook/game/cookWorker.ts +38 -11
- package/src/cook/game/entryTotals.ts +51 -24
- package/src/cook/game/shardCook.ts +67 -9
- package/src/cook/game/spawnParts.ts +33 -8
- package/src/cook/game/tierTextures.ts +349 -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/ai/bossContenders.ts +27 -3
- package/src/server/engine/ai/phases.ts +1 -1
- package/src/server/engine/entities/creatureRefill.ts +9 -2
- package/src/server/engine/net/ledgerBook.ts +2 -0
- package/src/server/engine/net/room.ts +15 -0
- package/src/server/engine/sim/respawn.ts +8 -0
- package/src/server/game/boss/arenaRoomEntry.ts +5 -1
- package/src/server/game/boss/arenaRoomNative.ts +2 -0
- package/src/server/game/boss/native.ts +2 -1
- package/src/server/game/boss/nativeWake.ts +9 -5
- package/src/server/game/boss/openArenaNative.ts +2 -2
- package/src/server/game/boss/openArenaRoom.ts +3 -1
- package/src/server/game/grid/room.ts +44 -3
- package/src/server/game/grid/simulation.ts +23 -0
- package/src/server/game/population/mixedRoster.ts +11 -3
- package/src/server/game/population/nativeBake.ts +8 -3
- package/src/server/game/population/nativeReturns.ts +6 -3
- package/src/server/game/population/roster.ts +5 -3
- package/src/server/game/quest/eliteDrops.ts +15 -4
- package/src/server/game/quest/nativeChapter.ts +1 -1
- package/src/server/game/quest/nativeComposition.ts +5 -1
- package/src/server/game/riding/nativeTaming.ts +10 -6
- package/src/server/game/riding/wildRefill.ts +3 -2
- package/src/server/game/shardfile/bossRow.ts +4 -2
- package/src/server/game/shardfile/homeKeeper.ts +4 -2
- package/src/server/host/bake/headlessWorker.ts +1 -1
- package/src/server/host/dedicated/cellHost.ts +98 -16
- package/src/server/host/dedicated/cellProtocol.ts +16 -1
- package/src/server/host/dedicated/cellWorker.ts +8 -5
- package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
- package/src/server/host/dedicated/gridCells.ts +15 -6
- package/src/server/host/dedicated/loopLag.ts +21 -0
- package/src/server/host/dedicated/main.ts +13 -5
- package/src/server/host/dedicated/packReader.ts +3 -3
- package/src/server/host/dedicated/placementFile.ts +4 -19
- package/src/server/host/dedicated/roadRoom.ts +34 -4
- package/src/server/host/dedicated/serverMetrics.ts +126 -0
- package/src/server/host/dedicated/socketPump.ts +21 -4
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +15 -4
- package/src/server/host/dedicated/world.ts +95 -8
- package/src/server/host/headless.ts +1 -1
- package/src/server/host/headlessRuntime.ts +1 -1
- package/src/server/host/standalone/roadWorld.ts +15 -3
- package/src/server/host/standalone/serverHost.ts +4 -1
- package/src/server/host/standalone/serverProduct.ts +41 -11
- package/src/shared/engine/ai/BossBrain.ts +8 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/game/boss/wake.ts +6 -0
- package/src/shared/game/devColliders.ts +47 -0
- package/src/shared/game/eliteSystem.ts +8 -0
- package/src/shared/game/grid/allocator.ts +3 -0
- package/src/shared/game/grid/catalogueSlot.ts +7 -0
- package/src/shared/game/grid/placementRows.ts +36 -0
- package/src/shared/game/plugin/bossRecord.ts +3 -2
- package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
- package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
- package/src/shared/game/shardfile/packReads.ts +28 -3
- package/src/shared/game/shardfile/serverPack.ts +9 -0
- package/src/shared/game/systems/looks/trampleField.ts +2 -0
- package/src/shared/host/formatJsonSchema.ts +2 -2
- package/src/tsconfig.json +1 -27
- package/lint/host-reviews.json +0 -14
- package/lint/listed-view-code.json +0 -13
- package/lint/platform-pending-users.json +0 -2520
- package/lint/platform-pending-users.md +0 -18
- package/scripts/cell-mem/metrics-preload.mjs +0 -65
- package/scripts/check-closed-components.d.mts +0 -7
- package/scripts/check-closed-components.mjs +0 -87
- package/scripts/g571-hosts.d.mts +0 -3
- package/scripts/g571-hosts.mjs +0 -54
- package/scripts/host-ruler/register-migrate.mjs +0 -242
- package/scripts/listed-view-code.d.mts +0 -7
- package/scripts/listed-view-code.mjs +0 -93
- package/scripts/look-loop/fit-lut.py +0 -142
- package/scripts/look-loop/palette-delta.py +0 -183
- package/scripts/look-loop/regions/driftwood-isle.json +0 -25
- package/scripts/look-loop/regions/far-reach.json +0 -225
- package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
- package/scripts/look-loop/regions/pine-hollow.json +0 -22
- package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
- package/scripts/platform-chargebacks.d.mts +0 -9
- package/scripts/platform-chargebacks.mjs +0 -135
- package/scripts/shard-component-spans.d.mts +0 -15
- package/scripts/shard-component-spans.mjs +0 -18
- package/scripts/shard-components.d.mts +0 -16
- package/scripts/shard-components.mjs +0 -363
- package/scripts/shard-platform-hosts.d.mts +0 -2
- package/scripts/shard-platform-hosts.mjs +0 -93
- package/scripts/shard-platform-sections.d.mts +0 -2
- package/scripts/shard-platform-sections.mjs +0 -9
- package/scripts/shard-platform.d.mts +0 -76
- package/scripts/shard-platform.mjs +0 -1072
- package/src/.oxfmtrc.json +0 -48
- package/src/scripts/ask-new.sh +0 -29
- package/src/scripts/asks.mjs +0 -142
- package/src/scripts/herdr-prompt.sh +0 -34
- package/src/scripts/herdr-question-open.sh +0 -67
- package/src/scripts/md-wrap.mjs +0 -229
- /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
- /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
- /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
|
@@ -104,6 +104,7 @@ import { copyMarks } from './copyIdentity';
|
|
|
104
104
|
import { CellMinimaps } from './minimapBlend';
|
|
105
105
|
import { leaseMapImage } from '../shardfile/mapImage';
|
|
106
106
|
import { crossingSaveStatus, installBorderShimmer, type BorderShimmerState, type CrossingSaveStatus } from './borderShimmer';
|
|
107
|
+
import { refusalReporter, saveFailedReporter } from './screenReports';
|
|
107
108
|
import { GAME_STRINGS } from '../../../shared/game/strings';
|
|
108
109
|
import { GridCellWaitingError, classifyRefusal, pageShardRefusals, refusalReason, type ShardRefusal } from './refusal';
|
|
109
110
|
import { tileRing } from '../shardfile/tileDriver';
|
|
@@ -113,9 +114,12 @@ import { readGridSeamData, type GridSeamAddress } from '../../../shared/game/gri
|
|
|
113
114
|
import { readCompiledGridStrips } from '../../../shared/game/grid/compiledStrips';
|
|
114
115
|
import { startRoadGrain } from './roadGrainPreparation';
|
|
115
116
|
import { startRoadSigns } from './roadSignPreparation';
|
|
117
|
+
import { RoadMapShare } from './roadResources';
|
|
116
118
|
import { clientPreparationBatch } from '../shardfile/preparationTiming';
|
|
117
119
|
|
|
118
120
|
import { admittedRuntimeProduct } from '../shardfile/runtimeProduct';
|
|
121
|
+
import { gridArea } from './area';
|
|
122
|
+
import type { ProbeArea } from '@wildshard/engine/debug/probe';
|
|
119
123
|
|
|
120
124
|
/** D12: the A1 outer ring's share of a drawn frame (ms). On the phone tier its strips, colliders and road stop 4 ms after
|
|
121
125
|
* the last drawn frame (every other build keeps WORK_SLICE_MS): streamed at the shared 8 ms it held the grid's spawn
|
|
@@ -206,6 +210,10 @@ export interface GridSessionState {
|
|
|
206
210
|
readonly shimmer: BorderShimmerState;
|
|
207
211
|
/** G555: the cell whose step-by-step loading screen is open (its entry or re-entry waits), or null */
|
|
208
212
|
readonly cellLoading: string | null;
|
|
213
|
+
/** NET-LAG NL7: the loading card's running row, by label (null: no card). */
|
|
214
|
+
readonly cellStage: string | null;
|
|
215
|
+
/** GC8: the `cell` path step that screen shows now and its detail, so a harness times each step. */
|
|
216
|
+
readonly cellStep: { readonly step: string; readonly detail: string } | null;
|
|
209
217
|
/** the allocator's grid content (MB) and the §3.2 playing total with the engine base (MB, the 1.0 GB envelope, G65) */
|
|
210
218
|
readonly residentMB: number; readonly playingMB: number;
|
|
211
219
|
/** Exact category sum before engine base, overlap allowance or calibration factor; used by the soak harness. */
|
|
@@ -369,6 +377,8 @@ export class GridSession {
|
|
|
369
377
|
private readonly shimmer: { readonly step: () => void; readonly state: () => BorderShimmerState };
|
|
370
378
|
/** G167: why a neighbour's shard can't load (its product refused, with the admission's message) and its far view's status */
|
|
371
379
|
private readonly refusals = new Map<string, ShardRefusal>();
|
|
380
|
+
/** SENTRY-TRIAGE S18: UNAVAILABLE reports once per cell a session (screenReports.ts) */
|
|
381
|
+
private readonly reportRefusal = refusalReporter();
|
|
372
382
|
private readonly issues = new Map<string, string>();
|
|
373
383
|
private readonly farViews = new Set<string>();
|
|
374
384
|
private readonly farPreparation: () => readonly FarPreparationWait[];
|
|
@@ -498,7 +508,7 @@ export class GridSession {
|
|
|
498
508
|
return compiledOuter?.strips ?? generatePlatformSliced(source.cells, source.empty, pause, OUTER_RING_STRETCH_MS, await seamPlans(), (x, z) => !ring(x, z)); // T10: built in play after controls, short stretches beside the frame
|
|
499
509
|
};
|
|
500
510
|
const roadInput = { strips, home, pitch: assembly.pitch, layout, scene: host.scene,
|
|
501
|
-
scope: roadScope, camera: () => host.frame?.camera, plans, admission, tileBacking,
|
|
511
|
+
scope: roadScope, camera: () => host.frame?.camera, plans, admission, tileBacking, maps: new RoadMapShare(),
|
|
502
512
|
...(grain === undefined ? {} : { grain: grain.get }), ...(signs === undefined ? {} : { signs: signs.get }) };
|
|
503
513
|
const pause = async (): Promise<void> => { await construction.check(); };
|
|
504
514
|
// Spawn heap (T10): no closure here may capture `compiled`. Every closure of this scope shares one context, and the
|
|
@@ -672,7 +682,9 @@ export class GridSession {
|
|
|
672
682
|
const look = { instance: cell.instance, x: edge.x, z: edge.z, axis: edge.axis, halfLength: edge.halfLength };
|
|
673
683
|
return cell.edgeLook === undefined ? look : Object.assign(look, { height: cell.edgeLook.height });
|
|
674
684
|
})),
|
|
675
|
-
|
|
685
|
+
// GC12: drawn only while the traveller stands at that edge (the feet in the home frame)
|
|
686
|
+
ports: { closed: (id) => this.live === null || !this.live.live.ready(id),
|
|
687
|
+
feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; } } });
|
|
676
688
|
// QA 2026-11-13: a waiting cell's loading steps on SHARD SELECT's loading card, inset over the live world
|
|
677
689
|
this.cellLoading = new CellLoading(new CellLoadingCard(), (waiting) => this.neighbours.some(row => row.instance === waiting));
|
|
678
690
|
setParkedMatricesFrozen(true); // G580 T2: a hidden parked world skips matrix updates during its warm-up
|
|
@@ -680,10 +692,15 @@ export class GridSession {
|
|
|
680
692
|
// G78: a shimmer line at every shard border on its real ground; G119: SAVING… / SAVE FAILED, RETRY while a crossing waits
|
|
681
693
|
const rows = new Map((edges ?? []).map((cell) => [cell.instance, cell.edges]));
|
|
682
694
|
let status: CrossingSaveStatus = null, polled = 0;
|
|
695
|
+
// S18: SAVE FAILED, RETRY reports the first time a session shows it
|
|
696
|
+
const reportSave = saveFailedReporter((id) => { try { return id === null ? '' : this.assembly.cell(id).slug; } catch { return ''; } });
|
|
683
697
|
this.shimmer = installBorderShimmer({ scene: host.scene, scope: host.scope, time: () => app.clock.now,
|
|
684
698
|
cells: this.assembly.cells.map((cell) => ({ x: cell.origin.x - home.origin.x, z: cell.origin.z - home.origin.z, edges: rows.get(cell.instance) ?? null })),
|
|
685
699
|
ports: { feet: () => { const at = this.world(); return { x: at.x - home.origin.x, z: at.z - home.origin.z }; },
|
|
686
|
-
status: () => {
|
|
700
|
+
status: () => {
|
|
701
|
+
if (++polled % 4 === 0) { const crossing = this.live?.state().crossing; status = crossingSaveStatus(crossing); reportSave(status, crossing); }
|
|
702
|
+
return status;
|
|
703
|
+
},
|
|
687
704
|
text: (shown) => (shown === 'saving' ? GAME_STRINGS.grid.saving : GAME_STRINGS.grid.saveFailed) } });
|
|
688
705
|
this.constructorTiming?.('presentation');
|
|
689
706
|
const nativeOrigin = { origin: { x: 0, z: 0 } };
|
|
@@ -945,6 +962,7 @@ export class GridSession {
|
|
|
945
962
|
const refusal = classifyRefusal(error);
|
|
946
963
|
if (refusal === null || this.host.scope.disposed) return;
|
|
947
964
|
console.warn(`[grid] ${cell.instance} can't load (${refusal}):`, error);
|
|
965
|
+
this.reportRefusal(cell.instance, cell.slug, refusal, error);
|
|
948
966
|
this.refusals.set(cell.instance, refusal); this.issues.set(cell.instance, error instanceof Error ? error.message : String(error)); pageShardRefusals().note(cell.slug, refusal);
|
|
949
967
|
}
|
|
950
968
|
/**
|
|
@@ -1208,6 +1226,13 @@ export class GridSession {
|
|
|
1208
1226
|
* This runs only the presentation frame; no neighbour tick, input, physics or simulation is advanced. */
|
|
1209
1227
|
prepareFrame(): void { this.frame?.frame(); }
|
|
1210
1228
|
|
|
1229
|
+
/** T2E-1b: the cell the player is in, as the test probe reads it (its shard, door panels and the server's flags there).
|
|
1230
|
+
* Without a live host no region is admitted, so no panel reads solid. */
|
|
1231
|
+
area(): ProbeArea | null {
|
|
1232
|
+
return gridArea({ current: this.live === null ? this.home.instance : this.live.live.current(), cells: this.assembly.cells,
|
|
1233
|
+
targets: id => this.panels.targets(id), flags: id => this.live?.areaFlags(id) ?? [] });
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1211
1236
|
/** The readout: what each cell shows, the rings and the allocator. */
|
|
1212
1237
|
state(): GridSessionState {
|
|
1213
1238
|
const pending = bootWaits();
|
|
@@ -1222,7 +1247,7 @@ export class GridSession {
|
|
|
1222
1247
|
pitch: this.assembly.pitch,
|
|
1223
1248
|
home: this.home.instance, inside: gridCells.cell?.instance ?? null, feet: { x: Math.round(at.x * 100) / 100, z: Math.round(at.z * 100) / 100 },
|
|
1224
1249
|
cells: this.assembly.cells.map((cell) => { const d = drawn(cell.instance); return { instance: cell.instance, slug: cell.slug, cell: cell.cell, shows: shows(cell.instance, d), drawn: d }; }),
|
|
1225
|
-
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: this.cellLoading.open, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
|
|
1250
|
+
strips: this.strips.length, road: this.road, seams: this.seams, softWalls: this.softWalls.state(), shimmer: this.shimmer.state(), cellLoading: this.cellLoading.open, cellStage: this.cellLoading.stage, cellStep: this.cellLoading.now, ringsReady: this.rings.ready(), ringsWait: { cells: this.rings.waiting(), far: this.rings.farPlan(), preparation: this.farPreparation(), waits: { count: pending.length, oldest: pending.map(({ label, kind, ageMs }) => ({ label, kind, ageMs })).sort((a, b) => b.ageMs - a.ageMs).slice(0, 16) } },
|
|
1226
1251
|
residentMB: Math.round(cost.accounted / 1e4) / 100, playingMB: Math.round(cost.playing / 1e4) / 100,
|
|
1227
1252
|
accountedBytes: cost.accounted,
|
|
1228
1253
|
rings: { frame: stats.frame, far: stats.resident.far, l1: stats.resident.l1, l0: stats.resident.l0, refused: stats.refused, inFlight: stats.inFlight, queued: stats.queued,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Mesh, type BufferGeometry, type Object3D } from 'three';
|
|
2
2
|
import { prepareRigLoader } from '@wildshard/engine/anim/rig';
|
|
3
|
+
import { workSlice } from '@wildshard/engine/core/workSlice';
|
|
3
4
|
import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
4
5
|
import { NEAR_COLOUR, NEAR_LIGHT, nearPlaceholderCost, type NearPlaceholder } from '@wildshard/format/nearPlaceholder';
|
|
5
6
|
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
@@ -63,16 +64,21 @@ export async function loadShardfileNear(rows: ShardfileNearRows, read: (ref: str
|
|
|
63
64
|
const near = rows.near;
|
|
64
65
|
if (near.content.length === 0) throw new Error('Shardfile declares no near content');
|
|
65
66
|
const cost = nearPlaceholderCost(near, rows.inventory), loader = (await prepareRigLoader()).createRigLoader(), parts: BufferGeometry[] = [], lights: BufferGeometry[] = [], colours: BufferGeometry[] = [];
|
|
67
|
+
// GC36 / RP4: a neighbour's near placeholder loads while the traveller walks to its edge. Baking every mesh's pose in one
|
|
68
|
+
// go held the frame 60 to 170 ms per content file (Chromium, Driftwood to Sunscar); it now lets a frame through between meshes.
|
|
69
|
+
const slice = workSlice();
|
|
66
70
|
try {
|
|
67
71
|
for (const ref of near.content) {
|
|
68
72
|
const gltf = await loader.parseAsync((await read(ref)).slice().buffer, '');
|
|
69
73
|
gltf.scene.updateMatrixWorld(true);
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
const meshes: Mesh[] = [];
|
|
75
|
+
gltf.scene.traverse(node => { if (isMesh(node)) meshes.push(node); });
|
|
76
|
+
for (const node of meshes) {
|
|
77
|
+
await slice.check();
|
|
72
78
|
for (const material of Array.isArray(node.material) ? node.material : [node.material]) material.dispose();
|
|
73
79
|
// NM13: the light layer stays apart from the lit draw (drawn additively, unlit)
|
|
74
80
|
(node.name === NEAR_LIGHT ? lights : node.name === NEAR_COLOUR ? colours : parts).push(node.geometry.applyMatrix4(node.matrixWorld));
|
|
75
|
-
}
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
} catch (error) { for (const part of [...parts, ...lights, ...colours]) part.dispose(); throw error; }
|
|
78
84
|
const [first] = parts;
|
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
* One draw for every wall (a curtain quad per edge, additive, faded out past ~70 m so a 500 m wall never dominates the
|
|
8
8
|
* view). Which walls are closed comes from the session each fixed step; a wall opens the moment its neighbour is ready.
|
|
9
|
+
*
|
|
10
|
+
* GC12 (Jake, 2026-11-13 ~22:50 Cancún, board A): the wall shows only when a player meets a closed edge. A closed wall is drawn
|
|
11
|
+
* while the traveller's feet stand within `MEET_METRES` of it, so a warm crossing (or a wall seen from across the cell) never
|
|
12
|
+
* shows it; the readiness wall itself still holds at every closed edge.
|
|
9
13
|
*/
|
|
10
14
|
import { AdditiveBlending, BufferAttribute, BufferGeometry, Color, DoubleSide, DynamicDrawUsage, Group, Mesh, type Object3D, ShaderMaterial } from 'three';
|
|
11
15
|
import type { LookScope } from '../../../shared/game/grid/roadLayout';
|
|
@@ -15,9 +19,19 @@ export interface SoftWallEdge { readonly instance: string; readonly x: number; r
|
|
|
15
19
|
/** What the look reads each fixed step. */
|
|
16
20
|
export interface SoftWallPorts {
|
|
17
21
|
readonly closed: (instance: string) => boolean;
|
|
22
|
+
/** the traveller's feet in the home frame; absent: every closed wall shows, as before GC12 */
|
|
23
|
+
readonly feet?: () => { readonly x: number; readonly z: number };
|
|
24
|
+
}
|
|
25
|
+
/** GC12: how near a closed edge the feet must stand for its wall to show (a player at the wall, a stride or two short of it). */
|
|
26
|
+
export const MEET_METRES = 6;
|
|
27
|
+
/** Distance from the feet to an edge's wall segment, in the home frame. */
|
|
28
|
+
export function edgeDistance(edge: SoftWallEdge, feet: { readonly x: number; readonly z: number }): number {
|
|
29
|
+
const dx = feet.x - edge.x, dz = feet.z - edge.z;
|
|
30
|
+
const across = edge.axis === 'x' ? dx : dz, along = edge.axis === 'x' ? dz : dx;
|
|
31
|
+
return Math.hypot(across, Math.max(0, Math.abs(along) - edge.halfLength));
|
|
18
32
|
}
|
|
19
|
-
/** The readout: how many neighbour edges are closed. */
|
|
20
|
-
export interface SoftWallState { readonly closed: number }
|
|
33
|
+
/** The readout: how many neighbour edges are closed, and how many of those show (GC12: the ones the traveller meets). */
|
|
34
|
+
export interface SoftWallState { readonly closed: number; readonly shown: number }
|
|
21
35
|
|
|
22
36
|
const HEIGHT = 7, CYAN = new Color(0x38e6ff);
|
|
23
37
|
|
|
@@ -99,18 +113,21 @@ export function installSoftWallLook(input: { readonly edges: readonly SoftWallEd
|
|
|
99
113
|
const closedAttr = wall.geometry.getAttribute('aClosed');
|
|
100
114
|
group.add(wall); scene.add(group);
|
|
101
115
|
const flags = edges.map(() => -1);
|
|
102
|
-
let closedCount = 0;
|
|
116
|
+
let closedCount = 0, shownCount = 0;
|
|
103
117
|
const step = (): void => {
|
|
104
118
|
uTime.value = input.time();
|
|
105
|
-
closedCount = 0;
|
|
119
|
+
closedCount = 0; shownCount = 0;
|
|
120
|
+
const feet = ports.feet?.();
|
|
106
121
|
for (let k = 0; k < edges.length; k++) {
|
|
107
122
|
const edge = edges[k];
|
|
108
123
|
if (edge === undefined) continue;
|
|
109
|
-
const closed = ports.closed(edge.instance)
|
|
110
|
-
if (closed
|
|
111
|
-
|
|
124
|
+
const closed = ports.closed(edge.instance);
|
|
125
|
+
if (closed) closedCount++;
|
|
126
|
+
const shown = closed && (feet === undefined || edgeDistance(edge, feet) <= MEET_METRES) ? 1 : 0;
|
|
127
|
+
shownCount += shown;
|
|
128
|
+
if (flags[k] !== shown) { flags[k] = shown; for (let c = 0; c < 4; c++) closedAttr.setX(k * 4 + c, shown); closedAttr.needsUpdate = true; }
|
|
112
129
|
}
|
|
113
130
|
};
|
|
114
131
|
scope.onDispose(() => { group.removeFromParent(); wall.geometry.dispose(); material.dispose(); });
|
|
115
|
-
return { step, state: () => ({ closed: closedCount }) };
|
|
132
|
+
return { step, state: () => ({ closed: closedCount, shown: shownCount }) };
|
|
116
133
|
}
|
|
@@ -40,6 +40,10 @@ const LOW_POWER_BANNER = 'Low Power Mode is on, so you\'re on Low graphics. Turn
|
|
|
40
40
|
export const MAIN_MENU_HERO: string = titleAssetURL('/assets/title/main-crossroads-landscape.jpg');
|
|
41
41
|
/** Square title artwork shared by the menu deck. */
|
|
42
42
|
export const MAIN_MENU_SQUARE_HERO: string = titleAssetURL('/assets/title/main-crossroads-square.jpg');
|
|
43
|
+
/** PZ19: the shell's ~30 kB first cuts of both heroes; the menu layers the full image over its first cut, so the art never
|
|
44
|
+
* blanks while the full image arrives, and the full image is fetched only once the title is up. */
|
|
45
|
+
const FIRST_HERO: string = titleAssetURL('/assets/title/main-crossroads-landscape-first.jpg');
|
|
46
|
+
const FIRST_SQUARE_HERO: string = titleAssetURL('/assets/title/main-crossroads-square-first.jpg');
|
|
43
47
|
|
|
44
48
|
const CARDS_ICON = '<svg viewBox="0 0 64 48" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"><rect x="6" y="11" width="18" height="27" rx="2" transform="rotate(-16 15 24)"/><rect x="40" y="11" width="18" height="27" rx="2" transform="rotate(16 49 24)"/><rect x="22" y="4" width="20" height="31" rx="2" fill="rgba(6,10,18,0.85)"/></g></svg>';
|
|
45
49
|
const GRID_CELLS = [0, 1, 2].flatMap((r) => [0, 1, 2].map((c) => `<rect x="${17 + c * 11}" y="${6 + r * 13}" width="8" height="9" rx="1"/>`)).join('');
|
|
@@ -125,8 +129,8 @@ export function buildTitleMenu(opts: TitleMenuOptions): TitleMenu {
|
|
|
125
129
|
${online ? `<div class="ws-main-row"><button class="ws-main-settings ws-main-doctor" type="button"><i class="ws-main-doctor-dot" aria-hidden="true"></i>${s.checkConnection}</button></div>` : ''}
|
|
126
130
|
</div>`;
|
|
127
131
|
const hero = required(main, '.ws-main-hero', HTMLElement);
|
|
128
|
-
hero.style.setProperty('--ws-hero-landscape', `url('${MAIN_MENU_HERO}')`);
|
|
129
|
-
hero.style.setProperty('--ws-hero-square', `url('${MAIN_MENU_SQUARE_HERO}')`);
|
|
132
|
+
hero.style.setProperty('--ws-hero-landscape', `url('${MAIN_MENU_HERO}'), url('${FIRST_HERO}')`);
|
|
133
|
+
hero.style.setProperty('--ws-hero-square', `url('${MAIN_MENU_SQUARE_HERO}'), url('${FIRST_SQUARE_HERO}')`);
|
|
130
134
|
if (notice !== undefined && notice !== '') {
|
|
131
135
|
const line = document.createElement('div');
|
|
132
136
|
line.className = 'ws-main-notice';
|
|
@@ -19,6 +19,7 @@ import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
|
19
19
|
import { ownedPresentationImages } from '../shardfile/presentation';
|
|
20
20
|
import { lookLightManifest } from '@wildshard/engine/render/lookLight';
|
|
21
21
|
import { lookLightOn } from '@wildshard/engine/ui/lookLightOption';
|
|
22
|
+
import { TIER } from '@wildshard/engine/core/tier';
|
|
22
23
|
import { absentShardProduct, type ShardProduct } from '../../../shared/game/shardfile/shardProduct';
|
|
23
24
|
|
|
24
25
|
|
|
@@ -163,7 +164,7 @@ export function sourceManifest(source: Pick<Shardfile, 'identity' | 'accent' | '
|
|
|
163
164
|
const slug = parseShardSlug(source.identity.slug);
|
|
164
165
|
const images = imageOwner === undefined ? undefined : ownedPresentationImages(source, assets, imageOwner);
|
|
165
166
|
// LF1-4: the look's light settings (height fog, bloom, desktop AO) behind Settings ▸ Debug ▸ Look ▸ "Look light"
|
|
166
|
-
const light = lookLightManifest(source.look, lookLightOn());
|
|
167
|
+
const light = lookLightManifest(source.look, lookLightOn(), TIER);
|
|
167
168
|
const card = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/%3E';
|
|
168
169
|
return {
|
|
169
170
|
...(source.navigation === null || source.navigation === undefined || navigation === undefined ? {} : { navigation: { row: source.navigation, bytes: navigation } }),
|
|
@@ -179,6 +179,12 @@ export function installFollowedMovers(ctx: LevelContext, world: World, options:
|
|
|
179
179
|
ctx.scope.onDispose(() => { if (movers.riding()) world.player.carried = false; });
|
|
180
180
|
if (options.onDispose !== undefined) ctx.scope.onDispose(options.onDispose);
|
|
181
181
|
ctx.debug.expose(`movers.${options.systemId}`, { showRest: () => { movers.showRest(); } }); // the map bake poses movers at rest
|
|
182
|
-
|
|
182
|
+
// GC30b: the scope frees these movers' bodies, so their views leave the wire with it, or the next row of that id poses a freed
|
|
183
|
+
// body ("null pointer passed to rust"). Only this cell's own view: another cell may have lent one under the same id since.
|
|
184
|
+
for (const row of options.data) {
|
|
185
|
+
const view: MoverView = { pose: pose => { wirePage.posed++; movers.follow(row.id, pose); }, place: (at, next) => { movers.replayPose(row.id, at, next); } };
|
|
186
|
+
wirePage.movers.set(row.id, view);
|
|
187
|
+
ctx.scope.onDispose(() => { if (wirePage.movers.get(row.id) === view) wirePage.movers.delete(row.id); });
|
|
188
|
+
}
|
|
183
189
|
return movers;
|
|
184
190
|
}
|
|
@@ -84,6 +84,8 @@ export function questFigure(row: QuestFigureRows, ports: QuestFigurePorts): KitF
|
|
|
84
84
|
const figure = new KitFigure(ports.sky, row.kit, ports.catalogue.rows(row.kit), ports.catalogue.kit(row.kit),
|
|
85
85
|
{ geometry, objects, channels: ports.channels }, ports.resources, ports.scope);
|
|
86
86
|
figure.group.position.set(feet.x, feet.y, feet.z); figure.group.rotation.y = yaw;
|
|
87
|
+
// its body box was read at the origin, before the figure stood at its feet
|
|
88
|
+
figure.presentation.syncAnchors();
|
|
87
89
|
return figure;
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -29,6 +29,7 @@ import { textureBytes } from '@wildshard/engine/render/textureBytes';
|
|
|
29
29
|
import { setPoseProvider } from '@wildshard/engine/ui/ReloadPrompt';
|
|
30
30
|
import { lastEnd, registerBeforeReload } from '@wildshard/engine/boot/lastEnd';
|
|
31
31
|
import { gridPrefetchOrder, startGridPrefetch } from '../grid/prefetch';
|
|
32
|
+
import { shardArea } from '../grid/area';
|
|
32
33
|
import { admittedRuntimeProduct, completeManifestCache, releaseManifestTransport } from '../shardfile/runtimeProduct';
|
|
33
34
|
import { enterSkyClock } from './clockSettings';
|
|
34
35
|
import { settleEntryPrograms } from './settlePrograms';
|
|
@@ -392,7 +393,16 @@ export async function finishStage(ctx: Awaited<ReturnType<typeof playStage>>): P
|
|
|
392
393
|
ctx.session.residency?.bindComposer(game, game.engineScope, TIER);
|
|
393
394
|
game.captureLevelResources();
|
|
394
395
|
game.levelScope.onDispose(() => { windupWarn?.dispose(); weapons.setEnabled(false); boot.runtime.hooks.dispose?.(); audio.unloadLevel(); });
|
|
395
|
-
|
|
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() });
|
|
400
|
+
// SHARD-SOURCE AP5 (J347): a DEVSERVER page carries the dev hook sharddev's `watch` page script drives; a production
|
|
401
|
+
// build's define makes this `false` in this module, so the import and its chunk go (scripts/check-devserver.mjs checks;
|
|
402
|
+
// DEVSERVER imported from grid/menu did not fold across modules and kept the chunk).
|
|
403
|
+
if (typeof __DEVSERVER__ === 'boolean' && __DEVSERVER__) void import('../devScene/hook').then(dev => dev.installDevHook({ scope: game.levelScope, scene: game.rootScene, physics: () => world.physics,
|
|
404
|
+
look: () => game.look, server: () => window.__workerClientDevColliders ?? null, watchFrames: fn => game.watchFrames(fn) }))
|
|
405
|
+
.catch((cause: unknown) => { console.error('[devScene]', cause); });
|
|
396
406
|
ctx.startExplore?.();
|
|
397
407
|
document.dispatchEvent(new Event('ws:ready')); // booted to the title
|
|
398
408
|
const completeOfflineCopy = async (): Promise<void> => {
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assetCacheName } from '@wildshard/engine/pwa/cacheNames';
|
|
2
2
|
import { readContentResponse } from '@wildshard/engine/boot/readContentResponse';
|
|
3
3
|
|
|
4
4
|
type ReadStorage = Pick<CacheStorage, 'open'> & Partial<Pick<CacheStorage, 'match'>>;
|
|
@@ -7,9 +7,9 @@ type ReadStorage = Pick<CacheStorage, 'open'> & Partial<Pick<CacheStorage, 'matc
|
|
|
7
7
|
async function matchAsset(storage: ReadStorage, url: string): Promise<Response | undefined> {
|
|
8
8
|
try {
|
|
9
9
|
const match = storage.match;
|
|
10
|
-
if (match !== undefined) return await match.call(storage, url, { cacheName:
|
|
10
|
+
if (match !== undefined) return await match.call(storage, url, { cacheName: assetCacheName(), ignoreVary: true });
|
|
11
11
|
} catch { /* The existing read port may still be available. */ }
|
|
12
|
-
return (await storage.open(
|
|
12
|
+
return (await storage.open(assetCacheName())).match(url, { ignoreVary: true });
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/** Shared service-worker URL storage, without a page index, queue or leases. */
|
|
@@ -38,7 +38,7 @@ export async function cacheAsset(storage: Pick<CacheStorage, 'open'>, url: strin
|
|
|
38
38
|
const type = path.endsWith('.wasm') ? 'application/wasm' : path.endsWith('.json') ? 'application/json'
|
|
39
39
|
: path.endsWith('.glb') ? 'model/gltf-binary' : path.endsWith('.ktx2') ? 'image/ktx2' : 'application/octet-stream';
|
|
40
40
|
try {
|
|
41
|
-
await (await storage.open(
|
|
41
|
+
await (await storage.open(assetCacheName())).put(url, new Response(Uint8Array.from(bytes), {
|
|
42
42
|
headers: { 'content-type': type, 'content-length': String(bytes.length) },
|
|
43
43
|
}));
|
|
44
44
|
return true;
|
|
@@ -285,7 +285,10 @@ export class ShardfileClient {
|
|
|
285
285
|
worldStep(ctx, 'item models');
|
|
286
286
|
this.skins = await loadClientSkins(this.source, this.assets.retained, presentation.compile, ctx.scope);
|
|
287
287
|
worldStep(ctx, 'skins');
|
|
288
|
-
|
|
288
|
+
// M4.6: a planar pool's ripples run on the game clock
|
|
289
|
+
const waterClocks: ((dt: number) => void)[] = [];
|
|
290
|
+
installClientWater(undrawnWater(this.source.water, this.plan?.features ?? []), { root: ctx.root, scope: ctx.scope, materials: presentation.materials, outline: presentation.outline, frame: (run) => { waterClocks.push(run); } });
|
|
291
|
+
if (waterClocks.length > 0) ctx.system({ id: 'game.shardfile.water', phase: 'update', run: (dt) => { for (const run of waterClocks) run(dt); } });
|
|
289
292
|
const nativeWorld = this.nativeFeatures || this.mode === 'presentation';
|
|
290
293
|
const start = nativeWorld ? ctx.manifest.spawn : this.source.spawn;
|
|
291
294
|
const collider = nativeWorld && this.source.terrain !== null ? await this.assets.read(this.source.terrain.collider) : undefined;
|
|
@@ -4,9 +4,12 @@ import { memoryAttribution } from '@wildshard/engine/core/memoryAttribution';
|
|
|
4
4
|
|
|
5
5
|
import { boundedResponse, type ProductOptions } from './product';
|
|
6
6
|
import { outputBlobUrl, outputDescriptor } from '../../../shared/game/shardfile/outputDescriptor';
|
|
7
|
-
import { readPackWhole, releasePackWholes } from '../../../shared/game/shardfile/packReads';
|
|
7
|
+
import { packMissing, packOrLoose, readPackWhole, releasePackWholes } from '../../../shared/game/shardfile/packReads';
|
|
8
8
|
import type { Shardfile } from '@wildshard/format/shardSchema';
|
|
9
9
|
|
|
10
|
+
/** PZ7: the marker for "read this member loose" */
|
|
11
|
+
const LOOSE = new Uint8Array(0);
|
|
12
|
+
|
|
10
13
|
/** Release admitted transport copies after decoding; revisiting a tile rechecks immutable bytes from cache or the product. */
|
|
11
14
|
export class ClientAssets {
|
|
12
15
|
private readonly wire: Map<string, Uint8Array>;
|
|
@@ -105,9 +108,10 @@ export class ClientAssets {
|
|
|
105
108
|
const packs = outputDescriptor(this.source)?.index.packs;
|
|
106
109
|
const pack = packs?.find(row => row.entries.some(entry => entry.hash === ref));
|
|
107
110
|
const member = pack?.entries.find(entry => entry.hash === ref);
|
|
108
|
-
if (packs === undefined || pack === undefined || member === undefined) return undefined;
|
|
111
|
+
if (packs === undefined || pack === undefined || member === undefined || packMissing(pack)) return undefined;
|
|
109
112
|
if (member.bytes !== cap) throw new Error('Resident packed member size mismatch');
|
|
110
|
-
|
|
113
|
+
// PZ7: a pack that is not published (or fails) leaves the member to its loose blob (an abort still throws)
|
|
114
|
+
const wire = await packOrLoose(() => readPackWhole(packs, pack, async (path, maximum) => {
|
|
111
115
|
|
|
112
116
|
const fetch = priority === 'low' ? this.options.backgroundFetch ?? this.options.fetch : this.options.fetch;
|
|
113
117
|
const response = await fetch(new URL(path, this.options.base).href);
|
|
@@ -115,8 +119,8 @@ export class ClientAssets {
|
|
|
115
119
|
const bytes = await boundedResponse(response, maximum);
|
|
116
120
|
|
|
117
121
|
return this.observe(pack.hash, bytes);
|
|
118
|
-
}, bytes => this.hashOf(bytes), this.options.hash);
|
|
119
|
-
return wire.slice(member.offset, member.offset + member.bytes);
|
|
122
|
+
}, bytes => this.hashOf(bytes), this.options.hash), () => Promise.resolve(LOOSE));
|
|
123
|
+
return wire === LOOSE ? undefined : wire.slice(member.offset, member.offset + member.bytes);
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
/** SHA-256 of `bytes` off the page (an owned copy through `hashOwned`), else on the page. */
|
|
@@ -46,7 +46,7 @@ export async function leaseClientLibrary(source: Shardfile, assets: ReadonlyMap<
|
|
|
46
46
|
}
|
|
47
47
|
for (const hash of source.requires.commons) {
|
|
48
48
|
const bytes = assets.get(`commons:${hash}`) ?? await ports.read?.(`commons:${hash}`); if (bytes === undefined) throw new Error('Missing admitted commons residency');
|
|
49
|
-
const { assetCost, prepareAssetDecoders } = await import('@wildshard/format/
|
|
49
|
+
const { assetCost, prepareAssetDecoders } = await import('@wildshard/format/shardfileAssets');
|
|
50
50
|
await prepareAssetDecoders();
|
|
51
51
|
const cost = assetCost('commons', bytes);
|
|
52
52
|
claims.push({ id: `commons:${hash}`, category: 'commons', bytes: cost.decoded + cost.gpu, owner: 'platform', distance: 0, needed: true });
|
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
* a stream a ribbon through its points at their levels, the sea a cell-wide plane. The surface is `materials.get('water')`
|
|
6
6
|
* when the look declares one, else the default water surface (`defaultWaterMaterial`, LF1-3: a no-code shard has no client
|
|
7
7
|
* plan to draw a graph surface, so this is its pond); a graph surface that declares `stages.outline` draws its hull
|
|
8
|
-
* through `outline` (`clientMaterials().outline`).
|
|
8
|
+
* through `outline` (`clientMaterials().outline`). A pool that declares its `surface` (TEMPLATES-CLEANROOM M4.6) draws
|
|
9
|
+
* that instead: a planar mirror on the desktop tier (`reflectingWater.ts`), the default surface in its tint and Fresnel
|
|
10
|
+
* otherwise.
|
|
9
11
|
*/
|
|
10
12
|
import { BufferAttribute, BufferGeometry, CircleGeometry, Mesh, MeshStandardMaterial, PlaneGeometry, Shape, ShapeGeometry, Vector2, type Material, type Object3D } from 'three';
|
|
11
13
|
import type { Scope } from '@wildshard/engine/app/scope';
|
|
12
14
|
import { patchShader } from '@wildshard/engine/render/shaderPatches';
|
|
13
15
|
import type { ShardWater } from '@wildshard/format/water';
|
|
16
|
+
import type { PoolSurface } from '@wildshard/format/pool-surface';
|
|
17
|
+
import { TIER } from '@wildshard/engine/core/tier';
|
|
18
|
+
import { mirrorPool } from './reflectingWater';
|
|
14
19
|
import type { GraphOutlineHook } from './clientGraphs';
|
|
15
20
|
import type { ClientFeatureRow } from '@wildshard/format/clientPlan';
|
|
16
21
|
|
|
@@ -51,9 +56,9 @@ export function undrawnWater(water: ShardWater, features: readonly ClientFeature
|
|
|
51
56
|
* normal rippled from world position (faded with distance, so far water stays flat and does not shimmer), reflected
|
|
52
57
|
* into a sky made from the shard's own light (its fog colour at the horizon, its hemisphere's sky colour above, its key
|
|
53
58
|
* light's glint), Fresnel-weighted; the alpha rises with the Fresnel, so water looked into shows its bed. */
|
|
54
|
-
const
|
|
59
|
+
const waterGlsl = (base: string, power: string, ripple: string, alpha: boolean): string => `{
|
|
55
60
|
vec3 wsV = normalize(vViewPosition), wsUpV = normalize((viewMatrix * vec4(0.0, 1.0, 0.0, 0.0)).xyz);
|
|
56
|
-
vec2 wsP = vWsWaterWorld.xz;
|
|
61
|
+
vec2 wsP = vWsWaterWorld.xz * ${ripple};
|
|
57
62
|
float wsFade = 1.0 / (1.0 + length(vViewPosition) * 0.06);
|
|
58
63
|
vec2 wsSlope = vec2(sin(wsP.x * 1.7 + sin(wsP.y * 0.9) * 1.3) + 0.6 * sin(wsP.y * 2.3 + wsP.x * 0.6),
|
|
59
64
|
cos(wsP.y * 1.9 + sin(wsP.x * 1.1) * 1.2) + 0.5 * cos(wsP.x * 2.9 - wsP.y * 0.7)) * 0.045 * wsFade;
|
|
@@ -71,11 +76,13 @@ const DEFAULT_WATER_GLSL = `{
|
|
|
71
76
|
float wsSun = max(dot(wsR, directionalLights[ 0 ].direction), 0.0);
|
|
72
77
|
wsWaterSky += directionalLights[ 0 ].color * (pow(wsSun, 600.0) * 2.5 + pow(wsSun, 10.0) * 0.3);
|
|
73
78
|
#endif
|
|
74
|
-
float wsFres =
|
|
79
|
+
float wsFres = ${base} + (1.0 - ${base}) * pow(1.0 - clamp(dot(wsN, wsV), 0.0, 1.0), ${power});
|
|
75
80
|
outgoingLight = mix(outgoingLight, wsWaterSky, wsFres);
|
|
76
|
-
diffuseColor.a = mix(diffuseColor.a, 1.0, wsFres);
|
|
81
|
+
${alpha ? 'diffuseColor.a = mix(diffuseColor.a, 1.0, wsFres);' : ''}
|
|
77
82
|
}
|
|
78
83
|
`;
|
|
84
|
+
const DEFAULT_WATER_GLSL = waterGlsl('0.22', '3.0', '1.0', true);
|
|
85
|
+
const glslFloat = (n: number): string => n.toFixed(4);
|
|
79
86
|
|
|
80
87
|
/** The default water surface (LF1-3) for a declared body the look gives no `water` material: three's standard material
|
|
81
88
|
* (so the engine's fog, shadow and light patches apply as to any other) with a deep tint, a sky reflection and a Fresnel
|
|
@@ -94,15 +101,50 @@ export function defaultWaterMaterial(): MeshStandardMaterial {
|
|
|
94
101
|
return material;
|
|
95
102
|
}
|
|
96
103
|
|
|
104
|
+
/** M4.6: a declared surface's sky water (`reflect: 'sky'`, or `planar` on the phone tier): the default surface's program
|
|
105
|
+
* with the surface's opaque tint, Fresnel and ripple scale (its own program, keyed by those values). */
|
|
106
|
+
export function skyWaterMaterial(look: PoolSurface): MeshStandardMaterial {
|
|
107
|
+
const material = new MeshStandardMaterial({ roughness: 0.12, metalness: 0 });
|
|
108
|
+
material.color.setRGB(look.tint[0], look.tint[1], look.tint[2]);
|
|
109
|
+
material.name = 'water-sky';
|
|
110
|
+
const glsl = waterGlsl(glslFloat(look.fresnel[0]), glslFloat(look.fresnel[1]), glslFloat(Math.max(0.05, look.ripple.scale / 2)), false);
|
|
111
|
+
const key = `m46-sky-water-${glsl.length}-${look.fresnel.join('-')}-${String(look.ripple.scale)}`;
|
|
112
|
+
patchShader(material, key, 100, (shader): void => {
|
|
113
|
+
shader.vertexShader = shader.vertexShader
|
|
114
|
+
.replace('#include <common>', '#include <common>\nvarying vec3 vWsWaterWorld;')
|
|
115
|
+
.replace('#include <project_vertex>', '#include <project_vertex>\nvWsWaterWorld = (modelMatrix * vec4(transformed, 1.0)).xyz;');
|
|
116
|
+
shader.fragmentShader = shader.fragmentShader
|
|
117
|
+
.replace('#include <common>', '#include <common>\nvarying vec3 vWsWaterWorld;')
|
|
118
|
+
.replace('#include <opaque_fragment>', `${glsl}#include <opaque_fragment>`);
|
|
119
|
+
}, { key });
|
|
120
|
+
return material;
|
|
121
|
+
}
|
|
122
|
+
|
|
97
123
|
/** Draw every declared water body's surface under `root`; the scope takes the meshes, geometry and default material. */
|
|
98
|
-
export function installClientWater(water: ShardWater, ports: { root: Object3D; scope: Scope; materials?: ReadonlyMap<string, Material>; outline?: GraphOutlineHook }): readonly Mesh[] {
|
|
124
|
+
export function installClientWater(water: ShardWater, ports: { root: Object3D; scope: Scope; materials?: ReadonlyMap<string, Material>; outline?: GraphOutlineHook; frame?: (run: (dt: number) => void) => void }, tier: string = TIER): readonly Mesh[] {
|
|
99
125
|
if (water.length === 0) return [];
|
|
100
|
-
const
|
|
126
|
+
const declared = ports.materials?.get('water');
|
|
127
|
+
let fallback: Material | null = null;
|
|
128
|
+
const material = (): Material => declared ?? (fallback ??= ports.scope.own(defaultWaterMaterial()));
|
|
101
129
|
return water.map((body) => {
|
|
102
|
-
const
|
|
130
|
+
const look = body.kind === 'pool' ? body.surface : undefined;
|
|
131
|
+
if (body.kind === 'pool' && look !== undefined && declared === undefined) {
|
|
132
|
+
if (look.reflect === 'planar' && tier !== 'phone') {
|
|
133
|
+
const pool = mirrorPool(body.shape, body.level, look);
|
|
134
|
+
pool.mesh.name = `water:${body.id}`; pool.mesh.renderOrder = 1;
|
|
135
|
+
ports.root.add(pool.mesh); ports.scope.onDispose(() => { pool.mesh.removeFromParent(); pool.dispose(); });
|
|
136
|
+
ports.frame?.(pool.tick);
|
|
137
|
+
return pool.mesh;
|
|
138
|
+
}
|
|
139
|
+
const sky = ports.scope.own(skyWaterMaterial(look)), mesh = new Mesh(ports.scope.own(surface(body)), sky);
|
|
140
|
+
mesh.name = `water:${body.id}`; mesh.receiveShadow = true; mesh.castShadow = false; mesh.renderOrder = 1;
|
|
141
|
+
ports.root.add(mesh); ports.scope.onDispose(() => { mesh.removeFromParent(); });
|
|
142
|
+
return mesh;
|
|
143
|
+
}
|
|
144
|
+
const drawn = material(), mesh = new Mesh(ports.scope.own(surface(body)), drawn);
|
|
103
145
|
mesh.name = `water:${body.id}`; mesh.receiveShadow = true; mesh.castShadow = false; mesh.renderOrder = 1;
|
|
104
146
|
ports.root.add(mesh); ports.scope.onDispose(() => { mesh.removeFromParent(); });
|
|
105
|
-
ports.outline?.(mesh,
|
|
147
|
+
ports.outline?.(mesh, drawn, ports.scope);
|
|
106
148
|
return mesh;
|
|
107
149
|
});
|
|
108
150
|
}
|