# Dungeon Tile System Overhaul (Plan) Goal: Unify live dungeon editor, Builder, and TileMaps around a shared tile metadata model that supports decoration overlays and animation behavior. ## Tile Types - Floor: base walkable tile. - Wall: base blocking tile. - Decoration: overlay tile that does not modify underlying base tile properties. ## Tile Properties (Base) - `type`: floor | wall | decoration - `isStatic`: bool (static vs animated) - `blocksLos`: bool - `blocksProjectiles`: bool - `interactable`: bool ## Tile Properties (Animation) Only if `isStatic = false`: - `frames`: ordered list of frame indices (from the same sheet) - `frameRate`: float (fps) or `frameDurationMs` (pick one) - `trigger`: `tick` | `interaction` - `endBehavior`: `reset` | `loop` | `stop` - `reset`: return to frame 0 and stop - `loop`: continuously loop - `stop`: stop on last frame - `finalFrameOverrides` (optional): - Properties that change when animation ends, e.g. `blocksLos`, `blocksProjectiles`, `walkable`, `interactable` ## Apply Scope - `scope = tile_instance` (this placement only) - `scope = tile_type` (all tiles with this sprite definition) ## Data Model (Draft) Shared metadata should be stored once and used by: - Live editor (runtime overrides) - Builder (authoring time) - TileMaps (definition time) Proposed entities: - `TileDefinition` (global): sheetId + frameIndex + base properties + animation settings - `TileInstanceOverride` (per placement): overrides for base/animation props - `DecorationLayer` (per placement): optional overlay(s) with own definition and properties ## UI Flow (Live Editor) 1) Mode toggle: View | Edit 2) Tile Picker enabled only in Edit 3) Select Sheet ? Select Tile(s) 4) Show "Tile Properties" panel 5) Choose Apply Scope: This Tile Only / All Tiles of This Type 6) For Animated: - select frames - trigger (interaction/tick) - endBehavior (reset/loop/stop) - optional final frame overrides ## Builder + TileMaps - Should surface the same Tile Properties UI and write to the same tables/JSON - Decoration tiles must be placeable on top of base tiles without changing base ## DungeonSimulation Impact - Must resolve base tile + decoration layers into: - walkability - LOS blocking - projectile blocking - interactability - Animated tiles with end behavior + final overrides must update tile state at runtime - e.g. door animation ends ? walkable = true, blocksLos = false ## Open Questions - Should `frameRate` be global per definition or per instance? - Should decoration tiles participate in collisions (default: no)? - Do we allow multiple decorations per tile? If yes, define max layers.