LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




The server definitions for the server-client communication protocol.


The communication channels

type ConnServerDict = EnumMap FactionId ChanServer Source #

Connection information for all factions, indexed by faction identifier.

data ChanServer Source #

Connection channel between the server and a single client.

The server-client communication monad

class MonadServer m => MonadServerReadRequest m where Source #

The server monad with the ability to communicate with clients.

Minimal complete definition

getsDict, modifyDict, liftIO


getsDict :: (ConnServerDict -> a) -> m a Source #

modifyDict :: (ConnServerDict -> ConnServerDict) -> m () Source #

liftIO :: IO a -> m a Source #


sendUpdate :: (MonadServerAtomic m, MonadServerReadRequest m) => FactionId -> UpdAtomic -> m () Source #

If the AtomicFail conditions hold, send a command to client, otherwise do nothing.

sendUpdateCheck :: (MonadServerAtomic m, MonadServerReadRequest m) => FactionId -> UpdAtomic -> m () Source #

Send a command to client, crashing if the AtomicFail conditions don't hold when executed on the client's state.


updateConn :: (MonadServerAtomic m, MonadServerReadRequest m) => (Bool -> FactionId -> ChanServer -> IO ()) -> m () Source #

Update connections to the new definition of factions. Connect to clients in old or newly spawned threads that read and write directly to the channels.

Internal operations