@codexo/exojs-tilemap-physics 0.17.0 → 0.18.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/README.md
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Static physics colliders from ExoJS tilemap collision geometry.
|
|
4
4
|
|
|
5
|
-
> A peer-dependency library on top of `@codexo/exojs`, `@codexo/exojs-tilemap`
|
|
6
|
-
> and `@codexo/exojs-physics` — construct its API directly. Importing it
|
|
7
|
-
> registers nothing.
|
|
5
|
+
> A peer-dependency library on top of `@codexo/exojs`, `@codexo/exojs-tilemap` and `@codexo/exojs-physics` — construct its API directly. Importing it registers nothing.
|
|
8
6
|
|
|
9
|
-
`@codexo/exojs-tilemap` never imports physics and `@codexo/exojs-physics` never
|
|
10
|
-
imports tilemap; this package is the seam between them, so both stay usable on
|
|
11
|
-
their own.
|
|
7
|
+
`@codexo/exojs-tilemap` never imports physics and `@codexo/exojs-physics` never imports tilemap; this package is the seam between them, so both stay usable on their own.
|
|
12
8
|
|
|
13
9
|
## Installation
|
|
14
10
|
|
|
@@ -18,9 +14,7 @@ npm install @codexo/exojs @codexo/exojs-tilemap @codexo/exojs-physics @codexo/ex
|
|
|
18
14
|
|
|
19
15
|
## Tile layers
|
|
20
16
|
|
|
21
|
-
`TileColliderStreamer` keeps a physics world's static tile colliders in sync
|
|
22
|
-
with a `TileLayer`: one static body per chunk-sized partition of the layer,
|
|
23
|
-
rebuilt when that partition is edited, destroyed when its chunk is evicted.
|
|
17
|
+
`TileColliderStreamer` keeps a physics world's static tile colliders in sync with a `TileLayer`: one static body per chunk-sized partition of the layer, rebuilt when that partition is edited, destroyed when its chunk is evicted.
|
|
24
18
|
|
|
25
19
|
```ts
|
|
26
20
|
import { PhysicsWorld } from '@codexo/exojs-physics';
|
|
@@ -32,24 +26,18 @@ const colliders = new TileColliderStreamer(world, groundLayer);
|
|
|
32
26
|
scene.systems.add({
|
|
33
27
|
update: delta => {
|
|
34
28
|
colliders.sync();
|
|
35
|
-
world.step(delta
|
|
29
|
+
world.step(delta);
|
|
36
30
|
},
|
|
37
31
|
});
|
|
38
32
|
```
|
|
39
33
|
|
|
40
|
-
`sync()` is cheap to call every frame: with no change since the last call it
|
|
41
|
-
returns immediately and does no work. It observes the layer through its public
|
|
42
|
-
revision counters, so it works with `ChunkStreamer`, a hand-rolled loader, or a
|
|
43
|
-
bounded layer that is fully resident.
|
|
34
|
+
`sync()` is cheap to call every frame: with no change since the last call it returns immediately and does no work. It observes the layer through its public revision counters, so it works with `ChunkStreamer`, a hand-rolled loader, or a bounded layer that is fully resident.
|
|
44
35
|
|
|
45
|
-
Call `destroy()` to remove every body the bridge created. Bodies it did not
|
|
46
|
-
create are untouched.
|
|
36
|
+
Call `destroy()` to remove every body the bridge created. Bodies it did not create are untouched.
|
|
47
37
|
|
|
48
38
|
## Collision authored per cell
|
|
49
39
|
|
|
50
|
-
Some editors author collision per grid cell rather than per tile - LDtk's
|
|
51
|
-
`IntGrid` is the common case. Pass a `cells` source and the bridge covers the
|
|
52
|
-
whole bounded layer, including partitions that hold no tiles at all:
|
|
40
|
+
Some editors author collision per grid cell rather than per tile - LDtk's `IntGrid` is the common case. Pass a `cells` source and the bridge covers the whole bounded layer, including partitions that hold no tiles at all:
|
|
53
41
|
|
|
54
42
|
```ts
|
|
55
43
|
import { createLdtkIntGridCellSource } from '@codexo/exojs-ldtk';
|
|
@@ -60,15 +48,9 @@ const colliders = new TileColliderStreamer(world, collisionLayer, {
|
|
|
60
48
|
});
|
|
61
49
|
```
|
|
62
50
|
|
|
63
|
-
A cell source is a plain `(tx, ty) => string | null`, so a procedural or
|
|
64
|
-
hand-rolled grid works the same way. The returned string is a classification,
|
|
65
|
-
never a meaning: it is the merge key for adjacent cells and it is what the
|
|
66
|
-
`material` resolver sees. Nothing in this package knows what `Solid` or `Water`
|
|
67
|
-
are supposed to do.
|
|
51
|
+
A cell source is a plain `(tx, ty) => string | null`, so a procedural or hand-rolled grid works the same way. The returned string is a classification, never a meaning: it is the merge key for adjacent cells and it is what the `material` resolver sees. Nothing in this package knows what `Solid` or `Water` are supposed to do.
|
|
68
52
|
|
|
69
|
-
The source is sampled while a partition is built and is expected to answer
|
|
70
|
-
identically for the lifetime of the bridge. Changing what it returns does not
|
|
71
|
-
invalidate colliders that already exist - rebuild by recreating the bridge.
|
|
53
|
+
The source is sampled while a partition is built and is expected to answer identically for the lifetime of the bridge. Changing what it returns does not invalidate colliders that already exist - rebuild by recreating the bridge.
|
|
72
54
|
|
|
73
55
|
## Object layers
|
|
74
56
|
|
|
@@ -99,32 +81,17 @@ for (const { object, body } of built) {
|
|
|
99
81
|
| Polyline | open chain; closed chain when its endpoints coincide |
|
|
100
82
|
| Point | nothing |
|
|
101
83
|
|
|
102
|
-
An ellipse maps to the capsule with the minor semi-axis as its radius and the
|
|
103
|
-
difference of the semi-axes as its spine. That capsule contains the ellipse and
|
|
104
|
-
is contained in the circumscribed circle, so it covers the source without a
|
|
105
|
-
tuning constant, and degenerates to a circle when the ellipse is round.
|
|
84
|
+
An ellipse maps to the capsule with the minor semi-axis as its radius and the difference of the semi-axes as its spine. That capsule contains the ellipse and is contained in the circumscribed circle, so it covers the source without a tuning constant, and degenerates to a circle when the ellipse is round.
|
|
106
85
|
|
|
107
86
|
## Region modes
|
|
108
87
|
|
|
109
|
-
`regionMode: 'boxes'` (the default) keeps merged rectangles as solid boxes. The
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
— neighbouring cells with different collision semantics, staircase profiles,
|
|
113
|
-
partial cells — adjacent boxes share an internal edge that a body sliding across
|
|
114
|
-
can catch on.
|
|
115
|
-
|
|
116
|
-
`regionMode: 'outline'` traces the boundary of each solid region into closed
|
|
117
|
-
one-sided chains, which have no internal edges at all. It removes intra-chunk
|
|
118
|
-
seams between adjacent cells that resolve to the same collision semantics;
|
|
119
|
-
boundaries between regions with different resolved semantics remain separate, as
|
|
120
|
-
do chunk boundaries. The trade-off is that a chain is a boundary, not an area:
|
|
121
|
-
queries inside the region find nothing, and a body spawned inside it falls
|
|
122
|
-
through.
|
|
88
|
+
`regionMode: 'boxes'` (the default) keeps merged rectangles as solid boxes. The region has an interior, so point queries, overlaps and sensors behave, and a body that starts inside solid tiles is pushed out. Where the merge cannot merge — neighbouring cells with different collision semantics, staircase profiles, partial cells — adjacent boxes share an internal edge that a body sliding across can catch on.
|
|
89
|
+
|
|
90
|
+
`regionMode: 'outline'` traces the boundary of each solid region into closed one-sided chains, which have no internal edges at all. It removes intra-chunk seams between adjacent cells that resolve to the same collision semantics; boundaries between regions with different resolved semantics remain separate, as do chunk boundaries. The trade-off is that a chain is a boundary, not an area: queries inside the region find nothing, and a body spawned inside it falls through.
|
|
123
91
|
|
|
124
92
|
## Materials
|
|
125
93
|
|
|
126
|
-
Friction, restitution, density, the sensor flag and the collision filter are
|
|
127
|
-
call-level defaults, optionally overridden per object:
|
|
94
|
+
Friction, restitution, density, the sensor flag and the collision filter are call-level defaults, optionally overridden per object:
|
|
128
95
|
|
|
129
96
|
```ts
|
|
130
97
|
new TileColliderStreamer(world, groundLayer, {
|
|
@@ -133,33 +100,19 @@ new TileColliderStreamer(world, groundLayer, {
|
|
|
133
100
|
});
|
|
134
101
|
```
|
|
135
102
|
|
|
136
|
-
The resolver is a build-time mapping, not a live rule: it runs only while a
|
|
137
|
-
chunk is being built or rebuilt. Changing what it would return has no effect
|
|
138
|
-
until the layer itself changes. An unrecognised `type` is not an error — it
|
|
139
|
-
reaches the resolver like any other and falls back to the defaults.
|
|
103
|
+
The resolver is a build-time mapping, not a live rule: it runs only while a chunk is being built or rebuilt. Changing what it would return has no effect until the layer itself changes. An unrecognised `type` is not an error — it reaches the resolver like any other and falls back to the defaults.
|
|
140
104
|
|
|
141
|
-
In `outline` mode the resolved material also decides what may share a boundary:
|
|
142
|
-
cells whose colliders would be indistinguishable are traced into one chain, and
|
|
143
|
-
cells that resolve differently keep their own.
|
|
105
|
+
In `outline` mode the resolved material also decides what may share a boundary: cells whose colliders would be indistinguishable are traced into one chain, and cells that resolve differently keep their own.
|
|
144
106
|
|
|
145
107
|
## Things to know before shipping a level
|
|
146
108
|
|
|
147
|
-
- **Merging never crosses a chunk boundary.** A solid run spanning two chunks is
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- **A dynamic body resting on an evicted chunk falls.** Eviction is the chunk
|
|
151
|
-
source's decision; widen its unload radius if that matters.
|
|
152
|
-
- **Order is stable, part counts are not.** For a given layer and resident chunk
|
|
153
|
-
set the colliders are identical regardless of load order, and `bodies()`
|
|
154
|
-
iterates in `(cy, cx)` chunk order. The number of convex parts a concave
|
|
155
|
-
polygon decomposes into, and the exact rectangle decomposition of a merged
|
|
156
|
-
region, are not contractual.
|
|
109
|
+
- **Merging never crosses a chunk boundary.** A solid run spanning two chunks is at least two rectangles. That is what makes the result independent of the order chunks were loaded in.
|
|
110
|
+
- **A dynamic body resting on an evicted chunk falls.** Eviction is the chunk source's decision; widen its unload radius if that matters.
|
|
111
|
+
- **Order is stable, part counts are not.** For a given layer and resident chunk set the colliders are identical regardless of load order, and `bodies()` iterates in `(cy, cx)` chunk order. The number of convex parts a concave polygon decomposes into, and the exact rectangle decomposition of a merged region, are not contractual.
|
|
157
112
|
|
|
158
113
|
## Core compatibility
|
|
159
114
|
|
|
160
|
-
|
|
161
|
-
| ------------------------------- | --------------- |
|
|
162
|
-
| 0.15.x | 0.15.x |
|
|
115
|
+
This package follows the Core lockstep release line. Its Core, tilemap, and physics peer dependencies require the matching minor release.
|
|
163
116
|
|
|
164
117
|
## License
|
|
165
118
|
|
|
@@ -33,15 +33,15 @@ export interface TileColliderOptions extends ColliderDefaults {
|
|
|
33
33
|
* {@link import('@codexo/exojs-tilemap').ChunkStreamer}, a hand-rolled loader,
|
|
34
34
|
* or a fully resident bounded layer.
|
|
35
35
|
*
|
|
36
|
-
* Tick it from `
|
|
36
|
+
* Tick it from `preFrame`, before the frame's fixed steps run - not from
|
|
37
37
|
* `update`, which runs after them:
|
|
38
38
|
*
|
|
39
39
|
* ```ts
|
|
40
40
|
* const colliders = new TileColliderStreamer(world, layer);
|
|
41
|
-
* scene.systems.add({
|
|
41
|
+
* scene.systems.add({ preFrame: () => colliders.sync() });
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
* `SceneScope` runs `
|
|
44
|
+
* `SceneScope` runs `preFrame` once per frame, before any of that frame's
|
|
45
45
|
* fixed steps, and `update` after all of them. A chunk that becomes resident
|
|
46
46
|
* this frame needs its collider body built before the world steps over the
|
|
47
47
|
* hole, and a chunk evicted this frame must not keep its body for a whole
|
|
@@ -21,15 +21,15 @@ const blockExtent = (chunkExtent, layerExtent, start) => layerExtent === void 0
|
|
|
21
21
|
* {@link import('@codexo/exojs-tilemap').ChunkStreamer}, a hand-rolled loader,
|
|
22
22
|
* or a fully resident bounded layer.
|
|
23
23
|
*
|
|
24
|
-
* Tick it from `
|
|
24
|
+
* Tick it from `preFrame`, before the frame's fixed steps run - not from
|
|
25
25
|
* `update`, which runs after them:
|
|
26
26
|
*
|
|
27
27
|
* ```ts
|
|
28
28
|
* const colliders = new TileColliderStreamer(world, layer);
|
|
29
|
-
* scene.systems.add({
|
|
29
|
+
* scene.systems.add({ preFrame: () => colliders.sync() });
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
|
-
* `SceneScope` runs `
|
|
32
|
+
* `SceneScope` runs `preFrame` once per frame, before any of that frame's
|
|
33
33
|
* fixed steps, and `update` after all of them. A chunk that becomes resident
|
|
34
34
|
* this frame needs its collider body built before the world steps over the
|
|
35
35
|
* hole, and a chunk evicted this frame must not keep its body for a whole
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileColliderStreamer.js","names":[],"sources":["../../src/TileColliderStreamer.ts"],"sourcesContent":["import { PhysicsBody, type PhysicsWorld } from '@codexo/exojs-physics';\nimport type { ReadonlyTileChunk, TileCellSource, TileLayer, TileMapObject } from '@codexo/exojs-tilemap';\nimport { buildTileCollisionGeometry } from '@codexo/exojs-tilemap';\n\nimport { buildTileColliders } from './buildColliders';\nimport { resolveDefaults, type ResolvedMaterial } from './material';\nimport type { ColliderDefaults, TileRegionMode } from './types';\n\n/** Options for a {@link TileColliderStreamer}. All optional. */\nexport interface TileColliderOptions extends ColliderDefaults {\n /** How solid whole-cell regions are represented. Default `'boxes'`. */\n regionMode?: TileRegionMode;\n /**\n * Merge adjacent whole-cell boxes sharing a `type` into larger rectangles.\n * Default `true`. Merging never crosses a chunk boundary.\n */\n merge?: boolean;\n /** Drop a source shape before any collider is built for it. */\n accept?: (object: TileMapObject, tx: number, ty: number) => boolean;\n /**\n * Per-cell collision classification, for layers whose collision is authored\n * per cell rather than per tile. On a bounded layer this makes the bridge\n * cover the whole layer, including partitions that hold no tiles at all.\n *\n * Sampled while a partition is built and expected to answer identically for\n * the lifetime of this bridge: changing what it returns does not invalidate\n * colliders that already exist. Rebuild by recreating the bridge.\n */\n cells?: TileCellSource | undefined;\n}\n\n/**\n * One collision build block: the deterministic spatial partition this bridge\n * may own a body for. A partition is not the same thing as tile residency - a\n * cell source covers partitions that hold no {@link ReadonlyTileChunk} at all,\n * and nothing here makes a non-resident chunk look resident.\n *\n * An entry with `body === null` is a cached empty result, not an absence: it\n * is what keeps an unrelated layer revision from re-walking every cell of\n * every empty partition.\n */\ninterface BlockEntry {\n readonly cx: number;\n readonly cy: number;\n /** The chunk the body was built from; `null` for a cell-only partition. A re-adopted chunk is a new one. */\n readonly chunk: ReadonlyTileChunk | null;\n readonly revision: number;\n /** `null` when the partition holds no collision geometry at all. */\n readonly body: PhysicsBody | null;\n}\n\nconst chunkKey = (cx: number, cy: number): string => `${cx},${cy}`;\n\n/**\n * Tile extent of a build block along one axis. Edge blocks of a bounded layer\n * are clipped, matching the dimensions the layer gives an edge chunk, so a\n * cell-only block never walks cells outside the layer.\n */\nconst blockExtent = (chunkExtent: number, layerExtent: number | undefined, start: number): number =>\n layerExtent === undefined ? chunkExtent : Math.min(chunkExtent, layerExtent - start);\n\n/**\n * Keeps a physics world's static tile colliders in sync with a\n * {@link TileLayer}: one static body per chunk-sized partition of the layer,\n * rebuilt when that partition changes, destroyed when it is evicted.\n *\n * The bridge owns every body it creates and nothing else. It observes the layer\n * through its public revision counters, so it works with any chunk source -\n * {@link import('@codexo/exojs-tilemap').ChunkStreamer}, a hand-rolled loader,\n * or a fully resident bounded layer.\n *\n * Tick it from `preUpdate`, before the frame's fixed steps run - not from\n * `update`, which runs after them:\n *\n * ```ts\n * const colliders = new TileColliderStreamer(world, layer);\n * scene.systems.add({ preUpdate: () => colliders.sync() });\n * ```\n *\n * `SceneScope` runs `preUpdate` once per frame, before any of that frame's\n * fixed steps, and `update` after all of them. A chunk that becomes resident\n * this frame needs its collider body built before the world steps over the\n * hole, and a chunk evicted this frame must not keep its body for a whole\n * extra frame of stepping - `update` gets both of those one step too late.\n * Wiring `sync()` into `fixedUpdate` instead (ordered before\n * {@link SystemOrder.Physics}) also works, and additionally re-syncs on\n * every fixed step within a frame rather than once per frame.\n *\n * Two consequences worth knowing before shipping a level:\n *\n * - Whole-cell merging never crosses a partition boundary, so a solid run\n * spanning two of them is at least two rectangles. This is what makes the\n * result independent of the order chunks were loaded in.\n * - A dynamic body resting on a chunk that gets evicted falls. Eviction is the\n * chunk source's decision; widen its unload radius if that matters.\n * - With {@link TileColliderOptions.cells}, a bounded layer's partitions are\n * all covered, resident or not - collision authored per cell does not depend\n * on tiles being placed.\n */\nexport class TileColliderStreamer {\n private readonly _world: PhysicsWorld;\n private readonly _layer: TileLayer;\n private readonly _options: TileColliderOptions;\n private readonly _defaults: ResolvedMaterial;\n private readonly _regionMode: TileRegionMode;\n\n private readonly _built = new Map<string, BlockEntry>();\n private readonly _seen = new Set<string>();\n\n private _layerRevision = -1;\n private _offsetX: number;\n private _offsetY: number;\n private _destroyed = false;\n\n public constructor(world: PhysicsWorld, layer: TileLayer, options: TileColliderOptions = {}) {\n this._world = world;\n this._layer = layer;\n this._options = options;\n this._defaults = resolveDefaults(options);\n this._regionMode = options.regionMode ?? 'boxes';\n this._offsetX = layer.offsetX;\n this._offsetY = layer.offsetY;\n }\n\n /** Number of bodies currently owned by this bridge. */\n public get bodyCount(): number {\n let count = 0;\n\n for (const entry of this._built.values()) {\n if (entry.body !== null) count++;\n }\n\n return count;\n }\n\n /**\n * The bodies this bridge owns, in `(cy, cx)` partition order - independent of\n * the order the chunks became resident in.\n */\n public *bodies(): IterableIterator<PhysicsBody> {\n const ordered = [...this._built.values()].sort((a, b) => a.cy - b.cy || a.cx - b.cx);\n\n for (const entry of ordered) {\n if (entry.body !== null) yield entry.body;\n }\n }\n\n /**\n * Bring the world's tile colliders up to date with the layer: build bodies\n * for newly resident chunks, rebuild edited ones, destroy evicted ones.\n *\n * Cheap to call every frame. With no change since the last call it performs\n * no work and allocates nothing. No-op once {@link destroy}ed or once the\n * layer is destroyed.\n */\n public sync(): void {\n if (this._destroyed || this._layer.destroyed) return;\n\n const layer = this._layer;\n const offsetChanged = layer.offsetX !== this._offsetX || layer.offsetY !== this._offsetY;\n\n if (!offsetChanged && layer.revision === this._layerRevision) return;\n\n if (offsetChanged) {\n // Geometry is emitted in layer pixel space, so a moved layer invalidates\n // every collider - and moving a layer does not bump its revision.\n this._clear();\n this._offsetX = layer.offsetX;\n this._offsetY = layer.offsetY;\n }\n\n const seen = this._seen;\n\n seen.clear();\n\n for (const chunk of layer.loadedChunks()) {\n this._syncBlock(chunk.cx, chunk.cy, chunk);\n }\n\n // A cell source covers the layer, not its residency: every partition of a\n // bounded layer is a build block, whether or not tiles were ever placed in\n // it. Without this the canonical case - collision authored per cell on a\n // layer that renders nothing - would produce no bodies at all.\n if (this._options.cells !== undefined) {\n const range = layer.chunkRange();\n\n if (range !== null) {\n for (let cy = range.minCy; cy <= range.maxCy; cy++) {\n for (let cx = range.minCx; cx <= range.maxCx; cx++) {\n this._syncBlock(cx, cy, layer.getChunk(cx, cy) ?? null);\n }\n }\n }\n }\n\n for (const [key, entry] of this._built) {\n if (seen.has(key)) continue;\n\n if (entry.body !== null) this._world.destroyBody(entry.body);\n this._built.delete(key);\n }\n\n this._layerRevision = layer.revision;\n }\n\n /**\n * Destroy every body this bridge created and stop responding to\n * {@link sync}. Bodies it did not create are untouched. Idempotent.\n */\n public destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n this._clear();\n }\n\n private _clear(): void {\n for (const entry of this._built.values()) {\n if (entry.body !== null) this._world.destroyBody(entry.body);\n }\n\n this._built.clear();\n this._layerRevision = -1;\n }\n\n /**\n * Reconcile one build block against what was built for it before. Skips\n * without sampling anything when neither the backing chunk nor its revision\n * moved - which is what keeps an empty cell-only block from re-walking its\n * cells on every unrelated layer change.\n */\n private _syncBlock(cx: number, cy: number, chunk: ReadonlyTileChunk | null): void {\n const key = chunkKey(cx, cy);\n\n if (this._seen.has(key)) return;\n\n this._seen.add(key);\n\n const entry = this._built.get(key);\n const revision = chunk?.revision ?? -1;\n\n if (entry?.chunk === chunk && entry.revision === revision) {\n return;\n }\n\n if (entry?.body != null) {\n this._world.destroyBody(entry.body);\n }\n\n this._built.set(key, { cx, cy, chunk, revision, body: this._buildBlock(cx, cy, chunk) });\n }\n\n private _buildBlock(cx: number, cy: number, chunk: ReadonlyTileChunk | null): PhysicsBody | null {\n const layer = this._layer;\n const options = this._options;\n const startTx = cx * layer.chunkWidth;\n const startTy = cy * layer.chunkHeight;\n const width = chunk?.width ?? blockExtent(layer.chunkWidth, layer.width, startTx);\n const height = chunk?.height ?? blockExtent(layer.chunkHeight, layer.height, startTy);\n const geometry = buildTileCollisionGeometry(layer, {\n region: { x: startTx, y: startTy, width, height },\n ...(options.merge !== undefined && { merge: options.merge }),\n ...(options.accept !== undefined && { accept: options.accept }),\n ...(options.cells !== undefined && { cells: options.cells }),\n });\n\n if (geometry.rects.length === 0 && geometry.shapes.length === 0) {\n return null;\n }\n\n const x = startTx * layer.tileWidth + layer.offsetX;\n const y = startTy * layer.tileHeight + layer.offsetY;\n const colliders = buildTileColliders(geometry, {\n x,\n y,\n tileWidth: layer.tileWidth,\n tileHeight: layer.tileHeight,\n layerOffsetX: layer.offsetX,\n layerOffsetY: layer.offsetY,\n regionMode: this._regionMode,\n defaults: this._defaults,\n material: options.material,\n });\n\n if (colliders.length === 0) {\n return null;\n }\n\n return this._world.add(new PhysicsBody({ type: 'static', position: { x, y }, colliders }));\n }\n}\n"],"mappings":";;;;;;AAmDA,MAAM,YAAY,IAAY,OAAuB,GAAG,GAAG,GAAG;;;;;;AAO9D,MAAM,eAAe,aAAqB,aAAiC,UACzE,gBAAgB,SAAY,cAAc,KAAK,IAAI,aAAa,cAAc,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCrF,IAAa,uBAAb,MAAkC;CAChC,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,AAAiB,yBAAS,IAAI,IAAwB;CACtD,AAAiB,wBAAQ,IAAI,IAAY;CAEzC,AAAQ,iBAAiB;CACzB,AAAQ;CACR,AAAQ;CACR,AAAQ,aAAa;CAErB,AAAO,YAAY,OAAqB,OAAkB,UAA+B,CAAC,GAAG;EAC3F,KAAK,SAAS;EACd,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,KAAK,YAAY,gBAAgB,OAAO;EACxC,KAAK,cAAc,QAAQ,cAAc;EACzC,KAAK,WAAW,MAAM;EACtB,KAAK,WAAW,MAAM;CACxB;;CAGA,IAAW,YAAoB;EAC7B,IAAI,QAAQ;EAEZ,KAAK,MAAM,SAAS,KAAK,OAAO,OAAO,GACrC,IAAI,MAAM,SAAS,MAAM;EAG3B,OAAO;CACT;;;;;CAMA,CAAQ,SAAwC;EAC9C,MAAM,UAAU,CAAC,GAAG,KAAK,OAAO,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;EAEnF,KAAK,MAAM,SAAS,SAClB,IAAI,MAAM,SAAS,MAA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Ac,MAAM;GACpB,cAAc,MAAM;GACpB,YAAY,KAAK;GACjB,UAAU,KAAK;GACf,UAAU,QAAQ;EACpB,CAAC;EAED,IAAI,UAAU,WAAW,GACvB,OAAO;EAGT,OAAO,KAAK,OAAO,IAAI,IAAI,YAAY;GAAE,MAAM;GAAU,UAAU;IAAE;IAAG;GAAE;GAAG;EAAU,CAAC,CAAC;CAC3F;AACF"}
|
|
1
|
+
{"version":3,"file":"TileColliderStreamer.js","names":[],"sources":["../../src/TileColliderStreamer.ts"],"sourcesContent":["import { PhysicsBody, type PhysicsWorld } from '@codexo/exojs-physics';\nimport type { ReadonlyTileChunk, TileCellSource, TileLayer, TileMapObject } from '@codexo/exojs-tilemap';\nimport { buildTileCollisionGeometry } from '@codexo/exojs-tilemap';\n\nimport { buildTileColliders } from './buildColliders';\nimport { resolveDefaults, type ResolvedMaterial } from './material';\nimport type { ColliderDefaults, TileRegionMode } from './types';\n\n/** Options for a {@link TileColliderStreamer}. All optional. */\nexport interface TileColliderOptions extends ColliderDefaults {\n /** How solid whole-cell regions are represented. Default `'boxes'`. */\n regionMode?: TileRegionMode;\n /**\n * Merge adjacent whole-cell boxes sharing a `type` into larger rectangles.\n * Default `true`. Merging never crosses a chunk boundary.\n */\n merge?: boolean;\n /** Drop a source shape before any collider is built for it. */\n accept?: (object: TileMapObject, tx: number, ty: number) => boolean;\n /**\n * Per-cell collision classification, for layers whose collision is authored\n * per cell rather than per tile. On a bounded layer this makes the bridge\n * cover the whole layer, including partitions that hold no tiles at all.\n *\n * Sampled while a partition is built and expected to answer identically for\n * the lifetime of this bridge: changing what it returns does not invalidate\n * colliders that already exist. Rebuild by recreating the bridge.\n */\n cells?: TileCellSource | undefined;\n}\n\n/**\n * One collision build block: the deterministic spatial partition this bridge\n * may own a body for. A partition is not the same thing as tile residency - a\n * cell source covers partitions that hold no {@link ReadonlyTileChunk} at all,\n * and nothing here makes a non-resident chunk look resident.\n *\n * An entry with `body === null` is a cached empty result, not an absence: it\n * is what keeps an unrelated layer revision from re-walking every cell of\n * every empty partition.\n */\ninterface BlockEntry {\n readonly cx: number;\n readonly cy: number;\n /** The chunk the body was built from; `null` for a cell-only partition. A re-adopted chunk is a new one. */\n readonly chunk: ReadonlyTileChunk | null;\n readonly revision: number;\n /** `null` when the partition holds no collision geometry at all. */\n readonly body: PhysicsBody | null;\n}\n\nconst chunkKey = (cx: number, cy: number): string => `${cx},${cy}`;\n\n/**\n * Tile extent of a build block along one axis. Edge blocks of a bounded layer\n * are clipped, matching the dimensions the layer gives an edge chunk, so a\n * cell-only block never walks cells outside the layer.\n */\nconst blockExtent = (chunkExtent: number, layerExtent: number | undefined, start: number): number =>\n layerExtent === undefined ? chunkExtent : Math.min(chunkExtent, layerExtent - start);\n\n/**\n * Keeps a physics world's static tile colliders in sync with a\n * {@link TileLayer}: one static body per chunk-sized partition of the layer,\n * rebuilt when that partition changes, destroyed when it is evicted.\n *\n * The bridge owns every body it creates and nothing else. It observes the layer\n * through its public revision counters, so it works with any chunk source -\n * {@link import('@codexo/exojs-tilemap').ChunkStreamer}, a hand-rolled loader,\n * or a fully resident bounded layer.\n *\n * Tick it from `preFrame`, before the frame's fixed steps run - not from\n * `update`, which runs after them:\n *\n * ```ts\n * const colliders = new TileColliderStreamer(world, layer);\n * scene.systems.add({ preFrame: () => colliders.sync() });\n * ```\n *\n * `SceneScope` runs `preFrame` once per frame, before any of that frame's\n * fixed steps, and `update` after all of them. A chunk that becomes resident\n * this frame needs its collider body built before the world steps over the\n * hole, and a chunk evicted this frame must not keep its body for a whole\n * extra frame of stepping - `update` gets both of those one step too late.\n * Wiring `sync()` into `fixedUpdate` instead (ordered before\n * {@link SystemOrder.Physics}) also works, and additionally re-syncs on\n * every fixed step within a frame rather than once per frame.\n *\n * Two consequences worth knowing before shipping a level:\n *\n * - Whole-cell merging never crosses a partition boundary, so a solid run\n * spanning two of them is at least two rectangles. This is what makes the\n * result independent of the order chunks were loaded in.\n * - A dynamic body resting on a chunk that gets evicted falls. Eviction is the\n * chunk source's decision; widen its unload radius if that matters.\n * - With {@link TileColliderOptions.cells}, a bounded layer's partitions are\n * all covered, resident or not - collision authored per cell does not depend\n * on tiles being placed.\n */\nexport class TileColliderStreamer {\n private readonly _world: PhysicsWorld;\n private readonly _layer: TileLayer;\n private readonly _options: TileColliderOptions;\n private readonly _defaults: ResolvedMaterial;\n private readonly _regionMode: TileRegionMode;\n\n private readonly _built = new Map<string, BlockEntry>();\n private readonly _seen = new Set<string>();\n\n private _layerRevision = -1;\n private _offsetX: number;\n private _offsetY: number;\n private _destroyed = false;\n\n public constructor(world: PhysicsWorld, layer: TileLayer, options: TileColliderOptions = {}) {\n this._world = world;\n this._layer = layer;\n this._options = options;\n this._defaults = resolveDefaults(options);\n this._regionMode = options.regionMode ?? 'boxes';\n this._offsetX = layer.offsetX;\n this._offsetY = layer.offsetY;\n }\n\n /** Number of bodies currently owned by this bridge. */\n public get bodyCount(): number {\n let count = 0;\n\n for (const entry of this._built.values()) {\n if (entry.body !== null) count++;\n }\n\n return count;\n }\n\n /**\n * The bodies this bridge owns, in `(cy, cx)` partition order - independent of\n * the order the chunks became resident in.\n */\n public *bodies(): IterableIterator<PhysicsBody> {\n const ordered = [...this._built.values()].sort((a, b) => a.cy - b.cy || a.cx - b.cx);\n\n for (const entry of ordered) {\n if (entry.body !== null) yield entry.body;\n }\n }\n\n /**\n * Bring the world's tile colliders up to date with the layer: build bodies\n * for newly resident chunks, rebuild edited ones, destroy evicted ones.\n *\n * Cheap to call every frame. With no change since the last call it performs\n * no work and allocates nothing. No-op once {@link destroy}ed or once the\n * layer is destroyed.\n */\n public sync(): void {\n if (this._destroyed || this._layer.destroyed) return;\n\n const layer = this._layer;\n const offsetChanged = layer.offsetX !== this._offsetX || layer.offsetY !== this._offsetY;\n\n if (!offsetChanged && layer.revision === this._layerRevision) return;\n\n if (offsetChanged) {\n // Geometry is emitted in layer pixel space, so a moved layer invalidates\n // every collider - and moving a layer does not bump its revision.\n this._clear();\n this._offsetX = layer.offsetX;\n this._offsetY = layer.offsetY;\n }\n\n const seen = this._seen;\n\n seen.clear();\n\n for (const chunk of layer.loadedChunks()) {\n this._syncBlock(chunk.cx, chunk.cy, chunk);\n }\n\n // A cell source covers the layer, not its residency: every partition of a\n // bounded layer is a build block, whether or not tiles were ever placed in\n // it. Without this the canonical case - collision authored per cell on a\n // layer that renders nothing - would produce no bodies at all.\n if (this._options.cells !== undefined) {\n const range = layer.chunkRange();\n\n if (range !== null) {\n for (let cy = range.minCy; cy <= range.maxCy; cy++) {\n for (let cx = range.minCx; cx <= range.maxCx; cx++) {\n this._syncBlock(cx, cy, layer.getChunk(cx, cy) ?? null);\n }\n }\n }\n }\n\n for (const [key, entry] of this._built) {\n if (seen.has(key)) continue;\n\n if (entry.body !== null) this._world.destroyBody(entry.body);\n this._built.delete(key);\n }\n\n this._layerRevision = layer.revision;\n }\n\n /**\n * Destroy every body this bridge created and stop responding to\n * {@link sync}. Bodies it did not create are untouched. Idempotent.\n */\n public destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n this._clear();\n }\n\n private _clear(): void {\n for (const entry of this._built.values()) {\n if (entry.body !== null) this._world.destroyBody(entry.body);\n }\n\n this._built.clear();\n this._layerRevision = -1;\n }\n\n /**\n * Reconcile one build block against what was built for it before. Skips\n * without sampling anything when neither the backing chunk nor its revision\n * moved - which is what keeps an empty cell-only block from re-walking its\n * cells on every unrelated layer change.\n */\n private _syncBlock(cx: number, cy: number, chunk: ReadonlyTileChunk | null): void {\n const key = chunkKey(cx, cy);\n\n if (this._seen.has(key)) return;\n\n this._seen.add(key);\n\n const entry = this._built.get(key);\n const revision = chunk?.revision ?? -1;\n\n if (entry?.chunk === chunk && entry.revision === revision) {\n return;\n }\n\n if (entry?.body != null) {\n this._world.destroyBody(entry.body);\n }\n\n this._built.set(key, { cx, cy, chunk, revision, body: this._buildBlock(cx, cy, chunk) });\n }\n\n private _buildBlock(cx: number, cy: number, chunk: ReadonlyTileChunk | null): PhysicsBody | null {\n const layer = this._layer;\n const options = this._options;\n const startTx = cx * layer.chunkWidth;\n const startTy = cy * layer.chunkHeight;\n const width = chunk?.width ?? blockExtent(layer.chunkWidth, layer.width, startTx);\n const height = chunk?.height ?? blockExtent(layer.chunkHeight, layer.height, startTy);\n const geometry = buildTileCollisionGeometry(layer, {\n region: { x: startTx, y: startTy, width, height },\n ...(options.merge !== undefined && { merge: options.merge }),\n ...(options.accept !== undefined && { accept: options.accept }),\n ...(options.cells !== undefined && { cells: options.cells }),\n });\n\n if (geometry.rects.length === 0 && geometry.shapes.length === 0) {\n return null;\n }\n\n const x = startTx * layer.tileWidth + layer.offsetX;\n const y = startTy * layer.tileHeight + layer.offsetY;\n const colliders = buildTileColliders(geometry, {\n x,\n y,\n tileWidth: layer.tileWidth,\n tileHeight: layer.tileHeight,\n layerOffsetX: layer.offsetX,\n layerOffsetY: layer.offsetY,\n regionMode: this._regionMode,\n defaults: this._defaults,\n material: options.material,\n });\n\n if (colliders.length === 0) {\n return null;\n }\n\n return this._world.add(new PhysicsBody({ type: 'static', position: { x, y }, colliders }));\n }\n}\n"],"mappings":";;;;;;AAmDA,MAAM,YAAY,IAAY,OAAuB,GAAG,GAAG,GAAG;;;;;;AAO9D,MAAM,eAAe,aAAqB,aAAiC,UACzE,gBAAgB,SAAY,cAAc,KAAK,IAAI,aAAa,cAAc,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCrF,IAAa,uBAAb,MAAkC;CAChC,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,AAAiB,yBAAS,IAAI,IAAwB;CACtD,AAAiB,wBAAQ,IAAI,IAAY;CAEzC,AAAQ,iBAAiB;CACzB,AAAQ;CACR,AAAQ;CACR,AAAQ,aAAa;CAErB,AAAO,YAAY,OAAqB,OAAkB,UAA+B,CAAC,GAAG;EAC3F,KAAK,SAAS;EACd,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,KAAK,Y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AG;IAAS;IAAO;GAAO;GAChD,GAAI,QAAQ,UAAU,UAAa,EAAE,OAAO,QAAQ,MAAM;GAC1D,GAAI,QAAQ,WAAW,UAAa,EAAE,QAAQ,QAAQ,OAAO;GAC7D,GAAI,QAAQ,UAAU,UAAa,EAAE,OAAO,QAAQ,MAAM;EAC5D,CAAC;EAED,IAAI,SAAS,MAAM,WAAW,KAAK,SAAS,OAAO,WAAW,GAC5D,OAAO;EAGT,MAAM,IAAI,UAAU,MAAM,YAAY,MAAM;EAC5C,MAAM,IAAI,UAAU,MAAM,aAAa,MAAM;EAC7C,MAAM,YAAY,mBAAmB,UAAU;GAC7C;GACA;GACA,WAAW,MAAM;GACjB,YAAY,MAAM;GAClB,cAAc,MAAM;GACpB,cAAc,MAAM;GACpB,YAAY,KAAK;GACjB,UAAU,KAAK;GACf,UAAU,QAAQ;EACpB,CAAC;EAED,IAAI,UAAU,WAAW,GACvB,OAAO;EAGT,OAAO,KAAK,OAAO,IAAI,IAAI,YAAY;GAAE,MAAM;GAAU,UAAU;IAAE;IAAG;GAAE;GAAG;EAAU,CAAC,CAAC;CAC3F;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexo/exojs-tilemap-physics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Static physics colliders from ExoJS tilemap collision geometry.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@codexo/exojs": "0.
|
|
30
|
-
"@codexo/exojs-physics": "0.
|
|
31
|
-
"@codexo/exojs-tilemap": "0.
|
|
29
|
+
"@codexo/exojs": "0.18.x",
|
|
30
|
+
"@codexo/exojs-physics": "0.18.x",
|
|
31
|
+
"@codexo/exojs-tilemap": "0.18.x"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
+
"@codexo/exojs": "0.18.0",
|
|
34
35
|
"@codexo/exojs-config": "0.0.0",
|
|
35
|
-
"@codexo/exojs-
|
|
36
|
-
"@codexo/exojs-
|
|
37
|
-
"@codexo/exojs-
|
|
38
|
-
"@codexo/exojs": "0.
|
|
39
|
-
"@codexo/exojs-tilemap": "0.17.0"
|
|
36
|
+
"@codexo/exojs-ldtk": "0.18.0",
|
|
37
|
+
"@codexo/exojs-tiled": "0.18.0",
|
|
38
|
+
"@codexo/exojs-tilemap": "0.18.0",
|
|
39
|
+
"@codexo/exojs-physics": "0.18.0"
|
|
40
40
|
},
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"publishConfig": {
|