LambdaHack-0.4.99.0: A game engine library for roguelike dungeon crawlers

Safe HaskellNone

Game.LambdaHack.Server.ProtocolServer

Contents

Description

The server definitions for the server-client communication protocol.

Synopsis

The communication channels

data ChanServer resp req Source

Connection channel between the server and a single client.

Constructors

ChanServer 

Fields

responseS :: !(TQueue resp)
 
requestS :: !(TQueue req)
 

type ConnServerDict = EnumMap FactionId ConnServerFactionSource

Connection information for all factions, indexed by faction identifier.

The server-client communication monad

class MonadServer m => MonadServerReadRequest m whereSource

The server monad with the ability to communicate with clients.

Protocol

Assorted

updateConn :: (MonadAtomic m, MonadServerReadRequest m) => (FactionId -> ChanServer ResponseUI RequestUI -> IO ()) -> (FactionId -> ChanServer ResponseAI RequestAI -> 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.

type ConnServerFaction = (Maybe (ChanServer ResponseUI RequestUI), ChanServer ResponseAI RequestAI)Source

Connections to the human-controlled client of a faction and to the AI client for the same faction.