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

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Server.ProtocolM

Contents

Description

The server definitions for the server-client communication protocol.

Synopsis

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

Methods

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

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

liftIO :: IO a -> m a Source #

Protocol

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.

Assorted

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