Safe Haskell | None |
---|---|
Language | Haskell2010 |
The main loop of the server, processing human and computer player moves turn by turn.
- loopSer :: (MonadAtomic m, MonadServerReadRequest m) => DebugModeSer -> Config -> (Maybe SessionUI -> COps -> FactionId -> ChanServer -> IO ()) -> m ()
- factionArena :: MonadStateRead m => Faction -> m (Maybe LevelId)
- arenasForLoop :: MonadStateRead m => m [LevelId]
- handleFidUpd :: (MonadAtomic m, MonadServerReadRequest m) => Bool -> (FactionId -> m ()) -> FactionId -> Faction -> m Bool
- loopUpd :: forall m. (MonadAtomic m, MonadServerReadRequest m) => m () -> m ()
- endClip :: forall m. (MonadAtomic m, MonadServer m) => (FactionId -> m ()) -> m ()
- applyPeriodicLevel :: (MonadAtomic m, MonadServer m) => m ()
- handleTrajectories :: (MonadAtomic m, MonadServer m) => LevelId -> FactionId -> m ()
- hTrajectories :: (MonadAtomic m, MonadServer m) => (ActorId, Actor) -> m ()
- handleActors :: (MonadAtomic m, MonadServerReadRequest m) => LevelId -> FactionId -> m Bool
- hActors :: forall m. (MonadAtomic m, MonadServerReadRequest m) => FactionId -> [(ActorId, Actor)] -> m Bool
- gameExit :: (MonadAtomic m, MonadServerReadRequest m) => m ()
- restartGame :: (MonadAtomic m, MonadServer m) => m () -> m () -> Maybe (GroupName ModeKind) -> m ()
- writeSaveAll :: (MonadAtomic m, MonadServer m) => Bool -> m ()
- setTrajectory :: (MonadAtomic m, MonadServer m) => ActorId -> m ()
Documentation
:: (MonadAtomic m, MonadServerReadRequest m) | |
=> DebugModeSer | server debug parameters |
-> Config | |
-> (Maybe SessionUI -> COps -> 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
factionArena :: MonadStateRead m => Faction -> m (Maybe LevelId) Source #
arenasForLoop :: MonadStateRead m => m [LevelId] Source #
handleFidUpd :: (MonadAtomic m, MonadServerReadRequest m) => Bool -> (FactionId -> m ()) -> FactionId -> Faction -> m Bool Source #
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.
handleTrajectories :: (MonadAtomic m, MonadServer m) => LevelId -> FactionId -> m () Source #
hTrajectories :: (MonadAtomic m, MonadServer m) => (ActorId, Actor) -> m () Source #
handleActors :: (MonadAtomic m, MonadServerReadRequest m) => LevelId -> FactionId -> m Bool Source #
hActors :: forall m. (MonadAtomic m, MonadServerReadRequest m) => FactionId -> [(ActorId, Actor)] -> m Bool Source #
gameExit :: (MonadAtomic m, MonadServerReadRequest m) => m () Source #
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.