mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-21 11:18:08 +00:00
Created detailed implementation plan for redesigning the room layout system to support variable room sizes and four-direction connections. Core Concepts: - Grid unit system (5×4 tiles base, excluding 2-tile visual top) - Valid room heights: 6, 10, 14, 18, 22, 26... (formula: 2 + 4N) - Breadth-first room positioning from starting room - Deterministic door placement with alignment for asymmetric connections - Comprehensive scenario validation Documents Created: - OVERVIEW.md: High-level goals and changes - TERMINOLOGY.md: Definitions and concepts - GRID_SYSTEM.md: Grid unit system specification - POSITIONING_ALGORITHM.md: Room positioning logic - DOOR_PLACEMENT.md: Door placement rules and algorithms - WALL_SYSTEM.md: Wall collision system updates - VALIDATION.md: Scenario validation system - IMPLEMENTATION_STEPS.md: Step-by-step implementation guide - TODO_LIST.md: Detailed task checklist - README.md: Quick start and overview Review & Critical Fixes: - review1/CRITICAL_REVIEW.md: Identified 4 critical issues - review1/RECOMMENDATIONS.md: Solutions for all issues - UPDATED_FILES_SUMMARY.md: Integration of review feedback Critical Issues Identified & Resolved: 1. Grid height calculation (now: 6, 10, 14, 18...) 2. Door alignment for asymmetric connections (solution documented) 3. Code duplication (shared module approach specified) 4. Disconnected rooms (validation added) Implementation Strategy: - Incremental approach with feature flag - Phase 1: Constants and helpers - Phase 2a: North/South positioning - Phase 2b: East/West support - Phase 3: Door placement with critical fixes - Phase 4: Validation - Phase 5-6: Testing and documentation Estimated time: 18-26 hours Confidence: 9/10 (all critical issues addressed) Ready for implementation.
3.0 KiB
3.0 KiB
Room Layout System Redesign - Overview
Current System Limitations
The existing room positioning system has several constraints:
- Fixed Room Size: All rooms are 320x320px (10x10 tiles)
- Limited Connections: Only supports north/south connections with up to 2 rooms
- Gap Issues: When branching north to multiple rooms, awkward gaps appear between rooms
- Corner-Only Doors: North doors must be in corners, creating alignment issues
- No East/West Support: Cannot connect rooms horizontally
Goals of the Redesign
- Flexible Room Sizes: Support rooms in multiples of grid units (5x4 tiles base)
- Better Alignment: Stack rooms against each other with no gaps
- 4-Direction Support: Enable north, south, east, and west connections
- Smarter Door Placement:
- North/South doors still in corners for visual consistency
- East/West doors positioned based on connection count
- Deterministic door positioning using grid coordinates
- Overlap Detection: Validate scenarios to prevent positioning conflicts
- Hallway Support: Allow explicit hallway connectors in scenarios
Key Concepts
Grid Units
- Base grid unit: 5 tiles wide × 4 tiles tall (160px × 128px at 32px/tile)
- Stacking size: Excludes top 2 rows which overlap visually with rooms to the north
- All rooms must be sized in multiples of grid units (both X and Y)
Valid Room Sizes
- Closet: 5×4 tiles (1×1 grid units) - smallest room
- Standard Room: 10×8 tiles (2×2 grid units) - offices, reception, etc.
- Hallways: 10×4 or 20×4 tiles (2×1 or 4×1 grid units)
- Large Rooms: Any multiple of grid units (e.g., 10×16, 20×8, etc.)
Room Structure
WWWWWWWWWW <- Top 2 rows: Visual wall (overlaps room to north)
WWWWWWWWWW
WFFFFFFFFW <- Stacking area begins (floor + side walls)
WFFFFFFFFW
WFFFFFFFFW
WFFFFFFFFW
WFFFFFFFFW <- Bottom row: Can overlap room to south
WFFFFFFFFW (treated as floor when overlapping)
What Stays the Same
- 32px Tiles: Core tile size unchanged
- Top-Down Orthogonal View: Zelda-like perspective maintained
- Visual Overlapping: North rooms still overlap south rooms visually
- Collision System: Wall collision boxes at boundaries (except doors)
- Sprite-Based Doors: Continue using door sprites with physics
- Lazy Loading: Rooms still load on-demand
What Changes
- Room Positioning Algorithm: Complete rewrite to support grid units
- Door Placement Logic: Enhanced for 4 directions and multiple sizes
- Connection Format: Unchanged but interpreted differently
- Validation System: New overlap detection on scenario load
- Wall Management: Adapt to variable room sizes
Success Criteria
- Rooms of different sizes align without gaps
- Doors always align perfectly when two rooms connect
- East/West connections work correctly
- Scenarios with overlapping rooms are detected and logged
- Existing scenarios (using 10×8 rooms) continue to work
- Door placement is deterministic and visually pleasing