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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client.LoopM

Contents

- Internal operations

Description

The main loop of the client, processing human and computer player moves turn by turn.

Synopsis

- class MonadClient m => MonadClientReadResponse (m :: Type -> Type) where
  - receiveResponse :: m Response
- loopCli :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => CCUI -> UIOptions -> ClientOptions -> Bool -> m ()
- initAI :: MonadClient m => m ()
- initUI :: (MonadClient m, MonadClientUI m) => CCUI -> m ()
- loopAI :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => m ()
- longestDelay :: POSIXTime
- loopUI :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => POSIXTime -> m ()

# Documentation

class MonadClient m => MonadClientReadResponse (m :: Type -> Type) where Source #

Client monad in which one can receive responses from the server.

Methods

receiveResponse :: m Response Source #

#### Instances

Instances details

MonadClientReadResponse CliImplementation Source # |
Instance details Defined in Implementation.MonadClientImplementation Methods receiveResponse :: CliImplementation Response Source #

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`.

# Internal operations

initAI :: MonadClient m => m () Source #

initUI :: (MonadClient m, MonadClientUI m) => CCUI -> m () Source #

loopAI :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => m () Source #

longestDelay :: POSIXTime Source #

Alarm after this many seconds without server querying us for a command.

loopUI :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientReadResponse m, MonadClientWriteRequest m) => POSIXTime -> m () Source #

The argument is the time of last UI query from the server. After `longestDelay` seconds past this date, the client considers itself ignored and displays a warning and, at a keypress, gives direct control to the player, no longer waiting for the server to prompt it to do so.