@holtjs/stage 0.4.0 → 0.5.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 +19 -0
- package/README.md +140 -119
- package/dist/{game-CbmA4myj.js → game-Cu1G9xgW.js} +17 -4
- package/dist/{game-C6NrnZ7-.d.ts → game-GdPaQUqH.d.ts} +2 -1
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +1 -1
- package/dist/lighting.d.ts +129 -0
- package/dist/lighting.js +527 -0
- package/dist/projection.d.ts +131 -0
- package/dist/projection.js +262 -0
- package/dist/{renderer-webgpu-Bvvi5jN8.js → renderer-webgpu-BorAD6Kk.js} +1 -0
- package/dist/renderer-webgpu.d.ts +1 -1
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +317 -0
- package/dist/rig2d.js +871 -0
- package/dist/tilemap.d.ts +158 -0
- package/dist/tilemap.js +583 -0
- package/dist/trace.d.ts +1 -1
- package/dist/world.d.ts +183 -0
- package/dist/world.js +400 -0
- package/llms.txt +26 -17
- package/package.json +21 -1
- package/skills/stage/SKILL.md +140 -157
- package/skills/stage/references/subpaths.md +62 -54
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,25 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.5.0] - 2026-12-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **5 First-Party 2.5D Survival Sandbox Engine Subpaths** (`sideEffects: false`, zero runtime dependencies):
|
|
13
|
+
- **`@holtjs/stage/rig2d`** (`src/rig2d.ts`): 2D cutout/slot skeletal hierarchy (`defineRig2DSkeleton`, `Rig2DInstance`), O(1) slot/skin attachment swapping (`setAttachment`, `applySkin`) without resetting animation phase, two-layer animation mixer (`base` locomotion + bone-masked `overlay` action clips such as upper-body chopping while walking), keyframe events (`onEvent`), `mountRig2D()` scene adapter, and procedural `bakeCutoutAtlas()` spritesheet generator.
|
|
14
|
+
- **`@holtjs/stage/tilemap`** (`src/tilemap.ts`): Sparse integer-keyed `ChunkedTilemap` (`±1,000,000` tile coordinates) with cross-chunk border dirty propagation, Oskar Stålberg 16-tile **Dual-Grid Autotiler** (`computeDualGridMask`, `bakeDualGridTileset`), 47-tile Blob autotiler (`computeBlob47Index`), deterministic island biome noise generator (`createIslandBiomeGenerator`), nav obstacle extraction (`extractWalkableRect`), and viewport-streaming `mountChunkedTilemap()`.
|
|
15
|
+
- **`@holtjs/stage/projection`** (`src/projection.ts`): Rotatable oblique 2.5D camera (`Camera25D` with exact inverse `worldToScreen` ↔ `screenToGround` across full 360° `yaw` spins and smooth damped `Q/E` rotation) and `mountStage25D()` (3-stage nested ground-plane projection + upright cylindrical depth-sorted billboards + oblique sun shadow vector).
|
|
16
|
+
- **`@holtjs/stage/lighting`** (`src/lighting.ts`): `DayNightCycle` (`day`/`dusk`/`night` ambient tint, sun direction & shadow scale), 3×3 Sobel height-to-normal-map baker (`computeNormalMapPixels`, `bakeNormalMapCanvas`), `Lighting2DSystem` (`MULTIPLY` offscreen lightmap FBO + flickering point torches), and WebGL2 `createNormalLitSpritePass()` per-pixel directional + point normal-mapped sprite shader pass.
|
|
17
|
+
- **`@holtjs/stage/world`** (`src/world.ts`): `ItemRegistry`, `InventoryContainer` (with `freshness01` spoilage -> `'rot'`), `RecipeRegistry`, `WorkstationInstance` & `WorkstationScheduler` (fuel auto-refuel + deterministic offline `stepAll(deltaMs)` catch-up), and compact `WorldDeltaSave` (`captureWorldDelta`, `applyWorldDelta`, `encodeWorldDeltaBytes` / `decodeWorldDeltaBytes` `HWLD` binary codec).
|
|
18
|
+
- **12-Second 60 FPS Multi-Cut Survival Trailer Example (`examples/nightfall-trailer.mjs`)**: runnable via `pnpm run example:nightfall`, combining `StageKernel` + `createInputTimeline({ showCursor: true })` + all 5 new survival subpaths + 44.1 kHz stereo procedural foley & music score into a deterministic 1280×720 60 FPS MP4 + 6-panel storyboard PNG.
|
|
19
|
+
- **Expanded WebGPU, `StageKernel` & Survival Sandbox Documentation**: comprehensive reference & recipes across `README.md`, `docs/architecture.md`, `skills/stage/SKILL.md`, `skills/stage/references/subpaths.md`, and `llms.txt`.
|
|
20
|
+
|
|
21
|
+
## [0.4.1] - 2026-12-03
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- **WebGL `pixelStorei` Unpack Hygiene & `restoreState()` Isolation**:
|
|
25
|
+
- Reset `gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false)` immediately after `TextObject` (`src/display.ts`) and `RendererGl.uploadTextureSource()` (`src/renderer-gl.ts`) uploads instead of leaving `UNPACK_PREMULTIPLY_ALPHA_WEBGL = true` on the WebGL context (which premultiplied raw typed-array `RGBA8` data/splatmap uploads in `CustomPass` when alpha held non-opacity weights, reported by @Ivy).
|
|
26
|
+
- Updated `RendererGl.restoreState()` to reset `UNPACK_PREMULTIPLY_ALPHA_WEBGL = false`, `UNPACK_FLIP_Y_WEBGL = false`, `UNPACK_ALIGNMENT = 4`, `UNPACK_ROW_LENGTH = 0`, and the active framebuffer (`this.activeFbo`, supporting nested `renderToTarget()` FBO passes).
|
|
27
|
+
|
|
9
28
|
## [0.4.0] - 2026-12-03
|
|
10
29
|
|
|
11
30
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,49 +1,37 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Stage (`@holtjs/stage`)
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@holtjs/stage)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](package.json)
|
|
6
|
-
[](scripts/size.mjs)
|
|
7
7
|
|
|
8
|
-
A zero-dependency, tracing-first WebGL2 / Canvas2D 2D game
|
|
8
|
+
A zero-dependency, tracing-first **WebGPU / WebGL2 / Canvas2D** 2D & 2.5D game, UI, and 60 FPS programmable video engine written in strict TypeScript — covering GPU SDF panels, `StageKernel` plugins & unified `InputTimeline` automation, Flex/Wrap layout, damped springs, `SurfaceTree` barriers, zero-GC SoA ECS, FlowField/A* navigation, procedural foley audio, 2D cutout skeletal rigs, Dual-Grid chunked tilemaps, rotatable 2.5D camera projection, 2D normal-map lighting, and world delta saves.
|
|
9
9
|
|
|
10
|
+
- **Official Docs & Playground**: https://holt.js.org
|
|
10
11
|
- **npm**: https://www.npmjs.com/package/@holtjs/stage
|
|
11
12
|
- **Repository**: https://github.com/botiverse-play/stage
|
|
12
13
|
- **Architecture Docs**: [docs/architecture.md](docs/architecture.md)
|
|
13
14
|
- **AI Agent Kit**: [AGENTS.md](AGENTS.md) · [skills/stage/SKILL.md](skills/stage/SKILL.md) · [llms.txt](llms.txt)
|
|
14
15
|
- **Changelog & Community**: [CHANGELOG.md](CHANGELOG.md) · [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md)
|
|
15
16
|
|
|
16
|
-
Extracted from production use inside interactive 2D multiplayer worlds and canvas-native UI suites where bundle size, deterministic timing, crisp HiDPI rendering, and production observability matter.
|
|
17
|
-
|
|
18
17
|
## Highlights
|
|
19
18
|
|
|
20
|
-
- **Zero runtime dependencies**: Pure ESM TypeScript (
|
|
21
|
-
- **WebGL2
|
|
22
|
-
-
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- `
|
|
32
|
-
- `
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
- `
|
|
36
|
-
- `VirtualJoystick` — multi-touch finger-isolated (`pointer.id`) virtual joystick (`fixed` / `floating` with optional `follow`) + pure vector/deadzone/8-way D-pad math.
|
|
37
|
-
- `createSurfaceTree()` — Godot-inspired unified visual stacking = input barrier tree (`SURFACE_BAND`, `modal`/`fullscreen` barriers, scoped occlusion, `ui.cancel` / `onKey` / `Tab` focus dispatch, and monotonic DOM `z-index` solver).
|
|
38
|
-
- **First-Party Tree-Shakeable 2D Game Engine Primitives** (`sideEffects: false`, zero extra bytes if unused):
|
|
39
|
-
- **Spatial Hash Grid** (`@holtjs/stage/spatial`): zero-GC CSR uniform spatial hash for O(N) broadphase queries and crowd separation.
|
|
40
|
-
- **Deterministic 2D Hit & Push-Out** (`@holtjs/stage/hit`): IEEE-754 swept circles, melee arc sweeps, segments/capsules, AABB/circle obstacle resolution, and frame-rate-independent knockback.
|
|
41
|
-
- **Navigation** (`@holtjs/stage/nav`): multi-target `FlowFieldGrid`, bounded 8-neighbor A* with greedy LOS string-pulling (`findGridPath`), and local steering.
|
|
42
|
-
- **Particles & Hit-Feel Juice** (`@holtjs/stage/particles`): zero-GC `ParticlePool`, continuous `AmbientEmitterPool`, and hitstop + squared-trauma screen shake (`JuiceController`).
|
|
43
|
-
- **Procedural Audio & Foley** (`@holtjs/stage/audio`): pure-TS organic foley synthesis (`renderFoley`), spatial stereo panning (`spatialMix`), sfxr voice synth, and PCM16 WAV export.
|
|
44
|
-
- **Zero-GC SoA ECS** (`@holtjs/stage/ecs`): dense-packed `TypedArray` `SoaWorld` with generational entity handles, bitmask queries, `SpatialHashGrid` sync, frustum culling, Ciura-gap Shell depth sort, and 2.5D `DepthBand` partitioning.
|
|
45
|
-
- **Tracing-First Observability (`buildSceneDigest`)**:
|
|
46
|
-
- Privacy-safe structural scene snapshot (`clock`, `viewport`, `renderer`, `lifecycle`, `tweens`, `overlays`, `surfaces`, `sandbox`, and sanitized `trackId`/`role`/`alt`/`surface` nodes). Never scrapes arbitrary `TextObject.text` or user input.
|
|
19
|
+
- **Zero runtime dependencies & 20 tree-shakeable subpaths**: Pure ESM TypeScript (`sideEffects: false`); individual subpaths range from **1.1 kB to 7.4 kB gzipped**.
|
|
20
|
+
- **WebGPU + WebGL2 + Isomorphic Canvas2D + Node 60 FPS Headless**:
|
|
21
|
+
- **Native WebGPU (`@holtjs/stage/webgpu`)**: Zero-dependency `RendererWebGpu` + `requestWebGpuDevice()` with WGSL quad/polygon batching and WGSL analytical rounded/stepped-pixel SDF `PanelObject` pipelines across `NORMAL`, `ADD`, `MULTIPLY`, and `SCREEN` blends.
|
|
22
|
+
- **WebGL2 Primary (`RendererGl`)**: 1-sampler zero-branch shader + 8-unit multi-texture uber-batcher, `InstancedBatchObject` (`drawElementsInstanced`), offscreen `StageRenderTarget` FBOs, GPU SDF panels, Sharp-Bilinear Pixel-AA, MTSDF vector icons, and state-isolated `CustomPassObject`.
|
|
23
|
+
- **Isomorphic Canvas2D & Pure-Node 60 FPS Video (`@holtjs/stage/headless`)**: Identical scene graph runs in headless Node via `@napi-rs/canvas` (`createHeadlessStage`, `fastForward`, `renderStoryboard`, `createAudioTimeline` stereo WAV + `ffmpeg` MP4).
|
|
24
|
+
- **Godot-First `StageKernel` & Semantic `InputTimeline` (`@holtjs/stage/kernel`)**:
|
|
25
|
+
- Unified `StagePlugin` lifecycle (`setup`, `prestep`, `update`, `postrender`, LIFO `dispose`, auto-reported in `SceneDigest.plugins`).
|
|
26
|
+
- `ActionMap` (`bind`, `isDown`, `justPressed`, `axis`) + `InputProvider` bus shared by hardware mouse/keyboard, `createInputTimeline({ showCursor: true })` (click directly by `trackId`!), and `createInputRecorder` / `createInputReplay`.
|
|
27
|
+
- **2.5D Survival Sandbox Engine Pillars (*Don't Starve* / *Graveyard Keeper*-ready)**:
|
|
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, Oskar Stålberg **16-tile Dual-Grid** & **47-tile Blob** autotilers, island biome generator, and viewport-streaming `mountChunkedTilemap()`.
|
|
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
|
+
- **`@holtjs/stage/lighting`** (`4.1 kB` gz): `DayNightCycle`, Sobel 3×3 `bakeNormalMapCanvas()`, `Lighting2DSystem` (`MULTIPLY` offscreen lightmap FBO + flickering torches), and WebGL2 `createNormalLitSpritePass()`.
|
|
32
|
+
- **`@holtjs/stage/world`** (`2.8 kB` gz): `ItemRegistry`, `InventoryContainer` (with `freshness01` spoilage), `RecipeRegistry`, `WorkstationScheduler` (offline tick catch-up), and compact `HWLD` binary `WorldDeltaSave`.
|
|
33
|
+
- **Zero-GC Simulation, UI & Tracing (`buildSceneDigest`)**:
|
|
34
|
+
- `SoaWorld` ECS, CSR `SpatialHashGrid`, `FlowFieldGrid` + A*, swept-circle/arc `hit` + knockback, `ParticlePool` + `JuiceController`, procedural WebAudio `renderFoley`, `computeFlexLayout`, damped springs, `SurfaceTree` barriers, and zero-PII `buildSceneDigest()`.
|
|
47
35
|
|
|
48
36
|
## Install
|
|
49
37
|
|
|
@@ -51,103 +39,146 @@ Extracted from production use inside interactive 2D multiplayer worlds and canva
|
|
|
51
39
|
pnpm add @holtjs/stage
|
|
52
40
|
```
|
|
53
41
|
|
|
54
|
-
## Subpath Exports
|
|
55
|
-
|
|
56
|
-
| Import Path | Description | DOM Required? |
|
|
57
|
-
|
|
58
|
-
| `@holtjs/stage` | Full engine barrel (`
|
|
59
|
-
| `@holtjs/stage/
|
|
60
|
-
| `@holtjs/stage/
|
|
61
|
-
| `@holtjs/stage/
|
|
62
|
-
| `@holtjs/stage/
|
|
63
|
-
| `@holtjs/stage/
|
|
64
|
-
| `@holtjs/stage/
|
|
65
|
-
| `@holtjs/stage/
|
|
66
|
-
| `@holtjs/stage/
|
|
67
|
-
| `@holtjs/stage/
|
|
68
|
-
| `@holtjs/stage/
|
|
69
|
-
| `@holtjs/stage/
|
|
70
|
-
| `@holtjs/stage/
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
## 20 Subpath Exports
|
|
43
|
+
|
|
44
|
+
| Import Path | Gzip | Description | DOM Required? |
|
|
45
|
+
|---|---|---|---|
|
|
46
|
+
| `@holtjs/stage` | `57.3 kB` | Full engine barrel (`Stage`, `Game`, `Scene`, renderers, `InstancedBatch`, `Panel`, `StageKernel`, layout, tweens, tracing, surfaces) | Browser (`Game`/renderers) |
|
|
47
|
+
| `@holtjs/stage/webgpu` | `7.4 kB` | Native WebGPU WGSL batch & analytical SDF `PanelObject` renderer (`RendererWebGpu`, `requestWebGpuDevice`) | Browser WebGPU |
|
|
48
|
+
| `@holtjs/stage/kernel` | `4.8 kB` | `StageKernel`, `StagePlugin`, `ActionMap`, `createInputTimeline` (`trackId` clicks + cursor), recorder/replay | No |
|
|
49
|
+
| `@holtjs/stage/headless` | `38.6 kB` | Zero-browser 60 FPS `createHeadlessStage`, `fastForward`, `renderStoryboard`, `createAudioTimeline` WAV mixer | No (`@napi-rs/canvas`) |
|
|
50
|
+
| `@holtjs/stage/rig2d` | `5.7 kB` | 2D cutout skeletal rig (`defineRig2DSkeleton`, `Rig2DInstance`, `mountRig2D`, `bakeCutoutAtlas`), O(1) slot swap & 2-layer mixer | No |
|
|
51
|
+
| `@holtjs/stage/tilemap` | `3.5 kB` | Sparse `ChunkedTilemap`, 16-tile Dual-Grid & 47-tile Blob autotilers, biome generator, `mountChunkedTilemap` | No |
|
|
52
|
+
| `@holtjs/stage/projection` | `1.6 kB` | Rotatable 2.5D `Camera25D` (`worldToScreen` ↔ `screenToGround`) + `mountStage25D` upright cylindrical billboards | No |
|
|
53
|
+
| `@holtjs/stage/lighting` | `4.1 kB` | `DayNightCycle`, 3×3 Sobel normal-map baker, `Lighting2DSystem` (`MULTIPLY` lightmap), WebGL2 normal-lit sprite pass | No |
|
|
54
|
+
| `@holtjs/stage/world` | `2.8 kB` | `ItemRegistry`, `InventoryContainer` (spoilage), `RecipeRegistry`, `WorkstationScheduler`, `HWLD` binary `WorldDeltaSave` | No |
|
|
55
|
+
| `@holtjs/stage/flex` | `2.3 kB` | Pure 1D Flex & Wrap layout solvers (`computeFlexLayout`, `computeWrapLayout`, `resolvePadding`) | No |
|
|
56
|
+
| `@holtjs/stage/tween` | `1.4 kB` | Deterministic `TweenManager`, `Easings`, and damped springs | No |
|
|
57
|
+
| `@holtjs/stage/joystick` | `4.4 kB` | `VirtualJoystick` + pure vector/origin/8-way D-pad math helpers | Pure helpers: No |
|
|
58
|
+
| `@holtjs/stage/surfaces` | `2.2 kB` | Godot-inspired `SurfaceTree` input barrier & DOM `z-index` router | No |
|
|
59
|
+
| `@holtjs/stage/trace` | `1.9 kB` | Privacy-safe `buildSceneDigest()` and `sanitizeTrackToken()` | No |
|
|
60
|
+
| `@holtjs/stage/spatial` | `1.2 kB` | Zero-GC CSR `SpatialHashGrid` for broadphase queries & crowd separation | No |
|
|
61
|
+
| `@holtjs/stage/hit` | `1.1 kB` | Deterministic swept-circle, arc, segment, capsule, AABB hit & knockback math | No |
|
|
62
|
+
| `@holtjs/stage/nav` | `2.3 kB` | Multi-target `FlowFieldGrid`, A* + LOS string-pulling (`findGridPath`), steering | No |
|
|
63
|
+
| `@holtjs/stage/particles` | `3.0 kB` | Zero-GC `ParticlePool`, `AmbientEmitterPool`, and `JuiceController` (hitstop/shake) | No |
|
|
64
|
+
| `@holtjs/stage/audio` | `4.0 kB` | Procedural foley DSP (`renderFoley`), `spatialMix`, sfxr voices, PCM16 WAV export | No |
|
|
65
|
+
| `@holtjs/stage/ecs` | `3.5 kB` | Dense-packed zero-GC `SoaWorld` ECS, spatial sync, depth sort & 2.5D `DepthBand`s | No |
|
|
66
|
+
|
|
67
|
+
## Quick Starts
|
|
68
|
+
|
|
69
|
+
### 1. WebGPU-First Bootstrap with Automatic WebGL2 / Canvas2D Fallback
|
|
73
70
|
|
|
74
71
|
```ts
|
|
75
|
-
import {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class DemoScene extends Scene {
|
|
85
|
-
create() {
|
|
86
|
-
const layout = computeFlexLayout(
|
|
87
|
-
{ dir: 'row', w: 480, h: 120, gap: 12, padding: 16, align: 'center' },
|
|
88
|
-
[
|
|
89
|
-
{ w: 140, h: 80 },
|
|
90
|
-
{ w: 0, h: 80, grow: 1 },
|
|
91
|
-
],
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const card = this.add.panel(layout.rects[0].x, layout.rects[0].y, layout.rects[0].w, layout.rects[0].h, {
|
|
95
|
-
fillColor: 0xfff8e7,
|
|
96
|
-
borderColor: 0x2c241d,
|
|
97
|
-
borderWidth: 2,
|
|
98
|
-
radius: 14,
|
|
99
|
-
});
|
|
100
|
-
card.trackId = 'demo.card';
|
|
101
|
-
card.role = 'panel';
|
|
102
|
-
|
|
103
|
-
// Deterministic spring animation bound to the node's lifetime
|
|
104
|
-
this.tweens.spring({
|
|
105
|
-
from: card.y + 12,
|
|
106
|
-
to: card.y,
|
|
107
|
-
stiffness: 240,
|
|
108
|
-
damping: 20,
|
|
109
|
-
owner: card,
|
|
110
|
-
onUpdate: (y) => { card.y = y; },
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Privacy-safe structural trace snapshot
|
|
114
|
-
console.log(buildSceneDigest(this, { traceId: 'demo-trace-01' }));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
72
|
+
import { AUTO, Game, Scene, Scale, WEBGPU } from '@holtjs/stage';
|
|
73
|
+
import { requestWebGpuDevice } from '@holtjs/stage/webgpu';
|
|
74
|
+
|
|
75
|
+
const canvas = document.createElement('canvas');
|
|
76
|
+
document.getElementById('app')!.appendChild(canvas);
|
|
77
|
+
|
|
78
|
+
// Probes navigator.gpu cleanly; returns null when WebGPU is unavailable
|
|
79
|
+
const gpu = await requestWebGpuDevice(canvas, { powerPreference: 'high-performance' });
|
|
117
80
|
|
|
118
81
|
new Game({
|
|
119
|
-
type: AUTO,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
82
|
+
type: gpu ? WEBGPU : AUTO,
|
|
83
|
+
canvas,
|
|
84
|
+
webgpu: gpu ?? undefined,
|
|
85
|
+
width: 960,
|
|
86
|
+
height: 540,
|
|
87
|
+
backgroundColor: '#131722',
|
|
124
88
|
scale: { mode: Scale.NONE },
|
|
125
|
-
scene: [
|
|
89
|
+
scene: [MyScene],
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. `StageKernel` Actions & Semantic `InputTimeline` (`@holtjs/stage/kernel`)
|
|
94
|
+
|
|
95
|
+
Drive the exact same scene from physical keyboard/mouse, automated tests, or cinematic trailers — clicking UI elements directly by `trackId` via `buildSceneDigest()`:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import { createInputTimeline } from '@holtjs/stage/kernel';
|
|
99
|
+
|
|
100
|
+
// Bind semantic actions once on game.kernel.actions
|
|
101
|
+
game.kernel.actions
|
|
102
|
+
.bind('rotateCCW', ['KeyQ'])
|
|
103
|
+
.bind('rotateCW', ['KeyE'])
|
|
104
|
+
.bind('interact', ['Space', 'KeyF']);
|
|
105
|
+
|
|
106
|
+
// Script deterministic player input with a rendered virtual cursor & click ripples
|
|
107
|
+
const timeline = createInputTimeline({ showCursor: true, cursorColor: 0xffe066 });
|
|
108
|
+
timeline
|
|
109
|
+
.moveTo(640, 360, 0, 200)
|
|
110
|
+
.click('craft.torch', 600, { moveDurationMs: 280 }) // resolves bounds of node with trackId === 'craft.torch'
|
|
111
|
+
.pressKey('KeyE', 1200, 750); // smoothly orbits 2.5D camera via ActionMap
|
|
112
|
+
|
|
113
|
+
game.kernel.use(timeline);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 3. 2.5D Survival Sandbox (`rig2d` + `tilemap` + `projection` + `lighting` + `world`)
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { defineRig2DSkeleton, Rig2DInstance, mountRig2D } from '@holtjs/stage/rig2d';
|
|
120
|
+
import {
|
|
121
|
+
ChunkedTilemap, SurvivalBiomes, bakeDualGridTileset, createIslandBiomeGenerator, mountChunkedTilemap,
|
|
122
|
+
} from '@holtjs/stage/tilemap';
|
|
123
|
+
import { Camera25D, mountStage25D } from '@holtjs/stage/projection';
|
|
124
|
+
import { DayNightCycle, Lighting2DSystem } from '@holtjs/stage/lighting';
|
|
125
|
+
import { captureWorldDelta, encodeWorldDeltaBytes } from '@holtjs/stage/world';
|
|
126
|
+
|
|
127
|
+
const map = new ChunkedTilemap({
|
|
128
|
+
chunkSize: 16,
|
|
129
|
+
tileSize: 36,
|
|
130
|
+
generator: createIslandBiomeGenerator({ seed: 42, islandRadiusTiles: 24 }),
|
|
126
131
|
});
|
|
132
|
+
const dgAtlas = bakeDualGridTileset('island_dg', 36, [
|
|
133
|
+
{ id: 'beach', fillColor: 0xe6c88c, edgeColor: 0xfef3c7, matches: (t) => t >= SurvivalBiomes.BEACH },
|
|
134
|
+
{ id: 'meadow', fillColor: 0x5c8d3e, edgeColor: 0x3f6212, matches: (t) => t >= SurvivalBiomes.MEADOW },
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
const cam25 = new Camera25D({ viewportWidth: 1280, viewportHeight: 720, pitch: 0.84, zoom: 1.4 });
|
|
138
|
+
const stage25 = mountStage25D(scene, cam25, { depth: 10 });
|
|
139
|
+
const terrain = mountChunkedTilemap(scene, map, dgAtlas);
|
|
140
|
+
terrain.container.removeFromDisplayList();
|
|
141
|
+
stage25.groundWorld.add(terrain.container);
|
|
142
|
+
|
|
143
|
+
const heroRig = new Rig2DInstance(survivorSkeleton);
|
|
144
|
+
heroRig.play('walk');
|
|
145
|
+
heroRig.setAttachment('tool', 'axe_iron'); // O(1) slot swap without resetting walk cycle
|
|
146
|
+
heroRig.playOverlay('chop', { maskBones: ['arm_r', 'hand_r'] }); // upper-body chop while walking!
|
|
147
|
+
const heroView = mountRig2D(scene, heroRig, { depth: 20, trackId: 'actor.survivor' });
|
|
148
|
+
stage25.registerBillboard(heroView.container, 0, 0);
|
|
149
|
+
|
|
150
|
+
const cycle = new DayNightCycle({ dayLengthMs: 480_000 });
|
|
151
|
+
const lights = new Lighting2DSystem(scene, { width: 1280, height: 720, depth: 500 });
|
|
152
|
+
lights.addLight({ id: 'campfire', x: 0, y: 0, z: 18, radius: 240, color: 0xffa94d, intensity: 1, flicker: 0.18 });
|
|
153
|
+
|
|
154
|
+
// Save modified tiles + inventories + workstations in a compact binary HWLD delta
|
|
155
|
+
const saveBytes = encodeWorldDeltaBytes(captureWorldDelta({ seed: 42, simTimeMs: 120_000, tilemap: map }));
|
|
127
156
|
```
|
|
128
157
|
|
|
129
158
|
## AI Agent Support (`AGENTS.md`, Skills & `llms.txt`)
|
|
130
159
|
|
|
131
|
-
|
|
160
|
+
`@holtjs/stage` ships a full AI Agent Kit directly inside the npm tarball (`node_modules/@holtjs/stage/skills/stage/`):
|
|
132
161
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- **
|
|
138
|
-
- **
|
|
162
|
+
```bash
|
|
163
|
+
npx skills add botiverse-play/stage
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
- **Agent Skill**: [skills/stage/SKILL.md](skills/stage/SKILL.md) + [references/subpaths.md](skills/stage/references/subpaths.md)
|
|
167
|
+
- **Repository Agent Guide**: [AGENTS.md](AGENTS.md) & [skills/stage-contributor/SKILL.md](skills/stage-contributor/SKILL.md)
|
|
168
|
+
- **Machine-Readable Index**: [llms.txt](llms.txt)
|
|
139
169
|
|
|
140
170
|
## Runnable Examples
|
|
141
171
|
|
|
142
172
|
| Example | What it demonstrates | How to run |
|
|
143
173
|
|---|---|---|
|
|
174
|
+
| [examples/nightfall-trailer.mjs](examples/nightfall-trailer.mjs) | **12s 60 FPS 2.5D Survival Trailer** (`StageKernel` + `InputTimeline` + `rig2d` + Dual-Grid `tilemap` + rotatable `Camera25D` + `DayNightCycle`/`Lighting2DSystem` + `world` + stereo score) | `pnpm run pack && pnpm run example:nightfall` |
|
|
175
|
+
| [examples/headless-video.mjs](examples/headless-video.mjs) | Zero-browser 1280x720 60 FPS storyboard PNG + stereo WAV + H.264 MP4 video pipeline | `pnpm run pack && pnpm run example:video` |
|
|
176
|
+
| [examples/headless-sim.mjs](examples/headless-sim.mjs) | Zero-DOM Node 24 authoritative tick (`SoaWorld` + `FlowFieldGrid` + `sweptCircleHit` + `partitionDepthBands`) | `pnpm run pack && pnpm run example:headless` |
|
|
144
177
|
| [examples/showcase.html](examples/showcase.html) | Full 2-tab interactive Showcase (`2D Game Engine Lab` + `UI & SurfaceTree`) | `pnpm run build:pages && npx serve dist-pages` |
|
|
145
178
|
| [examples/minimal-game.html](examples/minimal-game.html) | ~120-line 2D arena (`SoaWorld` + `FlowFieldGrid` + `SpatialHashGrid` + `hit` + `ParticlePool` + `JuiceController`) | Open `/examples/minimal-game.html` from `dist-pages` |
|
|
146
179
|
| [examples/minimal-ui.html](examples/minimal-ui.html) | ~120-line GPU SDF UI (`computeFlexLayout` + `pixelStep` + damped springs + `SurfaceTree` Escape modal + `buildSceneDigest`) | Open `/examples/minimal-ui.html` from `dist-pages` |
|
|
147
|
-
| [examples/headless-sim.mjs](examples/headless-sim.mjs) | Zero-DOM Node 24 authoritative tick (`SoaWorld` + `FlowFieldGrid` + `sweptCircleHit` + `partitionDepthBands`) | `pnpm run pack && pnpm run example:headless` |
|
|
148
|
-
| [examples/headless-video.mjs](examples/headless-video.mjs) | Zero-browser 1280x720 60 FPS storyboard PNG + stereo WAV + H.264 MP4 video pipeline | `pnpm run pack && pnpm run example:video` |
|
|
149
180
|
|
|
150
|
-
## Development &
|
|
181
|
+
## Development & Verification
|
|
151
182
|
|
|
152
183
|
```bash
|
|
153
184
|
pnpm install
|
|
@@ -158,16 +189,6 @@ pnpm run build:pages
|
|
|
158
189
|
pnpm run size
|
|
159
190
|
```
|
|
160
191
|
|
|
161
|
-
Preview the 2-tab interactive Showcase (`2D Game Engine Lab` + `UI & SurfaceTree`) locally with `pnpm run build:pages && npx serve dist-pages`. Static hosting is pre-configured for **AWS Amplify** (`amplify.yml` + `customHttp.yml`) and **GitHub Pages** (`.github/workflows/pages.yml`).
|
|
162
|
-
|
|
163
|
-
See [docs/architecture.md](docs/architecture.md) for deep technical details on GPU batching invariants, coordinate/DPR contracts, cascading disposal, `SurfaceTree`, and tracing-first observability, and [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
|
|
164
|
-
|
|
165
|
-
## Community & Security
|
|
166
|
-
|
|
167
|
-
- Contributions welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
|
|
168
|
-
- Release history — see [CHANGELOG.md](CHANGELOG.md).
|
|
169
|
-
- Security reports — see [SECURITY.md](SECURITY.md) (please do not open public issues for vulnerabilities).
|
|
170
|
-
|
|
171
192
|
## License
|
|
172
193
|
|
|
173
194
|
Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, g as parseColor, h as packColorAbgr, l as Scenes, m as createMatrix2D, o as FilterMode, p as WHITE_RGB, r as BlendModes, u as TintModes } from "./types-DRFB0Klc.js";
|
|
2
|
-
import { a as CustomPassObject, c as Graphics, d as MsdfIconObject, f as NineSliceObject, g as TileSpriteObject, h as TextObject, i as Container, l as ImageObject, m as RectangleObject, o as DisplayList, p as PanelObject, r as BlitterObject, t as RendererWebGpu, u as InstancedBatchObject } from "./renderer-webgpu-
|
|
2
|
+
import { a as CustomPassObject, c as Graphics, d as MsdfIconObject, f as NineSliceObject, g as TileSpriteObject, h as TextObject, i as Container, l as ImageObject, m as RectangleObject, o as DisplayList, p as PanelObject, r as BlitterObject, t as RendererWebGpu, u as InstancedBatchObject } from "./renderer-webgpu-BorAD6Kk.js";
|
|
3
3
|
import { TweenManager } from "./tween.js";
|
|
4
4
|
import { StageKernel } from "./kernel.js";
|
|
5
5
|
// src/texture.ts
|
|
@@ -2326,6 +2326,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
2326
2326
|
sfMat = createMatrix2D();
|
|
2327
2327
|
maskWorldMat = createMatrix2D();
|
|
2328
2328
|
bindTextSlot0;
|
|
2329
|
+
activeFbo = null;
|
|
2329
2330
|
instProgram = null;
|
|
2330
2331
|
instUres = null;
|
|
2331
2332
|
instVao = null;
|
|
@@ -2374,6 +2375,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
2374
2375
|
this.onLostDom = (e) => {
|
|
2375
2376
|
e.preventDefault();
|
|
2376
2377
|
this.contextLost = true;
|
|
2378
|
+
this.activeFbo = null;
|
|
2377
2379
|
this.boundTexCache.fill(null);
|
|
2378
2380
|
this.activeTexUnit = -1;
|
|
2379
2381
|
this.batchStateBound = false;
|
|
@@ -2638,7 +2640,7 @@ var RendererGl = class extends EventEmitter {
|
|
|
2638
2640
|
src.glRepeat = canRepeat;
|
|
2639
2641
|
src.glPremultiplyAlpha = src.premultiplyAlpha;
|
|
2640
2642
|
}
|
|
2641
|
-
if (
|
|
2643
|
+
if (src.premultiplyAlpha) gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
2642
2644
|
src.dirty = false;
|
|
2643
2645
|
}
|
|
2644
2646
|
setTextureFilter(src) {
|
|
@@ -2690,12 +2692,20 @@ var RendererGl = class extends EventEmitter {
|
|
|
2690
2692
|
this.batchStateBound = true;
|
|
2691
2693
|
}
|
|
2692
2694
|
}
|
|
2693
|
-
/** Full state restore for external callers that may have mutated viewport/blend/textures directly. */
|
|
2695
|
+
/** Full state restore for external callers that may have mutated viewport/blend/textures/pixelStore/FBO directly. */
|
|
2694
2696
|
restoreState() {
|
|
2695
2697
|
const gl = this.gl;
|
|
2696
2698
|
this.invalidateProgramState();
|
|
2697
2699
|
this.boundTexCache.fill(null);
|
|
2698
2700
|
this.activeTexUnit = -1;
|
|
2701
|
+
if (typeof gl.bindFramebuffer === "function") gl.bindFramebuffer(gl.FRAMEBUFFER, this.activeFbo);
|
|
2702
|
+
if (typeof gl.pixelStorei === "function") {
|
|
2703
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
2704
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
|
2705
|
+
gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);
|
|
2706
|
+
const gl2 = gl;
|
|
2707
|
+
if (gl2.UNPACK_ROW_LENGTH !== void 0) gl.pixelStorei(gl2.UNPACK_ROW_LENGTH, 0);
|
|
2708
|
+
}
|
|
2699
2709
|
gl.viewport(0, 0, this.width, this.height);
|
|
2700
2710
|
gl.enable(gl.BLEND);
|
|
2701
2711
|
this.ensureBatchState();
|
|
@@ -3664,8 +3674,10 @@ var RendererGl = class extends EventEmitter {
|
|
|
3664
3674
|
fbo = created;
|
|
3665
3675
|
target._fbo = fbo;
|
|
3666
3676
|
} else gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
|
|
3677
|
+
const prevFbo = this.activeFbo;
|
|
3667
3678
|
const prevW = this.width;
|
|
3668
3679
|
const prevH = this.height;
|
|
3680
|
+
this.activeFbo = fbo;
|
|
3669
3681
|
this.width = target.width;
|
|
3670
3682
|
this.height = target.height;
|
|
3671
3683
|
this.updateProjection();
|
|
@@ -3686,7 +3698,8 @@ var RendererGl = class extends EventEmitter {
|
|
|
3686
3698
|
for (let i = 0; i < list.length; i++) this.renderNode(list[i], camera, null, camAlpha, 0);
|
|
3687
3699
|
}
|
|
3688
3700
|
this.flushAll();
|
|
3689
|
-
|
|
3701
|
+
this.activeFbo = prevFbo;
|
|
3702
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, prevFbo);
|
|
3690
3703
|
this.width = prevW;
|
|
3691
3704
|
this.height = prevH;
|
|
3692
3705
|
this.updateProjection();
|
|
@@ -901,6 +901,7 @@ declare class RendererGl extends EventEmitter implements GlTextureHost {
|
|
|
901
901
|
private readonly sfMat;
|
|
902
902
|
private readonly maskWorldMat;
|
|
903
903
|
private readonly bindTextSlot0;
|
|
904
|
+
private activeFbo;
|
|
904
905
|
private instProgram;
|
|
905
906
|
private instUres;
|
|
906
907
|
private instVao;
|
|
@@ -932,7 +933,7 @@ declare class RendererGl extends EventEmitter implements GlTextureHost {
|
|
|
932
933
|
ensureGlTexture(src: TextureSource): WebGLTexture | null;
|
|
933
934
|
getDummyGlTexture(): WebGLTexture | null;
|
|
934
935
|
private ensureBatchState;
|
|
935
|
-
/** Full state restore for external callers that may have mutated viewport/blend/textures directly. */
|
|
936
|
+
/** Full state restore for external callers that may have mutated viewport/blend/textures/pixelStore/FBO directly. */
|
|
936
937
|
restoreState(): void;
|
|
937
938
|
private setBlend;
|
|
938
939
|
private assignTextureUnit;
|
package/dist/headless.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as SceneDigestOptions, M as SceneDigest, T as StagePlugin, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-
|
|
1
|
+
import { I as SceneDigestOptions, M as SceneDigest, T as StagePlugin, f as SceneInput, n as EngineClockSnapshot, r as Game, u as Scene } from "./game-GdPaQUqH.js";
|
|
2
2
|
/** Minimal Canvas2D surface compatible with `@napi-rs/canvas`, `node-canvas`, and browser `<canvas>`. */
|
|
3
3
|
export interface HeadlessCanvasLike {
|
|
4
4
|
width: number;
|
package/dist/headless.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as WebGpuCanvasContextLike, $t as FilterMode, A as createInputReplay, At as RectangleObject, B as SceneDigestSurfaceSource, Bt as GlTextureHost, C as StageInputEvent, Ct as MsdfIconConfig, D as TimelineDragOptions, Dt as PanelOpenSide, E as TimelineClickOptions, Et as PanelObject, F as SceneDigestNode, Ft as Camera, G as InputPlugin, Gt as TextureManager, H as buildSceneDigest, Ht as Texture, I as SceneDigestOptions, It as CameraFollowOptions, J as PointerSample, Jt as BLACK_RGB, K as KeyboardPlugin, Kt as TextureSource, L as SceneDigestOverlayStats, Lt as HiDpiScaleLike, M as SceneDigest, Mt as TextObject, N as SceneDigestActiveFocus, Nt as TextStyleConfig, O as TimelineKeyOptions, Ot as PanelStyleConfig, P as SceneDigestEngineSandbox, Pt as TileSpriteObject, Q as WebGpuBootstrapResult, Qt as EventEmitter, R as SceneDigestSandbox, Rt as CanvasTexture, S as RecordedInputEntry, St as InstancedColumns, T as StagePlugin, Tt as NineSliceObject, U as sanitizeTrackToken, Ut as TextureImageOptions, V as SceneDigestSurfaces, Vt as SpriteSheetConfig, W as InputConfig, Wt as TextureImageSource, X as RendererWebGpuOptions, Xt as BlendModes, Y as RendererWebGpu, Yt as BlendMode, Z as RequestWebGpuOptions, Zt as CANVAS, _ as InputProvider, _t as DisplayObjectType, a as GameLoop, an as Scale, at as RendererStats, b as InputTimelineOptions, bt as ImageObject, c as LoaderPlugin, cn as TintModes, ct as BlitterObject, d as SceneCtor, dn as WHITE_RGB, dt as ContainerFiltersShim, en as FilterModeValue, et as WebGpuDeviceLike, f as SceneInput, fn as WorldView2D, ft as CustomPassCallback, g as ActionMap, gn as rgbToCss, gt as DisplayObject, h as StageRenderer, hn as parseColor, ht as DisplayList, i as GameConfig$1, in as RgbaColor, it as RendererGlOptions, j as createInputTimeline, jt as SceneHostLike, k as createInputRecorder, kt as RectClipMask, l as ScaleManager, ln as WEBGL, lt as Bob$1, m as SceneManager, mn as packColorAbgr, mt as CustomPassOptions, n as EngineClockSnapshot, nn as Matrix2D, nt as Renderer2D, o as GameObjectFactory, on as Scenes, ot as Stage2DCustomImageHandler, p as SceneLifecycleStats, pn as createMatrix2D, pt as CustomPassObject, q as Pointer, qt as AUTO, r as Game, rn as Rect2D, rt as RendererGl, s as JsonCache, sn as TintMode, st as StageRenderTarget, t as EngineClock, tn as HEX_MASK, tt as requestWebGpuDevice, u as Scene, un as WEBGPU, ut as Container, v as InputRecorderPlugin, vt as DisplaySemantics, w as StageKernel, wt as MsdfIconObject, x as InputTimelinePlugin, xt as InstancedBatchObject, y as InputTargetSpec, yt as Graphics, z as SceneDigestSurfaceEntry, zt as Frame } from "./game-
|
|
1
|
+
import { $ as WebGpuCanvasContextLike, $t as FilterMode, A as createInputReplay, At as RectangleObject, B as SceneDigestSurfaceSource, Bt as GlTextureHost, C as StageInputEvent, Ct as MsdfIconConfig, D as TimelineDragOptions, Dt as PanelOpenSide, E as TimelineClickOptions, Et as PanelObject, F as SceneDigestNode, Ft as Camera, G as InputPlugin, Gt as TextureManager, H as buildSceneDigest, Ht as Texture, I as SceneDigestOptions, It as CameraFollowOptions, J as PointerSample, Jt as BLACK_RGB, K as KeyboardPlugin, Kt as TextureSource, L as SceneDigestOverlayStats, Lt as HiDpiScaleLike, M as SceneDigest, Mt as TextObject, N as SceneDigestActiveFocus, Nt as TextStyleConfig, O as TimelineKeyOptions, Ot as PanelStyleConfig, P as SceneDigestEngineSandbox, Pt as TileSpriteObject, Q as WebGpuBootstrapResult, Qt as EventEmitter, R as SceneDigestSandbox, Rt as CanvasTexture, S as RecordedInputEntry, St as InstancedColumns, T as StagePlugin, Tt as NineSliceObject, U as sanitizeTrackToken, Ut as TextureImageOptions, V as SceneDigestSurfaces, Vt as SpriteSheetConfig, W as InputConfig, Wt as TextureImageSource, X as RendererWebGpuOptions, Xt as BlendModes, Y as RendererWebGpu, Yt as BlendMode, Z as RequestWebGpuOptions, Zt as CANVAS, _ as InputProvider, _t as DisplayObjectType, a as GameLoop, an as Scale, at as RendererStats, b as InputTimelineOptions, bt as ImageObject, c as LoaderPlugin, cn as TintModes, ct as BlitterObject, d as SceneCtor, dn as WHITE_RGB, dt as ContainerFiltersShim, en as FilterModeValue, et as WebGpuDeviceLike, f as SceneInput, fn as WorldView2D, ft as CustomPassCallback, g as ActionMap, gn as rgbToCss, gt as DisplayObject, h as StageRenderer, hn as parseColor, ht as DisplayList, i as GameConfig$1, in as RgbaColor, it as RendererGlOptions, j as createInputTimeline, jt as SceneHostLike, k as createInputRecorder, kt as RectClipMask, l as ScaleManager, ln as WEBGL, lt as Bob$1, m as SceneManager, mn as packColorAbgr, mt as CustomPassOptions, n as EngineClockSnapshot, nn as Matrix2D, nt as Renderer2D, o as GameObjectFactory, on as Scenes, ot as Stage2DCustomImageHandler, p as SceneLifecycleStats, pn as createMatrix2D, pt as CustomPassObject, q as Pointer, qt as AUTO, r as Game, rn as Rect2D, rt as RendererGl, s as JsonCache, sn as TintMode, st as StageRenderTarget, t as EngineClock, tn as HEX_MASK, tt as requestWebGpuDevice, u as Scene, un as WEBGPU, ut as Container, v as InputRecorderPlugin, vt as DisplaySemantics, w as StageKernel, wt as MsdfIconObject, x as InputTimelinePlugin, xt as InstancedBatchObject, y as InputTargetSpec, yt as Graphics, z as SceneDigestSurfaceEntry, zt as Frame } from "./game-GdPaQUqH.js";
|
|
2
2
|
import { FlexAlign, FlexContainerSpec, FlexDir, FlexItemRect, FlexItemSpec, FlexJustify, FlexPadding, FlexResult, WrapContainerSpec, WrapItemRect, WrapItemSpec, WrapJustify, WrapResult, computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
|
3
3
|
import { a as SpringHandle, c as TweenManager, i as Easings, l as TweenOptions, n as EasingFn, o as SpringOptions, r as EasingName, s as TweenHandle, t as DisposableOwner, u as TweenStats } from "./tween-BiF1FUvc.js";
|
|
4
4
|
import { JoystickDpad, JoystickDpadOptions, JoystickState, JoystickVector, JoystickViewport, JoystickZone, JoystickZonePredicate, JoystickZoneRect, VirtualJoystick, VirtualJoystickMode, VirtualJoystickOptions, VirtualJoystickStyle, clampJoystickOrigin, computeJoystickVector, isInJoystickZone, pullJoystickOrigin, quantizeJoystickDpad } from "./joystick.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as rgbToCss, a as EventEmitter, c as Scale, d as WEBGL, f as WEBGPU, g as parseColor, h as packColorAbgr, i as CANVAS, l as Scenes, m as createMatrix2D, n as BLACK_RGB, o as FilterMode, p as WHITE_RGB, r as BlendModes, s as HEX_MASK, t as AUTO, u as TintModes } from "./types-DRFB0Klc.js";
|
|
2
|
-
import { C as TextureSource, S as TextureManager, _ as SdfPanelBatcher, a as JsonCache, b as Frame, c as Scene, d as KeyboardPlugin, f as Pointer, g as MsdfIconBatcher, h as PixelAaBatcher, i as GameObjectFactory, l as SceneManager, m as RendererGl, n as Game, o as LoaderPlugin, p as Renderer2D, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Camera, x as Texture, y as CanvasTexture } from "./game-
|
|
3
|
-
import { a as CustomPassObject, c as Graphics, d as MsdfIconObject, f as NineSliceObject, g as TileSpriteObject, h as TextObject, i as Container, l as ImageObject, m as RectangleObject, n as requestWebGpuDevice, o as DisplayList, p as PanelObject, r as BlitterObject, s as DisplayObject, t as RendererWebGpu, u as InstancedBatchObject } from "./renderer-webgpu-
|
|
2
|
+
import { C as TextureSource, S as TextureManager, _ as SdfPanelBatcher, a as JsonCache, b as Frame, c as Scene, d as KeyboardPlugin, f as Pointer, g as MsdfIconBatcher, h as PixelAaBatcher, i as GameObjectFactory, l as SceneManager, m as RendererGl, n as Game, o as LoaderPlugin, p as Renderer2D, r as GameLoop, s as ScaleManager, t as EngineClock, u as InputPlugin, v as Camera, x as Texture, y as CanvasTexture } from "./game-Cu1G9xgW.js";
|
|
3
|
+
import { a as CustomPassObject, c as Graphics, d as MsdfIconObject, f as NineSliceObject, g as TileSpriteObject, h as TextObject, i as Container, l as ImageObject, m as RectangleObject, n as requestWebGpuDevice, o as DisplayList, p as PanelObject, r as BlitterObject, s as DisplayObject, t as RendererWebGpu, u as InstancedBatchObject } from "./renderer-webgpu-BorAD6Kk.js";
|
|
4
4
|
import { ActionMap, StageKernel, createInputRecorder, createInputReplay, createInputTimeline } from "./kernel.js";
|
|
5
5
|
import { buildSceneDigest, sanitizeTrackToken } from "./trace.js";
|
|
6
6
|
import { computeFlexLayout, computeWrapLayout, resolvePadding } from "./flex.js";
|
package/dist/joystick.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as PanelObject, q as Pointer, u as Scene, ut as Container } from "./game-
|
|
1
|
+
import { Et as PanelObject, q as Pointer, u as Scene, ut as Container } from "./game-GdPaQUqH.js";
|
|
2
2
|
export type VirtualJoystickMode = 'floating' | 'fixed';
|
|
3
3
|
export interface JoystickVector {
|
|
4
4
|
/** Normalized X axis in [-1, 1] after deadzone remapping. */
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as createInputReplay, C as StageInputEvent, D as TimelineDragOptions, E as TimelineClickOptions, O as TimelineKeyOptions, S as RecordedInputEntry, T as StagePlugin, _ as InputProvider, b as InputTimelineOptions, g as ActionMap, j as createInputTimeline, k as createInputRecorder, v as InputRecorderPlugin, w as StageKernel, x as InputTimelinePlugin, y as InputTargetSpec } from "./game-
|
|
1
|
+
import { A as createInputReplay, C as StageInputEvent, D as TimelineDragOptions, E as TimelineClickOptions, O as TimelineKeyOptions, S as RecordedInputEntry, T as StagePlugin, _ as InputProvider, b as InputTimelineOptions, g as ActionMap, j as createInputTimeline, k as createInputRecorder, v as InputRecorderPlugin, w as StageKernel, x as InputTimelinePlugin, y as InputTargetSpec } from "./game-GdPaQUqH.js";
|
|
2
2
|
export { ActionMap, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline };
|