LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




Hacks that haven't found their home yet.


Game object identifiers

data FactionId Source

A unique identifier of a faction in a game.

data LevelId Source

Abstract level identifiers.

newtype AbsDepth Source

Absolute depth in the dungeon. When used for the maximum depth of the whole dungeon, this can be different than dungeon size, e.g., when the dungeon is branched, and it can even be different than the length of the longest branch, if levels at some depths are missing.


AbsDepth Int 

data ActorId Source

A unique identifier of an actor in the dungeon.

Item containers

data Container Source

Item container type.


CFloor !LevelId !Point 
CEmbed !LevelId !Point 
CActor !ActorId !CStore 
CTrunk !FactionId !LevelId !Point

for bootstrapping actor bodies


normalLevelBound :: (Int, Int) Source

Level bounds. TODO: query terminal size instead and scroll view.

divUp :: Integral a => a -> a -> a infixl 7 Source

Integer division, rounding up.

type Freqs a = [(GroupName a, Int)] Source

For each group that the kind belongs to, denoted by a GroupName in the first component of a pair, the second component of a pair shows how common the kind is within the group.

breturn :: MonadPlus m => Bool -> a -> m a Source

breturn b a = [a | b]

type Rarity = [(Double, Int)] Source

Rarity on given depths.

data Tactic Source

Tactic of non-leader actors. Apart of determining AI operation, each tactic implies a skill modifier, that is added to the non-leader skills defined in fskillsOther field of Player.



if enemy nearby, attack, if no items, etc., explore unknown


always follow leader's target or his position if no target


follow but don't do any item management nor use


only melee and do ranged combat


only melee (or wait)


always only wait, even if enemy in melee range


if enemy nearby, attack, if no items, etc., roam randomly


find an open and uncrowded area, patrol it according to sight radius and fallback temporarily to TRoam when enemy is seen by the faction and is within the actor's sight radius TODO (currently the same as TExplore; should it chase targets too (TRoam) and only switch to TPatrol when none?)

Backward compatibility