LambdaHack- A roguelike game engine in early and active development

Safe HaskellNone




Server and client game state types and operations.


Basic game state, local or global

data State Source

View on game state. Remembered fields carry a subset of the info in the client copies of the state. Clients never directly change their State, but apply atomic actions sent by the server to do so.


State components

State operations

defStateGlobal :: Dungeon -> Int -> FactionDict -> COps -> ScoreTable -> StateSource

Initial complete global game state.

emptyState :: StateSource

Initial empty state.

localFromGlobal :: State -> StateSource

Local state created by removing secret information from global state components.

updateDungeon :: (Dungeon -> Dungeon) -> State -> StateSource

Update dungeon data within state.

updateDepth :: (Int -> Int) -> State -> StateSource

Update dungeon depth.

updateActorD :: (ActorDict -> ActorDict) -> State -> StateSource

Update the actor dictionary.

updateItemD :: (ItemDict -> ItemDict) -> State -> StateSource

Update the item dictionary.

updateFaction :: (FactionDict -> FactionDict) -> State -> StateSource

Update faction data within state.

updateTime :: (Time -> Time) -> State -> StateSource

Update global time within state.

updateCOps :: (COps -> COps) -> State -> StateSource

Update content data within state.

getLocalTime :: LevelId -> State -> TimeSource

Get current time from the dungeon data.

isSpawnFaction :: FactionId -> State -> BoolSource

Tell whether the faction can spawn actors.

isSummonFaction :: FactionId -> State -> BoolSource

Tell whether actors of the faction can be summoned by items, etc..