Safe Haskell | None |
---|---|
Language | Haskell2010 |
Game.LambdaHack.Client
Description
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) => CCUI -> UIOptions -> ClientOptions -> m ()
- type RequestAI = (ReqAI, Maybe ActorId)
- data ReqAI
- type RequestUI = (ReqUI, Maybe ActorId)
- data ReqUI
- data RequestTimed
- data Response
- data ClientOptions = ClientOptions {
- sgtkFontFamily :: Maybe Text
- sdlFontFile :: Maybe Text
- sdlScalableSizeAdd :: Maybe Int
- sdlBitmapSizeAdd :: Maybe Int
- sscalableFontSize :: Maybe Int
- slogPriority :: Maybe Int
- smaxFps :: Maybe Int
- sdisableAutoYes :: Bool
- snoAnim :: Maybe Bool
- snewGameCli :: Bool
- sbenchmark :: Bool
- stitle :: Maybe Text
- sfontDir :: Maybe FilePath
- ssavePrefixCli :: String
- sfrontendTeletype :: Bool
- sfrontendNull :: Bool
- sfrontendLazy :: Bool
- sdbgMsgCli :: Bool
- sstopAfterSeconds :: Maybe Int
- sstopAfterFrames :: Maybe Int
- sprintEachScreen :: Bool
- sexposePlaces :: Bool
- sexposeItems :: Bool
- sexposeActors :: Bool
- defClientOptions :: ClientOptions
- data CCUI
- 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) => CCUI -> 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.
Constructors
ReqAINop | |
ReqAITimed RequestTimed |
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 RequestTimed Source #
Requests that take game time.
Constructors
Instances
Show RequestTimed Source # | |
Defined in Game.LambdaHack.Client.Request Methods showsPrec :: Int -> RequestTimed -> ShowS # show :: RequestTimed -> String # showList :: [RequestTimed] -> 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.
Constructors
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).
Constructors
ClientOptions | |
Fields
|
Instances
Eq ClientOptions Source # | |
Defined in Game.LambdaHack.Client.ClientOptions Methods (==) :: ClientOptions -> ClientOptions -> Bool # (/=) :: ClientOptions -> ClientOptions -> Bool # | |
Show ClientOptions Source # | |
Defined in Game.LambdaHack.Client.ClientOptions Methods showsPrec :: Int -> ClientOptions -> ShowS # show :: ClientOptions -> String # showList :: [ClientOptions] -> ShowS # | |
Generic ClientOptions Source # | |
Defined in Game.LambdaHack.Client.ClientOptions Associated Types type Rep ClientOptions :: Type -> Type | |
Binary ClientOptions Source # | |
Defined in Game.LambdaHack.Client.ClientOptions | |
type Rep ClientOptions Source # | |
Defined in Game.LambdaHack.Client.ClientOptions type Rep ClientOptions = D1 ('MetaData "ClientOptions" "Game.LambdaHack.Client.ClientOptions" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" 'False) (C1 ('MetaCons "ClientOptions" 'PrefixI 'True) ((((S1 ('MetaSel ('Just "sgtkFontFamily") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "sdlFontFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "sdlScalableSizeAdd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)))) :*: (S1 ('MetaSel ('Just "sdlBitmapSizeAdd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "sscalableFontSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "slogPriority") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int))))) :*: ((S1 ('MetaSel ('Just "smaxFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "sdisableAutoYes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "snoAnim") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Bool)))) :*: (S1 ('MetaSel ('Just "snewGameCli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "sbenchmark") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "stitle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)))))) :*: (((S1 ('MetaSel ('Just "sfontDir") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe FilePath)) :*: (S1 ('MetaSel ('Just "ssavePrefixCli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 String) :*: S1 ('MetaSel ('Just "sfrontendTeletype") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: (S1 ('MetaSel ('Just "sfrontendNull") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "sfrontendLazy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "sdbgMsgCli") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool)))) :*: ((S1 ('MetaSel ('Just "sstopAfterSeconds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: (S1 ('MetaSel ('Just "sstopAfterFrames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Int)) :*: S1 ('MetaSel ('Just "sprintEachScreen") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: (S1 ('MetaSel ('Just "sexposePlaces") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: (S1 ('MetaSel ('Just "sexposeItems") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "sexposeActors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))))))) |
defClientOptions :: ClientOptions Source #
Default value of client options.
Re-exported from Game.LambdaHack.Client.UI
Options that affect the UI of the client.
Instances
Show UIOptions Source # | |
Generic UIOptions Source # | |
NFData UIOptions Source # | |
Defined in Game.LambdaHack.Client.UI.UIOptions | |
Binary UIOptions Source # | |
type Rep UIOptions Source # | |
Defined in Game.LambdaHack.Client.UI.UIOptions type Rep UIOptions = D1 ('MetaData "UIOptions" "Game.LambdaHack.Client.UI.UIOptions" "LambdaHack-0.9.5.0-4ovYxwv1jih9UUX4cyhTOG" 'False) (C1 ('MetaCons "UIOptions" 'PrefixI 'True) (((S1 ('MetaSel ('Just "uCommands") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(KM, CmdTriple)]) :*: (S1 ('MetaSel ('Just "uHeroNames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Int, (Text, Text))]) :*: S1 ('MetaSel ('Just "uVi") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uLaptop") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "uGtkFontFamily") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "uSdlFontFile") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "uSdlScalableSizeAdd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: (((S1 ('MetaSel ('Just "uSdlBitmapSizeAdd") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "uScalableFontSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "uHistoryMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "uMaxFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))) :*: ((S1 ('MetaSel ('Just "uNoAnim") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "uhpWarningPercent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "uMessageColors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [(MsgClass, Color)])) :*: S1 ('MetaSel ('Just "uCmdline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [String])))))) |
applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions Source #
Modify client options with UI options.