LambdaHack-0.4.99.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone

Game.LambdaHack.Server.DungeonGen.AreaRnd

Contents

Description

Operations on the Area type that involve random numbers.

Synopsis

Picking points inside areas

xyInArea :: Area -> Rnd PointSource

Pick a random point within an area.

mkRoomSource

Arguments

:: (X, Y)

minimum size

-> (X, Y)

maximum size

-> Area

the containing area, not the room itself

-> Rnd Area 

Create a random room according to given parameters.

mkVoidRoom :: Area -> Rnd AreaSource

Create a void room, i.e., a single point area within the designated area.

Choosing connections

connectGrid :: (X, Y) -> Rnd [(Point, Point)]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 (Point, Point)Source

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

Plotting corridors

type Corridor = [Point]Source

The coordinates of consecutive fields of a corridor.

connectPlaces :: (Area, Area) -> (Area, Area) -> Rnd CorridorSource

Try to connect two interiors of places with a corridor. Choose entrances at least 4 or 3 tiles distant from the edges, if the place is big enough. Note that with pfence == FNone, the area considered is the strict interior of the place, without the outermost tiles.