pixelkiln 0.115.0 → 0.115.2

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/docs/LIBRARY.md CHANGED
@@ -384,11 +384,31 @@ const exported = exportTileset(lockEntry, spec, {
384
384
  })
385
385
  ```
386
386
 
387
- The generic format preserves the complete provider rule object. Tiled and
388
- Godot exporters translate supported 4-edge and 4-corner rule sets and reject
387
+ The generic format preserves the complete provider rule object. Tiled, Godot
388
+ and LDtk exporters translate supported 4-edge and 4-corner rule sets and reject
389
389
  unknown semantics rather than emitting plausible but incorrect adjacency.
390
390
  See [TILES.md](./TILES.md) for file contracts and engine details.
391
391
 
392
+ Sets that share a terrain (`connect`) export as one tileset with every terrain
393
+ through `connectedGroup()` and `exportMergedTilesets()`, the calls behind
394
+ `pixelkiln export --merge-connected`:
395
+
396
+ ```ts
397
+ import { connectedGroup, exportMergedTilesets } from "pixelkiln"
398
+
399
+ // `specs` are the manifest's resolved specs; `lock` is its lockfile.
400
+ const group = connectedGroup(coastSpec, specs) // every linked set, parents first
401
+ const merged = exportMergedTilesets(
402
+ group.map((spec) => ({ spec, entry: lock.entries[`${spec.styleId}/${spec.assetId}`]! })),
403
+ { format: "godot", manifestDir: loaded.root, imageName: "coast.png" },
404
+ )
405
+ ```
406
+
407
+ `merged.png`, `merged.document` and `merged.generic` are the same shape as
408
+ `exportTileset()` returns; `merged.generic.sets` lists the group. It throws for
409
+ a group with a sidescroller set or mixed tile shapes. See
410
+ [connected sets](./TILES.md#connected-sets).
411
+
392
412
  ## Render effects
393
413
 
394
414
  `pixelkiln vfx` is a thin layer over exported functions. The local source,
package/docs/README.md CHANGED
@@ -39,7 +39,7 @@ provider you are using. These Markdown files also render at
39
39
  |---|---|
40
40
  | [Architecture](./ARCHITECTURE.md) | Manifest/lock state, provider boundary, output identity, hand edits, 3D models, the pinned editor build, concurrency, and durable writes. |
41
41
  | [Library API](./LIBRARY.md) | Public TypeScript imports for planning, quality checks, providers, packing, exporting, and managed artifact writes. |
42
- | [Tiles and engine exports](./TILES.md) | Structural tile roles, provider rule preservation, generic JSON, Tiled Wang sets, and Godot terrain sets. |
42
+ | [Tiles and engine exports](./TILES.md) | Structural tile roles, provider rule preservation, generic JSON, Tiled Wang sets, Godot terrain sets, LDtk projects, and exporting connected sets as one tileset. |
43
43
  | [Measured PixelLab endpoints](./ENDPOINTS.md) | Live-account cost and payload research, endpoint recipes, limits, and unresolved API behavior. |
44
44
  | [Provider comparison](../PROVIDERS.md) | Provider selection, costs, adapter capabilities, confidence, and next work. Start with the provider-specific setup guides above when you are ready to configure a project. |
45
45
 
package/docs/TILES.md CHANGED
@@ -283,6 +283,16 @@ owns: layer and tileset names get a capital first letter (the project asks for
283
283
  that style), `cachedPixelData` is filled in, and the build id. Only corner sets
284
284
  were opened; edge sets are covered by the matcher tests alone.
285
285
 
286
+ A merged group was opened the same way: two connected sets built from that real
287
+ art, grass shared, with the lake's blue recolored to dirt (32 tiles, three
288
+ terrains, 31 rules). The 16 by 12 Preview drew grass, lake and dirt with the
289
+ right border at every join, LDtk's own rule evaluation reproduced all 192
290
+ stored tiles, and painting dirt beside grass redrew the right tiles. Painting a
291
+ terrain next to one it has no set with (dirt against lake) left those cells
292
+ empty: no tile has a lake corner and a dirt corner, so no rule matches. That is
293
+ the same hard edge the Connected sets section describes; paint a band of the
294
+ shared terrain between them.
295
+
286
296
  ## Connected sets
287
297
 
288
298
  A coast is built from sets that share a terrain: one draws ocean against sand,
@@ -323,7 +333,8 @@ generated; a missing one stops the export and is named in the error.
323
333
  distinct set of four corners; tiles that share one are alternatives in that
324
334
  rule. The Preview level is larger (16 by 12) and painted so that only
325
335
  terrains a set joins ever meet, and the level's outside counts as the first
326
- terrain. The preview uses every rule.
336
+ terrain. The preview uses every rule. Cells whose corners no set joins are
337
+ left empty, so paint the shared terrain between two that have no set.
327
338
  - **Files.** The default name joins the sets: `coast-meadow-forest-tileset`.
328
339
  `--out` names the one result. The record beside it lists the sets.
329
340
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelkiln",
3
- "version": "0.115.0",
3
+ "version": "0.115.2",
4
4
  "description": "Manifest-driven pixel-art generation, review, recovery, and packaging with deterministic provenance.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -89,6 +89,13 @@ hashes.
89
89
  person; `pixelkiln tools install editor` prefetches it without opening
90
90
  anything. Art changed in PixelLab's own editor comes back with
91
91
  `pixelkiln fetch --refresh`, never by regenerating.
92
+ - For ground, terrain, roads, or any set of tiles that must join, read the
93
+ tiles reference below before picking a generator or exporting. Never read a
94
+ tile's adjacency from its file name: the rule is in the lockfile entry, and
95
+ `export --format generic` keeps all of it. Export to an engine only from
96
+ generated, `ok` sets. `--merge-connected` is opt-in: offer it when the person
97
+ wants one brush across sets that share a terrain, and never add it to an
98
+ existing export command unasked.
92
99
  - A `.glb` under a style's `outDir` is a 3D model, not a manifest asset. Its
93
100
  fixes go to an edited copy under `edits/` through `pixelkiln model`; the
94
101
  model as built is never written. Read the models reference below before
@@ -140,6 +147,11 @@ Read only the reference needed for the current decision:
140
147
  (PixelLab's workbench and paid artist, or the local pixelfx library), read
141
148
  [references/vfx.md](references/vfx.md). It covers which source to pick,
142
149
  every control, the files written, and how a game plays them.
150
+ - For ground, terrain, roads, connected tile sets, or exporting a tileset to
151
+ Tiled, Godot or LDtk (`pixelkiln export`, including `--merge-connected`),
152
+ read [references/tiles.md](references/tiles.md). It covers which generator
153
+ to pick, how sets connect, every export format and what it refuses, and
154
+ what has and has not been checked in an engine.
143
155
  - For Retro Diffusion styles, USD budgets, environment assets, animation, or
144
156
  experimental limits, read
145
157
  [references/retro-diffusion.md](references/retro-diffusion.md).
@@ -142,7 +142,8 @@ compared as written: adding `terrainMode: "standard"` to a style that left
142
142
  it out is a change, even though it is the default. A set generated before
143
143
  this record existed has none and stays current until it is regenerated.
144
144
 
145
- **Connected sets.** An asset's `connect` makes one of its terrains the very
145
+ **Connected sets.** (How to export one, and `--merge-connected`, are in
146
+ [tiles.md](./tiles.md).) An asset's `connect` makes one of its terrains the very
146
147
  terrain of another set in the same style, so ocean, sand, and grass paint on
147
148
  one map: `"connect": { "lower": { "of": "coast", "terrain": "upper" } }` is
148
149
  "this set's lower terrain is `coast`'s upper". The other set generates
@@ -0,0 +1,202 @@
1
+ # Tiles, terrain and engine exports
2
+
3
+ Read this reference when the person wants ground, a coastline, cliffs, roads,
4
+ a dungeon floor, or any set of tiles that must join, or wants a tileset in
5
+ Tiled, Godot or LDtk. The full detail is in `docs/TILES.md`; the generator
6
+ knobs are in [pixellab.md](./pixellab.md) and `docs/GENERATORS.md`; the flags
7
+ are in `docs/CLI.md`, "export".
8
+
9
+ ## What a tileset is here
10
+
11
+ A set of tile images is not a tileset until something says which tile goes
12
+ next to which. PixelLab returns that with the images, and PixelKiln keeps it
13
+ in the lockfile entry (`providerMetadata.pixellab`) so nobody has to guess
14
+ from file names:
15
+
16
+ - a **corner** set names a terrain on each of a tile's four corners (NW, NE,
17
+ SW, SE). Corner masks use bits 3, 2, 1, 0 for NW, NE, SW, SE, and a set bit
18
+ means the set's first terrain.
19
+ - an **edge** set names one on each side (PixelLab's `tiles` with a
20
+ `tileFeature` can return one). Edge masks use bits 0, 1, 2, 3 for N, E, S, W.
21
+ - a tile with no rule is a **stamp**: it goes in the atlas but no engine
22
+ brush uses it.
23
+
24
+ Never infer a tile's rule from its file name or position. Read the lock entry,
25
+ or export `--format generic`, which keeps every rule PixelKiln does not map.
26
+
27
+ ## Pick the generator
28
+
29
+ | The person wants… | Use | Notes |
30
+ |---|---|---|
31
+ | two surfaces that meet (water and sand, floor and cliff) | `terrain` | 16 tiles, or 25 with tall walls. Prompt: `1). lower 2). upper`, optionally `3). transition`. Square, top-down or side-on only. |
32
+ | a path or road network | `tiles` with `tileFeature: "roads"` | 18 tiles for the path configurations. |
33
+ | a rougher transition than `terrain` gives, or an isometric or hex set | `tiles` with `tileFeature: "tileset"` | 16-tile corner set; describe the transition itself in the prompt. |
34
+ | a floor, wall and doorway kit | `tiles` with `tileFeature: "building"` | May include stamp-only images. |
35
+ | several ground variations to pick from | `tiles`, no `tileFeature` | Normal review-and-pick; no rules, so it exports as a plain atlas. |
36
+ | one raised block or mesa | `isometricTile` | One standalone tile. It is not a set and `export` skips it. |
37
+ | a platform seen from the side | `terrain` with `terrainOrientation: "sidescroller"` | Prompt: `1). platform body 2). top layer`. |
38
+
39
+ Start with `terrain` for ground that meets other ground. Its response names
40
+ every tile's corners directly, and it costs the least of the set generators.
41
+
42
+ Prompt each terrain as a short material ending in "texture". Put style words in
43
+ the style's `promptPrefix`/`promptSuffix`; they wrap each terrain separately.
44
+ Terrain references, Pro shape controls and the rest are in
45
+ [pixellab.md](./pixellab.md).
46
+
47
+ ## The usual run
48
+
49
+ ```bash
50
+ pixelkiln doctor --dry-run
51
+ pixelkiln plan
52
+ pixelkiln gen --budget <approved-generations>
53
+ pixelkiln export --style ground --only coast --format tiled
54
+ ```
55
+
56
+ A terrain set resolves straight to a finished asset: one file per tile, no
57
+ candidates to pick. Report the price from `plan` and get a yes before `gen`,
58
+ as for any paid work. Measured costs: a Pro set billed 15 at 32px, standard
59
+ 1 to 3; a connected set bills like any other, so three sets cost three times
60
+ one.
61
+
62
+ Changing any terrain setting marks the set stale and `plan` names the setting.
63
+ Regenerating a set that others connect to marks those stale too, so ask before
64
+ redrawing a parent.
65
+
66
+ ## Connected sets
67
+
68
+ Ocean, sand, grass and a path on one map need a set for every pair that
69
+ touches. Sets share a terrain through `connect`, keyed by the connecting set's
70
+ own side:
71
+
72
+ ```jsonc
73
+ {
74
+ "styles": { "ground": { "generator": "terrain", "outDir": "art/ground" } },
75
+ "assets": {
76
+ "coast": { "prompt": "1). deep ocean water texture 2). plain smooth sand texture" },
77
+ "meadow": { "prompt": "1). plain smooth sand texture 2). short green grass texture",
78
+ "connect": { "lower": { "of": "coast", "terrain": "upper" } } },
79
+ "forest": { "prompt": "1). short green grass texture 2). dark forest floor texture",
80
+ "connect": { "lower": { "of": "meadow", "terrain": "upper" } } }
81
+ }
82
+ }
83
+ ```
84
+
85
+ "This set's lower terrain is `coast`'s upper." The parent generates first and
86
+ the child waits for it. Rules that trip people:
87
+
88
+ - Sharing a terrain makes it available, not blendable. Two terrains with no
89
+ set of their own between them meet with a hard edge. Plan a set for every
90
+ pair that touches.
91
+ - Connected sets share one style, so they share its `terrainMode`: a standard
92
+ set cannot connect to a Pro one.
93
+ - A sidescroller set connects only its platform (`lower`).
94
+ - Cycles are refused.
95
+ - Write the same wording for the shared surface in both sets. It is how the
96
+ merged tileset is named (below), and it keeps the art consistent.
97
+
98
+ ## Export
99
+
100
+ ```bash
101
+ pixelkiln export --style ground --only coast --format generic # default
102
+ pixelkiln export --style ground --only coast --format tiled
103
+ pixelkiln export --style ground --only coast --format godot
104
+ pixelkiln export --style ground --only coast --format ldtk
105
+ pixelkiln export --style ground --format tiled --merge-connected
106
+ ```
107
+
108
+ Files land in the style's `outDir` as `<asset>-tileset.png`,
109
+ `<asset>-tileset.<ext>` and `<asset>-tileset.pixelkiln.json` (the record of
110
+ inputs and output hashes). `--out <base>` names one result, `--columns <n>`
111
+ sets atlas columns.
112
+
113
+ | Format | Writes | What the engine gets |
114
+ |---|---|---|
115
+ | `generic` | `.json` | The lossless contract: atlas, every tile's rectangle, mask or corners, and the provider's raw rules. Use it for any engine without an exporter, and for anything below that is refused. |
116
+ | `tiled` | `.tsj` | An image tileset with a Wang set; ids in Tiled's own order. |
117
+ | `godot` | `.tres` | A `TileSet` with terrain peering bits on every tile. Corner sets use match-corners, edge sets match-sides. |
118
+ | `ldtk` | `.ldtk` | A whole project: tileset, an IntGrid layer plus an auto-rule layer, and a Preview level. Corner sets paint on a grid shifted half a tile. |
119
+
120
+ What export refuses, and what to do instead:
121
+
122
+ | Case | Use instead |
123
+ |---|---|
124
+ | six-edge hex masks | `generic` only. |
125
+ | `outline` or building images with no rule | `generic`; engine exporters will not invent placement. |
126
+ | Godot edge masks on an isometric or oblique tile | `generic` or `tiled`. |
127
+ | LDtk for hex, isometric, oblique, non-square tiles | `generic` or `tiled`; LDtk takes square tiles on an orthogonal grid. |
128
+ | tiles of different sizes | Engine formats need one cell size; `generic` does not. |
129
+
130
+ A hand-edited set (`pixelkiln edit --only <asset> --style <style> --no-open`)
131
+ is exported tile by tile from its edits, and the record names those paths.
132
+ A changed output stops the next export instead of being overwritten; `--force`
133
+ re-baselines the whole bundle, so read the difference first.
134
+
135
+ Export never changes source PNGs or the lockfile.
136
+
137
+ ### Merging connected sets
138
+
139
+ Without a flag each set exports as its own two-terrain tileset. In an engine
140
+ that is three separate brushes that do not know ocean, sand and grass share
141
+ surfaces. `--merge-connected` writes the whole group as one tileset with every
142
+ terrain:
143
+
144
+ - the group is every set linked by `connect`, in either direction. Naming one
145
+ (`--only meadow`) exports all of them.
146
+ - every set must be generated. A missing one stops the export and is named.
147
+ - terrains that connect become one terrain, numbered in the order the group
148
+ meets them, starting from the set that connects to nothing.
149
+ - each terrain is named from the first clause of the description in the set
150
+ that defines it ("deep ocean water texture" gives `deep ocean water texture`
151
+ up to 32 characters), so keep descriptions short and plain.
152
+ - the default file name joins the sets (`coast-meadow-forest-tileset`).
153
+ Generic JSON gains `sets` and per-tile `corners`; Tiled gets one Wang set;
154
+ Godot one terrain set; LDtk one value per terrain and a 16 by 12 Preview.
155
+ - refused: a group with a sidescroller set, or sets with different tile sizes
156
+ or shapes.
157
+
158
+ The flag is opt-in on purpose. Without it, existing exports and their file
159
+ names do not move, and a game that loads `coast-tileset` keeps working. Do not
160
+ add the flag to someone's existing export command unasked; offer it when they
161
+ want one brush for several surfaces.
162
+
163
+ ## What has been checked, and what has not
164
+
165
+ Tell the person when it matters:
166
+
167
+ - Godot: the `.tres` for a square corner set and an isometric set loads in a
168
+ headless Godot 4.7.2 in CI, and a peering bit reads back.
169
+ - LDtk: a 16-tile corner set was opened by hand in LDtk 1.5.3. The preview
170
+ drew correctly, LDtk's own rule matching reproduced the stored tiles, and
171
+ painting redrew the right tiles. Edge sets are covered by tests only.
172
+ - Tiled: the `.tsj` follows Tiled's documented layout but nothing loads it in
173
+ CI.
174
+ - Merged exports: tested through the `export` command. A merged LDtk project
175
+ (two connected sets from real art, three terrains) was opened in LDtk 1.5.3:
176
+ the preview drew every border, LDtk's own rules reproduced all stored tiles,
177
+ and painting redrew correctly. Painting two terrains that have no set between
178
+ them leaves empty cells, as expected. No Godot or Tiled load of a merged
179
+ export yet.
180
+
181
+ Before the person relies on a format, suggest opening one file in the engine
182
+ and painting a few cells.
183
+
184
+ ## Before reporting a tileset as done
185
+
186
+ - `pixelkiln plan` shows the asset `ok`, and `pixelkiln audit --check` passes.
187
+ - Look at the atlas PNG. Seams at the tile edges, a blank tile, or two
188
+ surfaces that do not match their neighbours' wording means it is not done,
189
+ whatever the exit code.
190
+ - Check the count: 16, 18 or 25 tiles as the generator promises. Report the
191
+ tile size, the atlas size, the format and the three files written.
192
+ - For a connected group, list the terrains in order and name any pair that
193
+ touches but has no set between them.
194
+ - State what was not checked (the engine, edge sets, a merged file).
195
+
196
+ ## Pointers
197
+
198
+ - `docs/TILES.md`: stored state, the `terrain` shape, each format's mapping,
199
+ Connected sets, and the deliberate limits.
200
+ - The website's `/tiles` page shows real output and the export commands.
201
+ - `docs/LIBRARY.md`, "Export generated tiles": `exportTileset()`, `connectedGroup()` and
202
+ `exportMergedTilesets()` from code.