LambdaHack-0.10.3.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Server.DungeonGen.Cave

Description

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

Synopsis

Documentation

data Cave Source #

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

Constructors

Cave 

Fields

Instances

Instances details
Show Cave Source # 
Instance details

Defined in Game.LambdaHack.Server.DungeonGen.Cave

Methods

showsPrec :: Int -> Cave -> ShowS #

show :: Cave -> String #

showList :: [Cave] -> ShowS #

buildCave Source #

Arguments

:: COps

content definitions

-> AbsDepth

depth of the level to generate

-> AbsDepth

absolute depth

-> Area

map area of the cave

-> Word32

secret tile seed

-> ContentId CaveKind

cave kind to use for generation

-> (X, Y)

the dimensions of the grid of places

-> EnumMap Point SpecialArea

pos of stairs, etc.

-> [Point]

boot positions to be treated as fixed

-> 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