flaw-game-0.1.0.0

LicenseMIT
Safe HaskellSafe
LanguageHaskell2010

Flaw.Game.Lockstep

Description

 
Synopsis

Documentation

class Lockstep a where Source #

Lockstep synchronization. Allows to support rich state between server and client, using small amount of data sent over network thanks to deterministic step function.

Minimal complete definition

lockstepRebaseIntent, lockstepTick

Associated Types

data LockstepConfig a :: * Source #

Global immutable configuration for synchronization.

data LockstepState a :: * Source #

State of the logic without intents.

data LockstepIntent a :: * Source #

Player's intent. Piece of data client is sending to server.

data LockstepSeed a :: * Source #

State seed generated by server from previous state and intents.

data LockstepClient a Source #

Constructors

LockstepClient 

Fields

lockstepClientReceiveTick :: Lockstep a => LockstepClient a -> LockstepTick -> LockstepSeed a -> (LockstepIntent a -> LockstepSeed a) -> STM (LockstepTicked (LockstepIntent a)) Source #

Receive seed from server, advance client to next tick.

lockstepClientRender Source #

Arguments

:: Lockstep a 
=> LockstepClient a 
-> LockstepIntent a

Intent to append.

-> Float

Time to advance in ticks.

-> STM (LockstepTicked (LockstepState a), LockstepTicked (LockstepState a), Float) 

Perform rendering.