@clockgrove/assetgrove-tiles 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +260 -2
- package/dist/animation.d.ts +8 -0
- package/dist/animation.js +46 -0
- package/dist/corner16.d.ts +55 -0
- package/dist/corner16.js +122 -0
- package/dist/extension.d.ts +3 -0
- package/dist/extension.js +10 -0
- package/dist/imported.d.ts +7 -0
- package/dist/imported.js +171 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/kind.d.ts +38 -0
- package/dist/kind.js +320 -0
- package/dist/labels.d.ts +25 -0
- package/dist/labels.js +67 -0
- package/dist/objects.d.ts +34 -0
- package/dist/objects.js +192 -0
- package/dist/sheet.d.ts +123 -0
- package/dist/sheet.js +279 -0
- package/package.json +55 -3
- package/skills/assetgrove-tiles/SKILL.md +144 -0
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clockgrove/assetgrove-tiles",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"description": "Terrain tile sets for Assetgrove: corner-16 sets between two terrains as one sheet, with exact grid and seam-class checks, and imported sheets in the corner-16, blob-47, side-16 and corner-16-2x2 autotile layouts.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"assetgrove",
|
|
7
|
+
"tiles",
|
|
8
|
+
"tilesets",
|
|
9
|
+
"terrain",
|
|
10
|
+
"atlas",
|
|
11
|
+
"gamedev"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/clockgrove/assetgrove.git",
|
|
17
|
+
"directory": "packages/assetgrove-tiles"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"assetgrove": {
|
|
30
|
+
"api": 3,
|
|
31
|
+
"entry": "./dist/extension.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"skills"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=24"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@clockgrove/assetgrove": "^0.3.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@biomejs/biome": "2.6.9",
|
|
48
|
+
"@clockgrove/assetgrove": "link:../..",
|
|
49
|
+
"@types/node": "24.19.2",
|
|
50
|
+
"typescript": "6.0.3"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -p ../../tsconfig.build.json --emitDeclarationOnly && tsc -p tsconfig.build.json",
|
|
54
|
+
"check": "biome check . && tsc --noEmit",
|
|
55
|
+
"format": "biome format --write .",
|
|
56
|
+
"test": "node --conditions=assetgrove-source --test \"test/**/*.test.ts\""
|
|
57
|
+
}
|
|
6
58
|
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: assetgrove-tiles
|
|
3
|
+
description: Load when an Assetgrove project makes a corner-16 terrain tile set, one atlas between two terrains that must tile seamlessly, generates a sheet of object tiles held to a grid and a palette, or imports a bought or hand-drawn tile sheet (corner-16, blob-47, side-16, corner-16-2x2 or no layout) by cell and labels its cells (kind, walkable, draws above or below). Needs the optional @clockgrove/assetgrove-tiles package listed in the developer settings; covers the tiles:terrain, tiles:objects and tiles:sheet kinds, importing a sheet with its origin, the profile blocks, the layouts and their autotile tables, the corner-16 cell table, the tiles:grid, tiles:palette, tiles:in-cell, tiles:class-uniformity and tiles:seam-quality checks, cell labels, changing one tile and its limits.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Assetgrove for tiles
|
|
7
|
+
|
|
8
|
+
`@clockgrove/assetgrove-tiles` is a pack: it loads only once a person lists it under `extensions` in the developer settings. It adds the kind `tiles:terrain`: a corner-16 terrain tile set between two terrains, as one atlas image; the kind `tiles:objects`: nine generated object tiles on a 3 × 3 grid; and the kind `tiles:sheet`: a bought or hand-drawn sheet, imported by cell.
|
|
9
|
+
|
|
10
|
+
## Set it up
|
|
11
|
+
|
|
12
|
+
- Install it beside core and list `@clockgrove/assetgrove-tiles` in `extensions`.
|
|
13
|
+
- Add `kinds["tiles:terrain"]` to the target profile. `tileSize` is the side of one square tile in whole pixels; the sheet is `4 * tileSize` square. `layout` is optional (`kinds.<kind>.layout`).
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{ "kinds": { "tiles:terrain": { "tileSize": 16 } } }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A profile without the block exits 2 `invalid_input` at plan, as does a spec without both terrains.
|
|
20
|
+
|
|
21
|
+
## Make a set
|
|
22
|
+
|
|
23
|
+
Name the two terrains in the spec, `lower` and `upper`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"kind": "tiles:terrain",
|
|
28
|
+
"assetId": "grass-dirt",
|
|
29
|
+
"fields": { "terrains": { "lower": "dirt", "upper": "grass" } }
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then `assetgrove stage --spec <spec.json> --bible <BIBLE.md> --profile <profile.json>`; add `--dry-run` for the forecast. The output is one image whose `output.fields` are `{ layout, grid, terrains, autotile }`, with `layout` `corner-16` and `autotile` its table. The pack generates with one `tiles:atlas` call (role `image`) given a template reference: the cell table drawn in dark grey `#404040` for the lower terrain and light grey `#c0c0c0` for the upper. It scales the image to fit `4 * tileSize` square, centred, and applies the profile's alpha and colour rule. Routes: settings `routes["tiles:atlas"]` and `routes["tiles:seams"]`, else roles `image` and `decisions`.
|
|
34
|
+
|
|
35
|
+
## Make object tiles
|
|
36
|
+
|
|
37
|
+
Nine unrelated objects for a top-down or isometric game, one per cell, as one sheet. Add `kinds["tiles:objects"]` with `tileSize` to the profile, and name exactly nine objects in cell order (top left, row by row):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{ "kind": "tiles:objects", "assetId": "garden-things", "fields": { "objects": ["a wooden crate", "a clay pot", "a round bush", "a grey rock", "a tree stump", "a signpost", "a log", "a flower bed", "a lantern"] } }
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then `assetgrove stage --spec <spec.json> --bible <BIBLE.md> --profile <profile.json>`. One `tiles:objects` call (role `image`) draws them on a flat `#ff00ff` background; the background is made transparent, the sheet fitted to 3 × 3 cells of `tileSize` (layout `none`, so the Godot tile-set export takes it) and the profile's alpha and colour rule applied. `tiles:grid` (every cell drawn), `tiles:palette` and `tiles:in-cell` filter it. For pixel art, put the look in the bible's style notes and use a palette profile. Route: settings `routes["tiles:objects"]`, else role `image`.
|
|
44
|
+
|
|
45
|
+
- Nine objects, no other count: another is refused at plan (exit 2 `invalid_input`). For more, make more sheets.
|
|
46
|
+
- This shape is the one qualified on real routes: `openai/gpt-image-2` (the `image` default) and `bfl/flux-2-pro`, at 16 px cells. On another model or cell size it is unmeasured; the checks still filter what misses the grid.
|
|
47
|
+
- Do not ask for a larger autotile layout (a 47-tile blob or similar): no route held one. Make terrain as `tiles:terrain`, render from 3D, or import a bought sheet.
|
|
48
|
+
|
|
49
|
+
## Import a bought or hand-drawn sheet
|
|
50
|
+
|
|
51
|
+
A sheet a person bought or drew is the kind `tiles:sheet`, imported with `assetgrove import --spec <spec.json> --sheet <file> --profile <profile.json> --origin <origin.json> --tool <name> --asset <id>`. It takes the file in by cell with its bytes as given and stages it as candidate `c1` of a run; a person picks it. No model call, no spend.
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{ "kind": "tiles:sheet", "assetId": "meadow", "fields": { "layout": "blob-47", "grid": { "cellWidth": 16, "cellHeight": 16, "margin": 1, "spacing": 2 }, "terrains": { "lower": "dirt", "upper": "grass" } } }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- State the grid as the person gives it: `cellWidth`, `cellHeight`, and `margin` and `spacing` (default 0), whole pixels. Columns and rows follow from the image.
|
|
58
|
+
- If the person does not know it, leave `fields.grid` out: the import reads it from the gutters, stages nothing, and exits 2 `invalid_input` with `fields.read.grid`. Show it to the person; once they confirm it, write it into the spec and import again. A sheet without gutters cannot be read: ask for the cell size.
|
|
59
|
+
- Declare the layout as `fields.layout` (`corner-16`, `blob-47`, `side-16`, `corner-16-2x2` or `none`); a declared layout is used as stated. If it is left out and the grid's columns × rows fit terrain layouts, the import stages nothing and exits 2 `invalid_input` with `fields.read.layouts`, the fitting names. Show them to the person; once they say which one the sheet is (or `none`), write it as `fields.layout` and import again. Never pick one for them. A grid that fits none imports as `none`.
|
|
60
|
+
- `fields.terrains` `{ lower, upper }` is optional and recorded as given.
|
|
61
|
+
- `--origin` must be third-party: `source` the supplier, `evidence` the evidence of purchase, `terms` the licence terms as the person read them (core's sheet-import docs, Declared origins). Never invent them.
|
|
62
|
+
- `tiles:grid` runs on the import; a failure refuses it (exit 2), naming the size or the empty cell. Empty cells are kept and listed in `fields.emptyCells`; one the layout's autotile table needs is refused; a cell the table marks optional (`?`, the blank spare of `blob-47` and `corner-16-2x2`) may be empty. `tiles:palette` does not run on an import: a bought sheet keeps its supplier's colours.
|
|
63
|
+
- An animated tile (water, fire) is one tile with frames: add `fields.animations`, `[{ "frames": ["r0c0", "r0c1", "r0c2"], "durationMs": 150 }]`, cell addresses base tile first (at least two) and the time of each frame in ms. Ask the person which cells are the frames. `tiles:animation` refuses the import when a frame is off the grid or used twice, the layout has an autotile table (`corner-16`, `blob-47`, `side-16`, `corner-16-2x2`), or the last frame jumps back to the first; fix the declaration or the art, do not retry as is.
|
|
64
|
+
- Never `stage` a `tiles:sheet` spec: it is refused.
|
|
65
|
+
|
|
66
|
+
## Label the cells
|
|
67
|
+
|
|
68
|
+
A `tiles:sheet` cell can carry a kind, whether it is walkable, and whether it draws above or below characters. State them in the spec as `fields.cellLabels`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{ "cellLabels": { "grid": { "cellWidth": 16, "cellHeight": 16, "margin": 1, "spacing": 2 }, "cells": { "r0c0": { "kind": "ground", "walkable": true, "draw": "below" } } } }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- `kind` is one of the project's tile kinds: `ground`, `wall`, `object`, `water` by default, or `tileKinds` in the nearest `.assetgrove/labels.json` at or above the `--profile` file's directory (keep the profile in the project). Any other kind is refused `invalid_input`, as is an address outside the grid or on an animated tile's later frame (label its first frame).
|
|
75
|
+
- `assetgrove import --spec <spec.json> --sheet <file> --propose-labels` (with the other import options) asks a model once (`tiles:labels`, role `vision`, paid) to label the drawn cells from the image. It stages nothing and exits 0 with `fields.read.cellLabels`. Show the proposal to the person; once they confirm it, write it into the spec as `fields.cellLabels` and import again. Never confirm it yourself.
|
|
76
|
+
- `cellLabels.grid` is the grid the labels were confirmed on. A re-import of the sheet carries the labels while the cell size, margin and spacing are unchanged, even if the pixels changed; with another grid it is refused `invalid_input`: propose again.
|
|
77
|
+
- The Godot tile-set preset writes the labels into the tile set.
|
|
78
|
+
|
|
79
|
+
## The sheet
|
|
80
|
+
|
|
81
|
+
A sheet is one image cut into a grid of cells, with a layout that gives the cells their meaning. `output.fields` carries `layout` and `grid`:
|
|
82
|
+
|
|
83
|
+
- `grid`: `{ cellWidth, cellHeight, columns, rows, margin, spacing }`, all whole pixels. `margin` applies on every side of the sheet and `spacing` between every pair of neighbouring cells. Cell `(column, row)` starts at `x = margin + column * (cellWidth + spacing)`, `y = margin + row * (cellHeight + spacing)`. The sheet is `2 * margin + columns * cellWidth + (columns - 1) * spacing` wide, and likewise tall.
|
|
84
|
+
- `layout`: a name in the pack's layouts list. `corner-16` (4 × 4), `blob-47` (12 × 4), `side-16` (4 × 4) and `corner-16-2x2` (4 × 4) fix a grid and carry an autotile table; `none` fixes nothing: a plain grid of unrelated tiles.
|
|
85
|
+
- cell address: `r<row>c<column>`, zero-based from the top left, so `r1c1` is row 1, column 1. Review notes, labels and exports point at a cell by it.
|
|
86
|
+
|
|
87
|
+
## Autotile layouts
|
|
88
|
+
|
|
89
|
+
A layout's `autotile` table, recorded as `output.fields.autotile`, is `{ mode, tiles }`: `tiles` in row-major order, each `{ cell, terrain, peering }` with `cell` an address (`r0c1`), `terrain` the centre and `peering` a record of neighbour to terrain, all 0 (lower) or 1 (upper). Modes: `corners` (nw ne sw se), `sides` (n e s w), `corners-and-sides` (n ne e se s sw w nw). `blob-47`, `side-16` and `corner-16-2x2` are Godot 3's autotile templates ("3x3 minimal", "3x3 16 tiles", "2x2"), which published Godot packs are drawn to.
|
|
90
|
+
|
|
91
|
+
## The corner-16 cell table
|
|
92
|
+
|
|
93
|
+
16 tiles on a 4 × 4 grid. Each tile labels its four corners `L` (lower terrain) or `U` (upper). Tile `i` has corner bits NW = 1, NE = 2, SW = 4, SE = 8, set for `U`, and sits at column `i % 4`, row `floor(i / 4)`, origin top-left. Tile 5 is NW `U`, NE `L`, SW `U`, SE `L`; tile 15 is `UUUU`.
|
|
94
|
+
|
|
95
|
+
| Tile | Column | Row | Address | NW | NE | SW | SE |
|
|
96
|
+
| ---: | -----: | --: | ------- | --- | --- | --- | --- |
|
|
97
|
+
| 0 | 0 | 0 | r0c0 | L | L | L | L |
|
|
98
|
+
| 1 | 1 | 0 | r0c1 | U | L | L | L |
|
|
99
|
+
| 2 | 2 | 0 | r0c2 | L | U | L | L |
|
|
100
|
+
| 3 | 3 | 0 | r0c3 | U | U | L | L |
|
|
101
|
+
| 4 | 0 | 1 | r1c0 | L | L | U | L |
|
|
102
|
+
| 5 | 1 | 1 | r1c1 | U | L | U | L |
|
|
103
|
+
| 6 | 2 | 1 | r1c2 | L | U | U | L |
|
|
104
|
+
| 7 | 3 | 1 | r1c3 | U | U | U | L |
|
|
105
|
+
| 8 | 0 | 2 | r2c0 | L | L | L | U |
|
|
106
|
+
| 9 | 1 | 2 | r2c1 | U | L | L | U |
|
|
107
|
+
| 10 | 2 | 2 | r2c2 | L | U | L | U |
|
|
108
|
+
| 11 | 3 | 2 | r2c3 | U | U | L | U |
|
|
109
|
+
| 12 | 0 | 3 | r3c0 | L | L | U | U |
|
|
110
|
+
| 13 | 1 | 3 | r3c1 | U | L | U | U |
|
|
111
|
+
| 14 | 2 | 3 | r3c2 | L | U | U | U |
|
|
112
|
+
| 15 | 3 | 3 | r3c3 | U | U | U | U |
|
|
113
|
+
|
|
114
|
+
Each cell as its index and corners NW NE / SW SE:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
col 0 col 1 col 2 col 3
|
|
118
|
+
row 0 0 LL/LL 1 UL/LL 2 LU/LL 3 UU/LL
|
|
119
|
+
row 1 4 LL/UL 5 UL/UL 6 LU/UL 7 UU/UL
|
|
120
|
+
row 2 8 LL/LU 9 UL/LU 10 LU/LU 11 UU/LU
|
|
121
|
+
row 3 12 LL/UU 13 UL/UU 14 LU/UU 15 UU/UU
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Read the checks
|
|
125
|
+
|
|
126
|
+
- `tiles:grid` is exact, free and filters, on a generated and an imported sheet alike. The sheet must be exactly its grid's size (`4 * tileSize` square for `tiles:terrain`, `3 * tileSize` for `tiles:objects`), no cell its layout's autotile table needs may be empty, and on `tiles:objects` no cell may be empty (no pixel at or above the profile's alpha threshold); other empty cells, such as any under `none`, pass and are listed as kept. It gives one reason per empty cell, naming it (`cell r1c1 is empty: ...`), or one for a wrong size. Do not retry the same image.
|
|
127
|
+
- `tiles:class-uniformity` is exact, free and filters. A class is a side and the corner-label pair along it, read along the side: north NW NE, south SW SE, west NW SW, east NE SE. The outermost 1-px strip of each tile is compared byte-exact as RGBA within its class; the strip most of the class shares wins, ties to the lowest index. A failing reason names the cell, the tile and the side. It applies only when the profile's resolved colour rule is `palette`; otherwise it passes with a reason starting `skipped:` that says why. On a sheet of the wrong size it is skipped too, as `tiles:grid` reports it. The pixel-art spike found no route that keeps this rule on the larger 47-tile layout, which is why only corner-16 is generated.
|
|
128
|
+
- `tiles:palette` is exact, free and filters, on generated kinds (`tiles:objects`), not on `tiles:sheet` imports. Under a palette colour rule every visible pixel must be a palette colour (the profile's, else the bible's); otherwise it passes as `skipped:`.
|
|
129
|
+
- `tiles:in-cell` is exact, free and filters, on `tiles:objects`: no visible pixel on a cell's outermost ring (the grid would cut the object) and each object at least 5% of its cell. Its reason names the cell. Stage again rather than editing: a failing sheet usually has one object drawn too large or off centre.
|
|
130
|
+
- `tiles:seam-quality` asks a model one boolean question (operation `tiles:seams`, role `decisions`) over the atlas and a wrap preview of the two pure tiles (0 and 15) repeated 2 × 2. It is advisory (`shadow`) and never filters, as the pack ships no stability entry. Treat its reasons as a prompt for a person.
|
|
131
|
+
|
|
132
|
+
## Change one tile
|
|
133
|
+
|
|
134
|
+
Mark the tile's cell with `request-change`, using `cellBox(grid, cell)`: `x = margin + column * (cellWidth + spacing)`, `y = margin + row * (cellHeight + spacing)`, `w = cellWidth`, `h = cellHeight`. Tile 5 is cell `r1c1`; at `tileSize` 16 its box is `16,16,16,16`:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
assetgrove request-change <address> --region "16,16,16,16 : the dirt looks too green at the corners"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The edit runs the kind's exact checks, and a failing edit is filtered.
|
|
141
|
+
|
|
142
|
+
## Limits
|
|
143
|
+
|
|
144
|
+
The pack generates the corner-16 terrain set and nine object tiles on 3 × 3; no larger autotile layout. The other layouts, `none` and any margin or spacing are imported, recorded and addressed but not generated. Two terrains per set. Square tiles.
|