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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client

Contents

- Re-exported from Game.LambdaHack.Client.LoopM
- Re-exported from Game.LambdaHack.Client.Request
- Re-exported from Game.LambdaHack.Client.Response
- Re-exported from Game.LambdaHack.Client.UI

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 -> Bool -> m ()
- type RequestAI = (ReqAI, Maybe ActorId)
- data ReqAI
  - = ReqAINop
  - | ReqAITimed RequestTimed
- type RequestUI = (ReqUI, Maybe ActorId)
- data ReqUI
  - = ReqUINop
  - | ReqUITimed RequestTimed
  - | ReqUIGameRestart (GroupName ModeKind) Challenge
  - | ReqUIGameDropAndExit
  - | ReqUIGameSaveAndExit
  - | ReqUIGameSave
  - | ReqUIDoctrine Doctrine
  - | ReqUIAutomate
- data RequestTimed
  - = ReqMove Vector
  - | ReqMelee ActorId ItemId CStore
  - | ReqDisplace ActorId
  - | ReqAlter Point
  - | ReqWait
  - | ReqWait10
  - | ReqYell
  - | ReqMoveItems [(ItemId, Int, CStore, CStore)]
  - | ReqProject Point Int ItemId CStore
  - | ReqApply ItemId CStore
- data Response
  - = RespUpdAtomicNoState UpdAtomic
  - | RespUpdAtomic State UpdAtomic
  - | RespQueryAI ActorId
  - | RespSfxAtomic SfxAtomic
  - | RespQueryUIunderAI
  - | RespQueryUI
- data CCUI
- data UIOptions
- applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions
- uOverrideCmdline :: UIOptions -> [String]
- mkUIOptions :: RuleContent -> ClientOptions -> IO UIOptions

# Re-exported from Game.LambdaHack.Client.LoopM

loopCli :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => CCUI -> UIOptions -> ClientOptions -> Bool -> 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.

Constructors

ReqAINop |
ReqAITimed RequestTimed |

#### Instances

Instances details

Show ReqAI Source # |
Instance details Defined in Game.LambdaHack.Client.Request Methods showsPrec :: Int -> ReqAI -> ShowS Source # show :: ReqAI -> String Source # showList :: [ReqAI] -> ShowS Source #

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 ReqUI Source #

Possible forms of requests sent by UI clients.

Constructors

ReqUINop |
ReqUITimed RequestTimed |
ReqUIGameRestart (GroupName ModeKind) Challenge |
ReqUIGameDropAndExit |
ReqUIGameSaveAndExit |
ReqUIGameSave |
ReqUIDoctrine Doctrine |
ReqUIAutomate |

#### Instances

Instances details

Show ReqUI Source # |
Instance details Defined in Game.LambdaHack.Client.Request Methods showsPrec :: Int -> ReqUI -> ShowS Source # show :: ReqUI -> String Source # showList :: [ReqUI] -> ShowS Source #

data RequestTimed Source #

Requests that take game time.

Constructors

ReqMove Vector |
ReqMelee ActorId ItemId CStore |
ReqDisplace ActorId |
ReqAlter Point |
ReqWait |
ReqWait10 |
ReqYell |
ReqMoveItems [(ItemId, Int, CStore, CStore)] |
ReqProject Point Int ItemId CStore |
ReqApply ItemId CStore |

#### Instances

Instances details

Show RequestTimed Source # |
Instance details Defined in Game.LambdaHack.Client.Request Methods showsPrec :: Int -> RequestTimed -> ShowS Source # show :: RequestTimed -> String Source # showList :: [RequestTimed] -> ShowS Source #

# 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.)
RespQueryUIunderAI | check if the UI client wants to regain control
RespQueryUI | prompt the human player for a command and send (the semantics of) it

#### Instances

Instances details

Show Response Source # |
Instance details Defined in Game.LambdaHack.Client.Response Methods showsPrec :: Int -> Response -> ShowS Source # show :: Response -> String Source # showList :: [Response] -> ShowS Source #

# Re-exported from Game.LambdaHack.Client.UI

data CCUI Source #

Operations for all UI content types, gathered together.

data UIOptions Source #

Options that affect the UI of the client, specified in the config file. More documentation is in the default config file.

#### Instances

Instances details

Binary UIOptions Source # |
Instance details Defined in Game.LambdaHack.Client.UI.UIOptions Methods put :: UIOptions -> Put Source # get :: Get UIOptions Source # putList :: [UIOptions] -> Put Source #
NFData UIOptions Source # |
Instance details Defined in Game.LambdaHack.Client.UI.UIOptions Methods rnf :: UIOptions -> () Source #
Generic UIOptions Source # |

Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

Associated Types

type Rep UIOptions |

Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

type Rep UIOptions = D1 ('MetaData "UIOptions" "Game.LambdaHack.Client.UI.UIOptions" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" '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 "uLeftHand") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uChosenFontset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "uAllFontsScale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "uFullscreenMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FullscreenMode) :*: S1 ('MetaSel ('Just "uhpWarningPercent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: (((S1 ('MetaSel ('Just "uMsgWrapColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 X) :*: S1 ('MetaSel ('Just "uHistoryMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "uMaxFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "uNoAnim") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uOverrideCmdline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "uFonts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontDefinition)])) :*: (S1 ('MetaSel ('Just "uFontsets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontSet)]) :*: S1 ('MetaSel ('Just "uMessageColors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(String, Color)]))))))

Methods

from :: UIOptions -> Rep UIOptions x Source #

to :: Rep UIOptions x -> UIOptions Source #

Show UIOptions Source # |
Instance details Defined in Game.LambdaHack.Client.UI.UIOptions Methods showsPrec :: Int -> UIOptions -> ShowS Source # show :: UIOptions -> String Source # showList :: [UIOptions] -> ShowS Source #
type Rep UIOptions Source # |

Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

type Rep UIOptions = D1 ('MetaData "UIOptions" "Game.LambdaHack.Client.UI.UIOptions" "LambdaHack-0.11.0.1-BLuOaw8nuizISmzkanqI8h" '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 "uLeftHand") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uChosenFontset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "uAllFontsScale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "uFullscreenMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FullscreenMode) :*: S1 ('MetaSel ('Just "uhpWarningPercent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: (((S1 ('MetaSel ('Just "uMsgWrapColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 X) :*: S1 ('MetaSel ('Just "uHistoryMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "uMaxFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "uNoAnim") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uOverrideCmdline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "uFonts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontDefinition)])) :*: (S1 ('MetaSel ('Just "uFontsets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontSet)]) :*: S1 ('MetaSel ('Just "uMessageColors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(String, Color)]))))))

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

Modify client options with UI options.

uOverrideCmdline :: UIOptions -> [String] Source #

mkUIOptions :: RuleContent -> ClientOptions -> IO UIOptions Source #

Read and parse UI config file.