Talk:Level Generation

Rules of map generation and Secret Room placement
Made by Uncausedruby2

The page doesn't list how the map is laid out before applying special rooms, rules for placing the Secret Room, and whether or not room layouts (and therefore possible doors in rooms) are decided before or after placing Secret Rooms. If the source code for this can be put here it would be greatly appreciated, but for now I'll add observations as I study maps.

Map Layout Observations

 * There will always be at least 2 rooms connected to the start room.
 * Maps will not generate in ways that create 2x2 boxes of rooms.
 * Double, quadruple, and L-shaped rooms count as a single room for this purpose, hence why it is common to see two regular rooms placed on the same side of a large room.
 * Rooms randomly placed on XL floors after initial map generation can ignore this rule.
 * Special rooms always generate in a certain order, and are placed based on distance from the start room. From the closest to the start room to the **furthest** (and barring loops and large rooms connected to more than one room on any given side), the order of Special Rooms encountered is:
 * Bedroom
 * Vault/Arcade (mutually exclusive)
 * Challenge/Boss Challenge Room (on odd/even floors, respectively)
 * Miniboss
 * Curse Room
 * Library
 * Dice/Sacrifice Room (mutually exclusive)
 * Treasure Room
 * Shop
 * Super Secret Room (replaces the end-room it occupies)
 * Boss Room
 * I'll just say here that the challenge/boss challenge on odd/even levels is a good catch, something easily glossed over but seems to hold true. --Frionil (talk) 14:53, 9 March 2020 (UTC)

Secret Room Observations

 * Secret Rooms will never border Boss Rooms or Super Secret Rooms, which are placed before the Secret Room is.
 * The following were not found to lock locations where the Secret Room spawns:
 * Proximity to the start room
 * The size of rooms
 * Whether or not the rooms bordering it are end-rooms or Special rooms (except Boss Rooms & Super Secret Rooms)
 * The number of rooms Secret Rooms border in order of most common to least common: 3, 4, 2, 1.
 * Secret Rooms most commonly border only 2 rooms if there are 0-1 other locations on the map where it would border 3+ rooms (viewing the map alone, room layouts were disregarded). Rules deciding when this occurs and where it's placed if it does occur are currently unknown.
 * Only exception found was a map on floor 1 with 3 locations having 3 bordering rooms.
 * There can be multiple favorable locations for the Secret Room to be on a floor; if that is the case, one of the locations is selected at random.