@codexo/exojs-ldtk 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 +18 -43
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @codexo/exojs-ldtk
|
|
2
2
|
|
|
3
|
-
Official ExoJS extension for loading [LDtk](https://ldtk.io) level files (`.ldtk`) into runtime
|
|
4
|
-
`TileMap`s — one per LDtk level — ready to render with the generic tilemap node.
|
|
3
|
+
Official ExoJS extension for loading [LDtk](https://ldtk.io) level files (`.ldtk`) into runtime `TileMap`s — one per LDtk level — ready to render with the generic tilemap node.
|
|
5
4
|
|
|
6
5
|
## Installation
|
|
7
6
|
|
|
@@ -9,44 +8,28 @@ Official ExoJS extension for loading [LDtk](https://ldtk.io) level files (`.ldtk
|
|
|
9
8
|
npm install @codexo/exojs @codexo/exojs-tilemap @codexo/exojs-ldtk
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
Both `@codexo/exojs` and `@codexo/exojs-tilemap` are **peer** dependencies, so install them
|
|
13
|
-
explicitly alongside the adapter. Nothing is pulled in transitively: strict package managers
|
|
14
|
-
(pnpm, Yarn PnP) will not resolve an unlisted peer, and npm's auto-install of peers still leaves
|
|
15
|
-
the versions outside your control. Keep the engine and every adapter on the same version.
|
|
11
|
+
Both `@codexo/exojs` and `@codexo/exojs-tilemap` are **peer** dependencies, so install them explicitly alongside the adapter. Nothing is pulled in transitively: strict package managers (pnpm, Yarn PnP) will not resolve an unlisted peer, and npm's auto-install of peers still leaves the versions outside your control. Keep the engine and every adapter on the same version.
|
|
16
12
|
|
|
17
13
|
## What this package provides
|
|
18
14
|
|
|
19
|
-
- `LdtkMap` — parsed LDtk world; the result of `loader.load('world.ldtk')`. Exposes the raw `data`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- `
|
|
23
|
-
`loader.load(Asset.type('ldtkProject', 'world.ldtk'))`. Loads the document and every tileset
|
|
24
|
-
atlas, and **no** level payload. Exposes the world layout (`worlds` / `world`, one `MapWorld`
|
|
25
|
-
per LDtk world) and `createRuntime({ scope })` for loading levels one at a time
|
|
26
|
-
- `ldtkToMapWorld` — build the format-neutral world model (level ids, bounds, neighbours) from a
|
|
27
|
-
raw document, without reading any layer payload
|
|
28
|
-
- `ldtkToTileMap` — convert a single LDtk level to a `TileMap` (used internally; available for
|
|
29
|
-
custom pipelines), plus its `LdtkToTileMapOptions`
|
|
15
|
+
- `LdtkMap` — parsed LDtk world; the result of `loader.load('world.ldtk')`. Exposes the raw `data`, the converted runtime `levels` (`readonly TileMap[]`, in document order), and `getLevelByName(identifier)`
|
|
16
|
+
- `LdtkProject` — the streaming counterpart of `LdtkMap`: the result of `loader.load(Asset.type('ldtkProject', 'world.ldtk'))`. Loads the document and every tileset atlas, and **no** level payload. Exposes the world layout (`worlds` / `world`, one `MapWorld` per LDtk world) and `createRuntime({ scope })` for loading levels one at a time
|
|
17
|
+
- `ldtkToMapWorld` — build the format-neutral world model (level ids, bounds, neighbours) from a raw document, without reading any layer payload
|
|
18
|
+
- `ldtkToTileMap` — convert a single LDtk level to a `TileMap` (used internally; available for custom pipelines), plus its `LdtkToTileMapOptions`
|
|
30
19
|
- `getLdtkIntGridValueAt` — the named/coloured IntGrid value at a tile coordinate
|
|
31
|
-
- `createLdtkIntGridCellSource` — the layer's IntGrid as a `TileCellSource`, ready to hand to
|
|
32
|
-
`buildTileCollisionGeometry` or `TileColliderStreamer` for collision authored per cell
|
|
20
|
+
- `createLdtkIntGridCellSource` — the layer's IntGrid as a `TileCellSource`, ready to hand to `buildTileCollisionGeometry` or `TileColliderStreamer` for collision authored per cell
|
|
33
21
|
- `ldtkExtension` — extension descriptor; depends on `tilemapExtension` automatically
|
|
34
22
|
- `ldtkMapBinding` / `ldtkProjectBinding` — the underlying `AssetBinding`s (advanced/custom wiring)
|
|
35
|
-
- The raw LDtk JSON types (`LdtkData`, `LdtkLevel`, `LdtkLayerInstance`, `LdtkEntityInstance`, …)
|
|
36
|
-
|
|
37
|
-
- `TileMap`, `TileMapNode`, `TileMapView`, `TileLayer`, `TileSet`, `ObjectLayer`, … re-exported
|
|
38
|
-
from `@codexo/exojs-tilemap` (same class identity — `instanceof TileMap` holds across both import
|
|
39
|
-
paths)
|
|
23
|
+
- The raw LDtk JSON types (`LdtkData`, `LdtkLevel`, `LdtkLayerInstance`, `LdtkEntityInstance`, …) and the flip-bit constants (`LDTK_FLIP_X`, `LDTK_FLIP_Y`, `LDTK_FLIP_XY`, `LDTK_FLIP_NONE`)
|
|
24
|
+
- `TileMap`, `TileMapNode`, `TileMapView`, `TileLayer`, `TileSet`, `ObjectLayer`, … re-exported from `@codexo/exojs-tilemap` (same class identity — `instanceof TileMap` holds across both import paths)
|
|
40
25
|
|
|
41
26
|
## Usage
|
|
42
27
|
|
|
43
|
-
Register the extension and load a `.ldtk` world. One extension enables **both** loading and
|
|
44
|
-
rendering — `ldtkExtension` depends on `tilemapExtension`, so the tile chunk renderer bindings are
|
|
45
|
-
materialised automatically:
|
|
28
|
+
Register the extension and load a `.ldtk` world. One extension enables **both** loading and rendering — `ldtkExtension` depends on `tilemapExtension`, so the tile chunk renderer bindings are materialised automatically:
|
|
46
29
|
|
|
47
30
|
```ts
|
|
48
31
|
import { Application } from '@codexo/exojs';
|
|
49
|
-
import {
|
|
32
|
+
import { TileMapNode, ldtkExtension } from '@codexo/exojs-ldtk';
|
|
50
33
|
|
|
51
34
|
const app = new Application({ extensions: [ldtkExtension] });
|
|
52
35
|
|
|
@@ -57,15 +40,11 @@ const level = world.getLevelByName('Level_0') ?? world.levels[0];
|
|
|
57
40
|
app.scenes.root.addChild(new TileMapNode(level));
|
|
58
41
|
```
|
|
59
42
|
|
|
60
|
-
`TileMapNode` is the same class exported by `@codexo/exojs-tilemap` (see its
|
|
61
|
-
[README](https://www.npmjs.com/package/@codexo/exojs-tilemap) for the rendering/culling model and
|
|
62
|
-
actor interleaving).
|
|
43
|
+
`TileMapNode` is the same class exported by `@codexo/exojs-tilemap` (see its [README](https://www.npmjs.com/package/@codexo/exojs-tilemap) for the rendering/culling model and actor interleaving).
|
|
63
44
|
|
|
64
45
|
### Streaming levels
|
|
65
46
|
|
|
66
|
-
`ldtkMap` converts every level up front. For a project too large for that, load it as an
|
|
67
|
-
`ldtkProject` and load levels individually — each gets its own `LoaderScope`, and external
|
|
68
|
-
`.ldtkl` payloads are fetched only when their level is:
|
|
47
|
+
`ldtkMap` converts every level up front. For a project too large for that, load it as an `ldtkProject` and load levels individually — each gets its own `LoaderScope`, and external `.ldtkl` payloads are fetched only when their level is:
|
|
69
48
|
|
|
70
49
|
```ts
|
|
71
50
|
import { Application, Asset } from '@codexo/exojs';
|
|
@@ -82,24 +61,20 @@ const forest = await runtime.loadLevel(project.world.getLevelByName('Forest')!.i
|
|
|
82
61
|
forest.destroy(); // map, spawned objects and the level's asset claims, in that order
|
|
83
62
|
```
|
|
84
63
|
|
|
85
|
-
Which levels to load, and when, stays game policy — `project.world` carries the bounds and
|
|
86
|
-
neighbour graph to decide with.
|
|
64
|
+
Which levels to load, and when, stays game policy — `project.world` carries the bounds and neighbour graph to decide with.
|
|
87
65
|
|
|
88
66
|
## Texture ownership
|
|
89
67
|
|
|
90
|
-
Tileset textures are loaded via the Loader and stay in the Loader cache. `LdtkMap.destroy()`
|
|
91
|
-
destroys the owned runtime `TileMap`s but does **not** unload textures (Loader-owned) or remove any
|
|
92
|
-
scene nodes — the application owns those.
|
|
68
|
+
Tileset textures are loaded via the Loader and stay in the Loader cache. `LdtkMap.destroy()` destroys the owned runtime `TileMap`s but does **not** unload textures (Loader-owned) or remove any scene nodes — the application owns those.
|
|
93
69
|
|
|
94
70
|
## Core compatibility
|
|
95
71
|
|
|
96
|
-
|
|
97
|
-
| -------------------- | --------------- |
|
|
98
|
-
| 0.14.x | 0.14.x |
|
|
72
|
+
This package follows the Core lockstep release line. Its `@codexo/exojs` and `@codexo/exojs-tilemap` peer dependencies require the matching minor release.
|
|
99
73
|
|
|
100
74
|
## Links
|
|
101
75
|
|
|
102
|
-
- [
|
|
76
|
+
- [LDtk guide](https://exoridus.github.io/ExoJS/en/guide/assets/ldtk/)
|
|
77
|
+
- [API reference](https://exoridus.github.io/ExoJS/en/api/)
|
|
103
78
|
- [LDtk level editor](https://ldtk.io)
|
|
104
79
|
|
|
105
80
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codexo/exojs-ldtk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "LDtk level format asset extension for ExoJS.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"LICENSE"
|
|
27
27
|
],
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@codexo/exojs": "0.
|
|
30
|
-
"@codexo/exojs-tilemap": "0.
|
|
29
|
+
"@codexo/exojs": "0.18.x",
|
|
30
|
+
"@codexo/exojs-tilemap": "0.18.x"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@codexo/exojs": "0.
|
|
33
|
+
"@codexo/exojs": "0.18.0",
|
|
34
34
|
"@codexo/exojs-config": "0.0.0",
|
|
35
|
-
"@codexo/exojs-tilemap": "0.
|
|
35
|
+
"@codexo/exojs-tilemap": "0.18.0"
|
|
36
36
|
},
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"publishConfig": {
|