Skip to content

Commit c7adfff

Browse files
committed
Included in this foundation
- Tile painting, erase, and value picker - Tile, collision, and data layers - Layer add/remove/visibility controls - Tileset palette selection - Object and spawn marker placement - JSON map load/save - Top-level project actions: New Project, Load Project, Load Sample, Save Project, Simulate, Exit Simulation - Simulation mode for tile/data/object preview - Runtime export JSON
1 parent e41fcc9 commit c7adfff

9 files changed

Lines changed: 320 additions & 212 deletions

CODEX_COMMANDS.md

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,7 @@
1-
Toolbox Aid
2-
David Quesenberry
3-
04/03/2026
4-
change_summary.txt
1+
Created implementation bundle for BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION.
52

6-
BUILD_PR_PROJECT_ASSET_REGISTRY summary
7-
8-
Implemented:
9-
- Added shared registry module:
10-
- tools/shared/projectAssetRegistry.js
11-
- supports sanitize/merge/upsert/find, project-relative path normalization, and duplicate reduction
12-
- Integrated Sprite Editor:
13-
- tools/Sprite Editor/index.html
14-
- tools/Sprite Editor/modules/projectModel.js
15-
- tools/Sprite Editor/modules/spriteEditorApp.js
16-
- tools/Sprite Editor/README.md
17-
- Added optional load/save project.assets.json controls
18-
- Added additive palette/sprite registry registration on save
19-
- Added optional assetRefs persistence (`paletteId`, `spriteId`)
20-
- Integrated Tile Map Editor:
21-
- tools/Tile Map Editor/index.html
22-
- tools/Tile Map Editor/main.js
23-
- tools/Tile Map Editor/README.md
24-
- Added optional load/save project.assets.json controls
25-
- Added additive tileset/image/parallax source registry registration
26-
- Added optional assetRefs persistence (`tilesetId`, `parallaxSourceIds`)
27-
- Integrated Parallax Editor:
28-
- tools/Parallax Editor/index.html
29-
- tools/Parallax Editor/main.js
30-
- tools/Parallax Editor/README.md
31-
- Added optional load/save project.assets.json controls
32-
- Added additive image/parallax source registration
33-
- Added optional `parallaxSourceId` (layer) + document assetRefs persistence
34-
- Added sample project data showing shared references:
35-
- tools/shared/samples/project-asset-registry-demo/project.assets.json
36-
- tools/shared/samples/project-asset-registry-demo/hero-idle.sprite.json
37-
- tools/shared/samples/project-asset-registry-demo/overworld-main.tilemap.json
38-
- tools/shared/samples/project-asset-registry-demo/overworld-main.parallax.json
39-
40-
Scope guardrails honored:
41-
- No engine core API changes
42-
- Additive, non-destructive registry merge behavior
43-
- Legacy standalone file compatibility preserved
44-
- Project-relative normalized paths used for registry path fields
3+
Summary:
4+
- Extends the shared registry helper with additive `tilemaps` support.
5+
- Updates Tile Map Editor to load/save `project.assets.json` and persist `assetRefs.tilemapId` plus `assetRefs.tilesetId`.
6+
- Registers `tilemaps` and relevant `tilesets` additively while preserving existing registry groups and unknown safe fields.
7+
- Keeps scope surgical: no engine changes and no Parallax Editor work in this PR.

