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

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Server.LoopM

Contents

Description

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

Synopsis

Documentation

loopSer Source #

Arguments

:: (MonadAtomic m, MonadServerReadRequest m) 
=> DebugModeSer

server debug parameters

-> Config 
-> (Maybe SessionUI -> FactionId -> ChanServer -> IO ())

the code to run for UI clients

-> m () 

Start a game session, including the clients, and then loop, communicating with the clients.

Internal operations

loopUpd :: forall m. (MonadAtomic m, MonadServerReadRequest m) => m () -> m () Source #

Handle a clip (a part of a turn for which one or more frames will be generated). Run the leader and other actors moves. Eventually advance the time and repeat.

endClip :: forall m. (MonadAtomic m, MonadServer m) => (FactionId -> m ()) -> m () Source #

Handle the end of every clip. Do whatever has to be done every fixed number of time units, e.g., monster generation. Advance time. Perform periodic saves, if applicable.

applyPeriodicLevel :: (MonadAtomic m, MonadServer m) => m () Source #

Trigger periodic items for all actors on the given level.

restartGame :: (MonadAtomic m, MonadServer m) => m () -> m () -> Maybe (GroupName ModeKind) -> m () Source #

writeSaveAll :: (MonadAtomic m, MonadServer m) => Bool -> m () Source #

Save game on server and all clients.

setTrajectory :: (MonadAtomic m, MonadServer m) => ActorId -> m () Source #

Manage trajectory of a projectile.

Colliding with a wall or actor doesn't take time, because the projectile does not move (the move is blocked). Not advancing time forces dead projectiles to be destroyed ASAP. Otherwise, with some timings, it can stay on the game map dead, blocking path of human-controlled actors and alarming the hapless human.