SpelunkyFan wiki

The Mines

Verified against the spelunky.ai port v0.1.10 on .

The Mines are the first area of Spelunky Classic, levels 1–4: brick caves of ladders, Snakes, Bats, Spiders and arrow traps, and the game's first shops.

Every new game starts here, on level 1, and the four levels down to the Jungle are brick caves, with ladders between their ledges. Level generation fills them with Snakes on the ground and Bats and Spiders on the ceilings, turns stone blocks into Arrow Traps, and from level 2 builds shops, Kali's altars and the Udjat Eye's locked chest. Each level can instead be a snake pit or a dark level.

Generation

#

The Mines are levels 1 to 4: the game's level type is the Mines' unless the level number puts it in a later area [1]. A new game's first level is reached through the title screen's START door; the very first game a player starts goes to the Tutorial instead [2]. In the first clip, the player walks into the START door and level 1 loads [3].

Into the Mines. On the title screen, the player walks left into the START door, and the first level of the Mines loads: brick ledges, ladders and stone blocks.

A level is a grid of four rooms by four, each 10 tiles wide and 8 high (a tile is 16 pixels), inside a border of bricks that can't be destroyed [4] [5]. First, a path is laid: it starts in a random room of the top row, which holds the entrance, and wanders left and right, dropping a row at random, until it leaves the bottom row, where the last room it reached holds the exit [6] [7]. The path's rooms are built from layouts that leave a way through: open rooms, ladders, and drops into the room below. The rest are side rooms, which needn't lead anywhere [8]. Each layout has slots that take one of a set of 5-by-3 chunks at random: a platform, a mound with Spikes, an overhang [9]. Then every tile is made: a brick, or, one time in ten, a stone block [10].

Then the side rooms get their features [11]:

RoomChance
Kali's altar1 in 16 for each side room from level 2, once a level[12]
Golden Idol room, with a giant tiki head and its Boulder1 in 10 for each side room off the bottom row, once the altar's roll fails, once a level[13]
A shopFrom level 2 (below)[14]

On top of that, a level may be special. Three side rooms one above the other, from the top row or the second, become a snake pit, 1 in 8 for each such column, once a level; from the top row, the pit runs down all four rows when the bottom room is a side room too [15] [16]. From level 2, a level may be a dark level, 1 in 12, at most once in the area, and never the first level after the title screen, nor one after a level finished 20 seconds or less past a whole minute on its clock [17] [18] [19].

Taking a level's exit leads to the screen between levels, which counts up what the player found, and on to the next level [20]. In the second clip, the player climbs down through level 1 and takes its exit [21].

Through a Mines level. In the Mines' first level, the player drops down past Bats, whips a Snake beside a Damsel, and takes the exit without losing a heart. The screen between levels counts up his time, loot, kills and money.

Inhabitants

#

Level generation goes over every block outside the shops and below the top row, and outside the room the entrance is in, and may hang a monster under it, if the two tiles below are open, or stand one on top of it [22]:

MonsterWhereChance
Giant SpiderHanging, where there's room for its two blocks by two1 in 40 for each block, on one level in six, once a level[23] [24]
ScarabHanging, on a dark level only1 in 40, once the roll for a lamp fails[25]
BatHanging1 in 60[26]
SpiderHanging1 in 80, once the Bat's fails[27]
SnakeOn top1 in 60[28]
CavemanOn top1 in 800, once the Snake's fails[29]

The Mines are the only area whose generation makes Snakes, Spiders and Giant Spiders. A snake pit adds a shaft full of Snakes. The treasure's piles of bones (below) may be a Skeleton waiting to rise. From level 2, the Ghost comes to a level the player stays on for 5,000 steps [30].

Hazards

#
  • Arrow Traps. One stone block in four becomes an Arrow Trap, if it's outside a shop, more than 48 pixels from the entrance (and not on the entrance's row within 144 pixels of it), and has a block behind it and open ground in front: two tiles on one side, three on the other [31].
  • Spikes come with the ground chunks that have a spike pit, one tile in three [32] [33].
  • Webs hang in nooks and tunnels (below). One holds the player, who struggles free by jumping, and stops monsters and thrown items [34] [35] [36] [37].
  • The Boulder of an idol room comes down when the Golden Idol is lifted.

Items and shops

#

Shops

#

