LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




Generation of caves (not yet inhabited dungeon levels) from cave kinds.



data Cave Source #

The type of caves (not yet inhabited dungeon levels).





buildCave Source #


:: COps

content definitions

-> AbsDepth

depth of the level to generate

-> AbsDepth

absolute depth

-> Int

secret tile seed

-> Id CaveKind

cave kind to use for generation

-> EnumMap Point (GroupName PlaceKind)

pos of stairs, etc.

-> Rnd Cave 

Generate a cave using an algorithm inspired by the original Rogue, as follows (in gross simplification):

  • The available area is divided into a grid, e.g, 3 by 3, where each of the 9 grid cells has approximately the same size.
  • In some of the 9 grid cells a room is placed at a random position and with a random size, but larger than the minimum size, e.g, 2 by 2 floor tiles.
  • Rooms that are on horizontally or vertically adjacent grid cells may be connected by a corridor. Corridors consist of 3 segments of straight lines (either "horizontal, vertical, horizontal" or "vertical, horizontal, vertical"). They end in openings in the walls of the room they connect. It is possible that one or two of the 3 segments have length 0, such that the resulting corridor is L-shaped or even a single straight line.
  • Corridors are generated randomly in such a way that at least every room on the grid is connected, and a few more might be. It is not sufficient to always connect all adjacent rooms, because not each cell holds a room.

Internal operations