LambdaHack-0.2.1: A roguelike game engine in early and very active development

Safe HaskellSafe-Infered




Operations on the Area type that involve random numbers.


Picking points inside areas

xyInArea :: Area -> Rnd PointXYSource

Pick a random point within an area.



:: (X, Y)

minimum size

-> Area

the containing area, not the room itself

-> Rnd Area 

Create a random room according to given parameters.



:: Area

the area in which to pick the point

-> Rnd Area 

Create a void room, i.e., a single point area.

Choosing connections

connectGrid :: (X, Y) -> Rnd [(PointXY, PointXY)]Source

Pick a subset of connections between adjacent areas within a grid until there is only one connected component in the graph of all areas.

randomConnection :: (X, Y) -> Rnd (PointXY, PointXY)Source

Pick a single random connection between adjacent areas within a grid.

Plotting corridors

type Corridor = [PointXY]Source

The coordinates of consecutive fields of a corridor.

connectPlaces :: Area -> Area -> Rnd CorridorSource

Try to connect two places with a corridor. Choose entrances at least 4 tiles distant from the edges, if possible.