From level 2, a level may have a shop: always on level 2, two times in three on level 3, one time in two on level 4 (the code's rand(1, level) <= 2). It goes in a side room beside a room of the path, and only if there is one: a side room qualifies when the room to its right is one the path crosses or leaves downward (not one it drops into), or, in the rightmost column, when the room to its left is [14]. So a level whose side rooms beside the path all have it on their left, outside the rightmost column, has no shop: seed 5's level 2 is one [19] [38]. Its kind is one of seven, each as likely: a General Store, Bomb Shop, Weapon Shop, Rare Shop, Clothing Shop, Dice House or Kissing Parlor [39].

Treasure

#

Level generation scatters loose things over every block outside the shops (the same in every area but Olmec's Lair), keeping them 32 pixels from the entrance and the exit and 64 from a Golden Idol [40]:

SpotWhat, and the chance
Any block with room aboveA Rock 1 in 100, else a Jar 1 in 40[41]
A nook (rock above and to one side)A Web 1 in 5; else a Crate 1 in 10, a Chest 1 in 15, a Damsel 1 in 8 (one a level), bones, a Gold Bar 1 in 3, Gold Bars, or a big gem, each roll made once the ones before it fail[42]
A tunnel (rock on both sides)A web 1 in 10; else a Gold Bar 1 in 4, Gold Bars 1 in 8, bones, or a big gem[43]
Open groundA Gold Bar 1 in 40, else Gold Bars 1 in 50, else bones[44]

The webs' odds are meant to be 1 in 60 away from a Giant Spider, but a typo makes the code always take its near-a-Giant-Spider odds [19]. The bones' odds grow with the level number, and one pile in eight is a Skeleton waiting to rise [45].

The bricks hold more. About one in five shows a vein of gold, which breaks into three Gold Chunks, and one in ten a rich vein, which adds a Gold Nugget. Of the rest, 1 in 100 holds a big sapphire, and rarer ones a big emerald, a big ruby, or an item [46] [47].

Secrets

#
  • Kali's altars, from level 2 (above).
  • The Udjat Eye: one level from 2 to 4 hides a locked chest and its key [48].
  • The snake pit's bottom holds big rubies and a free Mattock [49] [50].
  • Shortcuts. In the screen after level 4, the Tunnel Man may ask for money toward a shortcut, which opens a door to the Jungle on the title screen [51].

Trivia

#
  • The room script's header calls the Mines "Area 1" [52], and its comment explains the layouts: "ROOMS are 10x8 tile areas", and "OBSTACLES are 5x3 tile chunks that are randomized within rooms" [4].
  • The path script's own header says the path is the route to the exit with "no-bombs/no-rope (in theory)" [53].
  • A roll to move the path toward a room it has already taken moves it the other way instead, or down a row when both sides are taken; only at the level's edge does it do nothing. The code's indentation pairs each else with a check for the level's edge, where a blocked move would do nothing and be rolled again, but the else belongs to the nearest if [54] [19] [55].

FAQ

#
What levels are the Mines in Spelunky Classic?

Levels 1 to 4. Every game starts in the Mines, and taking level 4's exit leads to the Jungle, level 5.

What monsters live in the Mines in Spelunky Classic?

Snakes, Bats, Spiders and, rarely, Cavemen, with a Giant Spider on one level in six. A snake pit holds more Snakes, a dark level has Scarabs, and the Ghost comes to a level the player stays on too long.

Are there shops in the Mines in Spelunky Classic?

Yes, from level 2: level 2 always rolls one, level 3 two times in three and level 4 one time in two, but a level gets its shop only if a side room beside the path qualifies, and one with the path on its left only does in the rightmost column. The shop is one of seven kinds, each as likely.

Are there traps in the Mines in Spelunky Classic?

Yes. One stone block in four that faces open ground becomes an Arrow Trap, and there are Spikes, webs and, in an idol room, a Boulder.

See also

#

References

#
  1. scripts/scrInitLevel.gml:24-29
  2. objects/oPlayer1/other_animation_end.gml:72-86
  3. Clip mines/start
  4. scripts/scrRoomGen.gml:24-45
  5. scripts/scrInitLevel.gml:117-126
  6. scripts/scrLevelGen.gml:25-31
  7. scripts/scrLevelGen.gml:89-133
  8. scripts/scrRoomGen.gml:85-239
  9. scripts/scrRoomGen.gml:242-315
  10. scripts/scrRoomGen.gml:325-340
  11. scripts/scrRoomGen.gml:85-121
  12. scripts/scrRoomGen.gml:87-91
  13. scripts/scrRoomGen.gml:92-101
  14. scripts/scrLevelGen.gml:239-297
  15. scripts/scrLevelGen.gml:138-185
  16. scripts/scrClearGlobals.gml:55
  17. scripts/scrInitLevel.gml:167-174
  18. scripts/scrClearGlobals.gml:54
  19. Quirk 1 (docs/quirks.md)
  20. objects/oPlayer1/other_animation_end.gml:63-70
  21. Clip mines/exit
  22. scripts/scrEntityGen.gml:35-74
  23. scripts/scrEntityGen.gml:32-34
  24. scripts/scrEntityGen.gml:52-60
  25. scripts/scrEntityGen.gml:61-62
  26. scripts/scrEntityGen.gml:63
  27. scripts/scrEntityGen.gml:64
  28. scripts/scrEntityGen.gml:69
  29. scripts/scrEntityGen.gml:70
  30. objects/oGame/step.gml:39-46
  31. scripts/scrEntityGen.gml:145-171
  32. scripts/scrRoomGen.gml:273-284
  33. scripts/scrRoomGen.gml:343
  34. scripts/characterStepEvent.gml:294-305
  35. scripts/characterStepEvent.gml:743-748
  36. objects/oWeb/collision_oEnemy.gml:1-5
  37. objects/oWeb/collision_oItem.gml:1-5
  38. Replay fidelity/replays/mines-seed-5.txt
  39. scripts/scrRoomGen.gml:173-204
  40. scripts/scrTreasureGen.gml:26-29
  41. scripts/scrTreasureGen.gml:42-46
  42. scripts/scrTreasureGen.gml:47-94
  43. scripts/scrTreasureGen.gml:95-115
  44. scripts/scrTreasureGen.gml:116-133
  45. scripts/scrTreasureGen.gml:80-88
  46. objects/oBrick/create.gml:7-16
  47. objects/oBrick/destroy.gml:9-29
  48. scripts/scrInitLevel.gml:178-184
  49. scripts/scrRoomGen.gml:212-218
  50. scripts/scrRoomGen.gml:471-481
  51. objects/oTransition/create.gml:47-51
  52. scripts/scrRoomGen.gml:1-5
  53. scripts/scrLevelGen.gml:1-6
  54. scripts/scrLevelGen.gml:96-111
  55. Replay fidelity/replays/mines-seed-1.txt
  56. objects/oBrick/destroy.gml:18-29
  57. scripts/scrRoomGen.gml:363-369

Source code

  • scripts/scrInitLevel.gml
  • scripts/scrLevelGen.gml
  • scripts/scrRoomGen.gml
  • scripts/scrEntityGen.gml
  • scripts/scrTreasureGen.gml
  • objects/oBrick/create.gml
#