@holtjs/stage 0.14.0 → 0.16.0
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 +25 -0
- package/README.md +1 -1
- package/dist/ecs.d.ts +18 -0
- package/dist/ecs.js +174 -0
- package/dist/{game-BF1ZbJRC.js → game-CFxS641c.js} +56 -8
- package/dist/{game-rKghsNlA.d.ts → game-Dxh9e0Hv.d.ts} +151 -18
- package/dist/headless.d.ts +86 -19
- package/dist/headless.js +1183 -34
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -4
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +166 -1
- package/dist/lighting.d.ts +4 -2
- package/dist/lighting.js +17 -11
- package/dist/particles.d.ts +75 -0
- package/dist/particles.js +127 -1
- package/dist/projection.d.ts +3 -1
- package/dist/projection.js +7 -0
- package/dist/{renderer-webgpu-CnIevdNP.js → renderer-webgpu-q4vdE3kA.js} +73 -1
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +1 -1
- package/dist/tilemap.d.ts +2 -2
- package/dist/tilemap.js +228 -69
- package/dist/trace.d.ts +1 -1
- package/dist/world.d.ts +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/skills/stage/SKILL.md +1 -1
- package/skills/stage/references/subpaths.md +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,31 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.16.0] - 2026-12-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Sub-Millisecond `SoaWorld` Binary Snapshots, State Checksums & `RollbackSession` (`@holtjs/stage/ecs` & `@holtjs/stage/kernel`, `src/ecs.ts`, `src/kernel.ts`)**:
|
|
13
|
+
- Added `world.snapshotByteLength()`, `world.snapshot(into?)`, `world.restore(bytes)` (`'HSOA'` 8-byte aligned binary layout with schema-hash validation, preserving generational `EntityId`s and compiled `world.select()` views in `< 0.1 ms`), and `world.checksum()` (canonicalized 32-bit FNV-1a state checksum).
|
|
14
|
+
- Added `RollbackSession<TInput>` (`RollbackSession.fromSoaWorld`, `createRollbackSession`) with preallocated ring-buffer snapshot slots (`advance`, `applyAuthoritativeInput` for GGPO-style rollback netcode prediction & deterministic re-simulation, `rewindTo` for interactive Time-Travel debugging, and `checksumAt` / `currentChecksum`).
|
|
15
|
+
- **Single-Process Zero-Rasterization Batch Balance Rollout Runner (`runHeadlessRollouts`, `@holtjs/stage/headless`, `src/headless.ts`)**:
|
|
16
|
+
- Added `runHeadlessRollouts({ runs, seeds, ticksPerRun, createScene, onTick, extractMetrics })` executing dozens to hundreds of deterministic `stepSimOnly` game rollouts in a single Node.js, Bun, or Deno process with zero pixel rasterization or GPU driver overhead, returning per-run telemetry and aggregated `min / max / mean / p50 / p95 / sum` statistics.
|
|
17
|
+
- **Velocity-Driven Procedural Character Squash, Stretch & Lean (`LocomotionFeel`, `@holtjs/stage/particles` & `@holtjs/stage`, `src/particles.ts`)**:
|
|
18
|
+
- Added `LocomotionFeel` providing area-preserving (`scaleX * scaleY === 1`) log-space damped spring squash-and-stretch (`impulse`), automatic sharp-turn anticipation squash, velocity-proportional landing thud (`wz -> 0`), ground stride hop, and velocity lean (`applyTo(sprite)`).
|
|
19
|
+
|
|
20
|
+
## [0.15.0] - 2026-12-05
|
|
21
|
+
|
|
22
|
+
### Added, Optimized & Fixed
|
|
23
|
+
- **Seamless Cross-Chunk Neighbor-Apron Tilemap Composite & Edge-Extruded Dual-Grid Baker (`@holtjs/stage/tilemap`, `src/tilemap.ts`)**:
|
|
24
|
+
- `mountChunkedTilemap()` now enables chunk texture pre-compositing (`chunkCache: true`) by default across **WebGPU**, **WebGL2**, and **Canvas2D** (including a zero-Canvas2D pure-RGBA compositor for pure-WebGPU headless environments), collapsing ~4,500 per-frame rotated tile quads down to ~12 chunk quads while automatically inheriting `FilterMode.LINEAR` / `FilterMode.NEAREST` from the source tileset.
|
|
25
|
+
- Each cached chunk texture now bakes a `2px` cross-chunk world-neighbor apron (`chunkApron: 2`, with 2-tile border mutation invalidation in `ChunkedTilemap`) so `FilterMode.LINEAR` interpolates seamlessly across `16×16` chunk boundaries with zero tile or chunk cross seams under 45° isometric rotation and non-integer zoom.
|
|
26
|
+
- `bakeDualGridTileset()` now performs `2px` per-side edge-and-corner texel extrusion by default (`extrude: 2`), accepts `{ createCanvas, extrude, filterMode }` options, exposes raw `rgba` / `width` / `height` / `frameRect`, and runs in zero-DOM pure-WebGPU Node/Bun without `@napi-rs/canvas`.
|
|
27
|
+
- **Responsive `Scale.RESIZE` Container Observer & Automatic 2.5D Viewport Sync (`src/game.ts`, `src/projection.ts`, `src/lighting.ts`)**:
|
|
28
|
+
- `Game` with `scale: { mode: Scale.RESIZE }` now sizes the backing canvas to `parentElement` / `window` immediately before `Scene.create()` and attaches `ResizeObserver` + `resize` / `orientationchange` listeners (`fitToResizeContainer()`), automatically updating `scene.cameras.main` and `mountStage25D` (`autoResize: true`).
|
|
29
|
+
- `Lighting2DSystem.resize()` now skips redundant render-target reallocations and uses bounded sequential keys (`${baseKey}_r1`, `${baseKey}_r2`) instead of unbounded `_r` suffixes.
|
|
30
|
+
- **Trimmed-FFmpeg Auto-Fallback (`mjpeg` `image2pipe` + `libvpx-vp9` WebM) & Headless Linux SwiftShader ICD Auto-Discovery (`src/headless.ts`, `src/webgpu-headless.ts`)**:
|
|
31
|
+
- `stage.encodeVideo()` / `encodeVideoWithFfmpeg()` now auto-discovers Playwright's cached `ffmpeg` when system `ffmpeg` is absent, probes supported demuxers/decoders/encoders once per binary, and automatically switches from `rawvideo` (`libx264` MP4) to `image2pipe` (`mjpeg` + `libvpx-vp9` WebM) on stripped `ffmpeg` builds (using `@napi-rs/canvas` `toBuffer('image/jpeg')` when present or a built-in zero-dependency pure-TS baseline JFIF JPEG encoder).
|
|
32
|
+
- `openWgpuNativeFfi()` now searches `~/.cache/holt-stage/wgpu/lib` and `~/.local/lib` for `libwgpu_native` and automatically wires Playwright/Chromium's bundled `vk_swiftshader_icd.json` (including C `setenv` under `bun:ffi`) on headless Linux hosts without system `/usr/share/vulkan/icd.d`.
|
|
33
|
+
|
|
9
34
|
## [0.14.0] - 2026-12-05
|
|
10
35
|
|
|
11
36
|
### Added, Optimized & Fixed
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ A zero-dependency, tracing-first **WebGPU / WebGL2 / Canvas2D** 2D & 2.5D game,
|
|
|
26
26
|
- `ActionMap` (`bind`, `isDown`, `justPressed`, `axis`) + `InputProvider` bus shared by hardware mouse/keyboard, `createInputTimeline({ showCursor: true })` (click directly by `trackId`!), and `createInputRecorder` / `createInputReplay`.
|
|
27
27
|
- **2.5D Survival Sandbox Engine Pillars (*Don't Starve* / *Graveyard Keeper*-ready)**:
|
|
28
28
|
- **`@holtjs/stage/rig2d`** (`5.7 kB` gz): 2D cutout/slot skeletal hierarchy, O(1) tool/hat/armor attachment & skin swapping without phase glitches, 2-layer base + bone-masked overlay mixer (chop while walking), keyframe events, and procedural `bakeCutoutAtlas()`.
|
|
29
|
-
- **`@holtjs/stage/tilemap`** (`3.5 kB` gz): Sparse `ChunkedTilemap` (`±1,000,000` coords), cross-chunk dirty propagation,
|
|
29
|
+
- **`@holtjs/stage/tilemap`** (`3.5 kB` gz): Sparse `ChunkedTilemap` (`±1,000,000` coords), cross-chunk dirty propagation, **16-tile Dual-Grid** & **47-tile Blob** autotilers with edge extrusion, island biome generator, and seamless neighbor-apron `mountChunkedTilemap()`.
|
|
30
30
|
- **`@holtjs/stage/projection`** (`1.6 kB` gz): Rotatable oblique `Camera25D` (`worldToScreen` ↔ `screenToGround` exact inverse across 360° `yaw` spins + smooth `Q/E` rotation) and `mountStage25D()` upright cylindrical depth-sorted billboards.
|
|
31
31
|
- **`@holtjs/stage/lighting`** (`4.1 kB` gz): `DayNightCycle`, Sobel 3×3 `bakeNormalMapCanvas()`, `Lighting2DSystem` (`MULTIPLY` offscreen lightmap FBO + flickering torches), and WebGL2 `createNormalLitSpritePass()`.
|
|
32
32
|
- **`@holtjs/stage/world`** (`2.8 kB` gz): `ItemRegistry`, `InventoryContainer` (with `freshness01` spoilage), `RecipeRegistry`, `WorkstationScheduler` (offline tick catch-up), and compact `HWLD` binary `WorldDeltaSave`.
|
package/dist/ecs.d.ts
CHANGED
|
@@ -228,6 +228,24 @@ export declare class SoaWorld {
|
|
|
228
228
|
clear(): void;
|
|
229
229
|
/** PII-free runtime statistics snapshot. */
|
|
230
230
|
stats(): SoaWorldStats;
|
|
231
|
+
private computeSchemaHash;
|
|
232
|
+
/** Compute exact byte length required to snapshot the current `SoaWorld` state (`'HSOA'` binary layout). */
|
|
233
|
+
snapshotByteLength(count?: number, nextHandle?: number, freeCount?: number): number;
|
|
234
|
+
/**
|
|
235
|
+
* Capture a complete binary snapshot of all live entities, generational handle tables, and SoA component columns.
|
|
236
|
+
* Pass a reusable `into` `Uint8Array` (`byteLength >= world.snapshotByteLength()`) for zero-GC sub-millisecond capture.
|
|
237
|
+
*/
|
|
238
|
+
snapshot(into?: Uint8Array): Uint8Array;
|
|
239
|
+
/**
|
|
240
|
+
* Restore `SoaWorld` in-place from a snapshot produced by `world.snapshot()`.
|
|
241
|
+
* Preserves all compiled `world.select()` / `world.store()` column views and generational `EntityId` validity.
|
|
242
|
+
*/
|
|
243
|
+
restore(snapshot: Uint8Array): void;
|
|
244
|
+
/**
|
|
245
|
+
* Compute a fast deterministic 32-bit FNV-1a checksum over all live entities, masks, and active component columns
|
|
246
|
+
* (canonicalizing `-0.0` in float columns for rollback netcode & replay desync verification).
|
|
247
|
+
*/
|
|
248
|
+
checksum(): number;
|
|
231
249
|
}
|
|
232
250
|
/**
|
|
233
251
|
* In-place zero-GC insertion/Ciura-gap Shell sort of `slots[0..count - 1]` ordered ascending by
|
package/dist/ecs.js
CHANGED
|
@@ -557,6 +557,180 @@ var SoaWorld = class {
|
|
|
557
557
|
spatialCells: this.grid ? this.grid.cols * this.grid.rows : 0
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
|
+
computeSchemaHash() {
|
|
561
|
+
let h = 0x811c9dc5;
|
|
562
|
+
for (let i = 0; i < this.stores.length; i++) {
|
|
563
|
+
const def = this.stores[i].def;
|
|
564
|
+
const sig = def.isTag ? `${def.name}:tag` : `${def.name}:${def.fields.map((f) => `${f}=${def.schema[f]}`).join(",")}`;
|
|
565
|
+
for (let c = 0; c < sig.length; c++) {
|
|
566
|
+
h ^= sig.charCodeAt(c);
|
|
567
|
+
h = Math.imul(h, 16777619) >>> 0;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return h >>> 0;
|
|
571
|
+
}
|
|
572
|
+
/** Compute exact byte length required to snapshot the current `SoaWorld` state (`'HSOA'` binary layout). */
|
|
573
|
+
snapshotByteLength(count = this.count, nextHandle = this.nextHandle, freeCount = this.freeCount) {
|
|
574
|
+
const align8 = (n) => n + 7 & -8;
|
|
575
|
+
let off = 32;
|
|
576
|
+
off = align8(off + count * 4);
|
|
577
|
+
off = align8(off + count * 4);
|
|
578
|
+
off = align8(off + freeCount * 4);
|
|
579
|
+
off = align8(off + nextHandle * 4);
|
|
580
|
+
off = align8(off + nextHandle * 2);
|
|
581
|
+
for (let i = 0; i < this.stores.length; i++) {
|
|
582
|
+
const st = this.stores[i];
|
|
583
|
+
if (st.def.isTag) continue;
|
|
584
|
+
const fields = st.def.fields;
|
|
585
|
+
for (let f = 0; f < fields.length; f++) {
|
|
586
|
+
const bpe = st.columns[fields[f]].BYTES_PER_ELEMENT;
|
|
587
|
+
off = align8(off + count * bpe);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return off;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Capture a complete binary snapshot of all live entities, generational handle tables, and SoA component columns.
|
|
594
|
+
* Pass a reusable `into` `Uint8Array` (`byteLength >= world.snapshotByteLength()`) for zero-GC sub-millisecond capture.
|
|
595
|
+
*/
|
|
596
|
+
snapshot(into) {
|
|
597
|
+
const count = this.count;
|
|
598
|
+
const nextHandle = this.nextHandle;
|
|
599
|
+
const freeCount = this.freeCount;
|
|
600
|
+
const totalBytes = this.snapshotByteLength(count, nextHandle, freeCount);
|
|
601
|
+
const out = into && into.byteLength >= totalBytes ? into.subarray(0, totalBytes) : new Uint8Array(totalBytes);
|
|
602
|
+
const dv = new DataView(out.buffer, out.byteOffset, totalBytes);
|
|
603
|
+
dv.setUint32(0, 0x414f5348, true);
|
|
604
|
+
dv.setUint32(4, 1, true);
|
|
605
|
+
dv.setUint32(8, count, true);
|
|
606
|
+
dv.setUint32(12, nextHandle, true);
|
|
607
|
+
dv.setUint32(16, freeCount, true);
|
|
608
|
+
dv.setUint32(20, this.stores.length, true);
|
|
609
|
+
dv.setUint32(24, this.computeSchemaHash(), true);
|
|
610
|
+
dv.setUint32(28, 0, true);
|
|
611
|
+
let off = 32;
|
|
612
|
+
const writeBytes = (arr, byteLen) => {
|
|
613
|
+
if (byteLen > 0) out.set(new Uint8Array(arr.buffer, arr.byteOffset, byteLen), off);
|
|
614
|
+
const nextOff = off + byteLen + 7 & -8;
|
|
615
|
+
for (let p = off + byteLen; p < nextOff; p++) out[p] = 0;
|
|
616
|
+
off = nextOff;
|
|
617
|
+
};
|
|
618
|
+
writeBytes(this.masks, count * 4);
|
|
619
|
+
writeBytes(this.entities, count * 4);
|
|
620
|
+
writeBytes(this.freeHandles, freeCount * 4);
|
|
621
|
+
writeBytes(this.handleToSlot, nextHandle * 4);
|
|
622
|
+
writeBytes(this.handleGen, nextHandle * 2);
|
|
623
|
+
for (let i = 0; i < this.stores.length; i++) {
|
|
624
|
+
const st = this.stores[i];
|
|
625
|
+
if (st.def.isTag) continue;
|
|
626
|
+
const fields = st.def.fields;
|
|
627
|
+
for (let f = 0; f < fields.length; f++) {
|
|
628
|
+
const col = st.columns[fields[f]];
|
|
629
|
+
writeBytes(col, count * col.BYTES_PER_ELEMENT);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return out;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Restore `SoaWorld` in-place from a snapshot produced by `world.snapshot()`.
|
|
636
|
+
* Preserves all compiled `world.select()` / `world.store()` column views and generational `EntityId` validity.
|
|
637
|
+
*/
|
|
638
|
+
restore(snapshot) {
|
|
639
|
+
if (!snapshot || snapshot.byteLength < 32) throw new Error("SoaWorld.restore: invalid snapshot buffer (< 32 bytes)");
|
|
640
|
+
const dv = new DataView(snapshot.buffer, snapshot.byteOffset, snapshot.byteLength);
|
|
641
|
+
const magic = dv.getUint32(0, true);
|
|
642
|
+
const version = dv.getUint32(4, true);
|
|
643
|
+
if (magic !== 0x414f5348 || version !== 1) throw new Error("SoaWorld.restore: unrecognized HSOA snapshot header");
|
|
644
|
+
const snapCount = dv.getUint32(8, true);
|
|
645
|
+
const snapNextHandle = dv.getUint32(12, true);
|
|
646
|
+
const snapFreeCount = dv.getUint32(16, true);
|
|
647
|
+
const snapStores = dv.getUint32(20, true);
|
|
648
|
+
const snapSchema = dv.getUint32(24, true);
|
|
649
|
+
if (snapStores !== this.stores.length || snapSchema !== this.computeSchemaHash()) throw new Error("SoaWorld.restore: registered component schema does not match snapshot");
|
|
650
|
+
const expectedBytes = this.snapshotByteLength(snapCount, snapNextHandle, snapFreeCount);
|
|
651
|
+
if (snapshot.byteLength < expectedBytes) throw new Error(`SoaWorld.restore: truncated snapshot (${snapshot.byteLength} < ${expectedBytes})`);
|
|
652
|
+
const prevCount = this.count;
|
|
653
|
+
const prevNextHandle = this.nextHandle;
|
|
654
|
+
this.ensureCapacity(Math.max(16, snapCount));
|
|
655
|
+
this.ensureHandleCapacity(Math.max(16, snapNextHandle, snapFreeCount));
|
|
656
|
+
let off = 32;
|
|
657
|
+
const readBytes = (dst, byteLen) => {
|
|
658
|
+
if (byteLen > 0) new Uint8Array(dst.buffer, dst.byteOffset, byteLen).set(snapshot.subarray(off, off + byteLen));
|
|
659
|
+
off = off + byteLen + 7 & -8;
|
|
660
|
+
};
|
|
661
|
+
readBytes(this.masks, snapCount * 4);
|
|
662
|
+
if (prevCount > snapCount) this.masks.fill(0, snapCount, prevCount);
|
|
663
|
+
readBytes(this.entities, snapCount * 4);
|
|
664
|
+
if (prevCount > snapCount) this.entities.fill(0, snapCount, prevCount);
|
|
665
|
+
readBytes(this.freeHandles, snapFreeCount * 4);
|
|
666
|
+
readBytes(this.handleToSlot, snapNextHandle * 4);
|
|
667
|
+
this.handleToSlot.fill(-1, snapNextHandle);
|
|
668
|
+
readBytes(this.handleGen, snapNextHandle * 2);
|
|
669
|
+
if (prevNextHandle > snapNextHandle) this.handleGen.fill(0, snapNextHandle, prevNextHandle);
|
|
670
|
+
for (let i = 0; i < this.stores.length; i++) {
|
|
671
|
+
const st = this.stores[i];
|
|
672
|
+
if (st.def.isTag) continue;
|
|
673
|
+
const fields = st.def.fields;
|
|
674
|
+
for (let f = 0; f < fields.length; f++) {
|
|
675
|
+
const col = st.columns[fields[f]];
|
|
676
|
+
readBytes(col, snapCount * col.BYTES_PER_ELEMENT);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
this.count = snapCount;
|
|
680
|
+
this.nextHandle = snapNextHandle;
|
|
681
|
+
this.freeCount = snapFreeCount;
|
|
682
|
+
this.clearEvents();
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Compute a fast deterministic 32-bit FNV-1a checksum over all live entities, masks, and active component columns
|
|
686
|
+
* (canonicalizing `-0.0` in float columns for rollback netcode & replay desync verification).
|
|
687
|
+
*/
|
|
688
|
+
checksum() {
|
|
689
|
+
const count = this.count;
|
|
690
|
+
let h = 0x811c9dc5;
|
|
691
|
+
const mixByte = (b) => {
|
|
692
|
+
h ^= b & 255;
|
|
693
|
+
h = Math.imul(h, 16777619) >>> 0;
|
|
694
|
+
};
|
|
695
|
+
const mixU32 = (v) => {
|
|
696
|
+
mixByte(v);
|
|
697
|
+
mixByte(v >>> 8);
|
|
698
|
+
mixByte(v >>> 16);
|
|
699
|
+
mixByte(v >>> 24);
|
|
700
|
+
};
|
|
701
|
+
mixU32(count);
|
|
702
|
+
for (let s = 0; s < count; s++) {
|
|
703
|
+
mixU32(this.masks[s]);
|
|
704
|
+
mixU32(this.entities[s]);
|
|
705
|
+
}
|
|
706
|
+
const fDv = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
707
|
+
for (let i = 0; i < this.stores.length; i++) {
|
|
708
|
+
const st = this.stores[i];
|
|
709
|
+
if (st.def.isTag) continue;
|
|
710
|
+
const fields = st.def.fields;
|
|
711
|
+
for (let f = 0; f < fields.length; f++) {
|
|
712
|
+
const fname = fields[f];
|
|
713
|
+
const kind = st.def.schema[fname];
|
|
714
|
+
const col = st.columns[fname];
|
|
715
|
+
if (kind === "f32") for (let s = 0; s < count; s++) {
|
|
716
|
+
const v = col[s];
|
|
717
|
+
fDv.setFloat32(0, v === 0 ? 0 : Number.isNaN(v) ? 0 : v, true);
|
|
718
|
+
mixU32(fDv.getUint32(0, true));
|
|
719
|
+
}
|
|
720
|
+
else if (kind === "f64") for (let s = 0; s < count; s++) {
|
|
721
|
+
const v = col[s];
|
|
722
|
+
fDv.setFloat64(0, v === 0 ? 0 : Number.isNaN(v) ? 0 : v, true);
|
|
723
|
+
mixU32(fDv.getUint32(0, true));
|
|
724
|
+
mixU32(fDv.getUint32(4, true));
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
const bytes = new Uint8Array(col.buffer, col.byteOffset, count * col.BYTES_PER_ELEMENT);
|
|
728
|
+
for (let b = 0; b < bytes.length; b++) mixByte(bytes[b]);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return h >>> 0;
|
|
733
|
+
}
|
|
560
734
|
};
|
|
561
735
|
/**
|
|
562
736
|
* In-place zero-GC insertion/Ciura-gap Shell sort of `slots[0..count - 1]` ordered ascending by
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-CXsCvp1p.js";
|
|
2
2
|
import { AnimationManager } from "./anims.js";
|
|
3
|
-
import { o as Renderer2D, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-
|
|
3
|
+
import { o as Renderer2D, s as Camera, t as RendererWebGpu } from "./renderer-webgpu-q4vdE3kA.js";
|
|
4
4
|
import { _ as TileSpriteObject, c as ImageObject, d as NineSliceObject, f as PanelObject, g as TextObject, h as SpriteObject, i as DisplayList, l as InstancedBatchObject, m as ShapeBatchObject, n as Container, o as DrawStreamObject, p as RectangleObject, r as CustomPassObject, s as Graphics, t as BlitterObject, u as MsdfIconObject } from "./display-CVjvA8ZO.js";
|
|
5
5
|
import { TweenManager } from "./tween.js";
|
|
6
6
|
import { ScriptScheduler } from "./coroutine.js";
|
|
@@ -5341,8 +5341,10 @@ var ScaleManager = class extends EventEmitter {
|
|
|
5341
5341
|
fitToContainer(availWidth, availHeight) {
|
|
5342
5342
|
const parent = this.canvas?.parentElement;
|
|
5343
5343
|
const win = this.canvas?.ownerDocument?.defaultView;
|
|
5344
|
-
const
|
|
5345
|
-
const
|
|
5344
|
+
const parentW = parent?.clientWidth ?? 0;
|
|
5345
|
+
const parentH = parent?.clientHeight ?? 0;
|
|
5346
|
+
const aw = Math.max(1, availWidth ?? (parentW > 0 ? parentW : void 0) ?? win?.innerWidth ?? this.logicalWidth);
|
|
5347
|
+
const ah = Math.max(1, availHeight ?? (parentH > 0 ? parentH : void 0) ?? win?.innerHeight ?? this.logicalHeight);
|
|
5346
5348
|
const lw = Math.max(1, this.logicalWidth);
|
|
5347
5349
|
const lh = Math.max(1, this.logicalHeight);
|
|
5348
5350
|
const scale = Math.min(aw / lw, ah / lh);
|
|
@@ -5364,11 +5366,42 @@ var ScaleManager = class extends EventEmitter {
|
|
|
5364
5366
|
offsetY
|
|
5365
5367
|
};
|
|
5366
5368
|
}
|
|
5369
|
+
/**
|
|
5370
|
+
* Resize the backing canvas and `logicalWidth/logicalHeight` to fill `availWidth × availHeight`
|
|
5371
|
+
* (or `canvas.parentElement` / `window`) 1:1 without letterboxing (`Scale.RESIZE`), emitting `'resize'`.
|
|
5372
|
+
*/
|
|
5373
|
+
fitToResizeContainer(availWidth, availHeight) {
|
|
5374
|
+
const parent = this.canvas?.parentElement;
|
|
5375
|
+
const win = this.canvas?.ownerDocument?.defaultView;
|
|
5376
|
+
const parentW = parent?.clientWidth ?? 0;
|
|
5377
|
+
const parentH = parent?.clientHeight ?? 0;
|
|
5378
|
+
const w = Math.max(1, Math.round(availWidth ?? (parentW > 0 ? parentW : void 0) ?? win?.innerWidth ?? this.width));
|
|
5379
|
+
const h = Math.max(1, Math.round(availHeight ?? (parentH > 0 ? parentH : void 0) ?? win?.innerHeight ?? this.height));
|
|
5380
|
+
if (this.canvas?.style) {
|
|
5381
|
+
this.canvas.style.width = `${w}px`;
|
|
5382
|
+
this.canvas.style.height = `${h}px`;
|
|
5383
|
+
}
|
|
5384
|
+
this.logicalWidth = w;
|
|
5385
|
+
this.logicalHeight = h;
|
|
5386
|
+
if (w !== this.width || h !== this.height) this.resize(w, h);
|
|
5387
|
+
else {
|
|
5388
|
+
this.displayScale.x = 1 / (this.zoom || 1);
|
|
5389
|
+
this.displayScale.y = 1 / (this.zoom || 1);
|
|
5390
|
+
}
|
|
5391
|
+
return {
|
|
5392
|
+
width: w,
|
|
5393
|
+
height: h
|
|
5394
|
+
};
|
|
5395
|
+
}
|
|
5367
5396
|
refresh() {
|
|
5368
5397
|
if (this.mode === Scale.FIT) {
|
|
5369
5398
|
this.fitToContainer();
|
|
5370
5399
|
return this;
|
|
5371
5400
|
}
|
|
5401
|
+
if (this.mode === Scale.RESIZE) {
|
|
5402
|
+
this.fitToResizeContainer();
|
|
5403
|
+
return this;
|
|
5404
|
+
}
|
|
5372
5405
|
this.displayScale.x = 1 / (this.zoom || 1);
|
|
5373
5406
|
this.displayScale.y = 1 / (this.zoom || 1);
|
|
5374
5407
|
return this;
|
|
@@ -5694,6 +5727,7 @@ var Game = class {
|
|
|
5694
5727
|
ownedCanvas = false;
|
|
5695
5728
|
inStep = false;
|
|
5696
5729
|
onWindowResize = null;
|
|
5730
|
+
resizeObserver = null;
|
|
5697
5731
|
constructor(config = {}) {
|
|
5698
5732
|
this.config = config;
|
|
5699
5733
|
const fallbackDoc = typeof document !== "undefined" ? document : void 0;
|
|
@@ -5753,13 +5787,22 @@ var Game = class {
|
|
|
5753
5787
|
};
|
|
5754
5788
|
const scaleMode = config.scale?.mode ?? Scale.NONE;
|
|
5755
5789
|
this.scale = new ScaleManager(this.canvas, this.renderer, width, height, zoom, scaleMode);
|
|
5756
|
-
if (scaleMode === Scale.FIT) {
|
|
5757
|
-
this.scale.
|
|
5790
|
+
if (scaleMode === Scale.FIT || scaleMode === Scale.RESIZE) {
|
|
5791
|
+
this.scale.refresh();
|
|
5792
|
+
this.onWindowResize = () => {
|
|
5793
|
+
if (!this.destroyed) this.scale.refresh();
|
|
5794
|
+
};
|
|
5758
5795
|
if (this.win && typeof this.win.addEventListener === "function") {
|
|
5759
|
-
this.onWindowResize = () => {
|
|
5760
|
-
if (!this.destroyed) this.scale.fitToContainer();
|
|
5761
|
-
};
|
|
5762
5796
|
this.win.addEventListener("resize", this.onWindowResize);
|
|
5797
|
+
this.win.addEventListener("orientationchange", this.onWindowResize);
|
|
5798
|
+
}
|
|
5799
|
+
const observeEl = this.canvas?.parentElement;
|
|
5800
|
+
if (observeEl && typeof ResizeObserver === "function") {
|
|
5801
|
+
const ro = new ResizeObserver(() => {
|
|
5802
|
+
if (!this.destroyed) this.scale.refresh();
|
|
5803
|
+
});
|
|
5804
|
+
ro.observe(observeEl);
|
|
5805
|
+
this.resizeObserver = ro;
|
|
5763
5806
|
}
|
|
5764
5807
|
}
|
|
5765
5808
|
this.cache = { json: new JsonCache() };
|
|
@@ -5840,8 +5883,13 @@ var Game = class {
|
|
|
5840
5883
|
this.pendingDestroy = true;
|
|
5841
5884
|
this.destroyed = true;
|
|
5842
5885
|
this.loop.destroy();
|
|
5886
|
+
if (this.resizeObserver) {
|
|
5887
|
+
this.resizeObserver.disconnect();
|
|
5888
|
+
this.resizeObserver = null;
|
|
5889
|
+
}
|
|
5843
5890
|
if (this.onWindowResize && this.win && typeof this.win.removeEventListener === "function") {
|
|
5844
5891
|
this.win.removeEventListener("resize", this.onWindowResize);
|
|
5892
|
+
this.win.removeEventListener("orientationchange", this.onWindowResize);
|
|
5845
5893
|
this.onWindowResize = null;
|
|
5846
5894
|
}
|
|
5847
5895
|
this.events.emit("destroy", this);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as ScaleMode, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, _ as SpriteSheetConfig, d as AtlasJsonLike, g as GlTextureHost, p as Frame, r as AnimationManager, u as StageAnimation, v as Texture, x as TextureManager, y as TextureImageOptions } from "./anims-BOvaKn6w.js";
|
|
1
|
+
import { A as FilterModeValue, I as ScaleMode, M as Matrix2D, N as Rect2D, O as EventEmitter, P as RgbaColor, R as TintMode, S as TextureSource, T as BlendMode, U as WorldView2D, _ as SpriteSheetConfig, d as AtlasJsonLike, g as GlTextureHost, p as Frame, r as AnimationManager, u as StageAnimation, v as Texture, x as TextureManager, y as TextureImageOptions } from "./anims-BOvaKn6w.js";
|
|
2
2
|
import { c as TweenManager, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
3
3
|
import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
|
4
4
|
interface CameraFollowOptions {
|
|
@@ -1737,7 +1737,7 @@ declare function unpackChunkY(key: number): number;
|
|
|
1737
1737
|
declare function floorDiv(a: number, b: number): number;
|
|
1738
1738
|
declare function positiveMod(a: number, b: number): number;
|
|
1739
1739
|
/**
|
|
1740
|
-
* Compute
|
|
1740
|
+
* Compute the 4-bit **Dual-Grid** mask (`0..15`) for half-offset visual vertex `(vx, vy)`,
|
|
1741
1741
|
* which sits at world `(vx * tileSize - tileSize * 0.5, vy * tileSize - tileSize * 0.5)` and samples
|
|
1742
1742
|
* the 4 surrounding logical cells `(vx-1, vy-1)`, `(vx, vy-1)`, `(vx-1, vy)`, `(vx, vy)`.
|
|
1743
1743
|
*
|
|
@@ -1854,20 +1854,64 @@ interface DualGridLayerSpec {
|
|
|
1854
1854
|
/** Returns true when a ground `turfId` belongs to (or sits above) this Dual-Grid terrain layer. */
|
|
1855
1855
|
matches: (turfId: number) => boolean;
|
|
1856
1856
|
}
|
|
1857
|
+
interface BakeDualGridTilesetOptions {
|
|
1858
|
+
/** Custom canvas factory (e.g. `@napi-rs/canvas` `createCanvas` in headless Node/Bun). */
|
|
1859
|
+
createCanvas?: (w: number, h: number) => HTMLCanvasElement;
|
|
1860
|
+
/**
|
|
1861
|
+
* Per-side border extrusion in pixels (`default = 2`).
|
|
1862
|
+
* Repeats each tile's outermost edge and corner texels into a `2 * extrude` gutter around every cell
|
|
1863
|
+
* so `FilterMode.LINEAR` rotated or scaled quads never bleed adjacent tiles or transparent gutters.
|
|
1864
|
+
*/
|
|
1865
|
+
extrude?: number;
|
|
1866
|
+
/** Default `FilterMode` used by `registerOnScene()` (`default = FilterMode.NEAREST`; pass `FilterMode.LINEAR` for rotated 2.5D ground). */
|
|
1867
|
+
filterMode?: FilterModeValue;
|
|
1868
|
+
}
|
|
1857
1869
|
interface BakedDualGridAtlas {
|
|
1858
1870
|
readonly textureKey: string;
|
|
1859
1871
|
readonly tileSize: number;
|
|
1872
|
+
readonly extrude: number;
|
|
1873
|
+
readonly cellStride: number;
|
|
1874
|
+
readonly filterMode: FilterModeValue;
|
|
1875
|
+
readonly width: number;
|
|
1876
|
+
readonly height: number;
|
|
1877
|
+
readonly rgba: Uint8ClampedArray;
|
|
1860
1878
|
readonly canvas: HTMLCanvasElement;
|
|
1861
1879
|
readonly layers: ReadonlyArray<DualGridLayerSpec>;
|
|
1862
1880
|
frameName(layerId: string, mask: number): string;
|
|
1863
|
-
|
|
1881
|
+
frameRect(layerIndex: number, mask: number): {
|
|
1882
|
+
x: number;
|
|
1883
|
+
y: number;
|
|
1884
|
+
width: number;
|
|
1885
|
+
height: number;
|
|
1886
|
+
};
|
|
1887
|
+
registerOnScene(scene: SceneHostLike, opts?: {
|
|
1888
|
+
filterMode?: FilterModeValue;
|
|
1889
|
+
}): void;
|
|
1864
1890
|
}
|
|
1865
1891
|
/**
|
|
1866
1892
|
* Bake one or more 16-tile (`0..15`) organic Dual-Grid terrain layers onto a single crisp texture atlas!
|
|
1867
|
-
* Uses smooth analytical quarter-circle / saddle SDF distance fields per pixel
|
|
1868
|
-
*
|
|
1893
|
+
* Uses smooth analytical quarter-circle / saddle SDF distance fields per pixel with edge-pixel extrusion
|
|
1894
|
+
* (`extrude = 2` by default) so rotated 2.5D ground never bleeds neighbor cells under `FilterMode.LINEAR`.
|
|
1869
1895
|
*/
|
|
1870
|
-
declare function bakeDualGridTileset(textureKey: string, tileSize: number, layers: DualGridLayerSpec[],
|
|
1896
|
+
declare function bakeDualGridTileset(textureKey: string, tileSize: number, layers: DualGridLayerSpec[], createCanvasOrOpts?: ((w: number, h: number) => HTMLCanvasElement) | BakeDualGridTilesetOptions, maybeOpts?: BakeDualGridTilesetOptions): BakedDualGridAtlas;
|
|
1897
|
+
interface MountChunkedTilemapOptions {
|
|
1898
|
+
baseColor?: number;
|
|
1899
|
+
depth?: number;
|
|
1900
|
+
marginChunks?: number;
|
|
1901
|
+
trackId?: string;
|
|
1902
|
+
/**
|
|
1903
|
+
* Pre-composite all Dual-Grid layers of each `16×16` chunk onto a cached offscreen chunk texture (`default = true` across WebGPU, WebGL2 & Canvas2D).
|
|
1904
|
+
* Eliminates per-tile UV seams, inherits `filterMode` (`LINEAR` / `NEAREST`), and collapses ~4,500 tile quads/frame down to ~12 chunk quads.
|
|
1905
|
+
*/
|
|
1906
|
+
chunkCache?: boolean;
|
|
1907
|
+
/**
|
|
1908
|
+
* Cross-chunk neighbor apron in pixels baked around each cached chunk texture (`default = 2`).
|
|
1909
|
+
* Samples actual neighboring world Dual-Grid tiles so `FilterMode.LINEAR` interpolates seamlessly across chunk boundaries.
|
|
1910
|
+
*/
|
|
1911
|
+
chunkApron?: number;
|
|
1912
|
+
/** Override `FilterMode` for cached chunk textures (defaults to the source tileset texture's `filterMode`). */
|
|
1913
|
+
filterMode?: FilterModeValue;
|
|
1914
|
+
}
|
|
1871
1915
|
interface MountedChunkedTilemap {
|
|
1872
1916
|
readonly container: Container;
|
|
1873
1917
|
readonly blitters: ReadonlyArray<BlitterObject>;
|
|
@@ -1886,18 +1930,12 @@ interface MountedChunkedTilemap {
|
|
|
1886
1930
|
}
|
|
1887
1931
|
/**
|
|
1888
1932
|
* Mount a `ChunkedTilemap` + `BakedDualGridAtlas` onto a Stage `Scene`.
|
|
1889
|
-
* -
|
|
1890
|
-
*
|
|
1891
|
-
* `
|
|
1892
|
-
*
|
|
1933
|
+
* - By default (`chunkCache: true`) across WebGPU, WebGL2, and Canvas2D: pre-composites all Dual-Grid layers of each
|
|
1934
|
+
* chunk onto a cached chunk texture with a `2px` cross-chunk world-neighbor apron (`chunkApron: 2`), inheriting
|
|
1935
|
+
* `FilterMode.LINEAR` / `FilterMode.NEAREST` so rotated 2.5D ground has zero tile or chunk seams at ~12 quads/frame.
|
|
1936
|
+
* - Pass `{ chunkCache: false }` to emit individual per-layer `BlitterObject` quads instead.
|
|
1893
1937
|
*/
|
|
1894
|
-
declare function mountChunkedTilemap(scene: SceneHostLike, map: ChunkedTilemap, atlas: BakedDualGridAtlas, opts?:
|
|
1895
|
-
baseColor?: number;
|
|
1896
|
-
depth?: number;
|
|
1897
|
-
marginChunks?: number;
|
|
1898
|
-
trackId?: string;
|
|
1899
|
-
chunkCache?: boolean;
|
|
1900
|
-
}): MountedChunkedTilemap;
|
|
1938
|
+
declare function mountChunkedTilemap(scene: SceneHostLike, map: ChunkedTilemap, atlas: BakedDualGridAtlas, opts?: MountChunkedTilemapOptions): MountedChunkedTilemap;
|
|
1901
1939
|
interface ItemDef {
|
|
1902
1940
|
id: string;
|
|
1903
1941
|
name?: string;
|
|
@@ -2313,6 +2351,92 @@ interface InputRecorderPlugin extends StagePlugin {
|
|
|
2313
2351
|
declare function createInputRecorder(id?: string): InputRecorderPlugin;
|
|
2314
2352
|
/** Replays a recorded `RecordedInputEntry[]` log deterministically on matching simulation timestamps. */
|
|
2315
2353
|
declare function createInputReplay(log: ReadonlyArray<RecordedInputEntry>, id?: string): StagePlugin & InputProvider;
|
|
2354
|
+
interface RollbackStateCodec {
|
|
2355
|
+
/** Save current simulation state into `into` (if large enough) or return a fresh `Uint8Array`. */
|
|
2356
|
+
save(into?: Uint8Array): Uint8Array;
|
|
2357
|
+
/** Restore simulation state in-place from `snapshot`. */
|
|
2358
|
+
load(snapshot: Uint8Array): void;
|
|
2359
|
+
/** Optional deterministic 32-bit state checksum for desync detection. */
|
|
2360
|
+
checksum?(): number;
|
|
2361
|
+
}
|
|
2362
|
+
interface RollbackSessionOptions<TInput> {
|
|
2363
|
+
/** Maximum number of historical frames retained in the ring buffer (`default = 120` = 2.0s @ 60 Hz). */
|
|
2364
|
+
readonly windowFrames?: number;
|
|
2365
|
+
/** Initial simulation frame number (`default = 0`). */
|
|
2366
|
+
readonly initialFrame?: number;
|
|
2367
|
+
/** Equality comparator for `TInput` to skip redundant rollbacks when authoritative input matches prediction. */
|
|
2368
|
+
readonly inputEquals?: (a: TInput, b: TInput) => boolean;
|
|
2369
|
+
/** State serializer/deserializer (or pass a `SoaWorld` to `RollbackSession.fromSoaWorld(...)`). */
|
|
2370
|
+
readonly codec: RollbackStateCodec;
|
|
2371
|
+
/** Pure deterministic single-frame simulation step `(frame, input) => void`. */
|
|
2372
|
+
readonly step: (frame: number, input: TInput) => void;
|
|
2373
|
+
}
|
|
2374
|
+
interface RollbackResult {
|
|
2375
|
+
readonly rolledBack: boolean;
|
|
2376
|
+
readonly targetFrame: number;
|
|
2377
|
+
readonly framesResimulated: number;
|
|
2378
|
+
readonly checksum: number;
|
|
2379
|
+
}
|
|
2380
|
+
interface RollbackStats {
|
|
2381
|
+
readonly currentFrame: number;
|
|
2382
|
+
readonly oldestFrame: number;
|
|
2383
|
+
readonly windowFrames: number;
|
|
2384
|
+
readonly rollbackCount: number;
|
|
2385
|
+
readonly resimulatedFrames: number;
|
|
2386
|
+
readonly maxRollbackDepth: number;
|
|
2387
|
+
}
|
|
2388
|
+
interface SnapshotableWorldLike {
|
|
2389
|
+
snapshot(into?: Uint8Array): Uint8Array;
|
|
2390
|
+
restore(snapshot: Uint8Array): void;
|
|
2391
|
+
checksum?(): number;
|
|
2392
|
+
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Deterministic ring-buffered rollback netcode (GGPO-style prediction + authoritative correction)
|
|
2395
|
+
* and interactive Time-Travel debugger with zero steady-state heap allocations.
|
|
2396
|
+
*/
|
|
2397
|
+
declare class RollbackSession<TInput> {
|
|
2398
|
+
readonly windowFrames: number;
|
|
2399
|
+
private curFrame;
|
|
2400
|
+
private minRecordedFrame;
|
|
2401
|
+
private readonly codec;
|
|
2402
|
+
private readonly stepFn;
|
|
2403
|
+
private readonly inputEq;
|
|
2404
|
+
private readonly ringFrames;
|
|
2405
|
+
private readonly ringBufs;
|
|
2406
|
+
private readonly ringLens;
|
|
2407
|
+
private readonly ringChecksums;
|
|
2408
|
+
private readonly ringInputs;
|
|
2409
|
+
private rollbacks;
|
|
2410
|
+
private resimFrames;
|
|
2411
|
+
private maxDepth;
|
|
2412
|
+
constructor(options: RollbackSessionOptions<TInput>);
|
|
2413
|
+
/** Create a `RollbackSession` bound directly to a `SoaWorld` (`world.snapshot` / `world.restore` / `world.checksum`). */
|
|
2414
|
+
static fromSoaWorld<TInput>(world: SnapshotableWorldLike, step: (frame: number, input: TInput) => void, options?: Omit<RollbackSessionOptions<TInput>, 'codec' | 'step'>): RollbackSession<TInput>;
|
|
2415
|
+
get currentFrame(): number;
|
|
2416
|
+
get oldestFrame(): number;
|
|
2417
|
+
private captureAtSlot;
|
|
2418
|
+
/** Save pre-step state for `currentFrame`, execute `step(currentFrame, input)`, and advance `currentFrame`. */
|
|
2419
|
+
advance(input: TInput): number;
|
|
2420
|
+
/** Read the input applied at historical `frame` (within `[oldestFrame .. currentFrame - 1]`). */
|
|
2421
|
+
inputAt(frame: number): TInput | undefined;
|
|
2422
|
+
/** Compute current live state checksum. */
|
|
2423
|
+
currentChecksum(): number;
|
|
2424
|
+
/** Compute checksum of the pre-step snapshot stored at historical `frame` (`null` if evicted). */
|
|
2425
|
+
checksumAt(frame: number): number | null;
|
|
2426
|
+
/**
|
|
2427
|
+
* Time-Travel rewind: restore live simulation state back to `targetFrame` (`oldestFrame <= targetFrame <= currentFrame`),
|
|
2428
|
+
* resetting `currentFrame = targetFrame` so subsequent `advance()` calls branch into a new timeline cleanly.
|
|
2429
|
+
*/
|
|
2430
|
+
rewindTo(targetFrame: number): void;
|
|
2431
|
+
/**
|
|
2432
|
+
* Apply an authoritative remote/replay input for `targetFrame`.
|
|
2433
|
+
* If it matches the predicted input already simulated at `targetFrame`, returns immediately (`rolledBack: false`).
|
|
2434
|
+
* Otherwise restores `targetFrame`'s snapshot, updates the input at `targetFrame`, and re-simulates `[targetFrame .. currentFrame - 1]`.
|
|
2435
|
+
*/
|
|
2436
|
+
applyAuthoritativeInput(targetFrame: number, actualInput: TInput, equals?: (a: TInput, b: TInput) => boolean): RollbackResult;
|
|
2437
|
+
stats(): RollbackStats;
|
|
2438
|
+
}
|
|
2439
|
+
declare function createRollbackSession<TInput>(options: RollbackSessionOptions<TInput>): RollbackSession<TInput>;
|
|
2316
2440
|
type StageRenderer = RendererGl | Renderer2D | RendererWebGpu;
|
|
2317
2441
|
interface EngineClockSnapshot {
|
|
2318
2442
|
readonly frameSeq: number;
|
|
@@ -2463,6 +2587,14 @@ declare class ScaleManager extends EventEmitter {
|
|
|
2463
2587
|
* preserving `logicalWidth : logicalHeight` aspect ratio (zero CSS matrix distortion; `InputPlugin` & `clientToWorld` stay exact).
|
|
2464
2588
|
*/
|
|
2465
2589
|
fitToContainer(availWidth?: number, availHeight?: number): ViewportFitResult;
|
|
2590
|
+
/**
|
|
2591
|
+
* Resize the backing canvas and `logicalWidth/logicalHeight` to fill `availWidth × availHeight`
|
|
2592
|
+
* (or `canvas.parentElement` / `window`) 1:1 without letterboxing (`Scale.RESIZE`), emitting `'resize'`.
|
|
2593
|
+
*/
|
|
2594
|
+
fitToResizeContainer(availWidth?: number, availHeight?: number): {
|
|
2595
|
+
width: number;
|
|
2596
|
+
height: number;
|
|
2597
|
+
};
|
|
2466
2598
|
refresh(): this;
|
|
2467
2599
|
}
|
|
2468
2600
|
interface SceneLifecycleStats {
|
|
@@ -2611,10 +2743,11 @@ declare class Game {
|
|
|
2611
2743
|
private ownedCanvas;
|
|
2612
2744
|
private inStep;
|
|
2613
2745
|
private onWindowResize;
|
|
2746
|
+
private resizeObserver;
|
|
2614
2747
|
constructor(config?: GameConfig);
|
|
2615
2748
|
/** Advance simulation, tweens, kernel plugins, and camera follow by one deterministic tick WITHOUT rendering pixels. */
|
|
2616
2749
|
stepSimOnly(time: number, delta: number): boolean;
|
|
2617
2750
|
step(time: number, delta: number): void;
|
|
2618
2751
|
destroy(removeCanvas?: boolean): void;
|
|
2619
2752
|
}
|
|
2620
|
-
export {
|
|
2753
|
+
export { WorldCatalogSpec as $, SpriteObject as $n, WebGpuBootstrapResult as $t, StageKernel as A, DisplaySemantics as An, unpackChunkX as At, FrozenWorldCatalog as B, MsdfIconConfig as Bn, SceneDigestSurfaceEntry as Bt, RecordedInputEntry as C, CustomPassCallback as Cn, createIslandBiomeGenerator as Ct, RollbackStateCodec as D, DisplayList as Dn, mountChunkedTilemap as Dt, RollbackSessionOptions as E, DirectionalPlayOptions as En, hash2D as Et, createInputRecorder as F, EquipmentBinding as Fn, SceneDigestEngineSandbox as Ft, RecipeDef as G, PanelStyleConfig as Gn, InputConfig as Gt, ItemDef as H, NineSliceObject as Hn, SceneDigestSurfaces as Ht, createInputReplay as I, Graphics as In, SceneDigestNode as It, WorkstationInstance as J, SceneHostLike as Jn, Pointer as Jt, RecipeRegistry as K, RectClipMask as Kn, InputPlugin as Kt, createInputTimeline as L, ImageObject as Ln, SceneDigestOptions as Lt, TimelineClickOptions as M, DrawStreamObject as Mn, valueNoise2D as Mt, TimelineDragOptions as N, DrawStreamOptions as Nn, SceneDigest as Nt, RollbackStats as O, DisplayObject as On, packChunkKey as Ot, TimelineKeyOptions as P, DrawStreamSpriteOptions as Pn, SceneDigestActiveFocus as Pt, WorldCatalogRuntime as Q, SpriteAnimEventListener as Qn, RequestWebGpuOptions as Qt, createRollbackSession as R, InstancedBatchObject as Rn, SceneDigestOverlayStats as Rt, InputTimelinePlugin as S, ContainerFiltersShim as Sn, computeDualGridMask as St, RollbackSession as T, CustomPassOptions as Tn, floorDiv as Tt, ItemRegistry as U, PanelObject as Un, buildSceneDigest as Ut, InventoryContainer as V, MsdfIconObject as Vn, SceneDigestSurfaceSource as Vt, ItemStack as W, PanelOpenSide as Wn, sanitizeTrackToken as Wt, WorkstationScheduler as X, ShapeBatchObject as Xn, RendererWebGpu as Xt, WorkstationJob as Y, ShapeBatchColumns as Yn, PointerSample as Yt, WorkstationSnapshot as Z, ShapeBatchStyleDefaults as Zn, RendererWebGpuOptions as Zt, ActionMap as _, AnchorPose2D as _n, SurvivalBiomes as _t, GameLoop as a, HeadlessWebGpuOptions as an, Camera as ar, decodeWorldDeltaBytes as at, InputTargetSpec as b, Bob as bn, bakeDualGridTileset as bt, LoaderPlugin as c, openDawnWebGpu as cn, HiDpiScaleLike as cr, BakeDualGridTilesetOptions as ct, SceneCtor as d, Renderer2D as dn, ChunkedTilemap as dt, WebGpuCanvasContextLike as en, SpritePlayOptions as er, WorldDeltaSnapshot as et, SceneInput as f, RendererGl as fn, ChunkedTilemapOptions as ft, ViewportFitResult as g, StageRenderTarget as gn, MountedChunkedTilemap as gt, StageRenderer as h, Stage2DCustomImageHandler as hn, MountChunkedTilemapOptions as ht, GameConfig as i, HeadlessWebGpuHandle as in, TileSpriteObject as ir, createWorldCatalogRuntime as it, StagePlugin as j, DrawStreamBulkView as jn, unpackChunkY as jt, StageInputEvent as k, DisplayObjectType as kn, positiveMod as kt, ScaleManager as l, openWgpuNativeFfi as ln, BakedDualGridAtlas as lt, SceneManager as m, RendererStats as mn, IslandBiomeConfig as mt, EngineClockSnapshot as n, requestWebGpuDevice as nn, TextObject as nr, applyWorldDelta as nt, GameObjectFactory as o, OpenDawnWebGpuOptions as on, CameraFollowOptions as or, defineWorldCatalog as ot, SceneLifecycleStats as p, RendererGlOptions as pn, DualGridLayerSpec as pt, TileCellDelta as q, RectangleObject as qn, KeyboardPlugin as qt, Game as r, HeadlessWebGpuBackend as rn, TextStyleConfig as rr, captureWorldDelta as rt, JsonCache as s, OpenWgpuNativeFfiOptions as sn, HiDpiConfigureOptions as sr, encodeWorldDeltaBytes as st, EngineClock as t, WebGpuDeviceLike as tn, SyncAttachmentOptions as tr, WorldEntityRecord as tt, Scene as u, requestHeadlessWebGpu as un, ChunkGeneratorFn as ut, InputProvider as v, BindEquipmentOptions as vn, TileCellFlags as vt, RollbackResult as w, CustomPassObject as wn, fbm2D as wt, InputTimelineOptions as x, Container as xn, computeBlob47Index as xt, InputRecorderPlugin as y, BlitterObject as yn, TileChunk as yt, CatalogReloadDiff as z, InstancedColumns as zn, SceneDigestSandbox as zt };
|