MultiplayerSynchronizer
Synchronizes properties from the multiplayer authority to the remote peers.
MultiplayerSynchronizer.swift:33class MultiplayerSynchronizer
By default, MultiplayerSynchronizer
synchronizes configured properties to all peers.
Visibility can be handled directly with setVisibilityFor(peer:visible:)
or as-needed with addVisibilityFilter(_:)
and updateVisibility(forPeer:)
.
MultiplayerSpawner
s will handle nodes according to visibility of synchronizers as long as the node at rootPath
was spawned by one.
Internally, MultiplayerSynchronizer
uses objectConfigurationAdd(object:configuration:)
to notify synchronization start passing the Node
at rootPath
as the object
and itself as the configuration
, and uses objectConfigurationRemove(object:configuration:)
to notify synchronization end in a similar way.
This object emits the following signals:
Superclasses
class Node
Base class for all scene objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
enum VisibilityUpdateMode
Type members
Instance members
var deltaInterval: Double
Time interval between delta synchronizations. When set to
0.0
(the default), delta synchronizations happen every network process frame.var deltaSynchronized: SimpleSignal
Emitted when a new delta synchronization state is received by this synchronizer after the properties have been updated.
var publicVisibility: Bool
Whether synchronization should be visible to all peers by default. See
setVisibilityFor(peer:visible:)
andaddVisibilityFilter(_:)
for ways of configuring fine-grained visibility options.var replicationConfig: SceneReplicationConfig?
Resource containing which properties to synchronize.
var replicationInterval: Double
Time interval between synchronizations. When set to
0.0
(the default), synchronizations happen every network process frame.var rootPath: NodePath
Node path that replicated properties are relative to.
var synchronized: SimpleSignal
Emitted when a new synchronization state is received by this synchronizer after the properties have been updated.
var visibilityChanged: Signal1
Emitted when visibility of
forPeer
is updated. SeeupdateVisibility(forPeer:)
.var visibilityUpdateMode: MultiplayerSynchronizer.VisibilityUpdateMode
Specifies when visibility filters are updated (see
VisibilityUpdateMode
for options).func addVisibilityFilter(Callable
) Adds a peer visibility filter for this synchronizer.
func getVisibilityFor(peer: Int32
) -> Bool Queries the current visibility for peer
peer
.func removeVisibilityFilter(Callable
) Removes a peer visibility filter from this synchronizer.
func setVisibilityFor(peer: Int32, visible: Bool
) Sets the visibility of
peer
tovisible
. Ifpeer
is0
, the value ofpublicVisibility
will be updated instead.func updateVisibility(forPeer: Int32
) Updates the visibility of
forPeer
according to visibility filters. IfforPeer
is0
(the default), all peers’ visibilties are updated.