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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client.HandleResponseM

Description

Semantics of responses sent by the server to clients.

Synopsis

- class MonadClient m => MonadClientAtomic (m :: Type -> Type) where
  - execUpdAtomic :: UpdAtomic -> m ()
  - execPutState :: State -> m ()
- class MonadClient m => MonadClientWriteRequest (m :: Type -> Type) where
  - sendRequestAI :: RequestAI -> m ()
  - sendRequestUI :: RequestUI -> m ()
  - clientHasUI :: m Bool
- handleResponse :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientWriteRequest m) => Response -> m ()

# Documentation

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

Monad for executing atomic game state transformations on a client.

Methods

execUpdAtomic :: UpdAtomic -> m () Source #

Execute an atomic update that changes the client's `State`.

execPutState :: State -> m () Source #

Put state that is intended to be the result of performing an atomic update by the server on its copy of the client's `State`.

#### Instances

Instances details

MonadClientAtomic CliImplementation Source # |
Instance details Defined in Implementation.MonadClientImplementation Methods execUpdAtomic :: UpdAtomic -> CliImplementation () Source # execPutState :: State -> CliImplementation () Source #

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

Client monad in which one can send requests to the client.

Methods

sendRequestAI :: RequestAI -> m () Source #

sendRequestUI :: RequestUI -> m () Source #

clientHasUI :: m Bool Source #

#### Instances

Instances details

MonadClientWriteRequest CliImplementation Source # |
Instance details Defined in Implementation.MonadClientImplementation Methods sendRequestAI :: RequestAI -> CliImplementation () Source # sendRequestUI :: RequestUI -> CliImplementation () Source # clientHasUI :: CliImplementation Bool Source #

handleResponse :: (MonadClientSetup m, MonadClientUI m, MonadClientAtomic m, MonadClientWriteRequest m) => Response -> m () Source #

Handle server responses.

Note that for clients communicating with the server over the net, `RespUpdAtomicNoState` should be used, because executing a single command is cheaper than sending the whole state over the net. However, for the standalone exe mode, with clients in the same process as the server, a pointer to the state set with `execPutState` is cheaper.