diff --git a/README_scenario_design.md b/README_scenario_design.md index 5e9991b..dcad7a7 100644 --- a/README_scenario_design.md +++ b/README_scenario_design.md @@ -11,51 +11,24 @@ There are several constraints and patterns for designing scenarios for BreakEsca - All scenarios must have a `rooms` object containing individual room definitions ### Room Connections -- Rooms can connect in two directions: `north`, `south` -- When a room connects to multiple rooms in the same direction, an array is used: - ```json - "connections": { - "north": ["office2", "office3"], - "south": "reception" - } - ``` -- The room layout algorithm positions rooms based on these connections, with specific alignment logic for multiple rooms +Rooms can connect in **four directions**: `north`, `south`, `east`, `west` +**Connection Syntax**: +```json +"connections": { + "north": "office1", // Single connection + "south": ["reception", "hall"], // Multiple connections (array) + "east": "serverroom", + "west": ["closet1", "closet2"] +} +``` - -#### Room Connection Constraints - -##### North vs South Connection Asymmetry - -The code reveals an important asymmetry in how rooms can be connected: - -- **North Connections**: A room can connect to up to two rooms in the north direction - ```json - "connections": { - "north": ["office2", "office3"], - "south": "reception" - } - ``` - -- **South Connections**: A room can only connect to a single room in the south direction - ```json - "connections": { - "south": "office1" - } - ``` - -This is confirmed in the `calculateRoomPositions()` function (lines 2036-2077), which has special handling for arrays of rooms in the north/south directions, but the code only positions multiple rooms when they are north of the current room. When rooms are south, the code expects a single room, not an array. - -##### Room Positioning Logic - -The code in `calculateRoomPositions()` reveals how rooms are positioned: - -1. The `startRoom` is positioned at coordinates (0,0) (line 2012) -2. When a room connects to two rooms in the north direction: - - The first room is positioned with its right edge aligned with the current room's left edge (lines 2048-2051) - - The second room is positioned with its left edge aligned with the current room's right edge (lines 2054-2057) -3. For single room connections, the connected room is centered relative to the current room (lines 2087-2093) +**Key Points**: +- All directions support both single connections (string) and multiple connections (array) +- The room layout algorithm positions rooms using breadth-first traversal +- Multiple rooms in the same direction are positioned side-by-side (N/S) or stacked (E/W) +- All rooms align to grid boundaries for consistent door placement #### Door Validation and Locking @@ -65,61 +38,79 @@ The code in `validateDoorsByRoomOverlap()` (lines 3236-3323) shows that: 2. If a door connects to a locked room, the door inherits the lock properties (lines 3296-3303) 3. Doors that don't connect exactly two rooms are removed (lines 3281-3291) -#### Designing Solvable Scenarios +#### Designing Solvable Scenarios with the Grid System -Based on the updated understanding of the north/south connection asymmetry, here are guidelines for creating solvable scenarios: +The grid-based room layout system provides significant flexibility for scenario design: -1. **Tree-like Structure**: Design your scenario with a tree-like structure where: - - The starting room is at the "bottom" (south) - - The scenario branches out as you move north - - Each room can have at most one room to its south +1. **Flexible Layout Patterns**: Design scenarios using any combination of directions: + - **Vertical**: Stack rooms north/south for traditional layouts + - **Horizontal**: Connect rooms east/west for wide facilities + - **Mixed**: Combine directions for complex, non-linear layouts + - **Branching**: All directions support multiple connections -2. **Room Layout Planning**: When planning your scenario: - - Start with the reception/starting room - - Branch out with up to two rooms to the north - - Continue branching northward, but ensure each room connects to only one room to its south +2. **Room Size Variety**: Mix different room sizes for visual interest and gameplay: + - Use **1×1 GU closets** for small storage rooms or utility spaces + - Use **2×2 GU standard rooms** for offices, reception areas + - Use **1×2 GU or 4×1 GU halls** to connect distant areas + - Ensure all room dimensions follow the valid size formula -3. **Lock Progression**: Design a logical progression of locks: - - Place keys, codes, and other unlock items in accessible rooms - - Ensure the player can access all required items before encountering locked doors - - Consider the player's path through the branching structure +3. **Lock Progression**: Design logical progression through the facility: + - Place keys, codes, and unlock items in accessible rooms first + - Create puzzles that require backtracking or exploring side rooms + - Use east/west connections for optional areas with bonus items + - Layer security with multiple lock types (key → PIN → biometric) -4. **Avoid South Branching**: The code doesn't support multiple south connections, so: - - Don't create scenarios where a room needs to connect to multiple rooms to its south - - If you need complex layouts, use east/west connections to create alternative paths +4. **Connection Planning**: + - Start by sketching your layout on grid paper (5-tile width increments) + - Ensure all rooms are reachable from the starting room + - Verify room dimensions before creating Tiled maps + - Test door alignment between connected rooms -5. **Room Overlap Awareness**: Be aware that rooms are positioned based on their connections: - - Two rooms connected to the north will be positioned side by side - - This may create visual overlaps if rooms have unusual dimensions - - Test your scenario to ensure doors properly connect rooms +5. **Avoid Common Pitfalls**: + - **Invalid heights**: Heights of 7, 8, 9, 11, 12, 13 will cause issues + - **Room overlaps**: System validates and warns, but plan carefully + - **Disconnected rooms**: Ensure all rooms connect to the starting room + - **Asymmetric connections**: When connecting single-door to multi-door rooms, the system handles alignment automatically -6. **End Goal Placement**: Place your scenario's end goal (important items, final objective) in: - - Rooms that are furthest north in the layout - - Rooms that require the most complex unlocking sequence - -#### Example Layout Structure +#### Example Layout Structures +**Vertical Tower** (traditional): ``` - [Room D] [Room E] - ↑ ↑ - | | - [Room B] [Room C] - ↑ ↑ - | | - +--[Room A]--+ - ↑ - | - [Reception] + [Server Room] + ↑ + [CEO Office] + ↑ + [Office1] [Office2] + ↑ ↑ + [Reception] ``` -This layout follows the constraints: -- Reception connects north to Room A -- Room A connects north to both Room B and Room C -- Room B connects north to Room D -- Room C connects north to Room E -- Each room connects south to exactly one room +**Horizontal Facility** (wide): +``` +[Closet1] ← [Office] → [Meeting] → [Server] + ↑ + [Reception] +``` -By understanding these constraints, you can design scenarios that work correctly with the game engine while providing engaging, solvable experiences for players. +**Complex Multi-Direction**: +``` + [Storage] [CEO] + ↑ ↑ + [Closet] ← [Office] → [Server] + ↑ + [Reception] +``` + +**With Hallways**: +``` + [Office1] [Office2] + ↑ ↑ + [---- Hall ----] + ↑ + [Reception] +``` + +These layouts demonstrate the flexibility of the new grid system for creating engaging, solvable scenarios. ### Room Properties @@ -166,24 +157,73 @@ By understanding these constraints, you can design scenarios that work correctly - `lockpick`: For picking locks - Objects can have `hasFingerprint` with properties like `fingerprintOwner` and `fingerprintDifficulty` -## Door and Room Positioning Logic +## Room Layout System (Grid-Based) -The code in index.html reveals how rooms are positioned: +The game uses a **grid unit system** for room positioning that supports variable room sizes and four-direction connections. -1. The `startRoom` is positioned at coordinates (0,0) -2. Other rooms are positioned relative to their connections -3. When a room connects to two rooms in the north/south direction: - - The first room is positioned with its right edge aligned with the current room's left edge - - The second room is positioned with its left edge aligned with the current room's right edge -4. Doors are validated based on room overlaps - a door must connect exactly two rooms -5. Doors inherit lock properties from the rooms they connect +### Grid Unit System + +- **Base Grid Unit (GU)**: 5 tiles wide × 4 tiles tall (160px × 128px) +- **Tile Size**: 32px × 32px +- **Room Structure**: + - Top 2 rows: Visual wall (overlaps room to north) + - Middle rows: Stackable area (used for positioning calculations) + - All rooms must be multiples of grid units + +### Valid Room Sizes + +**Width**: Must be multiple of 5 tiles (5, 10, 15, 20, 25...) + +**Height**: Must follow formula `2 + (N × 4)` where N ≥ 1 +- **Valid heights**: 6, 10, 14, 18, 22, 26... (increments of 4 after initial 2) +- **Invalid heights**: 7, 8, 9, 11, 12, 13... + +**Examples**: +- **1×1 GU** (Closet): 5×6 tiles = 160×192px +- **2×2 GU** (Standard): 10×10 tiles = 320×320px +- **1×2 GU** (Hall): 5×10 tiles = 160×320px +- **4×1 GU** (Wide Hall): 20×6 tiles = 640×192px + +### Room Positioning Algorithm + +1. The `startRoom` is positioned at grid coordinates (0,0) +2. Rooms are positioned outward from the starting room using breadth-first traversal +3. Rooms align to grid boundaries using `Math.floor()` for consistent rounding +4. **North/South**: Rooms stack vertically, centered or side-by-side when multiple +5. **East/West**: Rooms align horizontally, stacked vertically when multiple +6. All positions are validated to detect overlaps + +### Door Placement Rules + +**North/South Doors**: +- **Size**: 1 tile wide × 2 tiles tall +- **Single door**: Placed in corner (NW or NE), determined by grid coordinates using `(gridX + gridY) % 2` +- **Multiple doors**: Evenly spaced across room width with 1.5 tile inset from edges + +**East/West Doors**: +- **Size**: 1 tile wide × 1 tile tall +- **Single door**: North corner of edge, 2 tiles from top +- **Multiple doors**: First at north corner, last 3 tiles up from south, others evenly spaced + +**Alignment**: Doors must align perfectly between connecting rooms. Special logic handles asymmetric connections (single door to multi-door room). + +### Four-Direction Connections + +Unlike the old system (north/south only), the new system supports: +- **North**: Connects to rooms above +- **South**: Connects to rooms below +- **East**: Connects to rooms on the right +- **West**: Connects to rooms on the left + +Each direction supports multiple connections (arrays). ## Designing Solvable Scenarios -Based on the code analysis, here are guidelines for creating solvable scenarios: +Based on the grid-based room layout system, here are comprehensive guidelines for creating solvable scenarios: 1. **Clear Progression Path**: Design a logical sequence of rooms that can be unlocked in order - Ensure keys/codes for locked rooms are obtainable before they're needed + - Use the four-direction connection system to create interesting navigation puzzles 2. **Tool Placement**: Place necessary tools early in the scenario - Critical tools like fingerprint kits, lockpicks, or bluetooth scanners should be available before they're needed @@ -204,12 +244,20 @@ Based on the code analysis, here are guidelines for creating solvable scenarios: - Mark important items with `important: true` - Use `isEndGoal: true` for the final objective item -7. **Room Layout**: Design a logical physical layout - - Remember that north/south connections can have at most two rooms - - Ensure all rooms are reachable through the connection graph +7. **Room Layout with Grid System**: Design layouts using the grid unit system + - Use valid room sizes (widths: multiples of 5 tiles; heights: 2 + 4N where N ≥ 1) + - Mix room sizes for variety (1×1 GU closets, 2×2 GU standard rooms, hallways) + - Leverage all four directions (north, south, east, west) for complex layouts + - Ensure all rooms are reachable from the starting room 8. **Fingerprint Mechanics**: When using biometric locks: - Ensure the required fingerprints can be collected from objects in accessible rooms - Set appropriate difficulty thresholds (higher = more difficult) +9. **Testing Your Scenario**: + - Verify all room dimensions follow the valid size formula + - Check that all rooms connect properly (no isolated rooms) + - Ensure door alignment by testing connections between different-sized rooms + - Play through to verify the scenario is solvable + By following these constraints and guidelines, you can create scenarios that are both technically valid for the game engine and provide an engaging, solvable experience for players. diff --git a/scenarios/TEST_SCENARIOS_README.md b/scenarios/TEST_SCENARIOS_README.md new file mode 100644 index 0000000..deff4ec --- /dev/null +++ b/scenarios/TEST_SCENARIOS_README.md @@ -0,0 +1,242 @@ +# Test Scenarios for Grid-Based Room Layout System + +This directory contains test scenarios designed to validate and demonstrate the new grid-based room layout system. + +## Grid Unit System Overview + +- **Base Grid Unit (GU)**: 5 tiles wide × 4 tiles tall (160px × 128px) +- **Tile Size**: 32px × 32px +- **Valid Room Widths**: Multiples of 5 tiles (5, 10, 15, 20, 25...) +- **Valid Room Heights**: Formula `2 + (N × 4)` where N ≥ 1 + - Valid: 6, 10, 14, 18, 22, 26... + - Invalid: 7, 8, 9, 11, 12, 13... + +## Room Size Examples + +| Type | Size (GU) | Tiles (W×H) | Pixels (W×H) | File | +|------|-----------|-------------|--------------|------| +| Closet | 1×1 | 5×6 | 160×192 | small_room_1x1gu.json* | +| Hall (Vertical) | 1×2 | 5×10 | 160×320 | hall_1x2gu.json* | +| Standard | 2×2 | 10×10 | 320×320 | room_office2.json, room_ceo2.json, etc. | +| Wide Hall | 4×1 | 20×6 | 640×192 | (to be created) | + +*Note: These room files are referenced in test scenarios but need to be created in assets/rooms/ + +## Test Scenarios + +### 1. test_vertical_layout.json +**Purpose**: Test traditional vertical stacking with north/south connections + +**Layout**: +``` + [CEO Office] + ↑ + [Office1][Office2] + ↑ ↑ + [Reception] +``` + +**Tests**: +- Single north connection (Reception → Offices) +- Multiple north connections (Offices → CEO) +- Door alignment between 2x2 GU rooms +- Grid-based positioning +- Deterministic door placement (alternating corners) + +**Rooms Used**: All 2×2 GU (room_reception2, room_office2, room_ceo2) + +--- + +### 2. test_horizontal_layout.json +**Purpose**: Test east/west connections and four-direction navigation + +**Layout**: +``` +[Storage] ← [Office] → [Servers] + ↑ + [Reception] +``` + +**Tests**: +- East/West connections +- Single door placement on east/west edges +- Four-direction connection support +- Side door alignment +- Mixed direction connections in one room + +**Rooms Used**: All 2×2 GU + +--- + +### 3. test_complex_multidirection.json +**Purpose**: Test complex layouts using all four directions + +**Layout**: +``` + [Storage] [CEO] + ↑ ↑ + [Office1] ← [Office2] → [Servers] + ↑ + [Reception] +``` + +**Tests**: +- All four directions in use +- Central hub room with 4 connections +- Complex navigation requiring backtracking +- Door alignment in all directions +- Grid-based positioning for complex layouts + +**Rooms Used**: All 2×2 GU + +--- + +### 4. test_multiple_connections.json +**Purpose**: Test multiple room connections in the same direction + +**Layout**: +``` + [Server1][Server2][Server3] + ↑ ↑ ↑ + [---- Hub ----] + ↑ + [Reception] +``` + +**Tests**: +- Multiple connections in one direction (Hub has 3 north connections) +- Door spacing across room width +- Alignment of multiple doors +- Array-based connection syntax +- Asymmetric connection handling (hub: 3 north doors, each server: 1 south door) + +**Rooms Used**: All 2×2 GU + +--- + +### 5. test_mixed_room_sizes.json +**Purpose**: Test different room sizes and door alignment between them + +**Layout** (when smaller rooms are available): +``` + [Closet-1×1] [CEO-2×2] + ↑ ↑ + [Hall-1×2 GU] + ↑ + [Reception-2×2] +``` + +**Tests**: +- Different room sizes in same scenario +- Door alignment between different-sized rooms +- Centering of smaller rooms on larger rooms +- Grid-based positioning with varied dimensions + +**Rooms Used**: +- Currently: All 2×2 GU placeholders +- Future: small_room_1x1gu.json, hall_1x2gu.json, room_reception2.json, room_ceo2.json + +**Note**: This scenario includes documentation about the proper room sizes and will demonstrate true size variety once the 1×1 GU and 1×2 GU room files are created. + +--- + +## How to Test + +1. **Load a test scenario** in the game +2. **Check the console** for positioning and validation logs: + - Room positions (grid coordinates) + - Door placement calculations + - Overlap detection results +3. **Verify visually**: + - Rooms align properly on grid boundaries + - Doors connect rooms correctly + - No visual gaps or overlaps + - Player can navigate through all doors +4. **Check door alignment**: + - Doors should align perfectly between connecting rooms + - Multiple doors should be evenly spaced + - East/West doors should be on room edges + +## Expected Console Output + +When loading a test scenario, you should see: +``` +=== Room Positioning Algorithm === +Room reception: 10×10 tiles (2×2 grid units) +Room office1: 10×10 tiles (2×2 grid units) +... +Starting room: reception at (0, 0) + +Processing: reception at (0, 0) + north: office1, office2 + office1 positioned at (-160, -256) + office2 positioned at (160, -256) +... + +=== Validating Room Positions === +✅ No overlaps detected + +=== Final Room Positions === +reception: (0, 0) [320×320px] +office1: (-160, -256) [320×320px] +... +``` + +## Validation Checks + +Each test scenario should pass these checks: +- [ ] All rooms load without errors +- [ ] No room overlap warnings +- [ ] All doors align correctly (verified in console) +- [ ] Player can navigate through all connections +- [ ] Rooms appear visually aligned to grid +- [ ] Multiple doors are evenly spaced +- [ ] Door sprites face the correct direction + +## Creating Additional Room Files + +To fully test the mixed room sizes scenario, create these room files in Tiled: + +### small_room_1x1gu.json (1×1 GU Closet) +- Dimensions: 5 tiles wide × 6 tiles tall +- Layers: walls, room, doors +- Use closet/storage tileset +- Place door markers in appropriate positions + +### hall_1x2gu.json (1×2 GU Hallway) +- Dimensions: 5 tiles wide × 10 tiles tall +- Layers: walls, room, doors +- Use hallway tileset +- Suitable for vertical corridors + +## Troubleshooting + +**Doors don't align**: +- Check room dimensions follow the formula (2 + 4N for height) +- Verify rooms are positioned on grid boundaries +- Check console for positioning logs + +**Rooms overlap**: +- Check connection definitions (ensure no circular dependencies) +- Verify room dimensions are valid +- Check validation output in console + +**Can't navigate through doors**: +- Verify door collision is set up correctly +- Check that both rooms reference each other in connections +- Ensure lockType/requires properties are correct if doors are locked + +## Future Enhancements + +Additional test scenarios to create: +- [ ] Wide hallway connector (4×1 GU) +- [ ] Maximum connections (testing limits) +- [ ] East/West multiple connections (stacked vertically) +- [ ] Mixed size complex layout (all sizes together) +- [ ] Edge cases (single-tile-wide rooms, very tall rooms) + +--- + +**Last Updated**: 2025-11-16 +**Grid System Version**: 2.0 +**Compatible with**: New grid-based room layout system diff --git a/scenarios/test_complex_multidirection.json b/scenarios/test_complex_multidirection.json new file mode 100644 index 0000000..dffa748 --- /dev/null +++ b/scenarios/test_complex_multidirection.json @@ -0,0 +1,142 @@ +{ + "scenario_brief": "Test Scenario: Complex Multi-Direction Layout\n\nThis scenario demonstrates complex layouts using all four directions with the new grid-based system.\n\nLayout:\n [Storage] [CEO]\n ↑ ↑\n [Office1] ← [Office2] → [Servers]\n ↑\n [Reception]\n\nTests:\n- All four directions in use\n- Multiple connection types\n- Complex navigation paths\n- Door alignment in mixed layouts", + "startRoom": "reception", + "startItemsInInventory": [ + { + "type": "notes", + "name": "Mission Brief", + "takeable": true, + "readable": true, + "text": "Complex Multi-Direction Test\n\nYour mission: Navigate through a facility with rooms in all directions.\n\nAll offices require keys. Search thoroughly!" + } + ], + "rooms": { + "reception": { + "type": "room_reception2", + "connections": { + "north": "office2" + }, + "objects": [ + { + "type": "key", + "name": "Office 2 Key", + "takeable": true, + "observations": "Key to Office 2" + } + ] + }, + "office2": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "office2_key", + "connections": { + "south": "reception", + "north": "ceo", + "west": "office1", + "east": "servers" + }, + "objects": [ + { + "type": "notes", + "name": "Central Hub", + "takeable": true, + "readable": true, + "text": "Office 2 - Central Hub\n\nConnections:\nNorth: CEO Office\nSouth: Reception\nEast: Server Room\nWest: Office 1\n\nThis room connects in all four directions!" + }, + { + "type": "key", + "name": "Office 1 Key", + "takeable": true, + "observations": "Key to Office 1" + }, + { + "type": "key", + "name": "Server Room Key", + "takeable": true, + "observations": "Key to Server Room" + } + ] + }, + "office1": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "office1_key", + "connections": { + "east": "office2", + "north": "storage" + }, + "objects": [ + { + "type": "key", + "name": "Storage Key", + "takeable": true, + "observations": "Key to storage room" + }, + { + "type": "notes", + "name": "Office 1 Log", + "takeable": true, + "readable": true, + "text": "Office 1 - West Wing\n\nStorage room is to the north.\nOffice 2 is to the east." + } + ] + }, + "storage": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "storage_key", + "connections": { + "south": "office1" + }, + "objects": [ + { + "type": "key", + "name": "CEO Office Key", + "takeable": true, + "observations": "Golden key to CEO office" + } + ] + }, + "servers": { + "type": "room_servers2", + "locked": true, + "lockType": "key", + "requires": "server_key", + "connections": { + "west": "office2" + }, + "objects": [ + { + "type": "notes", + "name": "Server Log", + "takeable": true, + "readable": true, + "text": "Server Room - East Wing\n\nThis room is accessed from the west.\nMakes a good test for west-facing doors." + } + ] + }, + "ceo": { + "type": "room_ceo2", + "locked": true, + "lockType": "key", + "requires": "ceo_key", + "connections": { + "south": "office2" + }, + "objects": [ + { + "type": "notes", + "name": "Victory!", + "takeable": true, + "readable": true, + "text": "Congratulations! Complex multi-direction layout complete!\n\nThis scenario tested:\n- All four directions (N, S, E, W)\n- Central hub room with 4 connections\n- Complex navigation requiring backtracking\n- Door alignment in all directions\n- Grid-based positioning for complex layouts", + "important": true, + "isEndGoal": true + } + ] + } + } +} diff --git a/scenarios/test_horizontal_layout.json b/scenarios/test_horizontal_layout.json new file mode 100644 index 0000000..0b09c72 --- /dev/null +++ b/scenarios/test_horizontal_layout.json @@ -0,0 +1,88 @@ +{ + "scenario_brief": "Test Scenario: Horizontal Layout\n\nThis scenario demonstrates horizontal connections using east/west directions with the new grid-based layout system.\n\nLayout:\n[Storage] ← [Office] → [Servers]\n ↑\n [Reception]\n\nTests:\n- East/West connections\n- Single door placement on east/west edges\n- Four-direction connection support\n- Door alignment for east/west doors", + "startRoom": "reception", + "rooms": { + "reception": { + "type": "room_reception2", + "connections": { + "north": "office" + }, + "objects": [ + { + "type": "notes", + "name": "Facility Map", + "takeable": true, + "readable": true, + "text": "Test Scenario: Horizontal Layout\n\nFrom the office to the north:\n- West: Storage Room (contains key)\n- East: Server Room (locked)\n\nThis tests east/west connections." + }, + { + "type": "key", + "name": "Office Key", + "takeable": true, + "observations": "Key to the office" + } + ] + }, + "office": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "office_key", + "connections": { + "south": "reception", + "west": "storage", + "east": "servers" + }, + "objects": [ + { + "type": "notes", + "name": "Office Note", + "takeable": true, + "readable": true, + "text": "This office connects in three directions:\n- South to Reception\n- West to Storage\n- East to Server Room\n\nCheck the storage room for the server access key." + } + ] + }, + "storage": { + "type": "room_office2", + "connections": { + "east": "office" + }, + "objects": [ + { + "type": "key", + "name": "Server Room Key", + "takeable": true, + "observations": "Electronic key card for server room" + }, + { + "type": "notes", + "name": "Storage Log", + "takeable": true, + "readable": true, + "text": "Storage Room - West Wing\n\nThis room demonstrates east connection.\nThe door should be on the east wall of this room." + } + ] + }, + "servers": { + "type": "room_servers2", + "locked": true, + "lockType": "key", + "requires": "server_key", + "connections": { + "west": "office" + }, + "objects": [ + { + "type": "notes", + "name": "Mission Complete", + "takeable": true, + "readable": true, + "text": "Success! Horizontal layout test complete.\n\nThis scenario demonstrated:\n- East/West connections\n- Four-direction navigation\n- Side door placement and alignment\n- Mixed connection types in one room", + "important": true, + "isEndGoal": true + } + ] + } + } +} diff --git a/scenarios/test_mixed_room_sizes.json b/scenarios/test_mixed_room_sizes.json new file mode 100644 index 0000000..61a2840 --- /dev/null +++ b/scenarios/test_mixed_room_sizes.json @@ -0,0 +1,96 @@ +{ + "scenario_brief": "Test Scenario: Mixed Room Sizes\n\nThis scenario demonstrates the grid system's ability to handle rooms of different sizes and properly align doors between them.\n\nNOTE: This scenario is designed to use rooms of different sizes:\n- 1x1 GU rooms (5x6 tiles): small_room_1x1gu.json\n- 1x2 GU rooms (5x10 tiles): hall_1x2gu.json\n- 2x2 GU rooms (10x10 tiles): room_office2.json, room_ceo2.json, etc.\n\nCurrently using 2x2 GU placeholders until smaller rooms are created.\n\nLayout Concept:\n [Closet-1x1] [CEO-2x2]\n ↑ ↑\n [Hall-1x2GU]\n ↑\n [Reception-2x2]\n\nTests:\n- Different room sizes in same scenario\n- Door alignment between different-sized rooms\n- Centering of smaller rooms on larger rooms\n- Grid-based positioning with varied dimensions", + "startRoom": "reception", + "rooms": { + "reception": { + "type": "room_reception2", + "connections": { + "north": "hall" + }, + "objects": [ + { + "type": "notes", + "name": "Size Guide", + "takeable": true, + "readable": true, + "text": "Mixed Room Sizes Test\n\nRoom Size Reference:\n- 1x1 GU (Closet): 5×6 tiles = 160×192px\n- 1x2 GU (Hall): 5×10 tiles = 160×320px \n- 2x2 GU (Standard): 10×10 tiles = 320×320px\n- 4x1 GU (Wide Hall): 20×6 tiles = 640×192px\n\nValid heights follow: 2 + (N × 4)\nValid: 6, 10, 14, 18, 22, 26...\nInvalid: 7, 8, 9, 11, 12, 13...\n\nAll widths must be multiples of 5 tiles." + }, + { + "type": "key", + "name": "Hall Key", + "takeable": true, + "observations": "Key to the hallway" + } + ] + }, + "hall": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "hall_key", + "connections": { + "south": "reception", + "north": ["closet", "ceo"] + }, + "objects": [ + { + "type": "notes", + "name": "Hallway Note", + "takeable": true, + "readable": true, + "text": "NOTE: This room should be hall_1x2gu.json (1×2 GU)\n\nCurrently using room_office2.json as placeholder.\n\nThe hall connects to:\n- Closet (1×1 GU) to the northwest\n- CEO Office (2×2 GU) to the northeast\n\nDoors should align properly despite size differences." + }, + { + "type": "key", + "name": "Closet Key", + "takeable": true, + "observations": "Key to storage closet" + }, + { + "type": "key", + "name": "CEO Key", + "takeable": true, + "observations": "Golden CEO office key" + } + ] + }, + "closet": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "closet_key", + "connections": { + "south": "hall" + }, + "objects": [ + { + "type": "notes", + "name": "Closet Info", + "takeable": true, + "readable": true, + "text": "NOTE: This room should be small_room_1x1gu.json (1×1 GU)\n\nCurrently using room_office2.json as placeholder.\n\nA 1×1 GU room is the smallest valid size:\n- 5 tiles wide (1 GU)\n- 6 tiles tall (2 + 1×4)\n- 160×192 pixels\n\nPerfect for closets, small storage, or utility rooms." + } + ] + }, + "ceo": { + "type": "room_ceo2", + "locked": true, + "lockType": "key", + "requires": "ceo_key", + "connections": { + "south": "hall" + }, + "objects": [ + { + "type": "notes", + "name": "Success!", + "takeable": true, + "readable": true, + "text": "CEO Office - Mixed Sizes Test Complete!\n\nThis scenario demonstrates:\n- Multiple room sizes in one layout\n- Door alignment between different-sized rooms\n- Grid-based positioning system\n- Proper centering of smaller rooms\n\nWhen small_room_1x1gu.json and hall_1x2gu.json are created, this scenario will show true size variety!\n\nRoom Size Formula:\nWidth: Must be multiple of 5 tiles\nHeight: Must be 2 + (N × 4) where N ≥ 1\n\nExamples:\n- 5×6 (1×1 GU) ✓\n- 10×10 (2×2 GU) ✓\n- 20×6 (4×1 GU) ✓\n- 10×8 ✗ (8 is invalid: not 2+4N)\n- 7×6 ✗ (7 not multiple of 5)", + "important": true, + "isEndGoal": true + } + ] + } + } +} diff --git a/scenarios/test_multiple_connections.json b/scenarios/test_multiple_connections.json new file mode 100644 index 0000000..bf4aff8 --- /dev/null +++ b/scenarios/test_multiple_connections.json @@ -0,0 +1,120 @@ +{ + "scenario_brief": "Test Scenario: Multiple Connections Per Direction\n\nThis scenario tests multiple room connections in the same direction, demonstrating the grid system's ability to position and align doors for side-by-side rooms.\n\nLayout:\n [Server1][Server2][Server3]\n ↑ ↑ ↑\n [---- Hub ----]\n ↑\n [Reception]\n\nTests:\n- Multiple connections in one direction (Hub has 3 north connections)\n- Door spacing across wide rooms\n- Alignment of multiple doors\n- Array-based connection syntax", + "startRoom": "reception", + "rooms": { + "reception": { + "type": "room_reception2", + "connections": { + "north": "hub" + }, + "objects": [ + { + "type": "notes", + "name": "Facility Access", + "takeable": true, + "readable": true, + "text": "Multiple Connection Test\n\nThe server hub to the north connects to three server rooms.\nThis tests the system's ability to handle multiple doors on one wall.\n\nAll server keys are in the hub." + }, + { + "type": "key", + "name": "Hub Key", + "takeable": true, + "observations": "Access key to server hub" + } + ] + }, + "hub": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "hub_key", + "connections": { + "south": "reception", + "north": ["server1", "server2", "server3"] + }, + "objects": [ + { + "type": "notes", + "name": "Hub Control", + "takeable": true, + "readable": true, + "text": "Server Hub - Central Control\n\nThis room has THREE north connections:\n- Server Room 1 (Northwest)\n- Server Room 2 (North)\n- Server Room 3 (Northeast)\n\nThe doors should be evenly spaced along the north wall." + }, + { + "type": "key", + "name": "Server 1 Key", + "takeable": true, + "observations": "Access to Server 1" + }, + { + "type": "key", + "name": "Server 2 Key", + "takeable": true, + "observations": "Access to Server 2" + }, + { + "type": "key", + "name": "Server 3 Key", + "takeable": true, + "observations": "Access to Server 3" + } + ] + }, + "server1": { + "type": "room_servers2", + "locked": true, + "lockType": "key", + "requires": "server1_key", + "connections": { + "south": "hub" + }, + "objects": [ + { + "type": "notes", + "name": "Server 1 Log", + "takeable": true, + "readable": true, + "text": "Server Room 1 - West Position\n\nThis is the leftmost server room.\nDoor should align with the hub's northwest door." + } + ] + }, + "server2": { + "type": "room_servers2", + "locked": true, + "lockType": "key", + "requires": "server2_key", + "connections": { + "south": "hub" + }, + "objects": [ + { + "type": "notes", + "name": "Server 2 Log", + "takeable": true, + "readable": true, + "text": "Server Room 2 - Center Position\n\nThis is the middle server room.\nDoor should align with the hub's center north door." + } + ] + }, + "server3": { + "type": "room_servers2", + "locked": true, + "lockType": "key", + "requires": "server3_key", + "connections": { + "south": "hub" + }, + "objects": [ + { + "type": "notes", + "name": "Mission Complete", + "takeable": true, + "readable": true, + "text": "Server Room 3 - East Position\n\nThis is the rightmost server room.\nDoor should align with the hub's northeast door.\n\nCONGRATULATIONS!\n\nMultiple connections test complete!\n\nThis scenario demonstrated:\n- Multiple connections in same direction (3 north doors on hub)\n- Proper door spacing and alignment\n- Array syntax for connections\n- Side-by-side room positioning\n- Asymmetric connection handling (hub: 3 south, each server: 1 north)", + "important": true, + "isEndGoal": true + } + ] + } + } +} diff --git a/scenarios/test_vertical_layout.json b/scenarios/test_vertical_layout.json new file mode 100644 index 0000000..869f698 --- /dev/null +++ b/scenarios/test_vertical_layout.json @@ -0,0 +1,81 @@ +{ + "scenario_brief": "Test Scenario: Vertical Layout\n\nThis scenario demonstrates vertical stacking of rooms using north/south connections with the new grid-based layout system.\n\nLayout:\n [CEO Office - 2x2GU]\n ↑\n [Office1][Office2]\n ↑ ↑\n [Reception - 2x2GU]\n\nTests:\n- Single north connection (Reception → Offices)\n- Multiple north connections (Offices → CEO)\n- Door alignment between 2x2 GU rooms\n- Grid-based positioning", + "startRoom": "reception", + "rooms": { + "reception": { + "type": "room_reception2", + "connections": { + "north": ["office1", "office2"] + }, + "objects": [ + { + "type": "notes", + "name": "Welcome Note", + "takeable": true, + "readable": true, + "text": "Test Scenario: Vertical Layout\n\nThis tests north/south connections with multiple rooms.\n\nOffice 1 has a key to the CEO office.\nOffice 2 has important information." + }, + { + "type": "key", + "name": "Office 1 Key", + "takeable": true, + "observations": "A key labeled 'Office 1'" + } + ] + }, + "office1": { + "type": "room_office2", + "locked": true, + "lockType": "key", + "requires": "office1_key", + "connections": { + "south": "reception", + "north": "ceo" + }, + "objects": [ + { + "type": "key", + "name": "CEO Office Key", + "takeable": true, + "observations": "A golden key for the CEO office" + } + ] + }, + "office2": { + "type": "room_office2", + "connections": { + "south": "reception", + "north": "ceo" + }, + "objects": [ + { + "type": "notes", + "name": "Office 2 Info", + "takeable": true, + "readable": true, + "text": "This office demonstrates multiple connections.\n\nBoth Office 1 and Office 2 connect to the CEO office to the north.\n\nThe doors should align properly despite being a multi-connection setup." + } + ] + }, + "ceo": { + "type": "room_ceo2", + "locked": true, + "lockType": "key", + "requires": "ceo_key", + "connections": { + "south": ["office1", "office2"] + }, + "objects": [ + { + "type": "notes", + "name": "Success Note", + "takeable": true, + "readable": true, + "text": "Congratulations! You've successfully navigated a vertical layout.\n\nThis demonstrates:\n- Multiple north connections from Reception\n- Multiple south connections to CEO office\n- Proper door alignment with grid-based positioning", + "important": true, + "isEndGoal": true + } + ] + } + } +}