1681-engine 0.5.9 → 0.6.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 +92 -1
- package/README.md +15 -6
- package/dist/1681-engine.js +588 -465
- package/dist/ai/behaviorTree.js +198 -0
- package/dist/ai/buildTree.js +54 -0
- package/dist/ambient/life/Birds.js +73 -0
- package/dist/ambient/life/Butterflies.js +43 -0
- package/dist/ambient/life/ChimneySmoke.js +50 -0
- package/dist/ambient/life/Drift.js +75 -0
- package/dist/ambient/life/Fireflies.js +52 -0
- package/dist/ambient/life/lifeMotion.js +49 -0
- package/dist/assets/AssetLoader.js +115 -70
- package/dist/assets/Prepainter.js +61 -0
- package/dist/assets/workerPainter.js +39 -0
- package/dist/audio/spatial.js +118 -0
- package/dist/cjs/electron/electronLike.d.ts +55 -0
- package/dist/cjs/electron/electronLike.js +7 -0
- package/dist/cjs/electron/index.d.ts +14 -0
- package/dist/cjs/electron/index.js +20 -0
- package/dist/cjs/electron/lockdown.d.ts +33 -0
- package/dist/cjs/electron/lockdown.js +69 -0
- package/dist/cjs/electron/lockdownRules.d.ts +28 -0
- package/dist/cjs/electron/lockdownRules.js +61 -0
- package/dist/cjs/electron/sessionStore.d.ts +40 -0
- package/dist/cjs/electron/sessionStore.js +77 -0
- package/dist/cjs/electron/shellId.d.ts +22 -0
- package/dist/cjs/electron/shellId.js +31 -0
- package/dist/cjs/electron/webFiles.d.ts +13 -0
- package/dist/cjs/electron/webFiles.js +52 -0
- package/dist/cjs/electron/webPatcher.d.ts +83 -0
- package/dist/cjs/electron/webPatcher.js +223 -0
- package/dist/cjs/electron/webPointers.d.ts +19 -0
- package/dist/cjs/electron/webPointers.js +35 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/updates/index.d.ts +8 -0
- package/dist/cjs/updates/index.js +21 -0
- package/dist/cjs/updates/manifest.d.ts +73 -0
- package/dist/cjs/updates/manifest.js +67 -0
- package/dist/cjs/updates/pickUpdate.d.ts +42 -0
- package/dist/cjs/updates/pickUpdate.js +52 -0
- package/dist/cjs/updates/webPlan.d.ts +20 -0
- package/dist/cjs/updates/webPlan.js +34 -0
- package/dist/dialogue/DialogueRunner.js +173 -0
- package/dist/dialogue/expr.js +137 -0
- package/dist/dialogue/validateDialogue.js +52 -0
- package/dist/ecs/prefab.js +94 -0
- package/dist/electron/lockdown.js +31 -0
- package/dist/electron/lockdownRules.js +42 -0
- package/dist/electron/sessionStore.js +48 -0
- package/dist/electron/shellId.js +18 -0
- package/dist/electron/webFiles.js +36 -0
- package/dist/electron/webPatcher.js +153 -0
- package/dist/electron/webPointers.js +25 -0
- package/dist/electron.js +19 -0
- package/dist/input/Actions.js +58 -27
- package/dist/input/InputCapture.js +98 -0
- package/dist/input/Keymap.js +32 -26
- package/dist/input/haptics.js +50 -0
- package/dist/input/inputTape.js +68 -0
- package/dist/mobile/backButton.js +40 -0
- package/dist/mobile/capacitor.js +48 -0
- package/dist/mobile/screen.js +31 -0
- package/dist/mobile.js +12 -0
- package/dist/nav/flowField.js +58 -0
- package/dist/nav/steering.js +77 -0
- package/dist/net/ApiClient.js +96 -0
- package/dist/net/InterpolationBuffer.js +30 -23
- package/dist/net/LagCompensator.js +100 -0
- package/dist/net/Room.js +122 -43
- package/dist/net/RoomHost.js +13 -4
- package/dist/net/SpatialHash.js +66 -0
- package/dist/pixel/lifeArt.js +83 -0
- package/dist/pixel.js +63 -58
- package/dist/react/ConfirmButton.js +24 -0
- package/dist/react/baseCss.js +1 -0
- package/dist/react/labels.js +7 -6
- package/dist/react/useJsonSelector.js +13 -0
- package/dist/react.js +73 -68
- package/dist/tilemap/TilemapView.js +57 -32
- package/dist/tilemap/autotile.js +103 -0
- package/dist/tilemap/collision.js +29 -18
- package/dist/tilemap/ldtk.js +21 -0
- package/dist/tilemap/ldtkParse.js +191 -0
- package/dist/types/ai/behaviorTree.d.ts +133 -0
- package/dist/types/ai/behaviorTree.d.ts.map +1 -0
- package/dist/types/ai/buildTree.d.ts +55 -0
- package/dist/types/ai/buildTree.d.ts.map +1 -0
- package/dist/types/ambient/life/Birds.d.ts +50 -0
- package/dist/types/ambient/life/Birds.d.ts.map +1 -0
- package/dist/types/ambient/life/Butterflies.d.ts +32 -0
- package/dist/types/ambient/life/Butterflies.d.ts.map +1 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts +37 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts.map +1 -0
- package/dist/types/ambient/life/Drift.d.ts +58 -0
- package/dist/types/ambient/life/Drift.d.ts.map +1 -0
- package/dist/types/ambient/life/Fireflies.d.ts +43 -0
- package/dist/types/ambient/life/Fireflies.d.ts.map +1 -0
- package/dist/types/ambient/life/lifeMotion.d.ts +63 -0
- package/dist/types/ambient/life/lifeMotion.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +20 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -1
- package/dist/types/assets/Prepainter.d.ts +64 -0
- package/dist/types/assets/Prepainter.d.ts.map +1 -0
- package/dist/types/assets/workerPainter.d.ts +21 -0
- package/dist/types/assets/workerPainter.d.ts.map +1 -0
- package/dist/types/audio/spatial.d.ts +107 -0
- package/dist/types/audio/spatial.d.ts.map +1 -0
- package/dist/types/dialogue/DialogueRunner.d.ts +78 -0
- package/dist/types/dialogue/DialogueRunner.d.ts.map +1 -0
- package/dist/types/dialogue/expr.d.ts +12 -0
- package/dist/types/dialogue/expr.d.ts.map +1 -0
- package/dist/types/dialogue/script.d.ts +78 -0
- package/dist/types/dialogue/script.d.ts.map +1 -0
- package/dist/types/dialogue/validateDialogue.d.ts +21 -0
- package/dist/types/dialogue/validateDialogue.d.ts.map +1 -0
- package/dist/types/ecs/prefab.d.ts +84 -0
- package/dist/types/ecs/prefab.d.ts.map +1 -0
- package/dist/types/electron/electronLike.d.ts +56 -0
- package/dist/types/electron/electronLike.d.ts.map +1 -0
- package/dist/types/electron/index.d.ts +15 -0
- package/dist/types/electron/index.d.ts.map +1 -0
- package/dist/types/electron/lockdown.d.ts +34 -0
- package/dist/types/electron/lockdown.d.ts.map +1 -0
- package/dist/types/electron/lockdownRules.d.ts +29 -0
- package/dist/types/electron/lockdownRules.d.ts.map +1 -0
- package/dist/types/electron/sessionStore.d.ts +41 -0
- package/dist/types/electron/sessionStore.d.ts.map +1 -0
- package/dist/types/electron/shellId.d.ts +23 -0
- package/dist/types/electron/shellId.d.ts.map +1 -0
- package/dist/types/electron/webFiles.d.ts +14 -0
- package/dist/types/electron/webFiles.d.ts.map +1 -0
- package/dist/types/electron/webPatcher.d.ts +84 -0
- package/dist/types/electron/webPatcher.d.ts.map +1 -0
- package/dist/types/electron/webPointers.d.ts +20 -0
- package/dist/types/electron/webPointers.d.ts.map +1 -0
- package/dist/types/index.d.ts +30 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/input/Actions.d.ts +14 -0
- package/dist/types/input/Actions.d.ts.map +1 -1
- package/dist/types/input/InputCapture.d.ts +53 -0
- package/dist/types/input/InputCapture.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +12 -6
- package/dist/types/input/Keymap.d.ts.map +1 -1
- package/dist/types/input/haptics.d.ts +42 -0
- package/dist/types/input/haptics.d.ts.map +1 -0
- package/dist/types/input/inputTape.d.ts +66 -0
- package/dist/types/input/inputTape.d.ts.map +1 -0
- package/dist/types/mobile/backButton.d.ts +30 -0
- package/dist/types/mobile/backButton.d.ts.map +1 -0
- package/dist/types/mobile/capacitor.d.ts +62 -0
- package/dist/types/mobile/capacitor.d.ts.map +1 -0
- package/dist/types/mobile/index.d.ts +4 -0
- package/dist/types/mobile/index.d.ts.map +1 -0
- package/dist/types/mobile/screen.d.ts +27 -0
- package/dist/types/mobile/screen.d.ts.map +1 -0
- package/dist/types/nav/flowField.d.ts +31 -0
- package/dist/types/nav/flowField.d.ts.map +1 -0
- package/dist/types/nav/steering.d.ts +47 -0
- package/dist/types/nav/steering.d.ts.map +1 -0
- package/dist/types/net/ApiClient.d.ts +74 -0
- package/dist/types/net/ApiClient.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +5 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -1
- package/dist/types/net/LagCompensator.d.ts +70 -0
- package/dist/types/net/LagCompensator.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +72 -3
- package/dist/types/net/Room.d.ts.map +1 -1
- package/dist/types/net/RoomHost.d.ts +8 -3
- package/dist/types/net/RoomHost.d.ts.map +1 -1
- package/dist/types/net/SpatialHash.d.ts +25 -0
- package/dist/types/net/SpatialHash.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +1 -0
- package/dist/types/pixel/index.d.ts.map +1 -1
- package/dist/types/pixel/lifeArt.d.ts +63 -0
- package/dist/types/pixel/lifeArt.d.ts.map +1 -0
- package/dist/types/react/ConfirmButton.d.ts +26 -0
- package/dist/types/react/ConfirmButton.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +1 -1
- package/dist/types/react/baseCss.d.ts.map +1 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/index.d.ts.map +1 -1
- package/dist/types/react/labels.d.ts +2 -0
- package/dist/types/react/labels.d.ts.map +1 -1
- package/dist/types/react/useJsonSelector.d.ts +13 -0
- package/dist/types/react/useJsonSelector.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +17 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -1
- package/dist/types/tilemap/autotile.d.ts +95 -0
- package/dist/types/tilemap/autotile.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +8 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -1
- package/dist/types/tilemap/ldtk.d.ts +97 -0
- package/dist/types/tilemap/ldtk.d.ts.map +1 -0
- package/dist/types/tilemap/ldtkParse.d.ts +26 -0
- package/dist/types/tilemap/ldtkParse.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -1
- package/dist/types/updates/index.d.ts +9 -0
- package/dist/types/updates/index.d.ts.map +1 -0
- package/dist/types/updates/manifest.d.ts +74 -0
- package/dist/types/updates/manifest.d.ts.map +1 -0
- package/dist/types/updates/pickUpdate.d.ts +43 -0
- package/dist/types/updates/pickUpdate.d.ts.map +1 -0
- package/dist/types/updates/webPlan.d.ts +21 -0
- package/dist/types/updates/webPlan.d.ts.map +1 -0
- package/dist/ui/ScrollView.js +10 -8
- package/dist/updates/manifest.js +35 -0
- package/dist/updates/pickUpdate.js +27 -0
- package/dist/updates/webPlan.js +14 -0
- package/dist/updates.js +15 -0
- package/package.json +35 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,98 @@
|
|
|
3
3
|
All notable changes to this package are written here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
4
4
|
and versions follow [Semantic Versioning](https://semver.org/); before 1.0 a minor version may break the API.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 0.6.0
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- **Interest management**: `Room` takes `interest: { radius, leaveMargin, canSee }` and sends each player only the
|
|
11
|
+
bodies near it, with a margin so one on the edge is not spawned and removed over and over. `room.place(id, x, y)`.
|
|
12
|
+
`SpatialHash` (points in square cells, `near` and `inRect`) is exported for a game's own use.
|
|
13
|
+
- **Lag compensation**: `Room` takes `rewindMs` and keeps `history`, a `LagCompensator` recorded as each round of
|
|
14
|
+
snapshots goes out and blended as `InterpolationBuffer` blends, so a shot is judged against what the shooter saw:
|
|
15
|
+
`at`, `all`, `near`, `alongRay`. `RoomHost.rewindTime(claimed)` and `LagCompensator.clampTime` hold a client's
|
|
16
|
+
claim within the window; `InterpolationBuffer.viewTime(now)` is the time a client sends with a shot.
|
|
17
|
+
- **Server bodies**: `Room.addBody(data, x, y)` and `removeBody` for monsters, projectiles and crates the server
|
|
18
|
+
moves, sent beside the players with the same interest and rewind history (`RoomBody`, `RoomSeen`, `BODY_ID_BASE`).
|
|
19
|
+
`canSee` now gets either kind.
|
|
20
|
+
- **Rebinding the gamepad**: `Keymap` keeps a first binding per device, so pad buttons are rebindable beside keys
|
|
21
|
+
(`keysFor(action, device)`); `InputCapture` waits for the next key, pad button or stick push for a settings
|
|
22
|
+
screen; `padLabel` and `deviceOf`.
|
|
23
|
+
- **Input replays**: `InputRecorder` keeps an `Actions`' steps as a JSON `InputTape` (changes only); `InputPlayer`
|
|
24
|
+
plays one back through `Actions.replay`, exactly. `Actions.tap` hands every step's values to a listener.
|
|
25
|
+
- **Tools**: the `dialogue` example, a playground that checks a script as it is typed and plays it with its
|
|
26
|
+
variables in view; `formatTrace` prints a behaviour tree's last tick.
|
|
27
|
+
- **Crowds**: `flowField` and `followField` (one search for a crowd, by `findPath`'s own rules), and steering:
|
|
28
|
+
`seek`, `flee`, `arrive`, `separation`, `alignment`, `cohesion`, `followFlow`, `combineSteering`, `applySteering`.
|
|
29
|
+
- **Behaviour trees**: `BehaviorTree` and `BtAgent` (one tree, many agents, each with its own memory), `sequence`,
|
|
30
|
+
`selector`, `reactiveSequence`, `reactiveSelector`, `parallel`, `invert`, `succeed`, `repeat`, `retry`, `cooldown`,
|
|
31
|
+
`timeout`, `wait`, `condition`, `action` with `onHalt`, a trace for debugging, and `buildTree` from JSON.
|
|
32
|
+
- **Dialogue**: `DialogueRunner` runs a branching script written as data (lines, choices with conditions, `once`
|
|
33
|
+
and locked choices, variables, commands, `{…}` in text, translation, save and restore); `validateDialogue` checks
|
|
34
|
+
a script; `compileExpr` is its safe expression language.
|
|
35
|
+
- **Prefabs**: `definePrefab`, `prefabPart`, `spawnPrefab` and `isPrefabOf`, with variants laid over their base
|
|
36
|
+
field by field; `PrefabLibrary` loads them from data.
|
|
37
|
+
- **Sounds in the world**: `SpatialAudio` places any buffer at a point, panned, faded and muffled by distance from a
|
|
38
|
+
moving listener, loops paused out of range and picked up where they would be; `spatialMix` is the mix on its own.
|
|
39
|
+
- **`1681-engine/mobile`**: `capacitorConfig` (a Capacitor config with a game's defaults), `BackStack`,
|
|
40
|
+
`doubleBackToExit` and `installBackButton` for Android's back button, `safeAreaInsets`, `keepScreenOn`, and
|
|
41
|
+
`nativeBuildOf` for `pickWebUpdate`. Capacitor is handed in, never imported.
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
|
|
45
|
+
- `RoomInterest.canSee(viewer, other)` gets a `RoomSeen` (a player or a body the server moves), told apart by
|
|
46
|
+
`other.kind`; `RoomPlayer` has `kind: 'player'`. `Room` and `RoomHost` take a second type parameter for bodies' data.
|
|
47
|
+
- `Keymap.bind` replaces the action's first binding of the same device (a pad input its first pad input, a key its
|
|
48
|
+
first key) instead of its first binding of any kind. Keymaps of keys only behave as before.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- `WebPatcher.tidy` called while the tidy `startEntry` began was still running deleted the same folders twice at
|
|
53
|
+
once; one failed, and the old webs after it were left on disk. Calls now run one after another.
|
|
54
|
+
- `ScrollView.measure` read the content as no taller than the view (Pixi cuts a masked container's bounds to its
|
|
55
|
+
mask), so a view measured that way never scrolled. It now measures the content without the clip.
|
|
56
|
+
|
|
57
|
+
## 0.5.10
|
|
58
|
+
|
|
59
|
+
### Added
|
|
60
|
+
|
|
61
|
+
- **LDtk import**: `parseLdtk` reads a project's levels into the same `TileMap` Tiled maps use, so `TilemapView`,
|
|
62
|
+
`collisionFromTiled` and `objectsOf` work on them: IntGrid, AutoLayer, Tiles and Entities layers, entity and level
|
|
63
|
+
fields, tile custom data and enum tags, world layouts, multi-worlds projects and separate `.ldtkl` level files.
|
|
64
|
+
`levelByName`, `levelAt`, `entitiesOf`, `intGridAt`, `ldtkExternalLevels`, `loadLdtkLevel`;
|
|
65
|
+
`AssetLoader.ldtk(key, url, { levels })` and `ldtkProject(key)`; `collisionFromIntGrid(grid, solid)`.
|
|
66
|
+
- **Autotiling**: `autotile`, `updateAutotile` and `paintTerrain` on 4-bit edge masks or 47-tile blob masks
|
|
67
|
+
(`edgeMask`, `blobMask`, `BLOB47_MASKS`, `blob47Index`), with stable variants, fallbacks and `connectsTo`; an edit
|
|
68
|
+
retiles only its 3x3 neighbourhood. `TilemapView.refreshTiles(layer, cells)` repaints only the chunks touched, and
|
|
69
|
+
`x`/`y` place a map at a world position. The `ldtk` example.
|
|
70
|
+
- **Ambient life**: `Drift` (leaves, seeds, embers, motes, ash), `Birds`, `Butterflies`, `Fireflies` and
|
|
71
|
+
`ChimneySmoke`, bounded pools that live only in view on whole pixels, spawned from a `LifeSource` callback
|
|
72
|
+
(`sourceOf`, `pickInView`) under a `LifeAir`; `paintLifeArt` in `1681-engine/pixel` paints their art.
|
|
73
|
+
- `Haptics` and `HapticGate`: a per-kind rate-limited buzz with an injectable player (`navigator.vibrate` by default).
|
|
74
|
+
- `ApiClient` and `ApiError`: a JSON REST client with a timeout, a bearer token, a 401 refreshed once and retried,
|
|
75
|
+
status and error hooks, and abort.
|
|
76
|
+
- `Prepainter` and `workerPainter`: big textures painted ahead in a worker for the neighbours of the current key, the
|
|
77
|
+
rest freed.
|
|
78
|
+
- React kit: `ConfirmButton` (a button asked twice), `useJsonSelector`, `useStoreJson`, the optional label
|
|
79
|
+
`confirmAgain`.
|
|
80
|
+
- **`1681-engine/updates`**: the pure half of file-by-file web updates from a release store, shared by desktop,
|
|
81
|
+
browser and phone builds — `LatestJson`/`WebManifest`/`WebFile`, `validManifest`, `planWeb`, `pickWebUpdate`,
|
|
82
|
+
`apkUpdateOf`, `pluginEntries`, `heldBundle`.
|
|
83
|
+
- **`1681-engine/electron`**, the main-process side of an Electron build: `WebPatcher` (each newer web built beside the
|
|
84
|
+
running one, checked by sha256, only for the same shell; one that never boots is dropped for the last good one),
|
|
85
|
+
`shellId`, `SessionStore`/`registerSessionStore` (an OS-encrypted `safeStorage` secret, refused under `basic_text`),
|
|
86
|
+
`lockDownWindow`, `denyPermissions`, `refuseDebugLaunch` and the pure link rules. Both subpaths ship as ES modules
|
|
87
|
+
and CommonJS (`dist/cjs`); `electron` is an optional peer dependency that nothing imports.
|
|
88
|
+
- **Browser tests** (`npm run test:browser`, Vitest browser mode on headless Chromium with SwiftShader): WebGL pixels
|
|
89
|
+
read back, canvas text, `FontFace`, `decodeAudioData`, TexturePacker atlases, silhouettes, `RichText`, `PixelLayer`,
|
|
90
|
+
`PixelMarks`, `Darkness`, the React `Panel`'s fitting, fullscreen and pointer lock, `Engine.create` and
|
|
91
|
+
`DrawCallCounter`, in a CI job of their own; `npm run check` stays node-only.
|
|
92
|
+
- Guide page "Desktop: patching, sessions, lockdown"; the tilemap page covers LDtk and autotiling.
|
|
93
|
+
|
|
94
|
+
### Fixed
|
|
95
|
+
|
|
96
|
+
- `AssetLoader` names the URL when an image, sprite sheet or atlas page cannot be decoded, and the family and URL when
|
|
97
|
+
a font cannot be loaded; the browser's bare message named neither.
|
|
7
98
|
|
|
8
99
|
## 0.5.9
|
|
9
100
|
|
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ await engine.scenes.replace(new Level());
|
|
|
41
41
|
| `1681-engine/pixel` | pixel-art games | `PixelLayer`, `pixelPaint` shapes, colour ramps, dithered `Darkness` lighting, `Evaporation`, sprite pixel tools |
|
|
42
42
|
| `1681-engine/ui` | games with menus and a HUD | canvas widgets, focus, the pure layout maths, the DOM/React bridge (`DomOverlay`, `createStore`, `InputShield`) |
|
|
43
43
|
| `1681-engine/postfx` | full-screen effects | `PostFx` (a chain of filters, flashes, shockwaves, animated uniforms), bloom, vignette, colour adjust, chromatic aberration, CRT, pixelate, shockwave, and `FxFilter` to write your own in GLSL and WGSL |
|
|
44
|
+
| `1681-engine/mobile` | a phone app on Capacitor | `capacitorConfig`, the Android back button (`BackStack`), `safeAreaInsets`, `keepScreenOn`, `nativeBuildOf`; Capacitor is handed in, never imported |
|
|
44
45
|
| `1681-engine/react` | a UI written in React | `Panel`, `TabStrip`, `SplitPane`, `Select`, `Tooltip`/`TitleTips`, `ConfirmDialog`, `ChoiceDialog`, `Slider`, `PixelImage`, `Glyph`, `UiProvider`, `useStore`, themed by CSS custom properties (`baseCss`) |
|
|
45
46
|
|
|
46
47
|
The core never imports the pixel module (a test holds it to that), so a game that does not use it does not ship it.
|
|
@@ -53,29 +54,35 @@ pixels. Without it, textures are smooth and drawn at the screen's own density.
|
|
|
53
54
|
| Area | What you get |
|
|
54
55
|
|---|---|
|
|
55
56
|
| **Engine** | `Engine` (canvas, renderer, frame loop), a stack of `Scene`s (`replace`, `push`, `pop`, async loading), a fixed-step `FixedLoop` with interpolation and spiral-of-death protection, typed `EventBus`. |
|
|
56
|
-
| **ECS** | `World` on sparse sets: typed components, `query`, allocation-free `each`, numeric components in typed-array columns (`defineFields`) walked through a cached `slots()` list — a step over 50,000 bodies in 0.1 ms. Systems in `fixed` and `frame` phases, recycled ids with generations, error isolation. |
|
|
57
|
+
| **ECS** | `World` on sparse sets, prefabs with variants (`definePrefab`, `PrefabLibrary` from data): typed components, `query`, allocation-free `each`, numeric components in typed-array columns (`defineFields`) walked through a cached `slots()` list — a step over 50,000 bodies in 0.1 ms. Systems in `fixed` and `frame` phases, recycled ids with generations, error isolation. |
|
|
57
58
|
| **Assets** | `AssetLoader`: images, sprite sheets, JSON, text and Tiled maps with their tilesets, with progress and a concurrency limit. |
|
|
58
59
|
| **Tilemaps** | Tiled JSON maps (CSV or base64 layers, groups, objects, properties, flipped tiles), drawn in culled chunks by `TilemapView`, with collision from a layer or a tile property. |
|
|
59
60
|
| **Animation** | `Animator` clips (fps or per-frame durations, looping or finishing) and an animation system for sprites. |
|
|
60
|
-
| **Input** | `Actions`: named actions bound to keys, chords, gamepad buttons and sticks, and on-screen touch buttons, with per-step edges and analog values. `Keymap` rebinding, `AimGesture` and `TargetLock` for touch, stick maths, touch detection. [Guide](docs/guide/input.md) |
|
|
61
|
+
| **Input** | `Actions`: named actions bound to keys, chords, gamepad buttons and sticks, and on-screen touch buttons, with per-step edges and analog values. `Keymap` rebinding of keys and pad buttons, `InputCapture` for "press a key", input recording and exact replay, `AimGesture` and `TargetLock` for touch, stick maths, touch detection. [Guide](docs/guide/input.md) |
|
|
61
62
|
| **Camera** | Zoom, bounds, shake, flash, and `track` with a soft follow that is the same at any frame rate, a deadzone and an offset. |
|
|
62
63
|
| **Rendering** | `Stage` with world and screen layers, display objects, tweens, timers, bitmap labels, a texture atlas that splits pages by the GPU's limit, guards that keep one bad frame from stopping the loop. |
|
|
63
64
|
| **Characters** | A 2D skeleton rig drawn by `RigView` from cut-out images or vector shapes, `PosePlayer` blending key poses with crossfades, and a built-in humanoid with 72 poses and ready clips (idle, walk, run, roll, slash, thrust, cast, throw, emotes). |
|
|
64
65
|
| **Light** | `LightLayer`: smooth darkness with soft radial lights, colour washes and flicker (the pixel module has its own dithered `Darkness`). |
|
|
65
|
-
| **Audio** | Web Audio `sound` engine (synthesized recipes, recorded takes cleaned in a worker, voice limiting, distance muffling, panning) and `music`: streamed tracks crossfaded and looped. iOS unlock handled. |
|
|
66
|
-
| **Multiplayer** | An authoritative `Room` and its socket host for Node, a client `Connection`, `PredictedMover` (prediction and reconciliation over deterministic movement: in tests and in the example the server never has to correct it), `InterpolationBuffer` for everyone else, binary snapshots, clock sync, input validation and flood limits, cadence rules. A `LobbyHost` with rooms (host, codes, ready, chat, settings), a rating `Matchmaker` that keeps parties whole and balances teams, ready checks with decline lockouts, and a `LobbyClient`. [Guide](docs/guide/lobby.md) |
|
|
66
|
+
| **Audio** | Web Audio `sound` engine (synthesized recipes, recorded takes cleaned in a worker, voice limiting, distance muffling, panning), `SpatialAudio` for looping sounds placed in the world, and `music`: streamed tracks crossfaded and looped. iOS unlock handled. [Guide](docs/guide/audio.md) |
|
|
67
|
+
| **Multiplayer** | An authoritative `Room` and its socket host for Node, a client `Connection`, `PredictedMover` (prediction and reconciliation over deterministic movement: in tests and in the example the server never has to correct it), `InterpolationBuffer` for everyone else, binary snapshots, clock sync, input validation and flood limits, cadence rules, bodies the server moves, interest management by distance and lag compensation for shots. A `LobbyHost` with rooms (host, codes, ready, chat, settings), a rating `Matchmaker` that keeps parties whole and balances teams, ready checks with decline lockouts, and a `LobbyClient`. [Guide](docs/guide/lobby.md) |
|
|
67
68
|
| **Pixel art** (`/pixel`) | `PixelLayer` (thousands of pixel rects in one pooled texture), `pixelPaint` shapes shaded from hue-shifted ramps and faded by ordered dither, `Darkness` with dithered lamps and transient lights, `Evaporation`, the selective outline. |
|
|
68
69
|
| **UI** (`/ui`) | Canvas widgets with keyboard and gamepad focus, the pure layout maths, and a DOM/React bridge laid over the canvas. [Guide](docs/guide/ui.md) |
|
|
69
70
|
| **React kit** (`/react`) | Windows, tabs, split panes, drop-downs, tooltips and dialogs that never overflow the screen, themed by `--e1681-*` properties. [Guide](docs/guide/react.md) |
|
|
70
71
|
| **Physics** | `PhysicsWorld`: circles, boxes and convex polygons that turn when asked (contact points, torque, rolling), sensors, layers, kinematic platforms and spinners, one-way `preSolve`, raycasts, tiles merged into boxes with snag-free seams. [Guide](docs/guide/physics.md) |
|
|
71
72
|
| **Post-processing** (`/postfx`) | Bloom, vignette, colour grade and flash, chromatic aberration, CRT, pixelate, shockwaves; WebGL and WebGPU. [Guide](docs/guide/post-processing.md) |
|
|
72
73
|
| **Particles** | `Emitter` on one pooled `ParticleContainer`, curves over life, a shared budget that thins under reduced effects. [Guide](docs/guide/particles.md) |
|
|
73
|
-
| **Navigation** | A* `findPath` with reach, costs and end-only tiles, `straightenPath`, `floodFill`, `nearestOpen
|
|
74
|
+
| **Navigation** | A* `findPath` with reach, costs and end-only tiles, `straightenPath`, `floodFill`, `nearestOpen`; flow fields for crowds and steering (seek, arrive, separation, flocking). [Guide](docs/guide/navigation.md) |
|
|
75
|
+
| **AI** | Behaviour trees shared by many agents, reactive composites that halt what they interrupt, a trace, trees from JSON. [Guide](docs/guide/behaviour-trees.md) |
|
|
76
|
+
| **Dialogue** | Branching scripts as data with conditions, variables, commands, translation and saves; a checker and a playground. [Guide](docs/guide/dialogue.md) |
|
|
74
77
|
| **Saves** | `SaveStore` slots with migrations, checksums and a backup, pluggable backends, `Autosaver`. [Guide](docs/guide/saves.md) |
|
|
75
78
|
| **Transitions** | `transitionTo` with fade, crossfade and dithered wipe, `Letterbox`. [Guide](docs/guide/transitions.md) |
|
|
76
79
|
| **Localisation** | `Translator` with the English source as key, contexts, plurals, live switching; `extractStrings`. [Guide](docs/guide/i18n.md) |
|
|
77
80
|
| **Ambient** | `DayClock`, deterministic `weatherAt` and `WeatherLayer`, `ColorGrade`; in `/pixel`, `NightShade`, `SwayProp`, `DitherVignette`. [Guide](docs/guide/ambient.md) |
|
|
78
81
|
| **Game feel** | Pooled `FloatingText` for damage numbers, hit-stop, recoil and flash curves. [Guide](docs/guide/game-feel.md) |
|
|
82
|
+
| **LDtk and autotiling** | LDtk projects (IntGrid, auto-layers, entities with fields, world layouts, level files) read into the same tile map as Tiled; 4-bit and 47-tile blob autotiling that retiles only what an edit touched. [Guide](docs/guide/tilemap.md) |
|
|
83
|
+
| **Ambient life** | Drifting leaves, embers and ash, birds, butterflies, fireflies and chimney smoke, pooled and alive only in view. [Guide](docs/guide/ambient.md) |
|
|
84
|
+
| **Desktop** (`/electron`, `/updates`) | File-by-file web patching by sha256, an OS-encrypted session store and a window lockdown for Electron; the update rules shared with phones. [Guide](docs/guide/desktop.md) |
|
|
85
|
+
| **Mobile** (`/mobile`) | A Capacitor config with a game's defaults, the Android back button, the safe area, a screen kept on, the native build for over-the-air updates. [Guide](docs/guide/mobile.md) |
|
|
79
86
|
| **Diagnostics** | Error capture, WebGL context loss, a boot watch, frame sampling, and a `DebugOverlay` with collision boxes. [Guide](docs/guide/diagnostics-and-debug.md) |
|
|
80
87
|
|
|
81
88
|
### A React UI
|
|
@@ -132,7 +139,8 @@ locally.
|
|
|
132
139
|
[particles](docs/guide/particles.md), [game feel](docs/guide/game-feel.md), [ambient](docs/guide/ambient.md),
|
|
133
140
|
[transitions](docs/guide/transitions.md), [post-processing](docs/guide/post-processing.md),
|
|
134
141
|
[lobby and matchmaking](docs/guide/lobby.md), [UI](docs/guide/ui.md), [React kit](docs/guide/react.md),
|
|
135
|
-
[localisation](docs/guide/i18n.md), [saves](docs/guide/saves.md), [diagnostics and debug](docs/guide/diagnostics-and-debug.md)
|
|
142
|
+
[localisation](docs/guide/i18n.md), [saves](docs/guide/saves.md), [diagnostics and debug](docs/guide/diagnostics-and-debug.md),
|
|
143
|
+
[behaviour trees](docs/guide/behaviour-trees.md), [dialogue](docs/guide/dialogue.md), [mobile](docs/guide/mobile.md).
|
|
136
144
|
- [Examples](examples/), run with `npm run dev`:
|
|
137
145
|
- `top-down`: a Tiled map, asset loading, an animated hero, input actions on keyboard, gamepad and touch, camera follow.
|
|
138
146
|
- `platformer`: physics from a tile grid (crates, a moving platform, one-way planks, sensor coins), particles, a canvas
|
|
@@ -144,6 +152,7 @@ locally.
|
|
|
144
152
|
- `physics-toys`: bodies that turn (crates, balls, polygons, a spinning bar) under bloom, a vignette and the other effects.
|
|
145
153
|
- `lobby`: `npm run example:lobby`, then the page: rooms, codes, ready flags, chat, the queue and a ready check.
|
|
146
154
|
- `walk-room`: the smallest whole game, with pixel effects.
|
|
155
|
+
- `dialogue`: a playground for dialogue scripts, checked as they are typed and played with their variables in view.
|
|
147
156
|
|
|
148
157
|
## Develop
|
|
149
158
|
|