LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




Ways for the client to use player input via UI to produce server requests, based on the client's view (visualized for the player) of the game state.


Client UI monad

class MonadClient m => MonadClientUI m Source

Minimal complete definition

getsSession, liftIO


Assorted UI operations

queryUI :: MonadClientUI m => m RequestUI Source

Handle the move of a UI player.

pongUI :: MonadClientUI m => m RequestUI Source

Client signals to the server that it's still online, flushes frames (if needed) and sends some extra info.

displayRespUpdAtomicUI :: MonadClientUI m => Bool -> State -> StateClient -> UpdAtomic -> m () Source

Visualize atomic actions sent to the client. This is done in the global state after the command is executed and after the client state is modified by the command.

displayRespSfxAtomicUI :: MonadClientUI m => Bool -> SfxAtomic -> m () Source

Display special effects (text, animation) sent to the client.


srtFrontend :: (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerUI -> IO ()) -> (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerAI -> IO ()) -> KeyKind -> COps -> DebugModeCli -> ((FactionId -> chanServerUI -> IO ()) -> (FactionId -> chanServerAI -> IO ()) -> IO ()) -> IO () Source

Wire together game content, the main loop of game clients, the main game loop assigned to this frontend (possibly containing the server loop, if the whole game runs in one process), UI config and the definitions of game commands.

data KeyKind Source

Key-command mappings to be used for the UI.

data SessionUI Source

The information that is constant across a client playing session, including many consecutive games in a single session, but is completely disregarded and reset when a new playing session starts. Auxiliary AI and computer player clients have no sfs nor sbinding.

Operations exposed for LoopClient

data ColorMode Source

Color mode for the display.



normal, with full colours


black+white only

displayMore :: MonadClientUI m => ColorMode -> Msg -> m Bool Source

Display a message with a -more- prompt. Return value indicates if the player tried to cancel/escape.

msgAdd :: MonadClientUI m => Msg -> m () Source

Add a message to the current report.

humanCommand :: forall m. MonadClientUI m => Maybe Msg -> m RequestUI Source

Determine and process the next human player command. The argument is the last stop message due to running, if any.