:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.2/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml. .. _class_MultiplayerSynchronizer: MultiplayerSynchronizer ======================= **Inherits:** :ref:`Node` **<** :ref:`Object` Synchronizes properties from the multiplayer authority to the remote peers. .. rst-class:: classref-introduction-group Description ----------- By default, **MultiplayerSynchronizer** synchronizes configured properties to all peers. Visibility can be handled directly with :ref:`set_visibility_for` or as-needed with :ref:`add_visibility_filter` and :ref:`update_visibility`. \ :ref:`MultiplayerSpawner`\ s will handle nodes according to visibility of synchronizers as long as the node at :ref:`root_path` was spawned by one. Internally, **MultiplayerSynchronizer** uses :ref:`MultiplayerAPI.object_configuration_add` to notify synchronization start passing the :ref:`Node` at :ref:`root_path` as the ``object`` and itself as the ``configuration``, and uses :ref:`MultiplayerAPI.object_configuration_remove` to notify synchronization end in a similar way. \ **Note:** Synchronization is not supported for :ref:`Object` type properties, like :ref:`Resource`. Properties that are unique to each peer, like the instance IDs of :ref:`Object`\ s (see :ref:`Object.get_instance_id`) or :ref:`RID`\ s, will also not work in synchronization. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`float` | :ref:`delta_interval` | ``0.0`` | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`bool` | :ref:`public_visibility` | ``true`` | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`SceneReplicationConfig` | :ref:`replication_config` | | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`float` | :ref:`replication_interval` | ``0.0`` | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`NodePath` | :ref:`root_path` | ``NodePath("..")`` | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ | :ref:`VisibilityUpdateMode` | :ref:`visibility_update_mode` | ``0`` | +--------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+--------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_visibility_filter` **(** :ref:`Callable` filter **)** | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_visibility_for` **(** :ref:`int` peer **)** |const| | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`remove_visibility_filter` **(** :ref:`Callable` filter **)** | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_visibility_for` **(** :ref:`int` peer, :ref:`bool` visible **)** | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update_visibility` **(** :ref:`int` for_peer=0 **)** | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_MultiplayerSynchronizer_signal_delta_synchronized: .. rst-class:: classref-signal **delta_synchronized** **(** **)** Emitted when a new delta synchronization state is received by this synchronizer after the properties have been updated. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_signal_synchronized: .. rst-class:: classref-signal **synchronized** **(** **)** Emitted when a new synchronization state is received by this synchronizer after the properties have been updated. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_signal_visibility_changed: .. rst-class:: classref-signal **visibility_changed** **(** :ref:`int` for_peer **)** Emitted when visibility of ``for_peer`` is updated. See :ref:`update_visibility`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_MultiplayerSynchronizer_VisibilityUpdateMode: .. rst-class:: classref-enumeration enum **VisibilityUpdateMode**: .. _class_MultiplayerSynchronizer_constant_VISIBILITY_PROCESS_IDLE: .. rst-class:: classref-enumeration-constant :ref:`VisibilityUpdateMode` **VISIBILITY_PROCESS_IDLE** = ``0`` Visibility filters are updated during process frames (see :ref:`Node.NOTIFICATION_INTERNAL_PROCESS`). .. _class_MultiplayerSynchronizer_constant_VISIBILITY_PROCESS_PHYSICS: .. rst-class:: classref-enumeration-constant :ref:`VisibilityUpdateMode` **VISIBILITY_PROCESS_PHYSICS** = ``1`` Visibility filters are updated during physics frames (see :ref:`Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS`). .. _class_MultiplayerSynchronizer_constant_VISIBILITY_PROCESS_NONE: .. rst-class:: classref-enumeration-constant :ref:`VisibilityUpdateMode` **VISIBILITY_PROCESS_NONE** = ``2`` Visibility filters are not updated automatically, and must be updated manually by calling :ref:`update_visibility`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_MultiplayerSynchronizer_property_delta_interval: .. rst-class:: classref-property :ref:`float` **delta_interval** = ``0.0`` .. rst-class:: classref-property-setget - void **set_delta_interval** **(** :ref:`float` value **)** - :ref:`float` **get_delta_interval** **(** **)** Time interval between delta synchronizations. When set to ``0.0`` (the default), delta synchronizations happen every network process frame. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_property_public_visibility: .. rst-class:: classref-property :ref:`bool` **public_visibility** = ``true`` .. rst-class:: classref-property-setget - void **set_visibility_public** **(** :ref:`bool` value **)** - :ref:`bool` **is_visibility_public** **(** **)** Whether synchronization should be visible to all peers by default. See :ref:`set_visibility_for` and :ref:`add_visibility_filter` for ways of configuring fine-grained visibility options. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_property_replication_config: .. rst-class:: classref-property :ref:`SceneReplicationConfig` **replication_config** .. rst-class:: classref-property-setget - void **set_replication_config** **(** :ref:`SceneReplicationConfig` value **)** - :ref:`SceneReplicationConfig` **get_replication_config** **(** **)** Resource containing which properties to synchronize. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_property_replication_interval: .. rst-class:: classref-property :ref:`float` **replication_interval** = ``0.0`` .. rst-class:: classref-property-setget - void **set_replication_interval** **(** :ref:`float` value **)** - :ref:`float` **get_replication_interval** **(** **)** Time interval between synchronizations. When set to ``0.0`` (the default), synchronizations happen every network process frame. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_property_root_path: .. rst-class:: classref-property :ref:`NodePath` **root_path** = ``NodePath("..")`` .. rst-class:: classref-property-setget - void **set_root_path** **(** :ref:`NodePath` value **)** - :ref:`NodePath` **get_root_path** **(** **)** Node path that replicated properties are relative to. If :ref:`root_path` was spawned by a :ref:`MultiplayerSpawner`, the node will be also be spawned and despawned based on this synchronizer visibility options. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_property_visibility_update_mode: .. rst-class:: classref-property :ref:`VisibilityUpdateMode` **visibility_update_mode** = ``0`` .. rst-class:: classref-property-setget - void **set_visibility_update_mode** **(** :ref:`VisibilityUpdateMode` value **)** - :ref:`VisibilityUpdateMode` **get_visibility_update_mode** **(** **)** Specifies when visibility filters are updated (see :ref:`VisibilityUpdateMode` for options). .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_MultiplayerSynchronizer_method_add_visibility_filter: .. rst-class:: classref-method void **add_visibility_filter** **(** :ref:`Callable` filter **)** Adds a peer visibility filter for this synchronizer. \ ``filter`` should take a peer ID :ref:`int` and return a :ref:`bool`. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_method_get_visibility_for: .. rst-class:: classref-method :ref:`bool` **get_visibility_for** **(** :ref:`int` peer **)** |const| Queries the current visibility for peer ``peer``. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_method_remove_visibility_filter: .. rst-class:: classref-method void **remove_visibility_filter** **(** :ref:`Callable` filter **)** Removes a peer visibility filter from this synchronizer. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_method_set_visibility_for: .. rst-class:: classref-method void **set_visibility_for** **(** :ref:`int` peer, :ref:`bool` visible **)** Sets the visibility of ``peer`` to ``visible``. If ``peer`` is ``0``, the value of :ref:`public_visibility` will be updated instead. .. rst-class:: classref-item-separator ---- .. _class_MultiplayerSynchronizer_method_update_visibility: .. rst-class:: classref-method void **update_visibility** **(** :ref:`int` for_peer=0 **)** Updates the visibility of ``for_peer`` according to visibility filters. If ``for_peer`` is ``0`` (the default), all peers' visibilties are updated. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`