versión inicial del juego

This commit is contained in:
2025-12-30 23:24:58 +01:00
commit 7dbc77e75a
34 changed files with 1589 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
# Implementation Plan - Phase 1: Dungeon Generation
## Goal Description
Build a robust, data-driven procedural dungeon generator that supports campaign-specific requirements (custom exits vs. objective rooms). This logic will be decoupled from the 3D visualization to ensure testability.
## Architecture
The engine will consist of three main components:
1. **Tile Registry**: Definitions of all available board sections (Rooms, Corridors, T-Junctions, Corners).
2. **Dungeon Deck**: A deck manager that handles the probability of drawing specific room types.
3. **Generator Core**: The state machine that places tiles on a virtual grid.
## User Review Required
> [!IMPORTANT]
> **Campaign Logic Deviation**: The rulebook specifies random dungeons. We are implementing a constrained "Mission" system where:
> * Current functionality must support "Forced Exits" after X tiles for early campaign missions.
> * Final missions revert to standard "Objective Room" search.
## Proposed Changes
### [NEW] `src/engine/dungeon/`
We will structure the engine purely in JS logic first.
#### [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
}
```
#### [NEW] `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").
#### [NEW] `Generator.js`
- **Grid System**: A virtual 2D array or Map `Map<"x,y", TileID>` to track occupancy.
- **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.
### 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"
}
}
```
## Verification Plan
### Automated Tests
- **Unit Tests**: Verify `Generator` can place tiles without overlapping.
- **Logic Tests**: Verify "Exit functionality" triggers correctly after N tiles.

40
implementación/task.md Normal file
View File

@@ -0,0 +1,40 @@
# Project Tasks: Warhammer Quest 3D
## Phase 1: Dungeon Generation Engine (Priority)
- [x] **Core Data Structures**
- [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] 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 -->
## Phase 2: 3D Visualization & Camera
- [ ] **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 -->
## Phase 3: Game Mechanics (Loop)
- [ ] **Turn System**
- [ ] Define Phases (Power, Movement, Exploration, Combat) <!-- id: 30 -->
- [ ] Implement Turn State Machine <!-- id: 31 -->
- [ ] **Entity System**
- [ ] Define Hero/Monster Stats <!-- id: 32 -->
- [ ] Implement Movement Logic (Grid-based) <!-- id: 33 -->
## Phase 4: Campaign System
- [ ] **Campaign Manager**
- [ ] Save/Load Campaign State <!-- id: 40 -->
- [ ] Unlockable Missions Logic <!-- id: 41 -->
- [ ] Hero Progression (Between missions) <!-- id: 42 -->

View File

@@ -0,0 +1,3 @@
# Walkthrough
*Project reset. No features implemented yet.*