LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




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



loopSer Source #


:: (MonadServerAtomic m, MonadServerReadRequest m) 
=> ServerOptions

player-supplied server options

-> (Bool -> FactionId -> ChanServer -> IO ())

function that initializes a client and runs its main loop

-> m () 

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

The loop is started in server state that is empty, see emptyStateServer.

Internal operations

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

Handle a clip (the smallest fraction of a game turn for which a frame may potentially be generated). Run the leader and other actors moves. Eventually advance the time and repeat.

endClip :: forall m. MonadServerAtomic m => (FactionId -> m ()) -> m () Source #

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

manageCalmAndDomination :: MonadServerAtomic m => ActorId -> Actor -> m () Source #

Check if the given actor is dominated and update his calm.

applyPeriodicLevel :: MonadServerAtomic m => m () Source #

Trigger periodic items for all actors on the given level.

setTrajectory :: MonadServerAtomic 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.

restartGame :: MonadServerAtomic m => m () -> m () -> Maybe (GroupName ModeKind) -> m () Source #