docs/dev/reports/file_tree.txt

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1-
Toolbox Aid
2-
David Quesenberry
3-
04/03/2026
4-
file_tree.txt
5-
6-
BUILD_PR_PROJECT_ASSET_REGISTRY file tree
7-
8-
CODEX_COMMANDS.md
9-
docs/pr/PLAN_PR_PROJECT_ASSET_REGISTRY.md
10-
docs/pr/BUILD_PR_PROJECT_ASSET_REGISTRY.md
11-
docs/dev/reports/change_summary.txt
12-
docs/dev/reports/validation_checklist.txt
13-
docs/dev/reports/file_tree.txt
14-
tools/shared/projectAssetRegistry.js
15-
tools/shared/samples/project-asset-registry-demo/project.assets.json
16-
tools/shared/samples/project-asset-registry-demo/hero-idle.sprite.json
17-
tools/shared/samples/project-asset-registry-demo/overworld-main.tilemap.json
18-
tools/shared/samples/project-asset-registry-demo/overworld-main.parallax.json
19-
tools/Sprite Editor/index.html
20-
tools/Sprite Editor/README.md
21-
tools/Sprite Editor/modules/projectModel.js
22-
tools/Sprite Editor/modules/spriteEditorApp.js
23-
tools/Tile Map Editor/index.html
24-
tools/Tile Map Editor/README.md
25-
tools/Tile Map Editor/main.js
26-
tools/Parallax Editor/index.html
27-
tools/Parallax Editor/README.md
28-
tools/Parallax Editor/main.js
1+
BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION_delta/
2+
├── docs/
3+
│ ├── dev/
4+
│ │ └── reports/
5+
│ │ ├── change_summary.txt
6+
│ │ ├── file_tree.txt
7+
│ │ └── validation_checklist.txt
8+
│ └── pr/
9+
│ └── BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION.md
10+
└── tools/
11+
├── Tile Map Editor/
12+
│ ├── README.md
13+
│ └── main.js
14+
└── shared/
15+
└── projectAssetRegistry.js
Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
Toolbox Aid
2-
David Quesenberry
3-
04/03/2026
4-
validation_checklist.txt
5-
6-
BUILD_PR_PROJECT_ASSET_REGISTRY validation checklist
7-
8-
[x] Shared registry utility added for cross-tool use
9-
[x] Sprite Editor supports optional load/save of `project.assets.json`
10-
[x] Tile Map Editor supports optional load/save of `project.assets.json`
11-
[x] Parallax Editor supports optional load/save of `project.assets.json`
12-
[x] Registry merge behavior is additive and non-destructive
13-
[x] Duplicate entries reduced where practical (`id` + normalized `path`)
14-
[x] Registry path fields normalized to project-relative paths
15-
[x] Legacy standalone project files still load without registry presence
16-
[x] No engine core APIs were modified
17-
[x] Sample project data includes shared palette/sprite/tileset/parallax references
18-
19-
Syntax checks
20-
[x] node --check tools/shared/projectAssetRegistry.js
21-
[x] node --check tools/Sprite Editor/modules/projectModel.js
22-
[x] node --check tools/Sprite Editor/modules/spriteEditorApp.js
23-
[x] node --check tools/Sprite Editor/main.js
24-
[x] node --check tools/Tile Map Editor/main.js
25-
[x] node --check tools/Parallax Editor/main.js
26-
27-
Manual contract checks
28-
[x] Sprite save/load continues to work with and without registry file
29-
[x] Tile map save/load continues to work with and without registry file
30-
[x] Parallax save/load continues to work with and without registry file
31-
[x] Registry load merges unknown/other sections without destructive replacement
32-
[x] Separate `project.assets.json` contract is used (not engine-embedded)
1+
BUILD VALIDATION CHECKLIST
2+
3+
- [x] Tile Map Editor registry adoption implemented without engine core API changes
4+
- [x] Shared registry helpers reused and extended additively for `tilemaps`
5+
- [x] `project.assets.json` load/save supported in Tile Map Editor
6+
- [x] Tile map documents persist optional `assetRefs.tilemapId` and `assetRefs.tilesetId`
7+
- [x] Registry updates additively preserve existing groups and unknown safe fields
8+
- [x] Legacy tile map JSON remains loadable when `assetRefs` are absent
9+
- [x] No Parallax Editor implementation work included in this PR
10+
- [x] Syntax validation passed for changed JS files
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Toolbox Aid
2+
David Quesenberry
3+
04/04/2026
4+
BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION.md
5+
6+
# BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION
7+
8+
## Goal
9+
Implement the approved Tile Map Editor asset registry adoption slice from `PLAN_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION` using the shared registry helpers already established by Sprite Editor.
10+
11+
## Implemented scope
12+
- Extended `tools/shared/projectAssetRegistry.js` so `tilemaps` is a first-class additive registry section.
13+
- Kept shared registry behavior non-destructive:
14+
- preserves existing known groups
15+
- preserves unknown top-level safe fields
16+
- preserves unknown safe fields on known entries where practical
17+
- Updated Tile Map Editor registry integration:
18+
- loads and saves `project.assets.json`
19+
- persists optional `assetRefs.tilemapId` and `assetRefs.tilesetId`
20+
- additively upserts `tilemaps` and relevant `tilesets`
21+
- resolves `tilesetId` from the shared registry when local path data is absent
22+
- surfaces soft status messages when registry references are unresolved
23+
- Preserved backward compatibility for legacy tile map JSON files with no `assetRefs`.
24+
25+
## Scope boundaries honored
26+
- No engine core API changes
27+
- No Sprite Editor rework
28+
- No Parallax Editor implementation work in this PR
29+
- No destructive registry replacement behavior
30+
31+
## Validation summary
32+
- Syntax checks passed:
33+
- `node --check tools/shared/projectAssetRegistry.js`
34+
- `node --check tools/Tile Map Editor/main.js`
35+
- Validation checklist updated and all items marked pass in `docs/dev/reports/validation_checklist.txt`.
36+
37+
## Packaging
38+
- Delta ZIP: `tmp/BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION_delta.zip`
39+
- ZIP contains only files relevant to this PR.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# PLAN_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION
2+
3+
## Purpose
4+
Adopt the shared project asset registry in Tile Map Editor using the Sprite Editor registry contracts already present in the latest uploaded Sprite Editor code. This PR is docs-only and defines the next small, surgical implementation step for Codex. No implementation code is included in this bundle.
5+
6+
## Why this PR now
7+
The uploaded Sprite Editor already shows additive project asset registry behavior:
8+
- registry load/save in Project I/O
9+
- sprite asset registration
10+
- palette asset registration
11+
- `assetRefs` persisted in sprite JSON
12+
- compatibility with engine-owned palette authority
13+
14+
That means the next safest repo step is not more Sprite Editor coding. The next step is to let Tile Map Editor consume and publish the same registry contracts so sprite, palette, and tileset assets can be resolved through one project-owned asset graph.
15+
16+
## Goals
17+
1. Make Tile Map Editor able to load and save `project.assets.json`.
18+
2. Register tilemap-owned assets additively without overwriting Sprite Editor entries.
19+
3. Resolve sprite and palette references from the shared registry by id, not by hard-coded editor-local paths.
20+
4. Preserve backward compatibility for older tilemap files that have no registry or `assetRefs`.
21+
5. Keep engine APIs unchanged and avoid runtime-breaking coupling.
22+
23+
## Non-Goals
24+
- No engine core API changes.
25+
- No Sprite Editor rework in this PR.
26+
- No Parallax Editor adoption in this PR.
27+
- No forced migration of legacy tilemap JSON files.
28+
- No full-project asset browser UI in this PR.
29+
30+
## Proposed Scope
31+
### In scope
32+
- Tile Map Editor project I/O integration for `project.assets.json`
33+
- Additive registry merge/update behavior
34+
- `assetRefs` support on tilemap project documents
35+
- Registry-based resolution for palette/tileset/sprite references where Tile Map Editor already has compatible hooks
36+
- Graceful fallback when registry entries are missing or stale
37+
- Minimal status messaging showing whether registry resolution succeeded or fell back
38+
39+
### Out of scope
40+
- Registry garbage collection
41+
- Cross-tool rename propagation
42+
- Asset preview galleries
43+
- Registry schema expansion beyond what Tile Map Editor needs for adoption
44+
45+
## Current reference state from uploaded Sprite Editor
46+
The uploaded Sprite Editor code indicates the following contracts are already live and should be treated as source constraints for this PR:
47+
- imports shared registry helpers from `../../shared/projectAssetRegistry.js`
48+
- uses additive upsert/merge flows instead of replacing the registry wholesale
49+
- persists `assetRefs.paletteId` and `assetRefs.spriteId`
50+
- keeps palette selection engine-owned and locked after selection
51+
- supports legacy JSON when registry refs are absent
52+
53+
Tile Map Editor adoption must match these behaviors rather than inventing a parallel contract.
54+
55+
## Target Contracts
56+
### 1. Shared registry ownership
57+
- Project registry remains project-owned, not editor-owned.
58+
- Tile Map Editor reads and writes the same `project.assets.json` used by Sprite Editor.
59+
- Tile Map Editor must preserve foreign asset groups and unknown fields when safely possible.
60+
61+
### 2. Additive write contract
62+
- Saving from Tile Map Editor updates only relevant tilemap/tile-related entries.
63+
- Existing `sprites`, `palettes`, and future groups are preserved.
64+
- Registry writes must be deterministic and id-stable.
65+
66+
### 3. Asset identity contract
67+
Use ids, not direct editor-local paths, for logical references:
68+
- `paletteId`
69+
- `spriteId` when tile placements or entity markers reference sprite assets
70+
- `tilesetId`
71+
- `tilemapId`
72+
73+
Paths may still exist as metadata, but runtime/editor linkage should prefer ids.
74+
75+
### 4. Legacy compatibility contract
76+
- Old tilemap files without `assetRefs` remain loadable.
77+
- Old tilemap files without registry access remain editable.
78+
- Missing registry entries produce soft warnings, not hard failure.
79+
- Editor may fall back to local embedded config/path behavior when registry lookup fails.
80+
81+
### 5. Small-slice adoption contract
82+
- Only adopt the minimum registry surface Tile Map Editor needs.
83+
- Do not redesign Tile Map Editor data model beyond the registry seam.
84+
- Avoid coupling Tile Map Editor to Sprite Editor implementation details.
85+
86+
## Expected data additions
87+
### Tile Map project document
88+
Add optional `assetRefs` block:
89+
```json
90+
{
91+
"assetRefs": {
92+
"paletteId": "palette:arcade-classic",
93+
"tilesetId": "tileset:forest-pack",
94+
"spriteIds": ["sprite:hero-idle", "sprite:coin-spin"]
95+
}
96+
}
97+
```
98+
99+
### Registry groups used by Tile Map Editor
100+
Expected additive groups:
101+
- `palettes`
102+
- `sprites`
103+
- `tilesets`
104+
- `tilemaps`
105+
106+
### Suggested tilemap registry entry
107+
```json
108+
{
109+
"id": "tilemap:overworld-01",
110+
"name": "overworld-01",
111+
"path": "assets/tilemaps/overworld-01.json",
112+
"tilesetId": "tileset:forest-pack",
113+
"paletteId": "palette:arcade-classic",
114+
"sourceTool": "tile-map-editor"
115+
}
116+
```
117+
118+
## Likely files for Codex to inspect
119+
- `tools/Tile Map Editor/index.html`
120+
- `tools/Tile Map Editor/main.js`
121+
- `tools/Tile Map Editor/modules/*`
122+
- `shared/projectAssetRegistry.js`
123+
- any repo docs already describing project JSON or asset packaging
124+
125+
## Implementation guidance for Codex
126+
### Do
127+
- Reuse shared registry helpers that Sprite Editor already uses.
128+
- Mirror Sprite Editor additive merge/upsert patterns where appropriate.
129+
- Keep UI additions minimal and status-oriented.
130+
- Preserve current Tile Map Editor flows first; add registry as an additive layer.
131+
132+
### Do not
133+
- Do not rewrite Tile Map Editor architecture.
134+
- Do not break editor startup when registry file is absent.
135+
- Do not introduce engine dependency changes.
136+
- Do not silently discard foreign registry groups.
137+
138+
## Manual validation checklist
139+
1. Load Tile Map Editor without a registry file; normal legacy editing still works.
140+
2. Load `project.assets.json`; existing sprite and palette entries remain visible/preserved after save.
141+
3. Save a tilemap; registry receives stable `tilemaps` entry and any needed `tilesets` linkage.
142+
4. Reload saved registry and tilemap; ids resolve correctly.
143+
5. Missing `tilesetId` or `paletteId` triggers soft warning only.
144+
6. Legacy tilemap JSON with no `assetRefs` loads and can be re-saved.
145+
7. Saving from Tile Map Editor does not delete Sprite Editor `sprites` or `palettes` entries.
146+
8. No engine core APIs are changed.
147+
9. Repo remains limited to this PR scope.
148+
149+
## Risk notes
150+
- Highest risk is destructive registry overwrite.
151+
- Second highest risk is accidental path-based coupling that bypasses ids.
152+
- Third risk is mixed legacy/registry save behavior producing unstable ids.
153+
154+
## BUILD command
155+
MODEL: GPT-5.4
156+
REASONING: high
157+
COMMAND:
158+
Create BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION.
159+
160+
Requirements:
161+
- Docs-first implementation of Tile Map Editor registry adoption only
162+
- Reuse shared registry helpers already used by Sprite Editor
163+
- Add support for loading/saving `project.assets.json`
164+
- Persist optional `assetRefs` for tilemap documents
165+
- Register/update `tilemaps` and relevant `tilesets` additively
166+
- Preserve existing registry groups and unknown safe fields
167+
- Backward compatibility required for legacy tilemap JSON
168+
- No engine core API changes
169+
- No Parallax Editor work in this PR
170+
171+
Validation:
172+
- All checklist items in `docs/dev/reports/validation_checklist.txt` must pass
173+
- Include syntax validation for changed JS files
174+
- Package delta zip only
175+
176+
Package:
177+
- Output zip to `HTML-JavaScript-Gaming/tmp/BUILD_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION_delta.zip`
178+
179+
## Commit comment
180+
`plan(tilemap-editor): adopt shared project asset registry contracts`
181+
182+
## Next command after BUILD
183+
`APPLY_PR_TILEMAP_EDITOR_ASSET_REGISTRY_ADOPTION`

0 commit comments

Comments
 (0)