LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone




Semantics of atomic commands shared by client and server.




handleUpdAtomic :: MonadStateWrite m => UpdAtomic -> m () Source #

The game-state semantics of atomic game commands. There is no corresponding definition for special effects (SfxAtomic), because they don't modify State.

For each of the commands, we are guaranteed that the client, the command is addressed to, perceives all the positions the command affects (as computed by posUpdAtomic). In the code for each semantic function we additonally verify the client is aware of any relevant items and/or actors and we throw the AtomicFail exception if it's not. The server keeps copies of all clients' states and, before sending a command to a client, applies it to the client's state copy. If AtomicFail is signalled, the command is ignored for that client. This enables simpler server code that addresses commands to all clients that can see it, even though not all are able to process it.

Internal operations