Phase 1 Complete: Dungeon Engine & Visuals. Switched to Manual Exploration Plan.

This commit is contained in:
2025-12-31 00:21:07 +01:00
parent e90cfe3664
commit fd1708688a
8 changed files with 287 additions and 227 deletions

View File

@@ -17,48 +17,30 @@ The engine will consist of three main components:
## Proposed Changes
### [NEW] `src/engine/dungeon/`
We will structure the engine purely in JS logic first.
### [COMPLETED] `src/engine/dungeon/`
We structured the engine effectively.
#### [NEW] `TileDefinitions.js`
- **Data Structure**:
```javascript
{
id: 'corridor_straight',
type: 'corridor', // 'room', 'objective'
width: 2,
length: 5,
exits: [ {x:0, y:0, dir:'N'}, ... ] // Local coords
}
```
#### [DONE] `TileDefinitions.js`
- **Data Structure**: Updated to use Object Map & Single Anchor Points for alignment correction.
#### [NEW] `DungeonDeck.js`
#### [DONE] `DungeonDeck.js`
- Handles the stack of cards.
- Methods: `draw()`, `shuffle()`, `insert(card, position)`.
- **Campaign Injection**: Ability to inject specific "Events" or "Rooms" at certain deck depths (e.g., "After 10 cards, shuffle the Exit card into the top 3").
- Methods: `draw()`, `shuffle()`, `insert()`.
#### [NEW] `Generator.js`
- **Grid System**: A virtual 2D array or Map `Map<"x,y", TileID>` to track occupancy.
#### [DONE] `DungeonGenerator.js`
- **Grid System**: `GridSystem.js` handles collision & spatial logic.
- **Algorithm**:
1. Place Entry Room at (0,0).
2. Add Entry Exits to `OpenExitsList`.
3. **Step**:
- Pick an Exit from `OpenExitsList`.
- Draw Card from `DungeonDeck`.
- Attempt to place Tile at Exit.
- **IF Collision**: Discard and try alternative (or end path).
- **IF Success**: Register Tile, Remove used Exit, Add new Exits.
2. Step-by-Step generation implemented (currently automatic 1s delay).
3. **Refinement**: Automatic generation shows alignment issues due to random nature. **Plan Change**: Moving to Manual Player Exploration next.
### Campaign Integration
- **Mission Config Payload**:
```javascript
{
missionId: "campaign_1_mission_1",
deckComposition: [ ... ],
specialRules: {
forceExitAfter: 10, // Logic: Treat specific room as 'Objective' for generation purposes
exitType: "ladder_room"
}
missionId: "mission_1",
objectiveId: "room_dungeon", // Simplified for now
specialRules: {}
}
```

View File

@@ -5,25 +5,24 @@
- [x] Define Tile Data (Dimensions, Exits, Type) <!-- id: 1 -->
- [x] Define Dungeon Deck System (Cards, Shuffling, Probability) <!-- id: 2 -->
- [x] Define Mission Configuration Structure (Objective vs Exit) <!-- id: 3 -->
- [ ] Define Mission Configuration Structure (Objective vs Exit) <!-- id: 3 -->
- [x] **Grid & Logic System**
- [x] Implement Tile Placement Logic (Collision Detection, Alignment) <!-- id: 4 -->
- [x] Implement Connection Points (Exits/Entrances matching) <!-- id: 5 -->
- [x] Implement "Board" State (Tracking placed tiles) <!-- id: 6 -->
- [ ] **Generation Algorithms**
- [x] **Generation Algorithms**
- [x] Basic "Next Tile" Generation Rule <!-- id: 7 -->
- [x] Implement "Exit Room" Logic for Non-Final Missions <!-- id: 8 -->
- [x] Implement "Objective Room" Logic for Final Missions <!-- id: 9 -->
- [x] Create Loop for Full Dungeon Generation <!-- id: 10 -->
- [x] Create Loop for Full Dungeon Generation (Stopped for manual exploration) <!-- id: 10 -->
## Phase 2: 3D Visualization & Camera
- [ ] **Scene Setup**
- [x] **Scene Setup**
- [x] Setup Three.js Scene, Light, and Renderer <!-- id: 20 -->
- [x] Implement Isometric Camera (Orthographic) <!-- id: 21 -->
- [x] Implement Fixed Orbit Controls (N, S, E, W snapshots) <!-- id: 22 -->
- [ ] **Asset Management**
- [ ] Tile Model/Texture Loading <!-- id: 23 -->
- [ ] dynamic Tile Instancing based on Grid State <!-- id: 24 -->
- [x] **Asset Management**
- [x] Tile Model/Texture Loading <!-- id: 23 -->
- [x] dynamic Tile Instancing based on Grid State <!-- id: 24 -->
## Phase 3: Game Mechanics (Loop)
- [ ] **Turn System**

View File

@@ -1,3 +1,24 @@
# Walkthrough
## Current Status: Phase 1 (Dungeon Engine & Visualization) Completed
*Project reset. No features implemented yet.*
### Features Implemented
1. **Dungeon Logic Engine**:
* `GridSystem.js`: Manages spatial occupancy and global coordinate transformations.
* `DungeonDeck.js`: Manages card drawing probabilities and objective injection.
* `DungeonGenerator.js`: Connects tiles step-by-step. Uses a "Reference Cell" logic to align multi-cell doors (2-wide) correctly.
* `TileDefinitions.js`: Defines dimensions, layout, and specialized exit points for all Warhammer Quest base tiles (Corridors, Rooms, Objectives).
2. **3D Visualization**:
* `GameRenderer.js`: Three.js implementation.
* **Isometric Camera**: Fixed orthographic view with controls (WASD/Arrows + Rotation Snap).
* **Texture Mapping**: Tiles render with correct `.png` textures on flat planes.
* **Debugging Aids**: Green wireframes around tiles to visualize boundary collisions and alignment.
3. **Current Workflow**:
* The app launches and immediately starts generating a dungeon.
* A new tile is added every 1.0 seconds (Visual Debug Mode).
* Logs in the console show the decision process (Card drawn, Exit selected, Placement coordinates).
### Known Issues & Next Steps
* **Alignment**: Automatic random placement sometimes creates awkward visual gaps due to the complexity of aligning multi-cell exits in 4 directions.
* **Next Phase**: Transitioning to **Player-Controlled Exploration**. instead of random growth. The player will click an exit to "Reveal" the next section, ensuring logical continuity.