# 4. Design Constraints and Beat Charts Part of [[Procedural Generation]]. Prev: [[3. Seeded Graphs and Corridors]]. Next: [[5. Worked Example Seeded Dungeon]]. A generator that only packs rooms will produce a parking garage. Push **constraints** from [[Level Up! (Review)]] into the recipe, not into a later "art pass." ## 4.1 Metrics Every template prefab obeys [[2. Movement Metrics Asset]] (door width, step, jump - even if this dungeon has no jump). The generator may not scale a room non-uniformly. Validate at bake: if two sockets' heights differ by more than a step, fail. ## 4.2 Beat chart Level 4: a row per "beat." A `DungeonRecipe` can list **required tags in order** (Entrance → Combat → Lock → Key is *visible from Lock* → Combat → Exit/Weenie). The graph walk prefers a template that satisfies the next unmet tag. Optional extra rooms fill `roomCount` after the required beats. [[4. Beat-Chart to Gray-Box]] is the hand-authored version of the same idea. Procedural should not skip the chart; it should instance it. ## 4.3 Weenie and landmarks At least one room tagged `Weenie` should be **seen before it is entered** (a tall prop visible down a corridor, a lit doorway - [[3. Weenies Landmarks and Lighting as Wayfinding]]). If the generator hides the landmark behind a dogleg every time, bias placement so a socket faces a long corridor at the weenie. ## 4.4 Lock and key (Level 12) If the recipe includes a `Lock` and a `Key`: - Place the **lock on the path to the exit**. - Place the **key in a room the player can reach without the key**. - Prefer "show the door, then the key" ([[3. Lock-and-Key Data]]): the locked door is visible from an earlier room, the key is not behind that door. - Hook the placed prefabs to existing `KeyDoor` / inventory items; do not invent a second lock system. If the graph cannot satisfy this, fail the seed and reroll in the tool (with a try limit), rather than shipping a soft-lock. ## 4.5 Exercise Add required tags `{Entrance, Lock, Key, Exit}` and reject seeds that put the key behind the lock. Print why a seed failed. That log is part of the assignment. ## Sources - [[Level Up! (Review)]] Levels 4, 9, 12 - [[4. Beat-Chart to Gray-Box]] - [[3. Lock-and-Key Data]]