Documentation
¶
Overview ¶
By default, graphics.gd/classdb/MultiplayerSynchronizer synchronizes configured properties to all peers.
Visibility can be handled directly with Instance.SetVisibilityFor or as-needed with Instance.AddVisibilityFilter and Instance.UpdateVisibility.
[graphics.gd/classdb/MultiplayerSpawner]s will handle nodes according to visibility of synchronizers as long as the node at Instance.RootPath was spawned by one.
Internally, graphics.gd/classdb/MultiplayerSynchronizer uses graphics.gd/classdb/MultiplayerAPI.Instance.ObjectConfigurationAdd to notify synchronization start passing the graphics.gd/classdb/Node at Instance.RootPath as the object and itself as the configuration, and uses graphics.gd/classdb/MultiplayerAPI.Instance.ObjectConfigurationRemove to notify synchronization end in a similar way.
Note: Synchronization is not supported for graphics.gd/classdb/Object type properties, like graphics.gd/classdb/Resource. Properties that are unique to each peer, like the instance IDs of [graphics.gd/classdb/Object]s (see graphics.gd/classdb/Object.Instance.GetInstanceId) or [Resource.ID]s, will also not work in synchronization.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddVisibilityFilter(filter func(peer_id int) bool)
- func (self Instance) AsMultiplayerSynchronizer() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) DeltaInterval() Float.X
- func (self Instance) GetVisibilityFor(peer int) bool
- func (self Instance) ID() ID
- func (self Instance) OnDeltaSynchronized(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSynchronized(cb func(), flags ...Signal.Flags)
- func (self Instance) OnVisibilityChanged(cb func(for_peer int), flags ...Signal.Flags)
- func (self Instance) PublicVisibility() bool
- func (self Instance) RemoveVisibilityFilter(filter Callable.Function)
- func (self Instance) ReplicationConfig() SceneReplicationConfig.Instance
- func (self Instance) ReplicationInterval() Float.X
- func (self Instance) RootPath() string
- func (self Instance) SetDeltaInterval(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPublicVisibility(value bool)
- func (self Instance) SetReplicationConfig(value SceneReplicationConfig.Instance)
- func (self Instance) SetReplicationInterval(value Float.X)
- func (self Instance) SetRootPath(value string)
- func (self Instance) SetVisibilityFor(peer int, visible bool)
- func (self Instance) SetVisibilityUpdateMode(value VisibilityUpdateMode)
- func (self Instance) UpdateVisibility()
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VisibilityUpdateMode() VisibilityUpdateMode
- type VisibilityUpdateMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
type Expanded [1]gdclass.MultiplayerSynchronizer
func (Expanded) UpdateVisibility ¶
Updates the visibility of 'for_peer' according to visibility filters. If 'for_peer' is 0 (the default), all peers' visibilties are updated.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsMultiplayerSynchronizer ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.MultiplayerSynchronizer
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddVisibilityFilter ¶
Adds a peer visibility filter for this synchronizer.
'filter' should take a peer ID int and return a bool.
func (Instance) AsMultiplayerSynchronizer ¶
func (Instance) DeltaInterval ¶
func (Instance) GetVisibilityFor ¶
Queries the current visibility for peer 'peer'.
func (Instance) OnDeltaSynchronized ¶
func (Instance) OnSynchronized ¶
func (Instance) OnVisibilityChanged ¶
func (Instance) PublicVisibility ¶
func (Instance) RemoveVisibilityFilter ¶
Removes a peer visibility filter from this synchronizer.
func (Instance) ReplicationConfig ¶
func (self Instance) ReplicationConfig() SceneReplicationConfig.Instance
func (Instance) ReplicationInterval ¶
func (Instance) SetDeltaInterval ¶
func (Instance) SetPublicVisibility ¶
func (Instance) SetReplicationConfig ¶
func (self Instance) SetReplicationConfig(value SceneReplicationConfig.Instance)
func (Instance) SetReplicationInterval ¶
func (Instance) SetRootPath ¶
func (Instance) SetVisibilityFor ¶
Sets the visibility of 'peer' to 'visible'. If 'peer' is 0, the value of Instance.PublicVisibility will be updated instead.
func (Instance) SetVisibilityUpdateMode ¶
func (self Instance) SetVisibilityUpdateMode(value VisibilityUpdateMode)
func (Instance) UpdateVisibility ¶
func (self Instance) UpdateVisibility()
Updates the visibility of 'for_peer' according to visibility filters. If 'for_peer' is 0 (the default), all peers' visibilties are updated.
func (Instance) VisibilityUpdateMode ¶
func (self Instance) VisibilityUpdateMode() VisibilityUpdateMode
type VisibilityUpdateMode ¶
type VisibilityUpdateMode int //gd:MultiplayerSynchronizer.VisibilityUpdateMode
const ( // Visibility filters are updated during process frames (see [Node.NotificationInternalProcess]). VisibilityProcessIdle VisibilityUpdateMode = 0 // Visibility filters are updated during physics frames (see [Node.NotificationInternalPhysicsProcess]). VisibilityProcessPhysics VisibilityUpdateMode = 1 // Visibility filters are not updated automatically, and must be updated manually by calling [Instance.UpdateVisibility]. VisibilityProcessNone VisibilityUpdateMode = 2 )