Summary
Add doors to procedural world generation. Doors spawn opportunistically in single-width hallways with low odds, providing tactical options for players.
Behavior
Player interaction:
- Player walks through a door → it opens automatically
- Door closes behind the player after they pass through
- Opening/closing is seamless with movement (extra turn cost TBD)
Enemy interaction:
- Closed doors block enemy movement and pathing
- Enemies cannot open doors (at least initially — could be a higher-threat-level ability later)
- If an enemy moves into the door tile as it would close, the door stays open (contested close — TBD)
Spawn Rules
- Low spawn chance — doors should feel like a welcome find, not every hallway
- Single-width hallways only — detect tiles where the walkable path is exactly 1 tile wide (wall on both perpendicular sides)
- Should not spawn adjacent to exits, stairs, or other special tiles
- Per-level config for spawn rate (some floors might have more/fewer doors)
Open Design Questions
- Does opening a door cost an extra turn? (Tactical cost vs. flow)
- Can a door be blocked from closing by an enemy in the doorway?
- Can players manually close doors they've opened? (Could be useful tactically)
- Should doors have HP / be destructible by enemies?
- Visual/audio feedback — creak sound, animation?
- Do doors block line-of-sight for attacks?
Implementation Notes
- New tile type or world entity for doors (open/closed state)
- Hallway detection algorithm: for each floor tile, check if perpendicular axis has walls on both sides and parallel axis is open
- Integration with
Grid3D for pathfinding (closed door = impassable for enemies, passable for player)
- Door state needs to persist per-chunk
- Enemy AI pathfinding should treat closed doors as walls
References
scripts/procedural/chunk_manager.gd — chunk gen, hallway cutting
scripts/procedural/sub_chunk.gd — tile types, tile data
scripts/autoload/pathfinding_manager.gd — A* pathfinding (needs door awareness)
scripts/ai/behaviors/entity_behavior.gd — enemy movement/pathing
Summary
Add doors to procedural world generation. Doors spawn opportunistically in single-width hallways with low odds, providing tactical options for players.
Behavior
Player interaction:
Enemy interaction:
Spawn Rules
Open Design Questions
Implementation Notes
Grid3Dfor pathfinding (closed door = impassable for enemies, passable for player)References
scripts/procedural/chunk_manager.gd— chunk gen, hallway cuttingscripts/procedural/sub_chunk.gd— tile types, tile datascripts/autoload/pathfinding_manager.gd— A* pathfinding (needs door awareness)scripts/ai/behaviors/entity_behavior.gd— enemy movement/pathing