Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

MultiplayerSynchronizer

Inherits: Node < Object

Synchronizes properties from the multiplayer authority to the remote peers.

Description

By default, MultiplayerSynchronizer synchronizes configured properties to all peers.

Visibility can be handled directly with set_visibility_for or as-needed with add_visibility_filter and update_visibility.

MultiplayerSpawners will handle nodes according to visibility of synchronizers as long as the node at root_path was spawned by one.

Internally, MultiplayerSynchronizer uses MultiplayerAPI.object_configuration_add to notify synchronization start passing the Node at root_path as the object and itself as the configuration, and uses MultiplayerAPI.object_configuration_remove to notify synchronization end in a similar way.

Note: Synchronization is not supported for Object type properties, like Resource. Properties that are unique to each peer, like the instance IDs of Objects (see Object.get_instance_id) or RIDs, will also not work in synchronization.

Properties

float

delta_interval

0.0

bool

public_visibility

true

SceneReplicationConfig

replication_config

float

replication_interval

0.0

NodePath

root_path

NodePath("..")

VisibilityUpdateMode

visibility_update_mode

0

Methods

void

add_visibility_filter ( Callable filter )

bool

get_visibility_for ( int peer ) const

void

remove_visibility_filter ( Callable filter )

void

set_visibility_for ( int peer, bool visible )

void

update_visibility ( int for_peer=0 )


Signals

delta_synchronized ( )

Emitted when a new delta synchronization state is received by this synchronizer after the properties have been updated.


synchronized ( )

Emitted when a new synchronization state is received by this synchronizer after the properties have been updated.


visibility_changed ( int for_peer )

Emitted when visibility of for_peer is updated. See update_visibility.


Enumerations

enum VisibilityUpdateMode:

VisibilityUpdateMode VISIBILITY_PROCESS_IDLE = 0

Visibility filters are updated during process frames (see Node.NOTIFICATION_INTERNAL_PROCESS).

VisibilityUpdateMode VISIBILITY_PROCESS_PHYSICS = 1

Visibility filters are updated during physics frames (see Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS).

VisibilityUpdateMode VISIBILITY_PROCESS_NONE = 2

Visibility filters are not updated automatically, and must be updated manually by calling update_visibility.


Property Descriptions

float delta_interval = 0.0

  • void set_delta_interval ( float value )

  • float get_delta_interval ( )

Time interval between delta synchronizations. When set to 0.0 (the default), delta synchronizations happen every network process frame.


bool public_visibility = true

  • void set_visibility_public ( bool value )

  • bool is_visibility_public ( )