|
| 1 | +# King of the Iceberg Layout Contract |
| 2 | + |
| 3 | +## 1. Purpose |
| 4 | + |
| 5 | +Define the minimal, explicit data contract for a King of the Iceberg (KOTI) baseline layout using validated tool workflow artifacts. This contract is documentation-only and does not introduce gameplay or runtime behavior. |
| 6 | + |
| 7 | +## 2. Source Artifacts Used |
| 8 | + |
| 9 | +- `tmp/uat_exports/king_of_the_iceberg_layout_snapshot.json` |
| 10 | +- `tmp/uat_tool_layout_workflow_results.json` |
| 11 | +- `docs/dev/reports/PR_tool_layout_workflow_baseline_report.md` |
| 12 | + |
| 13 | +Observed baseline facts from these artifacts: |
| 14 | + |
| 15 | +- Exported baseline layout contains 4 fragmented ice platform objects. |
| 16 | +- Selection behavior includes explicit no-selection state. |
| 17 | +- Save/export workflow completed and produced the snapshot artifact. |
| 18 | + |
| 19 | +## 3. Minimal Layout Object Shape |
| 20 | + |
| 21 | +The minimal KOTI layout uses explicit map metadata and explicit object roles. |
| 22 | + |
| 23 | +```json |
| 24 | +{ |
| 25 | + "documentData": { |
| 26 | + "name": "koti_first_arena", |
| 27 | + "mode": "2d", |
| 28 | + "width": 1600, |
| 29 | + "height": 900, |
| 30 | + "objects": [ |
| 31 | + { |
| 32 | + "id": "obj-001", |
| 33 | + "name": "Top Control Platform", |
| 34 | + "kind": "polyline", |
| 35 | + "role": "top-control-platform", |
| 36 | + "points": [ |
| 37 | + { "x": 640, "y": 300, "z": 0 }, |
| 38 | + { "x": 840, "y": 300, "z": 0 } |
| 39 | + ] |
| 40 | + } |
| 41 | + ] |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +## 4. Platform Object Requirements |
| 47 | + |
| 48 | +- Platform objects are objects whose `role` is `platform` or `top-control-platform`. |
| 49 | +- MVP requires 3 to 5 platform objects total. |
| 50 | +- Each platform object must include: |
| 51 | + - `id` (non-empty string) |
| 52 | + - `name` (non-empty string) |
| 53 | + - `kind` (for baseline exports, `polyline` is valid) |
| 54 | + - `role` (explicit role value) |
| 55 | + - `points` (at least 2 points with numeric `x` and `y`) |
| 56 | +- Platform objects must be explicitly authored in layout data. Hidden/generated fallback platforms are not allowed. |
| 57 | + |
| 58 | +## 5. Required Roles |
| 59 | + |
| 60 | +The layout contract requires explicit use of these roles: |
| 61 | + |
| 62 | +- `platform` |
| 63 | +- `top-control-platform` |
| 64 | +- `water-zone` |
| 65 | +- `visual-background` |
| 66 | +- `visual-midground` |
| 67 | + |
| 68 | +Role notes: |
| 69 | + |
| 70 | +- At least one object must have role `top-control-platform`. |
| 71 | +- Exactly one object must represent the `water-zone` for MVP validation. |
| 72 | +- `visual-background` and `visual-midground` may be represented as geometry or non-interactive scene objects, but roles must still be explicit. |
| 73 | + |
| 74 | +## 6. Optional Fields |
| 75 | + |
| 76 | +Optional fields are permitted when present in authored data: |
| 77 | + |
| 78 | +- Layout-level: `version`, `background` |
| 79 | +- Object-level: `style`, `flags`, `center`, `rotation`, `space`, `closed` |
| 80 | +- Point-level: `z`, `color` |
| 81 | + |
| 82 | +Optional fields do not replace required fields and cannot be used to infer missing required roles. |
| 83 | + |
| 84 | +## 7. Validation Rules |
| 85 | + |
| 86 | +A KOTI layout is valid only when all rules pass: |
| 87 | + |
| 88 | +1. Layout/map id is required: |
| 89 | + - `documentData.name` must exist and be non-empty. |
| 90 | +2. At least one `top-control-platform` is required. |
| 91 | +3. One `water-zone` is required. |
| 92 | +4. MVP layout has 3 to 5 platform objects (`platform` + `top-control-platform`). |
| 93 | +5. Roles must be explicit (`role` is required on each contract-relevant object). |
| 94 | +6. Hidden fallback objects are not allowed. |
| 95 | +7. Missing required fields produce actionable errors. |
| 96 | + |
| 97 | +Actionable error examples: |
| 98 | + |
| 99 | +- `Missing required layout id: documentData.name` |
| 100 | +- `Missing required role: top-control-platform` |
| 101 | +- `Missing required role: water-zone` |
| 102 | +- `Invalid platform count: expected 3-5, found <n>` |
| 103 | +- `Object <id> is missing explicit role` |
| 104 | + |
| 105 | +## 8. Example Minimal Layout JSON |
| 106 | + |
| 107 | +```json |
| 108 | +{ |
| 109 | + "documentData": { |
| 110 | + "name": "koti_first_arena", |
| 111 | + "mode": "2d", |
| 112 | + "width": 1600, |
| 113 | + "height": 900, |
| 114 | + "objects": [ |
| 115 | + { |
| 116 | + "id": "obj-top-01", |
| 117 | + "name": "Top Control Platform", |
| 118 | + "kind": "polyline", |
| 119 | + "role": "top-control-platform", |
| 120 | + "points": [ |
| 121 | + { "x": 700, "y": 290, "z": 0 }, |
| 122 | + { "x": 900, "y": 290, "z": 0 } |
| 123 | + ] |
| 124 | + }, |
| 125 | + { |
| 126 | + "id": "obj-plat-01", |
| 127 | + "name": "Platform 01", |
| 128 | + "kind": "polyline", |
| 129 | + "role": "platform", |
| 130 | + "points": [ |
| 131 | + { "x": 420, "y": 520, "z": 0 }, |
| 132 | + { "x": 620, "y": 520, "z": 0 } |
| 133 | + ] |
| 134 | + }, |
| 135 | + { |
| 136 | + "id": "obj-plat-02", |
| 137 | + "name": "Platform 02", |
| 138 | + "kind": "polyline", |
| 139 | + "role": "platform", |
| 140 | + "points": [ |
| 141 | + { "x": 760, "y": 570, "z": 0 }, |
| 142 | + { "x": 980, "y": 570, "z": 0 } |
| 143 | + ] |
| 144 | + }, |
| 145 | + { |
| 146 | + "id": "obj-water-01", |
| 147 | + "name": "Water Zone", |
| 148 | + "kind": "rectangle", |
| 149 | + "role": "water-zone", |
| 150 | + "points": [ |
| 151 | + { "x": 0, "y": 760, "z": 0 }, |
| 152 | + { "x": 1600, "y": 900, "z": 0 } |
| 153 | + ] |
| 154 | + }, |
| 155 | + { |
| 156 | + "id": "obj-bg-01", |
| 157 | + "name": "Background Visual", |
| 158 | + "kind": "rectangle", |
| 159 | + "role": "visual-background", |
| 160 | + "points": [ |
| 161 | + { "x": 0, "y": 0, "z": 0 }, |
| 162 | + { "x": 1600, "y": 900, "z": 0 } |
| 163 | + ] |
| 164 | + }, |
| 165 | + { |
| 166 | + "id": "obj-mg-01", |
| 167 | + "name": "Midground Visual", |
| 168 | + "kind": "polyline", |
| 169 | + "role": "visual-midground", |
| 170 | + "points": [ |
| 171 | + { "x": 120, "y": 680, "z": 0 }, |
| 172 | + { "x": 1480, "y": 680, "z": 0 } |
| 173 | + ] |
| 174 | + } |
| 175 | + ] |
| 176 | + } |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +## 9. Out-of-Scope Items |
| 181 | + |
| 182 | +- Gameplay logic |
| 183 | +- Runtime engine loader implementation details |
| 184 | +- Collision physics tuning |
| 185 | +- Platform pass-through/solid behavior implementation |
| 186 | +- Tileset breakout and art slicing |
| 187 | +- Sample game/runtime code changes |
0 commit comments