LambdaHack- A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone




Generation of places from place kinds.



data Place Source #

The parameters of a place. All are immutable and rolled and fixed at the time when a place is generated.


Show Place Source # 
Instance details

Defined in Game.LambdaHack.Server.DungeonGen.Place


showsPrec :: Int -> Place -> ShowS #

show :: Place -> String #

showList :: [Place] -> ShowS #

type TileMapEM = EnumMap Point (ContentId TileKind) Source #

The map of tile kinds in a place (and generally anywhere in a cave). The map is sparse. The default tile that eventually fills the empty spaces is specified in the cave kind specification with cdefTile.

buildPlace Source #


:: COps

the game content

-> CaveKind

current cave kind

-> Bool

whether the cave is dark

-> ContentId TileKind

dark fence tile, if fence hollow

-> ContentId TileKind

lit fence tile, if fence hollow

-> AbsDepth

current level depth

-> AbsDepth

absolute depth

-> Int

secret tile seed

-> Area

whole area of the place, fence included

-> Maybe Area

whole inner area of the grid cell

-> Freqs PlaceKind

optional fixed place freq

-> Rnd Place 

Given a few parameters, roll and construct a Place datastructure and fill a cave section acccording to it.

buildFenceRnd :: COps -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> GroupName TileKind -> Area -> Rnd TileMapEM Source #

Construct a fence around an area, with the given tile group.

Internal operations

placeCheck Source #


:: Area

the area to fill

-> PlaceKind

the kind of place to construct

-> Bool 

For CAlternate tiling, require the place be comprised of an even number of whole corners, with exactly one square overlap between consecutive coners and no trimming. For other tiling methods, check that the area is large enough for tiling the corner twice in each direction, with a possible one row/column overlap.

interiorArea :: PlaceKind -> Area -> Maybe Area Source #

Calculate interior room area according to fence type, based on the total area for the room and it's fence. This is used for checking if the room fits in the area, for digging up the place and the fence and for deciding if the room is dark or lit later in the dungeon generation process.

olegend :: COps -> GroupName TileKind -> Rnd (EnumMap Char (Int, Int, ContentId TileKind), EnumMap Char (ContentId TileKind)) Source #

Roll a legend of a place plan: a map from plan symbols to tile kinds.

buildFence :: COps -> CaveKind -> Bool -> ContentId TileKind -> ContentId TileKind -> Bool -> Fence -> Area -> Rnd TileMapEM Source #

Construct a fence around a place.

buildFenceMap :: ContentId TileKind -> ContentId TileKind -> Area -> TileMapEM Source #

Construct a fence around an area, with the given tile kind. Corners have a different kind, e.g., to avoid putting doors there.

tilePlace Source #


:: Area

the area to fill

-> PlaceKind

the place kind to construct

-> Rnd (EnumMap Point Char) 

Create a place by tiling patterns.