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

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client

Contents

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

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.

data ReqAI Source #

Possible forms of requests sent by AI clients.

Instances

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.

data RequestAnyAbility Source #

Basic form of requests, sent by both AI and UI clients to the server.

data RequestTimed :: Ability -> * where Source #

Requests that take game time, indexed by actor ability that is needed for performing the corresponding actions.

Re-exported from Game.LambdaHack.Client.Response

data Response Source #

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 State by performing this atomic update

RespUpdAtomic State UpdAtomic

put the given State, which results from performing the atomic update

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

Eq ClientOptions Source # 
Show ClientOptions Source # 
Generic ClientOptions Source # 

Associated Types

type Rep ClientOptions :: * -> * #

Binary ClientOptions Source # 
type Rep ClientOptions Source # 
type Rep ClientOptions = D1 * (MetaData "ClientOptions" "Game.LambdaHack.Client.ClientOptions" "LambdaHack-0.7.0.0-3XPyz9bw1i28qJIoWU6CaM" False) (C1 * (MetaCons "ClientOptions" PrefixI True) ((:*:) * ((:*:) * ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "sgtkFontFamily") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Text))) (S1 * (MetaSel (Just Symbol "sdlFontFile") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Text)))) ((:*:) * (S1 * (MetaSel (Just Symbol "sdlTtfSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int))) ((:*:) * (S1 * (MetaSel (Just Symbol "sdlFonSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int))) (S1 * (MetaSel (Just Symbol "sfontSize") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int)))))) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "scolorIsBold") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Bool))) (S1 * (MetaSel (Just Symbol "smaxFps") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int)))) ((:*:) * (S1 * (MetaSel (Just Symbol "sdisableAutoYes") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) ((:*:) * (S1 * (MetaSel (Just Symbol "snoAnim") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Bool))) (S1 * (MetaSel (Just Symbol "snewGameCli") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)))))) ((:*:) * ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "sbenchmark") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) (S1 * (MetaSel (Just Symbol "stitle") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Text)))) ((:*:) * (S1 * (MetaSel (Just Symbol "sfontDir") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe FilePath))) ((:*:) * (S1 * (MetaSel (Just Symbol "ssavePrefixCli") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * String)) (S1 * (MetaSel (Just Symbol "sfrontendTeletype") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool))))) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "sfrontendNull") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) (S1 * (MetaSel (Just Symbol "sfrontendLazy") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool))) ((:*:) * (S1 * (MetaSel (Just Symbol "sdbgMsgCli") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) ((:*:) * (S1 * (MetaSel (Just Symbol "sstopAfterSeconds") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int))) (S1 * (MetaSel (Just Symbol "sstopAfterFrames") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * (Maybe Int)))))))))

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

data KeyKind Source #

Key-command mappings to be specified in content and used for the UI.

data UIOptions Source #

Options that affect the UI of the client.

Instances

Show UIOptions Source # 
Generic UIOptions Source # 

Associated Types

type Rep UIOptions :: * -> * #

Binary UIOptions Source # 
NFData UIOptions Source # 

Methods

rnf :: UIOptions -> () #

type Rep UIOptions Source # 
type Rep UIOptions = D1 * (MetaData "UIOptions" "Game.LambdaHack.Client.UI.UIOptions" "LambdaHack-0.7.0.0-3XPyz9bw1i28qJIoWU6CaM" False) (C1 * (MetaCons "UIOptions" PrefixI True) ((:*:) * ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "uCommands") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * [(KM, CmdTriple)])) ((:*:) * (S1 * (MetaSel (Just Symbol "uHeroNames") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * [(Int, (Text, Text))])) (S1 * (MetaSel (Just Symbol "uVi") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)))) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "uLaptop") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) (S1 * (MetaSel (Just Symbol "uGtkFontFamily") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Text))) ((:*:) * (S1 * (MetaSel (Just Symbol "uSdlFontFile") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Text)) (S1 * (MetaSel (Just Symbol "uSdlTtfSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int))))) ((:*:) * ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "uSdlFonSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int)) (S1 * (MetaSel (Just Symbol "uFontSize") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int))) ((:*:) * (S1 * (MetaSel (Just Symbol "uColorIsBold") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) (S1 * (MetaSel (Just Symbol "uHistoryMax") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int)))) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "uMaxFps") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Int)) (S1 * (MetaSel (Just Symbol "uNoAnim") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool))) ((:*:) * (S1 * (MetaSel (Just Symbol "uRunStopMsgs") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * Bool)) (S1 * (MetaSel (Just Symbol "uCmdline") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 * [String])))))))

applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions Source #

Modify client options with UI options.

uCmdline :: UIOptions -> [String] Source #

Hardwired commandline arguments to process.

mkUIOptions :: COps -> Bool -> IO UIOptions Source #

Read and parse UI config file.