@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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// P4 structural columns use only the emitted index and verified sections.
|
|
2
2
|
import {relative,resolve} from 'node:path';
|
|
3
|
-
import {createOutputReader} from './
|
|
3
|
+
import {createOutputReader} from './output-reader.mjs';
|
|
4
4
|
import {representativeProduct} from './shard-outputs.mjs';
|
|
5
5
|
|
|
6
6
|
/** Private binaries are opaque bin blobs without a platform decoder declaration.
|
|
7
7
|
* This is structural evidence, never a visual/behaviour compatibility verdict.
|
|
8
8
|
* @param {string} root @param {string} slug @param {string} products
|
|
9
|
-
* @param {import('./
|
|
9
|
+
* @param {import('./output-reader.mjs').OutputReader} reader */
|
|
10
10
|
export function outputContent(root,slug,products,reader=createOutputReader(root,products)) {
|
|
11
11
|
const output=reader.sections(slug);
|
|
12
12
|
const indexPath=relative(root,resolve(products,representativeProduct(root,slug),'shard.json')).replaceAll('\\','/');
|
|
@@ -92,7 +92,7 @@ export function productFolder(root, slug) {
|
|
|
92
92
|
}
|
|
93
93
|
/** The built product that stands for a source shard in per-shard measures: a folder that emits several outputs (all from
|
|
94
94
|
* one source, sharing its structure and scripts) is read through its first output; any other folder is its own product.
|
|
95
|
-
* Section inventories union every output (scripts/
|
|
95
|
+
* Section inventories union every output (scripts/output-reader.mjs). @param {string} root @param {string} slug */
|
|
96
96
|
export function representativeProduct(root, slug) {
|
|
97
97
|
return (/^[a-z0-9_-]+$/u.test(slug) ? shardOutputs(root, slug)?.[0]?.slug : undefined) ?? slug;
|
|
98
98
|
}
|
package/scripts/shard-public.mjs
CHANGED
|
@@ -12,7 +12,7 @@ export const GATHERED_SHARDS = Object.freeze(['_template', 'blender-template', '
|
|
|
12
12
|
* it, so point the tool at assets/public first. targets.json outputs count: check-model-sources needs them on disk.
|
|
13
13
|
* 2. Move every tracked file there, add the slug here and `/public/assets/<slug>/` to .gitignore, one shard per commit.
|
|
14
14
|
* 3. Prove it from an archive with no aliases: gen, every product by SHA-256 against the parent, and the full
|
|
15
|
-
*
|
|
15
|
+
* the guards with docs and art present. Scripts and tests read the alias, so their paths don't change.
|
|
16
16
|
* gen only copies: a file deleted here leaves its alias until the folder is cleared. */
|
|
17
17
|
export const PUBLIC_TREES = Object.freeze(['sunscar-dunes', 'driftwood-isle']);
|
|
18
18
|
|
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
// [--flow select|grid] [--upstream https://play.wildshard.io] [--settle ms] [--timeout ms] [--shot file.jpg]
|
|
9
9
|
// [--last <slug>] a returning player whose last pick was <slug>, with nothing stored yet
|
|
10
10
|
// [--dwell ms] time on the title before the tap
|
|
11
|
+
// [--card n] enter the deck's nth card instead of --shard's benchmark card (PAGE-SIZE PZ7 meters every card)
|
|
12
|
+
// byClass splits S1 shardfiles into `S1-packs` (blobs/pack/) and `S1-loose` (the other blobs) for PZ7. The browser
|
|
13
|
+
// profile lives in the root's tmp/wire-meter, never the system temp folder.
|
|
11
14
|
import { spawn } from 'node:child_process';
|
|
12
15
|
import { createRequire } from 'node:module';
|
|
13
|
-
import { mkdtempSync, writeFileSync, rmSync } from 'node:fs';
|
|
16
|
+
import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from 'node:fs';
|
|
14
17
|
import http from 'node:http';
|
|
15
18
|
import https from 'node:https';
|
|
16
|
-
import { tmpdir } from 'node:os';
|
|
17
19
|
import { join } from 'node:path';
|
|
18
20
|
import { pathToFileURL } from 'node:url';
|
|
19
21
|
import { parseArgs } from 'node:util';
|
|
20
22
|
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
21
23
|
|
|
22
|
-
const { values: o } = parseArgs({ options: { root: { type: 'string' }, shard: { type: 'string' }, tier: { type: 'string', default: 'phone' }, flow: { type: 'string', default: 'select' },
|
|
24
|
+
const { values: o } = parseArgs({ options: { root: { type: 'string' }, shard: { type: 'string' }, card: { type: 'string' }, tier: { type: 'string', default: 'phone' }, flow: { type: 'string', default: 'select' },
|
|
23
25
|
out: { type: 'string' }, upstream: { type: 'string' }, settle: { type: 'string', default: '20000' }, timeout: { type: 'string', default: '420000' }, shot: { type: 'string' }, last: { type: 'string' }, dwell: { type: 'string', default: '3000' } } });
|
|
24
26
|
const require = createRequire(join(o.root, 'package.json'));
|
|
25
27
|
const { chromium, devices } = require('playwright');
|
|
@@ -54,7 +56,8 @@ const port = await free();
|
|
|
54
56
|
await new Promise(resolve => { proxy.listen(port, '127.0.0.1', resolve); });
|
|
55
57
|
const url = `http://127.0.0.1:${port}/`;
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
mkdirSync(join(o.root, 'tmp/wire-meter'), { recursive: true });
|
|
60
|
+
const profile = mkdtempSync(join(o.root, 'tmp/wire-meter/profile-'));
|
|
58
61
|
const context = await chromium.launchPersistentContext(profile, { headless: true, args: [...KEYCHAIN_ARGS, ...process.platform === 'darwin' ? ['--use-angle=metal'] : [], '--ignore-gpu-blocklist', '--mute-audio'],
|
|
59
62
|
...(o.tier === 'phone' ? devices['iPhone 16 Pro'] : { viewport: { width: 1440, height: 900 } }) });
|
|
60
63
|
await developerSettings(context, { volume: 0, music: 0, tier: o.tier, holdLoading: true });
|
|
@@ -66,7 +69,8 @@ page.on('pageerror', e => errors.push(e.message.slice(0, 200)));
|
|
|
66
69
|
const result = { shard: o.shard, tier: o.tier, url: upstream, build: null, fact: null, bar: null, stoppedOn: null };
|
|
67
70
|
const summary = () => {
|
|
68
71
|
const sum = list => list.reduce((n, r) => n + r.wire, 0), byStage = {}, byClass = {};
|
|
69
|
-
const klass = u => u.startsWith('/assets/spawn/parts/') ? 'spawn-parts' : /\/shardfiles
|
|
72
|
+
const klass = u => u.startsWith('/assets/spawn/parts/') ? 'spawn-parts' : /\/shardfiles\/[^/]+\/blobs\/pack\//.test(u) ? 'S1-packs'
|
|
73
|
+
: /\/shardfiles\/[^/]+\/blobs\//.test(u) ? 'S1-loose' : /\/shardfiles\//.test(u) ? 'shardfiles' : /\/assets\/packs\//.test(u) ? 'legacy-packs'
|
|
70
74
|
: u.startsWith('/assets/spawn/') ? 'manifests' : u.startsWith('/b/') || /\.(?:js|mjs|css|html)(?:\?|$)/.test(u) || u === '/' ? 'app' : /\/assets\//.test(u) ? 'assets' : 'other';
|
|
71
75
|
for (const r of rows) { byStage[r.stage] = (byStage[r.stage] ?? 0) + r.wire; const k = klass(r.url); byClass[k] = (byClass[k] ?? 0) + r.wire; }
|
|
72
76
|
return { requests: rows.length, wireBytes: sum(rows), byStage, byClass };
|
|
@@ -76,14 +80,25 @@ try {
|
|
|
76
80
|
result.build = await page.evaluate(() => fetch('/version.json').then(r => r.json()).then(v => v.build ?? v.sha ?? null)).catch(() => null);
|
|
77
81
|
await page.locator('.ws-main-select').waitFor({ timeout });
|
|
78
82
|
await page.waitForTimeout(Number(o.dwell));
|
|
79
|
-
|
|
83
|
+
// a first visit names its player before the deck or the grid opens
|
|
84
|
+
const named = async () => {
|
|
85
|
+
if (await page.locator('#ws-name-box input').waitFor({ timeout: 15_000 }).then(() => true).catch(() => false)) {
|
|
86
|
+
await page.locator('#ws-name-box input').fill('wiremeter'); await page.locator('#ws-name-box button[type=submit]').click();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
if (o.flow === 'grid') { stage = 'entry'; await page.locator('.ws-main-grid').click({ timeout }); await named(); }
|
|
80
90
|
else {
|
|
81
91
|
await page.locator('.ws-main-select').click({ timeout });
|
|
92
|
+
await named();
|
|
82
93
|
await page.locator('.ws-menu-card').first().waitFor({ timeout });
|
|
83
|
-
const { loadingCardIndex } = await import(pathToFileURL(join(o.root, 'scripts/loading-benchmark/catalogue.mjs')).href);
|
|
84
94
|
const titles = await page.locator('.ws-menu-card b').allTextContents();
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
let index;
|
|
96
|
+
if (o.card !== undefined) index = Number(o.card);
|
|
97
|
+
else { const { loadingCardIndex } = await import(pathToFileURL(join(o.root, 'scripts/loading-benchmark/catalogue.mjs')).href); index = loadingCardIndex(titles, o.shard); }
|
|
98
|
+
if (!Number.isInteger(index) || index < 0 || index >= titles.length) throw new Error(`No deck card ${String(o.card ?? o.shard)} (index ${index} of ${titles.length})`);
|
|
99
|
+
result.card = { index, title: titles[index] ?? null, of: titles.length };
|
|
100
|
+
// the dots are positional (no data-i on them since the deck redesign); the card keeps its data-i
|
|
101
|
+
await page.locator('.ws-menu-dots i').nth(index).click();
|
|
87
102
|
await page.locator(`.ws-menu-card.selected[data-i="${index}"]`).waitFor({ timeout });
|
|
88
103
|
stage = 'entry';
|
|
89
104
|
const explicit = page.locator('.ws-menu-shardfile');
|
package/scripts/side-parity.mjs
CHANGED
|
@@ -69,14 +69,16 @@ export function colliderInventory(physics) {
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* One name per owner on both sides: a streamed tile keeps its authored owner with an 8 × 8 tile suffix (`pier.c3`), the server's
|
|
72
|
-
* bake prefixes its pieces (`piece:pier`, `string:platform.grid`), a streamed tree keeps its tile (`.trunks.t3`)
|
|
72
|
+
* bake prefixes its pieces (`piece:pier`, `string:platform.grid`), a streamed tree keeps its tile (`.trunks.t3`), and a placed
|
|
73
|
+
* piece keeps its placement after its model id (`nalati-grasslands/corral.camp.16`: Nalati's bake names it by the model). An owner
|
|
73
74
|
* object with no string id, or a creature's numeric id, is an actor (the player, a creature, a loose body): an entity the wire
|
|
74
75
|
* carries, grouped as `actor`.
|
|
75
76
|
*/
|
|
76
77
|
export function ownerGroup(owner) {
|
|
77
78
|
if (owner === null) return '(untagged)';
|
|
78
79
|
if (owner.startsWith('(object') || owner === '(number)') return 'actor';
|
|
79
|
-
return owner.replace(/^(?:piece|string):/u, '').replace(/\.c(?:[0-9]|[1-5][0-9]|6[0-3])$/u, '').replace(/\.trunks\.t\d+$/u, '')
|
|
80
|
+
return owner.replace(/^(?:piece|string):/u, '').replace(/\.c(?:[0-9]|[1-5][0-9]|6[0-3])$/u, '').replace(/\.trunks\.t\d+$/u, '')
|
|
81
|
+
.replace(/^([^/.]+\/[^/.]+)\.[a-z0-9-]+(?:\.\d+)?$/u, '$1');
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
/** A body of flesh is a creature, a person or a player on either side, whatever its owner: an actor. */
|
|
@@ -16,6 +16,7 @@ import { codeDirectory, stampBuildHtml } from './app-build/buildIdentity.mjs';
|
|
|
16
16
|
import { standaloneDirectory, writeStandaloneOutput } from './app-build/standaloneOutput.mjs';
|
|
17
17
|
import { readBuiltShardfile } from './built-product.mjs';
|
|
18
18
|
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
19
|
+
import { documentIsolation } from './app-build/isolation.mjs';
|
|
19
20
|
|
|
20
21
|
const ROOT = resolveFile(import.meta.dirname, '..'), OUT = join(ROOT, 'tmp', 'standalone-smoke'), EMITTED = join(OUT, 'emitted');
|
|
21
22
|
const option = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
@@ -46,16 +47,20 @@ const resolvePath = path => {
|
|
|
46
47
|
};
|
|
47
48
|
const declaredCreatures = join(unpacked !== '' || dist === '' ? resolveFile(product) : join(output, 'shardfiles', slug), 'sections/actors/creatures.json');
|
|
48
49
|
const declaresCreatures = !existsSync(declaredCreatures) || JSON.parse(readFileSync(declaredCreatures, 'utf8')).creatures?.spawns?.length !== 0;
|
|
50
|
+
// PZ12 (J274): the build's own isolation (its `_headers` `/*` rule, dist/ only), on every answer, as its host sends it
|
|
51
|
+
const isolation = dist === '' || !existsSync(join(output, '_headers')) ? {} : documentIsolation(readFileSync(join(output, '_headers'), 'utf8'));
|
|
52
|
+
const isolatedBuild = isolation['cross-origin-embedder-policy'] === 'require-corp' && isolation['cross-origin-opener-policy'] === 'same-origin';
|
|
49
53
|
const server = createServer((request, response) => {
|
|
50
54
|
const path = new URL(request.url ?? '/', 'http://localhost').pathname;
|
|
51
55
|
// The uncached pointer (J57): only these two responses say which build is live.
|
|
52
|
-
if (path === '/') { response.writeHead(200, { 'content-type': 'text/html', 'cache-control': 'no-store' }).end(stampBuildHtml(html, pointer)); return; }
|
|
56
|
+
if (path === '/') { response.writeHead(200, { ...isolation, 'content-type': 'text/html', 'cache-control': 'no-store' }).end(stampBuildHtml(html, pointer)); return; }
|
|
53
57
|
if (path === '/version.json') { response.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' }).end(JSON.stringify({ build: pointer })); return; }
|
|
54
58
|
// WebKit asks for the page's service worker over the pointer's reload, and a build has one. This smoke's has nothing to cache.
|
|
55
59
|
if (path === '/sw.js') { response.writeHead(200, { 'content-type': 'text/javascript' }).end(); return; }
|
|
56
60
|
const file = resolvePath(path);
|
|
57
61
|
if (file === null || !existsSync(file) || !statSync(file).isFile()) { response.writeHead(404).end(); return; }
|
|
58
|
-
|
|
62
|
+
// J59 Q8: the loopback needs no SharedArrayBuffer; an isolated channel's build (PZ12) sends its COOP / COEP on every file
|
|
63
|
+
response.writeHead(200, { ...isolation, 'content-type': TYPES[extname(file)] ?? 'application/octet-stream', ...file.endsWith('.pack.br') ? { 'content-encoding': 'br' } : {} });
|
|
59
64
|
createReadStream(file).pipe(response);
|
|
60
65
|
});
|
|
61
66
|
await new Promise(resolve => { server.listen(0, '127.0.0.1', resolve); });
|
|
@@ -96,7 +101,7 @@ try {
|
|
|
96
101
|
// A shard that declares no creature has no row to walk to (Nine's spawns are empty): the check holds for every shard that declares one.
|
|
97
102
|
check('rows checked against the worker', report.probes >= seconds * 2 && (report.matched > 0 || !declaresCreatures), report);
|
|
98
103
|
check('rows within one quantisation step', report.worstError <= report.step, { worst: report.worstError, step: report.step });
|
|
99
|
-
check('no cross-origin isolation',
|
|
104
|
+
check(isolatedBuild ? 'cross-origin isolated, as its channel (PZ12)' : 'no cross-origin isolation', report.crossOriginIsolated === isolatedBuild, report.crossOriginIsolated);
|
|
100
105
|
check('commands reached the worker', report.positionMoved > 5, report.positionMoved);
|
|
101
106
|
check('save durable', saved.ok && stored > 0, { saved, stored });
|
|
102
107
|
check('save survives the reload', second.restored && second.tick === saved.tick, { second, saved });
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// S12 (J330): does a shard page load and look the same with its phone textures cut to a tier size by the cook's mip trim
|
|
3
|
+
// (src/cook/game/tierTextures.ts)? Phone tier, iPhone 17 Pro viewport, headless. Every `.glb` and `.ktx2` the page reads
|
|
4
|
+
// is fetched from the served build and, with --max, answered with `tierGlb` / `trimKtx2` at that size, so the page reads
|
|
5
|
+
// exactly what a trim-only cook would ship. Reports the bytes those responses carried, the page's GPU ledger and three's
|
|
6
|
+
// texture count once the player stands in the world, and saves a screenshot to compare.
|
|
7
|
+
// scripts/browser-lane.sh node --import ./scripts/bake-loader.mjs scripts/tier-textures-proof.mjs --base=http://127.0.0.1:<port>
|
|
8
|
+
// [--engine=chromium|webkit] [--slug=pine-hollow] [--max=512] [--out=tmp/<lane>/tier-proof] [--label=<name>]
|
|
9
|
+
// Loopback only: never staging or production.
|
|
10
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { join, resolve as absolute } from 'node:path';
|
|
12
|
+
import { chromium, webkit } from 'playwright';
|
|
13
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
14
|
+
import { saveFixture } from './debug-settings.mjs';
|
|
15
|
+
import { pageMemoryAttributionExpression } from './memory-report-snapshot.mjs';
|
|
16
|
+
|
|
17
|
+
const { tierGlb, trimKtx2 } = await import('../src/cook/game/tierTextures.ts');
|
|
18
|
+
|
|
19
|
+
/** @type {Record<string, string>} */
|
|
20
|
+
const args = Object.fromEntries(process.argv.slice(2).map(arg => /^--([^=]+)(?:=(.*))?$/u.exec(arg)).filter(match => match !== null).map(match => [match[1], match.at(2) ?? '1']));
|
|
21
|
+
const base = (args.base ?? '').replace(/\/$/u, '');
|
|
22
|
+
if (!/^http:\/\/(127\.0\.0\.1|localhost):\d+$/u.test(base)) throw new Error('--base takes a loopback build only');
|
|
23
|
+
const engineName = args.engine ?? 'chromium', slug = args.slug ?? 'pine-hollow', max = args.max === undefined ? 0 : Number(args.max);
|
|
24
|
+
if (engineName !== 'chromium' && engineName !== 'webkit') throw new Error(`No engine ${engineName}`);
|
|
25
|
+
const label = args.label ?? `${engineName}-${max === 0 ? 'master' : `max${max}`}`, out = absolute(args.out ?? 'tmp/tier-proof');
|
|
26
|
+
mkdirSync(out, { recursive: true });
|
|
27
|
+
const MB = 1e6;
|
|
28
|
+
/** @param {number} ms */
|
|
29
|
+
const sleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
30
|
+
|
|
31
|
+
const READ = `(() => {
|
|
32
|
+
const api = window.__wildshard, mem = (() => { try { return ${pageMemoryAttributionExpression}; } catch (e) { return { error: String(e) }; } })();
|
|
33
|
+
const rows = Array.isArray(mem?.allocations) ? mem.allocations : [], kinds = {};
|
|
34
|
+
for (const r of rows) { const k = r.domain + ' ' + r.kind; kinds[k] = (kinds[k] ?? 0) + r.bytes; }
|
|
35
|
+
let three = null; try { const r = api.requireWorld().game.renderer; three = { textures: r.info.memory.textures, geometries: r.info.memory.geometries }; } catch {}
|
|
36
|
+
// Decoded texture bytes, once per texture the scene draws: a compressed texture's transcoded levels as uploaded, an
|
|
37
|
+
// image's RGBA8 levels (a third more for mips). What the GPU holds for the page's textures, not counting render targets.
|
|
38
|
+
let textureBytes = null; try {
|
|
39
|
+
const world = api.requireWorld(), scene = world.game?.scene ?? world.scene, seen = new Set(); let total = 0;
|
|
40
|
+
scene.traverse(object => { for (const material of [object.material ?? []].flat()) for (const value of Object.values(material)) {
|
|
41
|
+
if (value === null || typeof value !== 'object' || value.isTexture !== true || seen.has(value)) continue;
|
|
42
|
+
seen.add(value);
|
|
43
|
+
if (value.isCompressedTexture === true) total += (value.mipmaps ?? []).reduce((sum, level) => sum + (level.data?.byteLength ?? 0), 0);
|
|
44
|
+
else { const image = value.image; if (image?.width > 0) total += image.width * image.height * 4 * (value.generateMipmaps === false ? 1 : 4 / 3); }
|
|
45
|
+
} });
|
|
46
|
+
textureBytes = { total, textures: seen.size };
|
|
47
|
+
} catch (e) { textureBytes = { error: String(e).slice(0, 160) }; }
|
|
48
|
+
let mode = null; try { mode = api.textures?.()?.mode ?? null; } catch {}
|
|
49
|
+
return { totals: mem?.totals ?? null, kinds, three, mode, textureBytes };
|
|
50
|
+
})()`;
|
|
51
|
+
|
|
52
|
+
const result = { engine: engineName, base, slug, max, label, at: new Date().toISOString(), outcome: 'none', errors: /** @type {string[]} */ ([]),
|
|
53
|
+
glb: { files: 0, served: 0, read: 0 }, ktx2: { files: 0, served: 0, read: 0 }, page: /** @type {unknown} */ (null) };
|
|
54
|
+
const browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true,
|
|
55
|
+
args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] : [] });
|
|
56
|
+
let code = 0;
|
|
57
|
+
try {
|
|
58
|
+
const context = await browser.newContext({ viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, isMobile: engineName === 'chromium', hasTouch: true,
|
|
59
|
+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1' });
|
|
60
|
+
await saveFixture(context, { scope: 'device', key: 'firstPlayDone', data: true });
|
|
61
|
+
await saveFixture(context, { scope: 'global', key: 'settings', merge: true, data: { tier: 'phone', volume: 0 } });
|
|
62
|
+
await context.route('**/api/errors', route => route.fulfill({ status: 204, body: '' }));
|
|
63
|
+
await context.route(/\.(?:glb|ktx2)(?:\?.*)?$/u, async route => {
|
|
64
|
+
const response = await route.fetch(), body = new Uint8Array(await response.body());
|
|
65
|
+
const glb = /\.glb(?:\?|$)/u.test(route.request().url()), row = glb ? result.glb : result.ktx2;
|
|
66
|
+
/** @type {Uint8Array} */
|
|
67
|
+
let read = body;
|
|
68
|
+
try { if (max !== 0 && response.status() === 200) read = glb ? tierGlb(body, max) : trimKtx2(body, max); }
|
|
69
|
+
catch (error) { result.errors.push(`trim ${route.request().url()}: ${String(error).slice(0, 160)}`); }
|
|
70
|
+
row.files++; row.served += body.length; row.read += read.length;
|
|
71
|
+
const headers = { ...response.headers() };
|
|
72
|
+
delete headers['content-length']; delete headers['content-encoding']; delete headers.etag;
|
|
73
|
+
await route.fulfill({ status: response.status(), headers, body: Buffer.from(read) });
|
|
74
|
+
});
|
|
75
|
+
const page = await context.newPage(); page.setDefaultTimeout(240_000);
|
|
76
|
+
page.on('pageerror', error => { result.errors.push(error.message.slice(0, 240)); });
|
|
77
|
+
await page.goto(`${base}/?chunk=${slug}&skipintro&mute=1&nolock=1`, { waitUntil: 'commit', timeout: 120_000 });
|
|
78
|
+
const started = Date.now();
|
|
79
|
+
for (;;) {
|
|
80
|
+
await sleep(500);
|
|
81
|
+
if (Date.now() - started > 240_000) { result.outcome = 'stalled'; break; }
|
|
82
|
+
if (await page.locator('.ws-load-play').isVisible().catch(() => false)) await page.locator('.ws-load-play').click({ timeout: 3000 }).catch(() => undefined);
|
|
83
|
+
const ready = await page.evaluate(() => {
|
|
84
|
+
const api = /** @type {any} */ (window).__wildshard; let world = null; try { world = api?.requireWorld?.() ?? null; } catch { /* not yet */ }
|
|
85
|
+
return world?.player !== undefined && world?.player !== null && document.getElementById('hud')?.classList.contains('intro') !== true;
|
|
86
|
+
}).catch(() => false);
|
|
87
|
+
if (ready) { result.outcome = 'play'; break; }
|
|
88
|
+
}
|
|
89
|
+
await sleep(12_000);
|
|
90
|
+
result.page = await page.evaluate(READ);
|
|
91
|
+
await page.screenshot({ path: join(out, `${label}.png`) }).catch(() => undefined);
|
|
92
|
+
if (result.outcome !== 'play') code = 1;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
result.errors.push(String(error).slice(0, 400)); code = 1;
|
|
95
|
+
} finally {
|
|
96
|
+
await browser.close();
|
|
97
|
+
}
|
|
98
|
+
writeFileSync(join(out, `${label}.json`), `${JSON.stringify(result, null, 2)}\n`);
|
|
99
|
+
const page = /** @type {any} */ (result.page);
|
|
100
|
+
console.log(`${label}: ${result.outcome}, mode ${page?.mode ?? '?'}, glb ${result.glb.files} files ${(result.glb.served / MB).toFixed(2)} -> ${(result.glb.read / MB).toFixed(2)} MB, ktx2 ${result.ktx2.files} files ${(result.ktx2.served / MB).toFixed(2)} -> ${(result.ktx2.read / MB).toFixed(2)} MB, decoded textures ${((page?.textureBytes?.total ?? 0) / MB).toFixed(2)} MB in ${page?.textureBytes?.textures ?? page?.textureBytes?.error ?? '?'}, three textures ${page?.three?.textures ?? '?'}, errors ${result.errors.length}`);
|
|
101
|
+
process.exit(code);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// S12 (J330): a shard's phone textures cooked from its masters by mip trim, measured against what phones read today.
|
|
3
|
+
// node --import ./scripts/bake-loader.mjs scripts/tier-textures.mjs out/pine-hollow [--max=512] [--out=tmp/<lane>/phone]
|
|
4
|
+
// Reads an opened product dir (`out/<slug>`: discovery.json's KTX2 table and mounts/), no shardfile upload, no network.
|
|
5
|
+
// For every row of the shard's phone table it prints three columns: today's phone file (a hand-made 6×6 / 512 set or a
|
|
6
|
+
// GPU twin), the desktop master trimmed to --max by `trimKtx2`/`tierGlb` (what a trim-only cook would ship), and today's
|
|
7
|
+
// phone file trimmed to --max. Bytes are file bytes; GPU is `ktx2GpuBytes`, mips included. --out writes the trimmed
|
|
8
|
+
// phone files at their URL paths, for a browser to load.
|
|
9
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { dirname, join, resolve } from 'node:path';
|
|
12
|
+
|
|
13
|
+
const { glbImages, isKtx2, ktx2GpuBytes, masterOf, phoneTier, tierGlb, trimKtx2 } = await import('../src/cook/game/tierTextures.ts');
|
|
14
|
+
|
|
15
|
+
const args = process.argv.slice(2), flag = (/** @type {string} */ name) => args.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3);
|
|
16
|
+
const product = args.find(arg => !arg.startsWith('--'));
|
|
17
|
+
if (product === undefined) throw new Error('usage: tier-textures <product-dir> [--max=512] [--out=dir]');
|
|
18
|
+
const max = Number(flag('max') ?? 512), out = flag('out');
|
|
19
|
+
// --astc6 (S12c): a fourth column, the masters trimmed and re-encoded as ASTC 6×6 by the cook's encoder (`basisuAstc6`), as
|
|
20
|
+
// `phoneTier` cooks them with an encoder; its cache is the cook's, so a second run encodes nothing.
|
|
21
|
+
const astc6 = args.includes('--astc6') ? (await import('../src/cook/game/astc6Encode.ts')).basisuAstc6(process.env.WILDSHARD_ASTC6_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/astc6/1')) : undefined;
|
|
22
|
+
const slug = product.replace(/\/$/u, '').split('/').pop() ?? '';
|
|
23
|
+
const discovery = JSON.parse(readFileSync(join(product, 'mounts/shardfiles', slug, 'discovery.json'), 'utf8'));
|
|
24
|
+
/** @type {{phone: Record<string, string>, desktop: Record<string, string>}} */
|
|
25
|
+
const table = discovery.native.ktx2.args[0].shard;
|
|
26
|
+
/** @param {string} url @returns {Uint8Array | undefined} */
|
|
27
|
+
const read = url => { const path = join(product, 'mounts', url); return existsSync(path) ? new Uint8Array(readFileSync(path)) : undefined; };
|
|
28
|
+
/** @param {string} url @param {Uint8Array} bytes @returns {Uint8Array} */
|
|
29
|
+
const trim = (url, bytes) => (url.endsWith('.glb') ? tierGlb(bytes, max) : trimKtx2(bytes, max));
|
|
30
|
+
/** @param {string} url @param {Uint8Array} bytes @returns {number} */
|
|
31
|
+
const gpu = (url, bytes) => {
|
|
32
|
+
if (url.endsWith('.ktx2')) return isKtx2(bytes) ? ktx2GpuBytes(bytes) : 0;
|
|
33
|
+
if (url.endsWith('.glb')) return glbImages(bytes).reduce((total, image) => total + (isKtx2(image.bytes) ? ktx2GpuBytes(image.bytes) : 0), 0);
|
|
34
|
+
return 0;
|
|
35
|
+
};
|
|
36
|
+
/** The desktop master of a phone source: the same source, or its name without the `.phone` / `-phone` mark. */
|
|
37
|
+
/** @param {string} source @returns {string | undefined} */
|
|
38
|
+
const master = source => masterOf(table.desktop, source);
|
|
39
|
+
|
|
40
|
+
/** @type {Record<string, [number, number]>} */
|
|
41
|
+
const sum = { today: [0, 0], master: [0, 0], cooked: [0, 0], trimmed: [0, 0], astc6: [0, 0] };
|
|
42
|
+
let rows = 0, missing = 0, mastered = 0;
|
|
43
|
+
for (const [source, phoneUrl] of Object.entries(table.phone)) {
|
|
44
|
+
if (!/\.(?:glb|ktx2)$/u.test(phoneUrl)) continue;
|
|
45
|
+
const phone = read(phoneUrl);
|
|
46
|
+
if (phone === undefined) { missing++; continue; }
|
|
47
|
+
rows++;
|
|
48
|
+
const masterUrl = master(source), masterBytes = masterUrl === undefined ? undefined : read(masterUrl);
|
|
49
|
+
const cooked = masterBytes === undefined || masterUrl === undefined ? trim(phoneUrl, phone) : trim(masterUrl, masterBytes);
|
|
50
|
+
if (masterBytes !== undefined) mastered++;
|
|
51
|
+
const trimmed = trim(phoneUrl, phone);
|
|
52
|
+
/** @param {string} key @param {string} url @param {Uint8Array} bytes */
|
|
53
|
+
const add = (key, url, bytes) => { const row = sum[key] ?? [0, 0]; row[0] += bytes.length; row[1] += gpu(url, bytes); sum[key] = row; };
|
|
54
|
+
add('today', phoneUrl, phone);
|
|
55
|
+
add('master', masterUrl ?? phoneUrl, masterBytes ?? phone);
|
|
56
|
+
add('cooked', masterUrl ?? phoneUrl, cooked);
|
|
57
|
+
add('trimmed', phoneUrl, trimmed);
|
|
58
|
+
|
|
59
|
+
if (out !== undefined) { const path = resolve(out, `.${phoneUrl}`); mkdirSync(dirname(path), { recursive: true }); writeFileSync(path, trimmed); }
|
|
60
|
+
}
|
|
61
|
+
// --astc6: what `phoneTier` ships with the encoder, row by row: its cooked file, or today's where it keeps one (a `#layer` or horizon row).
|
|
62
|
+
if (astc6 !== undefined) {
|
|
63
|
+
const tier = phoneTier(new TextEncoder().encode(JSON.stringify(discovery)), read, undefined, astc6.encode);
|
|
64
|
+
const cookedTable = tier === undefined ? table : JSON.parse(new TextDecoder().decode(tier.discovery)).native.ktx2.args[0].shard;
|
|
65
|
+
const made = new Map([...(tier?.files.values() ?? [])].flat().map(file => [file.url, file.bytes]));
|
|
66
|
+
for (const url of Object.values(cookedTable.phone)) {
|
|
67
|
+
if (!/\.(?:glb|ktx2)$/u.test(url)) continue;
|
|
68
|
+
const bytes = made.get(url) ?? read(url);
|
|
69
|
+
if (bytes === undefined) continue;
|
|
70
|
+
const row = sum.astc6 ?? [0, 0]; row[0] += bytes.length; row[1] += gpu(url, bytes); sum.astc6 = row;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const mb = (/** @type {number} */ n) => (n / 1e6).toFixed(2);
|
|
74
|
+
console.log(`${slug} phone table: ${rows} KTX2/GLB rows (${mastered} with a desktop master, ${missing} not in the product), --max=${max}`);
|
|
75
|
+
for (const [key, label] of [['today', 'phone today'], ['master', 'desktop masters'], ['cooked', `masters trimmed to ${max}`], ['trimmed', `phone today trimmed to ${max}`], ...(astc6 === undefined ? [] : [['astc6', "the cook's phone table, 6x6"]])]) {
|
|
76
|
+
console.log(`${label.padEnd(28)} file ${mb(sum[key]?.[0] ?? 0).padStart(7)} MB GPU ${mb(sum[key]?.[1] ?? 0).padStart(7)} MB`);
|
|
77
|
+
}
|
|
78
|
+
if (astc6 !== undefined) console.log(`astc6: ${astc6.stats.encoded} encoded, ${astc6.stats.reused} reused, ${astc6.stats.failed} failed`);
|
|
@@ -4,7 +4,7 @@ import {createHash} from 'node:crypto';
|
|
|
4
4
|
import {existsSync,readFileSync} from 'node:fs';
|
|
5
5
|
import {resolve} from 'node:path';
|
|
6
6
|
import * as v from 'valibot';
|
|
7
|
-
import {outputFormat} from './
|
|
7
|
+
import {outputFormat} from './node-format.mjs';
|
|
8
8
|
|
|
9
9
|
const {TilesSchema,SpawnSchema}=await import('@wildshard/format/shardSections');
|
|
10
10
|
const {EntrywaysSchema}=await import('@wildshard/format/entryways');
|
package/scripts/tile-bakes.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
import { readFileSync } from 'node:fs';
|
|
4
4
|
import { resolve } from 'node:path';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
|
-
import { outputFormat } from './
|
|
6
|
+
import { outputFormat } from './node-format.mjs';
|
|
7
7
|
import { parseTileBakePolicy, TILE_BAKE_POLICY } from './tile-bake-policy.mjs';
|
|
8
8
|
|
|
9
9
|
const { CONTENT_CAPS: caps } = await import('@wildshard/format/contentBounds');
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"/assets/title/driftwood-isle-portrait.jpg": "/assets/title/driftwood-isle-portrait-e9d5c9aedd5c5920.jpg",
|
|
3
3
|
"/assets/title/launch-1206x2622-6afc7dd7eee8.png": "/assets/title/launch-1206x2622-6afc7dd7eee8.png",
|
|
4
|
+
"/assets/title/main-crossroads-landscape-first.jpg": "/assets/title/main-crossroads-landscape-first-f3f196486b3476a0.jpg",
|
|
4
5
|
"/assets/title/main-crossroads-landscape.jpg": "/assets/title/main-crossroads-landscape-9437ac10c599548a.jpg",
|
|
6
|
+
"/assets/title/main-crossroads-square-first.jpg": "/assets/title/main-crossroads-square-first-98ef65b2b3433656.jpg",
|
|
5
7
|
"/assets/title/main-crossroads-square.jpg": "/assets/title/main-crossroads-square-24abf23d2606ae3f.jpg",
|
|
6
8
|
"/assets/title/nalati-grasslands-portrait.jpg": "/assets/title/nalati-grasslands-portrait-5ac0c2e430a5a22b.jpg",
|
|
7
9
|
"/assets/title/nine-dragon-stack-portrait.jpg": "/assets/title/nine-dragon-stack-portrait-d92d65e333c1ccba.jpg",
|
package/scripts/tsconfig.json
CHANGED
|
@@ -347,9 +347,7 @@
|
|
|
347
347
|
"../test/pine-native-story-admission.test.ts",
|
|
348
348
|
"../test/pine-posed-tier-loading.test.ts",
|
|
349
349
|
"../test/pine-product-reads.test.ts",
|
|
350
|
-
"../test/platform-build-tools.test.ts",
|
|
351
350
|
"../test/platform-file-families.test.ts",
|
|
352
|
-
"../test/platform-namespace-reach.test.ts",
|
|
353
351
|
"../test/platform-output-reader.test.ts",
|
|
354
352
|
"../test/platform-runtime-closure.test.ts",
|
|
355
353
|
"../test/polearm-decision.test.ts",
|
|
@@ -567,6 +565,7 @@
|
|
|
567
565
|
"worker-client-play.mjs",
|
|
568
566
|
"worker-client-proof.mjs",
|
|
569
567
|
"worker-client-saves.mjs",
|
|
568
|
+
"worker-client-slug.mjs",
|
|
570
569
|
"**/*.test.*"
|
|
571
570
|
],
|
|
572
571
|
"files": [
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2019-2026 Binomial LLC
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|