# 06 — Puzzle Room

Create a key-hunt room where the player must find a key before the exit opens.

---

## Does a puzzle room need scripts?

**No.** Everything is handled by DKReforged at runtime. You only place markers:

- `WhatLockIsNeeded` with a `KeyLock` child → creates a locked door
- `DoorKeySpawner` → the game spawns a key here that the player can pick up

When the player picks up the key and brings it to the door, the exit opens.

---

## Setup

### 1. Key door

1. Right-click on root → **Create Empty** → rename `WhatLockIsNeeded`
2. Place it at the exit opening
3. Right-click on `WhatLockIsNeeded` → **Create Empty** → rename `KeyLock`
4. Optionally add a locked-door visual inside `KeyLock` (bars, chains, a door mesh)

### 2. Key spawn point

1. Right-click on root → **Create Empty** → rename `DoorKeySpawner`
2. Place it somewhere in the room — not too obvious, not impossible to find
3. One `DoorKeySpawner` is enough

### 3. Set the pool

In your `rooms.json`, set `"pool": "PuzzleRoomStructures"` — this tells the dungeon generator to use your room in the puzzle slot, which appears at a specific point in the run.

---

## Design tips

- **Hide the key** — place `DoorKeySpawner` behind a column, in a corner, or inside an alcove so the player must explore
- **Clear the room first** — if you also have enemies, the player fights before hunting for the key (no `MonsterLock` needed on the same door — the game handles key logic independently)
- **Visual hint** — a torch, a highlight light (Point Light with higher intensity), or distinctive decoration near the key spawn guides the player without making it trivial
- **Multiple rooms** — if your bundle has both a `NormalRoomStructures` room and a `PuzzleRoomStructures` room, use separate rooms.json files per bundle subfolder (one subfolder = one pool config)

---

## Hierarchy example

```
my-pack_PuzzleRoom
├── ... (geometry, lights)
├── SpawnHere
├── EnemySpawn  (×3, optional)
├── LootSpawner (×4)
├── DoorKeySpawner          ← key spawns here
└── WhatLockIsNeeded
    └── KeyLock
        └── [optional locked door geometry]
```

---

## Next

→ [07-multiple-parts.md](07-multiple-parts.md) — multi-prefab bundles
