gore-and-ash-sync-1.1.0.0: Gore&Ash module for high level network synchronization

Copyright(c) Anton Gushcha, 2015-2016
LicenseBSD3
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Game.GoreAndAsh.Sync.API

Description

 

Synopsis

Documentation

class MonadIO m => SyncMonad m where Source

Low level API for module Need at least one network channel to operate. If you open more than one channel, the module would use chanel id 1 as service channel, therefore count of channels on client and server should match (server won't response on channel 1 if it doesn't have it).

Methods

getSyncIdM :: HashableTypeRep -> m (Maybe Word64) Source

Find actor id by it stable type representation

getSyncTypeRepM :: Word64 -> m (Maybe HashableTypeRep) Source

Find actor type representation by it id

registerSyncIdM :: LoggingMonad m => HashableTypeRep -> m Word64 Source

Generate and register new id for given actor type representation

addSyncTypeRepM :: LoggingMonad m => HashableTypeRep -> Word64 -> m () Source

Register new type rep with given id, doesn't overide existing records

syncScheduleMessageM Source

Arguments

:: (NetworkMonad m, LoggingMonad m, NetworkMessage i, Serialize (NetworkMessageType i)) 
=> Peer

Which peer we sending to

-> ChannelID

Which channel we are sending within

-> i

ID of actor

-> MessageType

Strategy of the message (reliable, unordered etc.)

-> NetworkMessageType i

Message to send

-> m () 

Send message as soon as network id of actor is resolved

syncSetLoggingM :: Bool -> m () Source

Switch on/off detailed logging of the module

syncSetRoleM :: SyncRole -> m () Source

Setups behavior model in synchronizing of actor ids Note: clients should be slaves and server master

syncGetRoleM :: m SyncRole Source

Returns current behavior model in synchronizing of actor ids Note: clients should be slaves and server master

syncRequestIdM :: forall proxy i. (ActorMonad m, NetworkMonad m, LoggingMonad m, NetworkMessage i) => Peer -> proxy i -> m () Source

Send request for given peer for id of given actor

Instances