Snake pit
Verified against the spelunky.ai port v0.1.10 on .
A snake pit is a special Mines level of Spelunky Classic: a shaft of rooms off the path, full of Snakes, with two Big Rubies and a free Mattock at its bottom.
The pit is a column of rooms that level generation sets aside from the Mines' path: a room open at the bottom, then a narrow shaft dropping one or two rooms, then a bottom room with no way out but up. Snakes wait in its walls and on its floor, beside two Big Rubies and a Mattock buried in a brick. A level with a pit opens with the message "I HEAR SNAKES... I HATE SNAKES!".
Generation
#The roll
#Once the path from the entrance to the exit is laid (the Mines' Generation has how), level generation looks for a column with three side rooms (rooms the path doesn't cross) one above the other. It checks the top row's four columns from left to right, then the second row's, and each place it finds has a 1 in 8 chance of becoming a pit. The first that comes up is the pit, and the search stops, so a level has one at most [3] [4]. Every level of the Mines makes the roll, level 1 included, and no other area's does [1].
A pit that starts in the top row runs down all four rows when the bottom row's room is a side room too, and three rows otherwise; one that starts in the second row runs to the bottom [5]. The pit's rooms stop being side rooms, so none of them can be a shop, Kali's altar or the Golden Idol's room, which only side rooms become [6] [7].
A level with a pit opens with "I HEAR SNAKES... I HATE SNAKES!" [8]. On a dark level, it comes after the dark level's message [9].
The layout
#| Room | What | |
|---|---|---|
| The top | One of the drop rooms the path uses, with an opening at the bottom | [10] |
| The middle (one or two) | A shaft four tiles wide between solid walls, with blocks jutting from them here and there. Eight of its wall tiles, four a side, are each a Snake 1 in 10, or else a brick 1 in 2 | [11] [12] |
| The bottom | The shaft's foot, walled in on both sides and below: five Snakes, two Big Rubies, and the Mattock in a brick under them | [13] [14] |
The middle and bottom rooms have one layout each. In the clip, on level 4, the player drops down the shaft to the bottom room, collects its two Big Rubies, and the Snakes around him bite him three times [15]. The Mattock stays buried in its brick [16].
Inhabitants
#The pit's own Snakes are made with its rooms, before the rest of the level's monsters:
| Monster | Where | Chance | |
|---|---|---|---|
| Snake | In the walls: eight tiles of each middle room, two of the bottom room's | 1 in 10 for each tile | [17] [18] [12] |
| Snake | On the bottom room's floor | Five, always | [18] [19] |
Then level generation goes over the pit's blocks as over the rest of the level's, and may put the Mines' monsters there: Snakes on top of blocks, Bats and Spiders under them (the Mines' Inhabitants) [20].
Hazards
#- The Snakes, which bite for 1 heart each, five of them close together on the bottom room's floor [18] [16].
Items and shops
#The bottom room always has two Big Rubies and a free Mattock, its price 0 and not for sale, buried in the brick in the middle of the floor, under the rubies, where a Bomb or a Mattock already in hand can dig it out [18] [21]. The pit's bricks hide gems and items as any brick does, and treasure is scattered on its ledges as on the rest of the level (the Mines' Treasure). No shop is ever in the pit (above).
Secrets
#- The free Mattock in the floor of every pit.
Trivia
#- The code that marks the pit's rooms has an
if (true)around it, whoseelsewould have made a pit of two rooms, a top and a bottom; it never runs. Inside it, a test that the third room is a side room repeats one the loop has already made, and two variables set before it are never read [22] [23] [24]. - The middle and bottom rooms pick their layout with
switch(rand(1,1)), a roll with one outcome [25] [26]. - A commented-out line beside the roll sets its chance to 1 in 1, a pit on every level [27].
FAQ
#- What is a snake pit in Spelunky Classic?
A shaft of three or four rooms, one above the other, that level generation digs into a level of the Mines beside the path. Its walls hide Snakes, and its bottom room holds five more, two Big Rubies and a free Mattock. The level opens with "I HEAR SNAKES... I HATE SNAKES!".
- How often is there a snake pit in Spelunky Classic?
Level generation tries one wherever a level of the Mines has three side rooms one above the other, from the top row or the second, with a 1 in 8 chance each time, and stops at the first that comes up, so a level has one pit at most. A level with no such column has none.
- Where is the Mattock in a snake pit in Spelunky Classic?
Buried in a brick in the middle of the pit's floor, under the two Big Rubies. It's free, but the brick has to be dug or bombed out first.
- Are there snake pits outside the Mines in Spelunky Classic?
No. The roll for one is made only on the Mines' levels, 1 to 4.
See also
#References
#scripts/scrLevelGen.gml:142scripts/scrLevelGen.gml:144-148scripts/scrLevelGen.gml:138-185scripts/scrClearGlobals.gml:55scripts/scrLevelGen.gml:150-171scripts/scrLevelGen.gml:239-275scripts/scrRoomGen.gml:85-121objects/oPlayer1/alarm_0.gml:21-26objects/oPlayer1/alarm_1.gml:5-10scripts/scrRoomGen.gml:219-237scripts/scrRoomGen.gml:205-211scripts/scrRoomGen.gml:462-466scripts/scrRoomGen.gml:212-218scripts/scrRoomGen.gml:467-481- Clip snake-pit/descent
- Replay
fidelity/replays/mines-seed-2-snake-pit.txt scripts/scrRoomGen.gml:209scripts/scrRoomGen.gml:216scripts/scrRoomGen.gml:467-470scripts/scrEntityGen.gml:30-74scripts/scrRoomGen.gml:471-481scripts/scrLevelGen.gml:139-140scripts/scrLevelGen.gml:148-177- Quirk 1 (docs/quirks.md)
scripts/scrRoomGen.gml:207scripts/scrRoomGen.gml:214scripts/scrLevelGen.gml:141