Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC, and is used under the [Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt). spelunky.ai is an unofficial fan project, not affiliated with or endorsed by Mossmouth. The game and its assets may not be sold.

Music by George Buzinkai and Jonathan Perry; sound effects made in SFXR. From Spelunky Classic 1.1, © 2008, 2009 Derek Yu and Mossmouth, LLC.

# Level generation

From the spelunky.ai wiki: <https://spelunky.ai/wiki/level-generation>. Verified against the spelunky.ai port [v0.1.10](https://github.com/851-labs/spelunky/releases/tag/v0.1.10) on 28 October 2026.

This page describes a secret.

Level generation in Spelunky Classic builds each level as it loads: a random path of rooms from entrance to exit, the side rooms, then monsters and treasure.

No two games are the same: each level is made when the player enters it, from rolls of the game's random
number generator. The path comes first, so that the exit can be reached from the entrance; then each of its
sixteen rooms is picked from its area's layouts; then a pass over every block adds the monsters, traps and
treasure. A level may also be a special one, a [dark level](https://spelunky.ai/wiki/dark-level) or a [snake pit](https://spelunky.ai/wiki/snake-pit), with
odds the game sets once for all, on the levels of the areas that can have it. The areas' own rules are on
their pages: [the Mines](https://spelunky.ai/wiki/mines#generation), [the Jungle](https://spelunky.ai/wiki/jungle#generation),
[the Ice Caves](https://spelunky.ai/wiki/ice-caves#generation), [the Temple](https://spelunky.ai/wiki/temple#generation) and
[Olmec's Lair](https://spelunky.ai/wiki/olmecs-lair#generation).

## How it works

### When a level is made

A level is made when its room starts with a game in progress: the object that runs the level calls the
generator from its create event[^1]. The screen between levels picks
the room: the Ice Caves have a room of their own, a [flooded level](https://spelunky.ai/wiki/flooded-level) another, Olmec's Lair a
third, and every other level shares one[^2]. The area comes from
the level's number: levels 1–4 are the Mines, 5–8 the Jungle, 9–12 the Ice Caves, 13–15 the Temple and 16
Olmec's Lair[^3]. The Tutorial and custom levels from
the [level editor](https://spelunky.ai/wiki/level-editor) are laid out by hand, and get no monsters or treasure from it[^4].

A level is four rooms by four, each 10 tiles wide and 8 high, a tile being 16 pixels[^5]. Around them runs a border of blocks that nothing destroys; the Ice
Caves' and Olmec's Lair's have no bottom, and a flooded level's is lower, to make room for its lake[^6]. Olmec's Lair is a hall laid out by hand, with only the rooms
above it made this way ([Olmec's Lair](https://spelunky.ai/wiki/olmecs-lair#generation)).

### The path

The generator first lays a path through the grid[^7][^8]:

1. It starts in a random room of the top row, which will hold the entrance.
2. From each room it rolls a move. In the two middle columns, the move is left two times in five, right two
   in five and down one in five; at the left or right edge, it's away from the edge two times in three and
   down one in three.
3. A move sideways takes the path into the next room. A move toward a room the path already has goes the
   other way instead if that room is free, or down if it isn't; at an edge it does nothing, and the walk
   rolls again ([Quirks](https://spelunky.ai/wiki/level-generation#quirks)).
4. A move down marks the room it leaves as a drop and the one it enters as dropped into. A move down from the
   bottom row ends the path: the room it leaves holds the exit.

The path is there so that the exit can be reached, "generally no bombs required", as the code's comment
says[^9]. The rooms it doesn't take are side rooms. Each room's place
on the path decides its layouts, which leave a way on along the path; a side room's needn't lead anywhere[^10]:

| Room                      | What its layouts are                                                                                                                                                                      |       |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| The start room            | The entrance, with an open floor, or a hole in it if the path drops at once                                                                                                               | [^11] |
| The end room              | The exit, open from above if the path dropped into it                                                                                                                                     | [^12] |
| On the path, crossed      | Open to both sides                                                                                                                                                                        | [^13] |
| On the path, dropped into | Open from above                                                                                                                                                                           | [^14] |
| On the path, a drop       | A gap in the floor to the room below                                                                                                                                                      | [^15] |
| Side room                 | Ledges, walls, tunnels; or [Kali's altar](https://spelunky.ai/wiki/kalis-altar), 1 in 16 from level 2, or a [Golden Idol](https://spelunky.ai/wiki/golden-idol)'s room, once a level each | [^16] |
| A shop                    | One of the shops, beside the path                                                                                                                                                         | [^17] |

That table is the Mines' room script; each area has its own, with its own layouts, and the special levels
with them[^18]. A layout has slots for chunks of 5 tiles by 3,
picked at random (a platform, a mound with [Spikes](https://spelunky.ai/wiki/spikes), an overhang), and the start and end rooms' slot
for the door picks one with the door in it[^19]. Then each tile is
made: a block of the area's earth, or, one time in ten in the Mines, a stone block; some tiles are a block
only half the time[^20].

### Shops

From level 2 to level 15, a level rolls for a shop with a chance of 2 in its level's number: the roll always
passes on level 2, 2 times in 5 on level 5, 2 in 15 on level 15. The shop's room is a side room beside the
path, picked at random from those that qualify, and a level with none gets no shop; its kind is the room
script's roll[^21][^17]. Once the game has had the [Black Market](https://spelunky.ai/wiki/black-market), no
level has a shop again ([Quirks](https://spelunky.ai/wiki/level-generation#quirks)).

### Special levels

Some rolls turn rooms of the grid into something else, before or after the path is laid[^22]. The graveyard's roll comes next, before the rooms are built,
and the dark level's after[^23]:

| Special level                                             | Where                                                                              | Odds                                                                                                            |       |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
| [Snake pit](https://spelunky.ai/wiki/snake-pit)           | The Mines: a column of three side rooms from the top two rows                      | 1 in 8 for each such column, once a level                                                                       | [^24] |
| [Dark level](https://spelunky.ai/wiki/dark-level)         | From level 2, outside the Ice Caves and Olmec's Lair; once an area                 | 1 in 12, unless the level before it was the title screen or was finished 20 seconds or less past a whole minute | [^25] |
| [Black Market](https://spelunky.ai/wiki/black-market)     | The Jungle: the level after the player takes its hidden door                       | Always                                                                                                          | [^26] |
| [Graveyard level](https://spelunky.ai/wiki/restless-dead) | The Jungle                                                                         | 1 in 10                                                                                                         | [^27] |
| [Flooded level](https://spelunky.ai/wiki/flooded-level)   | The Jungle, from the screen between levels, until the Black Market's door is taken | 1 in 10                                                                                                         | [^28] |
| [Moai](https://spelunky.ai/wiki/moai)                     | The Ice Caves, once a game                                                         | Below                                                                                                           | [^29] |
| [Mothership](https://spelunky.ai/wiki/mothership)         | The Ice Caves, after the Moai's level                                              | 1 in 10                                                                                                         | [^30] |
| [Yeti lair](https://spelunky.ai/wiki/yeti-lair)           | The Ice Caves, after the Moai's level                                              | 1 in 6, once the mothership's roll fails                                                                        | [^31] |
| [Sacrifice pit](https://spelunky.ai/wiki/sacrifice-pit)   | The Temple                                                                         | 1 in 8                                                                                                          | [^32] |
| [City of Gold](https://spelunky.ai/wiki/city-of-gold)     | Level 15, after the player takes level 14's gold door                              | Always                                                                                                          | [^33] |

The Black Market can be a graveyard level as well, and the City of Gold a dark level or a sacrifice pit, as
their pages say.

### Once a game

Four things are made once a game, each on one of a few levels, until it's made:

| What                                                                           | Levels                                                                                    |       |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- | ----- |
| The [Udjat Eye](https://spelunky.ai/wiki/udjat-eye)'s locked chest and its key | Level 2 one time in 3, level 3 one time in 2, otherwise level 4                           | [^34] |
| The [Black Market](https://spelunky.ai/wiki/black-market)'s hidden door        | Level 5 one time in 3, level 6 one time in 2, otherwise level 7                           | [^35] |
| The [Moai](https://spelunky.ai/wiki/moai)                                      | Level 9 one time in 4, level 10 one time in 3, level 11 one time in 2, otherwise level 12 | [^29] |
| The gold door to the [City of Gold](https://spelunky.ai/wiki/city-of-gold)     | Level 14                                                                                  | [^36] |

A game started from one of the [Tunnel Man's shortcuts](https://spelunky.ai/wiki/tunnel-man-shortcuts) skips the levels before it,
and with them the chances of the first ones. [Reaching the Black Market](https://spelunky.ai/wiki/black-market-route) and [Reaching the City of Gold](https://spelunky.ai/wiki/city-of-gold-route) walk through
finding and using the two doors.

### Monsters, traps and treasure

Once the rooms are built, a last pass goes over every block outside the shops, in the area's own way[^37]:

- **Monsters** hang under a block with open space below it (in the Mines, a [Bat](https://spelunky.ai/wiki/bat) 1 in 60, a
  [Spider](https://spelunky.ai/wiki/spider) 1 in 80) or stand on one with open space above (a [Snake](https://spelunky.ai/wiki/snake) 1 in 60), each roll
  made once the ones before it fail. In the Mines, none start in the start room[^38].
- **Treasure** goes on top of a block with nothing over it: a [Rock](https://spelunky.ai/wiki/rock) 1 in 100, or a [Jar](https://spelunky.ai/wiki/jar) 1 in
  40; failing those, in a nook one block high, a [Web](https://spelunky.ai/wiki/web), the Udjat Eye's chest, a [Crate](https://spelunky.ai/wiki/crate), a
  [Chest](https://spelunky.ai/wiki/chest), the [Damsel](https://spelunky.ai/wiki/damsel) (once a level), bones, [gold](https://spelunky.ai/wiki/gold-bar) or a big gem; in a tunnel,
  a Web, gold, bones or a big gem; on open ground, gold or bones. Nothing goes within two blocks of the
  entrance or the exit[^39].
- **Gold in the rock** is the blocks' own: a block of the Mines' earth shows gold 29 times in 100, and one
  that doesn't may hold a big gem or, 1 time in 1,200 once those fail, an item[^40].
- **Traps**: in the Mines, one stone block in four that has open space on one side and a block on the other
  becomes an [Arrow Trap](https://spelunky.ai/wiki/arrow-trap) facing the open space, unless it's close to the entrance[^41].

The areas' Inhabitants sections have their monsters and odds. The pass ends with a crate of flares beside
the entrance of a [dark level](https://spelunky.ai/wiki/dark-level); then the player is put at the entrance, a thief or murderer finds
an angry [Shopkeeper](https://spelunky.ai/wiki/shopkeeper) at the exit, and any treasure inside a block that can't be destroyed is removed[^42][^43][^44].

### The random number generator

Every roll comes from the game's one random number generator, which play draws from too: monsters, items and
even the particles each take numbers from it, so a level depends on everything that happened before it.
The game never seeds the generator; GameMaker seeds it at random when the game starts[^45]. A test such as `a and rand(1, n) == 1` draws its number even when `a` is false, which
moves the generator on for rolls that can't come true[^46][^47]. The same
starting value and the same keys make the same levels again, which this wiki's replays rely on: the clip
below comes from one that starts the generator at 2[^48].

## Numbers

| Value                                                                                             | Odds                    |       |
| ------------------------------------------------------------------------------------------------- | ----------------------- | ----- |
| A move down, from a middle column                                                                 | 1 in 5                  | [^49] |
| A move down, from the left or right edge                                                          | 1 in 3                  | [^50] |
| A shop, from level 2                                                                              | 2 in the level's number | [^51] |
| [Kali's altar](https://spelunky.ai/wiki/kalis-altar), for each side room from level 2 (the Mines) | 1 in 16                 | [^52] |
| A [snake pit](https://spelunky.ai/wiki/snake-pit), for each column that can hold one              | 1 in 8                  | [^53] |
| A [dark level](https://spelunky.ai/wiki/dark-level)                                               | 1 in 12                 | [^54] |
| A [graveyard level](https://spelunky.ai/wiki/restless-dead)                                       | 1 in 10                 | [^55] |
| A [flooded level](https://spelunky.ai/wiki/flooded-level)                                         | 1 in 10                 | [^56] |
| A [mothership](https://spelunky.ai/wiki/mothership)                                               | 1 in 10                 | [^57] |
| A [Yeti lair](https://spelunky.ai/wiki/yeti-lair)                                                 | 1 in 6                  | [^58] |
| A [sacrifice pit](https://spelunky.ai/wiki/sacrifice-pit)                                         | 1 in 8                  | [^59] |

## Examples

**Clip: Down a level's path.** In the first level of the Mines, the player runs right from the entrance along the top row of rooms, drops into the room below at the level's right edge, runs back left along the second row, and drops again at its left edge. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/level-generation/path/clip.mp4))

- **A path.** On the first level with seed 2, the path starts in the top row's leftmost room, crosses the row
  to its right end and drops, crosses the second row back to the left and drops again. The player follows
  it: right along the top row, down at the right edge, left along the second row and down at the left[^60].
- **A move that goes the other way.** On the first level with seed 1, the walk rolls a move left twice in the
  third row, each time toward a room it has already taken, and moves right instead[^61].
- **No room for a shop.** Level 2 with seed 5 rolls its shop, but its only side rooms are on the bottom row,
  one not beside the path and one with the path on its left, so it gets none[^62].
- **A dark level.** Level 2 with seed 2 loads dark, with the crate of flares by the entrance[^63].

**Clip: A dark level.** Level 2 of the Mines loads dark, with the message "I CAN'T SEE A THING! I'D BETTER USE THESE FLARES!" A crate of flares glows by the entrance, and the player climbs down through the dark by the small light around him. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/dark-level/arrival/clip.mp4))

- **A snake pit.** A shaft of side rooms down a Mines level, with Snakes and two big rubies at its bottom[^64].

**Clip: Down a snake pit.** On a Mines level with a snake pit, the player drops down the pit's shaft to its bottom room, collects the two big rubies there, and the snakes around him bite him three times. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/snake-pit/descent/clip.mp4))

- **A flooded level.** A Jungle level whose bottom row is a lake, with the exit just above the water[^65].

**Clip: Across a flooded level.** A Jungle level loads flooded, with the message "I CAN HEAR RUSHING WATER..." The player crosses it above the lake that fills its bottom, and takes the exit, which stands on a strip of earth just above the water. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/flooded-level/crossing/clip.mp4))

- **The Moai.** An Ice Caves level with the Moai's room on it[^66]. With seed 2, the
  Moai comes on level 9, and level 11 has a mothership[^67].

**Clip: The Moai.** On an Ice Caves level with the Moai, the player makes his way down from a ledge, past a Yeti, to the rock the Moai stands on: a stone head three blocks wide and four tall. He stops beside it, then drops off the ledge and heads back left. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/moai/statue/clip.mp4))

- **A sacrifice pit.** A Temple level with the pit's column of rooms, a Damsel and a Golden Idol at its top[^68].

**Clip: Arriving at a sacrifice pit.** A Temple level loads with the message "I CAN HEAR PRAYERS TO KALI!" The player walks left from the entrance to the top of the sacrifice pit, where a damsel and a golden idol stand side by side on four skull blocks, and stops beside the idol. ([video](https://spelunky.ai/wiki/media/1d3f433106e37ef1/clips/sacrifice-pit/arrival/clip.mp4))

## Quirks

Level generation keeps several bugs of the original's code, each a row of docs/quirks.md:

- **The path walk's moves go the other way.** Each `else` of the walk's moves belongs to the `if` nearest it,
  not to the edge check its indentation pairs it with, so a move toward a room the path already has goes the
  other way, or down, rather than being rolled again. The path runs on across a row more than it would
  otherwise[^47][^61].
- **A shop faces left only from the rightmost column.** A side room with the path only on its left is a shop
  only in the last column, so a level whose shop roll passes can still have none[^47][^62].
- **No shops after the Black Market.** Once the Black Market is made, the shop roll never passes again that
  game[^47][^69].
- **No flooded level after the Black Market's door.** The lake is only rolled until the market's door is
  taken, so the Jungle levels after it are never flooded[^47].
- **No mothership or Yeti lair before the Moai.** Their rolls are the `else` of the Moai's, which every Ice
  Caves level takes until the Moai is made[^47].
- **A dark level needs the clock past 20 seconds.** It's ruled out after a level finished 20 seconds or less
  past a whole minute, and a dark roll on the Black Market's level, which stays lit, uses up the Jungle's
  dark level[^47].
- **Webs eleven times as often.** A misplaced bracket makes the web odds always take the branch meant for
  near a Giant Spider[^47].
- **Sealed in the rock.** The Udjat Eye's key, the gold door and the City of Gold's Lady Xoc statue can each
  land where no way leads, which only bombs open[^47].
- **Blocks under the Ice Caves.** A row of blocks lies under every Ice Caves level, out of reach, with
  treasure on it[^47].
- **Places.** The Black Market can be a graveyard level that never says so
  (Black Markets on graveyard levels), can have two General Stores ([Two General Stores](https://spelunky.ai/wiki/two-general-stores)), and its door's fallback
  can make several doors; a graveyard level can have several Ash graves ([Several Ash graves](https://spelunky.ai/wiki/ash-graves)); the City of Gold's
  stone blocks give no gold (Stone blocks without gold); and Olmec's Lair rolls a path and a shop that
  nothing uses[^47].

## FAQ

### Are the levels in Spelunky Classic randomly generated?

Yes. Every level from 1 to 15 is made anew when the player enters it: a path of rooms from the entrance to the exit, the rooms around it, and the monsters, traps and treasure in them. Olmec's Lair, level 16, is a hall laid out by hand with rooms made above it, and the Tutorial and custom levels are laid out by hand.

### Can a Spelunky Classic level be impossible to finish without bombs?

It can be. The path from the entrance to the exit is laid so that, in the code's own words, "generally no bombs \[are] required", but some things placed after it can block it: the City of Gold's Lady Xoc statue can land on the path's drop, and only bombs get past it.

### How often is a level dark in Spelunky Classic?

1 in 12 for each level that can be dark: from level 2, outside the Ice Caves and Olmec's Lair, once an area at most, never the first level after the title screen, and not after a level finished 20 seconds or less past a whole minute on its clock.

### Can you choose the seed in Spelunky Classic?

No. The game never seeds its random number generator: GameMaker seeds it at random when the game starts, and level generation and play draw from it alike, so each level depends on everything before it.

## See also

- **Related:** [The Mines](https://spelunky.ai/wiki/mines), [The Jungle](https://spelunky.ai/wiki/jungle), [The Ice Caves](https://spelunky.ai/wiki/ice-caves), [The Temple](https://spelunky.ai/wiki/temple), [Olmec's Lair](https://spelunky.ai/wiki/olmecs-lair), [Dark level](https://spelunky.ai/wiki/dark-level), [Snake pit](https://spelunky.ai/wiki/snake-pit), [Flooded level](https://spelunky.ai/wiki/flooded-level), [Graveyard level](https://spelunky.ai/wiki/restless-dead), [Black Market](https://spelunky.ai/wiki/black-market), [Moai](https://spelunky.ai/wiki/moai), [Mothership](https://spelunky.ai/wiki/mothership), [Yeti Lair](https://spelunky.ai/wiki/yeti-lair), [Sacrifice pit](https://spelunky.ai/wiki/sacrifice-pit), [City of Gold](https://spelunky.ai/wiki/city-of-gold), [Tunnel Man shortcuts](https://spelunky.ai/wiki/tunnel-man-shortcuts)

## References

[^1]: [`objects/oGame/create.gml:27`](https://spelunky.ai/wiki/source/objects/oGame/create#L27)

[^2]: [`objects/oTransition/step.gml:17-27`](https://spelunky.ai/wiki/source/objects/oTransition/step#L17-L27)

[^3]: [`scripts/scrInitLevel.gml:24-29`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L24-L29)

[^4]: [`scripts/scrInitLevel.gml:197-198`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L197-L198)

[^5]: [`scripts/scrRoomGen.gml:24-45`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L24-L45)

[^6]: [`scripts/scrInitLevel.gml:66-128`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L66-L128)

[^7]: [`scripts/scrLevelGen.gml:25-33`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L25-L33)

[^8]: [`scripts/scrLevelGen.gml:89-133`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L89-L133)

[^9]: [`scripts/scrInitLevel.gml:57`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L57)

[^10]: [`scripts/scrRoomGen.gml:48-239`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L48-L239)

[^11]: [`scripts/scrRoomGen.gml:53-69`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L53-L69)

[^12]: [`scripts/scrRoomGen.gml:70-84`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L70-L84)

[^13]: [`scripts/scrRoomGen.gml:122-151`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L122-L151)

[^14]: [`scripts/scrRoomGen.gml:152-172`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L152-L172)

[^15]: [`scripts/scrRoomGen.gml:219-239`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L219-L239)

[^16]: [`scripts/scrRoomGen.gml:85-121`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L85-L121)

[^17]: [`scripts/scrRoomGen.gml:173-204`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L173-L204)

[^18]: [`scripts/scrInitLevel.gml:150-165`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L150-L165)

[^19]: [`scripts/scrRoomGen.gml:242-315`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L242-L315)

[^20]: [`scripts/scrRoomGen.gml:317-357`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L317-L357)

[^21]: [`scripts/scrLevelGen.gml:239-297`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L239-L297)

[^22]: [`scripts/scrLevelGen.gml:35-237`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L35-L237)

[^23]: [`scripts/scrInitLevel.gml:147-176`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L147-L176)

[^24]: [`scripts/scrLevelGen.gml:138-185`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L138-L185)

[^25]: [`scripts/scrInitLevel.gml:167-176`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L167-L176)

[^26]: [`scripts/scrLevelGen.gml:44-69`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L44-L69)

[^27]: [`scripts/scrInitLevel.gml:147-148`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L147-L148)

[^28]: [`objects/oTransition/step.gml:18-24`](https://spelunky.ai/wiki/source/objects/oTransition/step#L18-L24)

[^29]: [`scripts/scrLevelGen.gml:212-221`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L212-L221)

[^30]: [`scripts/scrLevelGen.gml:222-233`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L222-L233)

[^31]: [`scripts/scrLevelGen.gml:234-237`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L234-L237)

[^32]: [`scripts/scrLevelGen.gml:71-87`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L71-L87)

[^33]: [`scripts/scrLevelGen.gml:135-136`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L135-L136)

[^34]: [`scripts/scrInitLevel.gml:178-184`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L178-L184)

[^35]: [`scripts/scrInitLevel.gml:186-192`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L186-L192)

[^36]: [`scripts/scrEntityGen.gml:387-388`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L387-L388)

[^37]: [`scripts/scrEntityGen.gml:30-525`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L30-L525)

[^38]: [`scripts/scrEntityGen.gml:44-71`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L44-L71)

[^39]: [`scripts/scrTreasureGen.gml:24-133`](https://spelunky.ai/wiki/source/scripts/scrTreasureGen#L24-L133)

[^40]: [`objects/oBrick/create.gml:3-16`](https://spelunky.ai/wiki/source/objects/oBrick/create#L3-L16)

[^41]: [`scripts/scrEntityGen.gml:145-171`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L145-L171)

[^42]: [`scripts/scrInitLevel.gml:200-204`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L200-L204)

[^43]: [`scripts/scrEntityGen.gml:527-545`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L527-L545)

[^44]: [`scripts/scrInitLevel.gml:245-266`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L245-L266)

[^45]: Quirk 4 (docs/quirks.md)

[^46]: Quirk 2 (docs/quirks.md)

[^47]: Quirk 1 (docs/quirks.md)

[^48]: Replay `fidelity/replays/mines-seed-2.txt`

[^49]: [`scripts/scrLevelGen.gml:92-94`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L92-L94)

[^50]: [`scripts/scrLevelGen.gml:92-93`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L92-L93)

[^51]: [`scripts/scrLevelGen.gml:240`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L240)

[^52]: [`scripts/scrRoomGen.gml:87-91`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L87-L91)

[^53]: [`scripts/scrLevelGen.gml:148`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L148)

[^54]: [`scripts/scrInitLevel.gml:169`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L169)

[^55]: [`scripts/scrInitLevel.gml:148`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L148)

[^56]: [`objects/oTransition/step.gml:22`](https://spelunky.ai/wiki/source/objects/oTransition/step#L22)

[^57]: [`scripts/scrLevelGen.gml:222`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L222)

[^58]: [`scripts/scrLevelGen.gml:234`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L234)

[^59]: [`scripts/scrLevelGen.gml:71`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L71)

[^60]: Clip level-generation/path

[^61]: Replay `fidelity/replays/mines-seed-1.txt`

[^62]: Replay `fidelity/replays/mines-seed-5.txt`

[^63]: Clip dark-level/arrival

[^64]: Clip snake-pit/descent

[^65]: Clip flooded-level/crossing

[^66]: Clip moai/statue

[^67]: Replay `fidelity/replays/ice-seed-2.txt`

[^68]: Clip sacrifice-pit/arrival

[^69]: Replay `fidelity/replays/city-of-gold-seed-9.txt`

### Source code

- [`objects/oGame/create.gml`](https://spelunky.ai/wiki/source/objects/oGame/create)
- [`scripts/scrInitLevel.gml`](https://spelunky.ai/wiki/source/scripts/scrInitLevel)
- [`scripts/scrLevelGen.gml`](https://spelunky.ai/wiki/source/scripts/scrLevelGen)
- [`scripts/scrRoomGen.gml`](https://spelunky.ai/wiki/source/scripts/scrRoomGen)
- [`scripts/scrEntityGen.gml`](https://spelunky.ai/wiki/source/scripts/scrEntityGen)
- [`scripts/scrTreasureGen.gml`](https://spelunky.ai/wiki/source/scripts/scrTreasureGen)
- [`scripts/scrClearGlobals.gml`](https://spelunky.ai/wiki/source/scripts/scrClearGlobals)
- [`objects/oTransition/step.gml`](https://spelunky.ai/wiki/source/objects/oTransition/step)
