|
| 1 | +Toolbox Aid |
| 2 | +David Quesenberry |
| 3 | +04/05/2026 |
| 4 | +BUILD_PR_RENDER_PIPELINE_CONTRACT_ALL_4_TOOLS.md |
| 5 | + |
| 6 | +# BUILD_PR_RENDER_PIPELINE_CONTRACT_ALL_4_TOOLS |
| 7 | + |
| 8 | +## Purpose |
| 9 | +Define a unified 2D render pipeline contract for Tile Map Editor, Parallax Editor, Sprite Editor, and Vector Asset Studio using a docs-first, non-destructive seam that does not redesign engine architecture. |
| 10 | + |
| 11 | +## Scope |
| 12 | +In scope: |
| 13 | +- Unified top-level render contract shape |
| 14 | +- Shared metadata and asset record rules |
| 15 | +- Normalized layer model + deterministic render ordering |
| 16 | +- Tool-specific mapping notes for all 4 tools |
| 17 | +- Runtime ownership boundaries |
| 18 | +- Validation and acceptance checklist |
| 19 | +- Incremental migration guidance that preserves unrelated engine APIs |
| 20 | + |
| 21 | +Out of scope: |
| 22 | +- Implementation code |
| 23 | +- Engine renderer rewrite |
| 24 | +- 3D scope |
| 25 | +- Unrelated tool/game/sample edits |
| 26 | + |
| 27 | +## 1. Unified Top-Level Render Contract |
| 28 | +Canonical engine-facing document (2D only): |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "documentType": "toolbox.render-pipeline.contract", |
| 33 | + "contractVersion": "1.0.0", |
| 34 | + "producer": { |
| 35 | + "tool": "tile-map-editor|parallax-editor|sprite-editor|vector-asset-studio", |
| 36 | + "toolVersion": "string" |
| 37 | + }, |
| 38 | + "scene": { |
| 39 | + "id": "string", |
| 40 | + "name": "string", |
| 41 | + "coordinateSpace": "2d" |
| 42 | + }, |
| 43 | + "assets": [], |
| 44 | + "layers": [], |
| 45 | + "entities": [], |
| 46 | + "metadata": {} |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +Required: |
| 51 | +- `documentType`, `contractVersion`, `producer.tool`, `scene.id`, `scene.name`, `scene.coordinateSpace` |
| 52 | +- `assets`, `layers`, `entities`, `metadata` always present (can be empty) |
| 53 | +- `scene.coordinateSpace` must be `2d` |
| 54 | + |
| 55 | +## 2. Shared Metadata Rules |
| 56 | +Top-level metadata standards: |
| 57 | +- `projectId` (optional but recommended) |
| 58 | +- `createdAt` ISO timestamp (optional) |
| 59 | +- `updatedAt` ISO timestamp (optional) |
| 60 | +- `tags` array of strings (optional) |
| 61 | +- `runtimeFlags` object (optional) |
| 62 | + |
| 63 | +Common object metadata standards: |
| 64 | +- `id` required, stable within document |
| 65 | +- `name` required, human-readable |
| 66 | +- `type` required where enumerated |
| 67 | +- `visible` required for renderable items |
| 68 | +- `locked` editor-side only (optional for runtime) |
| 69 | + |
| 70 | +ID rules: |
| 71 | +- Deterministic where practical |
| 72 | +- No duplicates per collection |
| 73 | +- No implicit ID rewriting at runtime |
| 74 | + |
| 75 | +## 3. Shared Asset Record Rules |
| 76 | +Asset entries under `assets` must use normalized project-relative paths. |
| 77 | + |
| 78 | +Minimal record: |
| 79 | + |
| 80 | +```json |
| 81 | +{ |
| 82 | + "id": "asset.id", |
| 83 | + "type": "image|spritesheet|vector|tileset", |
| 84 | + "path": "assets/path/file.ext", |
| 85 | + "source": "relative", |
| 86 | + "preload": true, |
| 87 | + "metadata": {} |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +Rules: |
| 92 | +- No absolute machine paths |
| 93 | +- No temp/session-only paths |
| 94 | +- Prefer additive updates over replacement |
| 95 | +- Avoid duplicates by `id`, then by normalized `type + path` where practical |
| 96 | +- Unknown extra fields must be preserved where low-risk |
| 97 | + |
| 98 | +## 4. Normalized Layer Model + Deterministic Ordering |
| 99 | +Layer contract fields: |
| 100 | +- `id`, `name`, `kind`, `visible`, `opacity`, `zIndex`, `items` |
| 101 | +- optional: `parallaxFactorX`, `parallaxFactorY`, `blendMode` |
| 102 | + |
| 103 | +Allowed `kind` values for this contract: |
| 104 | +- `tilemap` |
| 105 | +- `parallax` |
| 106 | +- `sprite` |
| 107 | +- `vector` |
| 108 | +- `collision` |
| 109 | +- `guide` |
| 110 | +- `overlay` |
| 111 | + |
| 112 | +Render order rules: |
| 113 | +1. Sort by `zIndex` ascending |
| 114 | +2. Tie-break by source order (stable) |
| 115 | +3. Within layer, render items by explicit item order if present, else source order |
| 116 | +4. `guide` and tool-only diagnostic layers excluded from gameplay render unless explicitly flagged |
| 117 | + |
| 118 | +## 5. Tool-Specific Mapping Notes |
| 119 | +Tile Map Editor: |
| 120 | +- Produces `tilemap` layers |
| 121 | +- Declares tileset/image assets |
| 122 | +- Maps tile grids, map dimensions, tile size |
| 123 | +- `collision`/`data` tool layers mapped as non-art or debug/runtime utility layers by policy |
| 124 | + |
| 125 | +Parallax Editor: |
| 126 | +- Produces `parallax` layers |
| 127 | +- Declares image/vector assets for background planes |
| 128 | +- Maps `parallaxFactorX/Y`, repeat flags, wrap behavior |
| 129 | +- Preserves deterministic draw stack through `zIndex` |
| 130 | + |
| 131 | +Sprite Editor: |
| 132 | +- Produces `sprite` layers or sprite-entity records |
| 133 | +- Declares sprite/spritesheet assets |
| 134 | +- Maps frame/animation metadata and origin hints |
| 135 | +- Supports shared palette references through metadata links (non-authoritative at runtime) |
| 136 | + |
| 137 | +Vector Asset Studio: |
| 138 | +- Produces `vector` layers or vector item collections |
| 139 | +- Declares vector/template assets |
| 140 | +- Maps primitives/style/transform payloads to normalized render items |
| 141 | + |
| 142 | +## 6. Runtime Ownership Boundaries |
| 143 | +Engine/runtime owns: |
| 144 | +- Contract validation |
| 145 | +- Relative asset resolution |
| 146 | +- Normalized runtime model projection |
| 147 | +- Deterministic render sequencing |
| 148 | +- Clear validation errors |
| 149 | + |
| 150 | +Tools own: |
| 151 | +- Valid contract output |
| 152 | +- Stable IDs |
| 153 | +- Correct layer/asset typing |
| 154 | +- Cross-reference integrity |
| 155 | + |
| 156 | +Boundary guardrails: |
| 157 | +- Runtime must not silently repair missing required fields |
| 158 | +- Runtime must not infer absolute/local paths |
| 159 | +- Contract seam should avoid unrelated engine API redesign |
| 160 | + |
| 161 | +## 7. Validation Rules + Acceptance Checklist |
| 162 | +Validation rules: |
| 163 | +- Required key presence |
| 164 | +- Supported `contractVersion` |
| 165 | +- Allowed `producer.tool` |
| 166 | +- Unique IDs by collection |
| 167 | +- Allowed layer kinds only |
| 168 | +- Valid asset references from layers/entities |
| 169 | +- Numeric/order field sanity (`zIndex`, opacity range) |
| 170 | +- 2D coordinate-space enforcement |
| 171 | + |
| 172 | +Acceptance checklist for this BUILD docs PR: |
| 173 | +- Contract covers all 4 tools |
| 174 | +- Metadata rules are explicit |
| 175 | +- Asset record rules are explicit |
| 176 | +- Layer model + deterministic ordering are explicit |
| 177 | +- Runtime ownership boundary is explicit |
| 178 | +- Migration guidance is incremental and non-breaking |
| 179 | +- Docs-only scope preserved |
| 180 | + |
| 181 | +## 8. Incremental Migration Guidance (Non-Breaking) |
| 182 | +Phase 1: Contract publication |
| 183 | +- Publish contract docs and validation checklist |
| 184 | +- No runtime or tool behavior changes required in this PR |
| 185 | + |
| 186 | +Phase 2: Tool-side adapters (future BUILD/APPLY PRs) |
| 187 | +- Add tool exporters that emit normalized contract fields |
| 188 | +- Preserve legacy payload loading in parallel |
| 189 | + |
| 190 | +Phase 3: Runtime seam adoption (future BUILD/APPLY PRs) |
| 191 | +- Introduce a contract validation/normalization seam |
| 192 | +- Keep existing public engine APIs stable |
| 193 | +- Deprecate legacy ad hoc mappings only after coverage and parity checks |
| 194 | + |
| 195 | +## Guardrails Confirmed |
| 196 | +- No implementation code added |
| 197 | +- No engine architecture redesign beyond contract seam |
| 198 | +- No 3D scope introduced |
| 199 | +- No unrelated sample/game/tool modifications |
| 200 | +- Contract remains 2D-focused and low-risk extensible |
0 commit comments