Safe Haskell | None |
---|---|
Language | Haskell2010 |
Semantics of responses that are sent from server to clients, in terms of client state transformations, and semantics of human commands and AI moves, in terms of requests to be sent from the client to the server.
See https://github.com/LambdaHack/LambdaHack/wiki/Client-server-architecture.
Synopsis
- loopCli :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => KeyKind -> UIOptions -> ClientOptions -> m ()
- type RequestAI = (ReqAI, Maybe ActorId)
- data ReqAI
- type RequestUI = (ReqUI, Maybe ActorId)
- data ReqUI
- data RequestAnyAbility = RequestAnyAbility (RequestTimed a)
- data RequestTimed :: Ability -> * where
- ReqMove :: Vector -> RequestTimed AbMove
- ReqMelee :: ActorId -> ItemId -> CStore -> RequestTimed AbMelee
- ReqDisplace :: ActorId -> RequestTimed AbDisplace
- ReqAlter :: Point -> RequestTimed AbAlter
- ReqWait :: RequestTimed AbWait
- ReqWait10 :: RequestTimed AbWait
- ReqMoveItems :: [(ItemId, Int, CStore, CStore)] -> RequestTimed AbMoveItem
- ReqProject :: Point -> Int -> ItemId -> CStore -> RequestTimed AbProject
- ReqApply :: ItemId -> CStore -> RequestTimed AbApply
- data Response
- data ClientOptions
- defClientOptions :: ClientOptions
- sbenchmark :: ClientOptions -> Bool
- data KeyKind
- data UIOptions
- applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions
- uCmdline :: UIOptions -> [String]
- mkUIOptions :: COps -> Bool -> IO UIOptions
Re-exported from Game.LambdaHack.Client.LoopM
loopCli :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => KeyKind -> UIOptions -> ClientOptions -> m () Source #
The main game loop for an AI or UI client. It receives responses from the server, changes internal client state accordingly, analyzes ensuing human or AI commands and sends resulting requests to the server. Depending on whether it's an AI or UI client, it sends AI or human player requests.
The loop is started in client state that is empty except for
the sside
and seps
fields, see emptyStateClient
.
Re-exported from Game.LambdaHack.Client.Request
type RequestAI = (ReqAI, Maybe ActorId) Source #
Requests sent by AI clients to the server. If faction leader is to be changed, it's included as the second component.
Possible forms of requests sent by AI clients.
type RequestUI = (ReqUI, Maybe ActorId) Source #
Requests sent by UI clients to the server. If faction leader is to be changed, it's included as the second component.
Possible forms of requests sent by UI clients.
data RequestAnyAbility Source #
Basic form of requests, sent by both AI and UI clients to the server.
Instances
Show RequestAnyAbility Source # | |
Defined in Game.LambdaHack.Client.Request showsPrec :: Int -> RequestAnyAbility -> ShowS # show :: RequestAnyAbility -> String # showList :: [RequestAnyAbility] -> ShowS # |
data RequestTimed :: Ability -> * where Source #
Requests that take game time, indexed by actor ability that is needed for performing the corresponding actions.
ReqMove :: Vector -> RequestTimed AbMove | |
ReqMelee :: ActorId -> ItemId -> CStore -> RequestTimed AbMelee | |
ReqDisplace :: ActorId -> RequestTimed AbDisplace | |
ReqAlter :: Point -> RequestTimed AbAlter | |
ReqWait :: RequestTimed AbWait | |
ReqWait10 :: RequestTimed AbWait | |
ReqMoveItems :: [(ItemId, Int, CStore, CStore)] -> RequestTimed AbMoveItem | |
ReqProject :: Point -> Int -> ItemId -> CStore -> RequestTimed AbProject | |
ReqApply :: ItemId -> CStore -> RequestTimed AbApply |
Instances
Show (RequestTimed a) Source # | |
Defined in Game.LambdaHack.Client.Request showsPrec :: Int -> RequestTimed a -> ShowS # show :: RequestTimed a -> String # showList :: [RequestTimed a] -> ShowS # |
Re-exported from Game.LambdaHack.Client.Response
Abstract syntax of responses sent by server to an AI or UI client (or a universal client that can handle both roles, which is why this type is not separated into distinct AI and UI types). A response tells a client how to update game state or what information to send to the server.
RespUpdAtomicNoState UpdAtomic | change |
RespUpdAtomic State UpdAtomic | put the given |
RespQueryAI ActorId | compute an AI move for the actor and send (the semantics of) it |
RespSfxAtomic SfxAtomic | perform special effects (animations, messages, etc.) |
RespQueryUI | prompt the human player for a command and send (the semantics of) it |
Re-exported from Game.LambdaHack.Client.ClientOptions
data ClientOptions Source #
Options that affect the behaviour of the client (but not game rules).
Instances
defClientOptions :: ClientOptions Source #
Default value of client options.
sbenchmark :: ClientOptions -> Bool Source #
Don't create directories and files and show time stats.
Re-exported from Game.LambdaHack.Client.UI
Options that affect the UI of the client.
Instances
applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions Source #
Modify client options with UI options.