srvsync

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NetworkIdCounter = atomic.Uint64{}

Functions

func AddNetworkFilter

func AddNetworkFilter(filter func(client *router.NetworkClient, entry *donburi.Entry) bool)

AddNetworkFilter accepts a callback that can be used to filter out entities that gets included in the snapshots sent to clients. By returning false in this filter function, the entity will be excluded.

func DoSync

func DoSync() error

DoSync should be called by the server and will build world state and then attempt to network it out to all the peers. This is done by serializing all the components of the entity, and preparing a network bundle for the clients.

func NetworkSync

func NetworkSync(world donburi.World, entity *donburi.Entity, components ...donburi.IComponentType) error

NetworkSync marks an entity and a list for network synchronization. This means that the esync package will automatically try to send state updates to the connected clients. Note that donburi tags are not supported for synchronization, as they contain no data. This will return an error if the entity does not have all the components being synced.

func UseEsync

func UseEsync(w donburi.World)

UseEsync is used to set the world instance to use for synchronization.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL