2021-10-08 12:13:06 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-07-12 21:12:42 +00:00
<class name= "MultiplayerSynchronizer" inherits= "Node" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2021-10-08 12:13:06 +00:00
<brief_description >
2022-07-28 23:30:30 +00:00
Synchronizes properties from the multiplayer authority to the remote peers.
2021-10-08 12:13:06 +00:00
</brief_description>
<description >
2022-07-28 23:30:30 +00:00
By default, [MultiplayerSynchronizer] synchronizes configured properties to all peers.
2022-09-30 12:23:36 +00:00
Visibility can be handled directly with [method set_visibility_for] or as-needed with [method add_visibility_filter] and [method update_visibility].
2022-07-28 23:30:30 +00:00
[MultiplayerSpawner]s will handle nodes according to visibility of synchronizers as long as the node at [member root_path] was spawned by one.
Internally, [MultiplayerSynchronizer] uses [method MultiplayerAPI.object_configuration_add] to notify synchronization start passing the [Node] at [member root_path] as the [code]object[/code] and itself as the [code]configuration[/code], and uses [method MultiplayerAPI.object_configuration_remove] to notify synchronization end in a similar way.
2021-10-08 12:13:06 +00:00
</description>
<tutorials >
</tutorials>
2022-07-09 18:45:30 +00:00
<methods >
<method name= "add_visibility_filter" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "filter" type= "Callable" />
2022-07-09 18:45:30 +00:00
<description >
2022-07-28 23:30:30 +00:00
Adds a peer visibility filter for this synchronizer.
[code]filter[/code] should take a peer id [int] and return a [bool].
2022-07-09 18:45:30 +00:00
</description>
</method>
<method name= "get_visibility_for" qualifiers= "const" >
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "peer" type= "int" />
2022-07-09 18:45:30 +00:00
<description >
2022-07-28 23:30:30 +00:00
Queries the current visibility for peer [code]peer[/code].
2022-07-09 18:45:30 +00:00
</description>
</method>
<method name= "remove_visibility_filter" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "filter" type= "Callable" />
2022-07-09 18:45:30 +00:00
<description >
2022-09-30 12:23:36 +00:00
Removes a peer visibility filter from this synchronizer.
2022-07-09 18:45:30 +00:00
</description>
</method>
<method name= "set_visibility_for" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "peer" type= "int" />
<param index= "1" name= "visible" type= "bool" />
2022-07-09 18:45:30 +00:00
<description >
2022-07-28 23:30:30 +00:00
Sets the visibility of [code]peer[/code] to [code]visible[/code]. If [code]peer[/code] is [code]0[/code], the value of [member public_visibility] will be updated instead.
2022-07-09 18:45:30 +00:00
</description>
</method>
<method name= "update_visibility" >
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "for_peer" type= "int" default= "0" />
2022-07-09 18:45:30 +00:00
<description >
2022-07-28 23:30:30 +00:00
Updates the visibility of [code]peer[/code] according to visibility filters. If [code]peer[/code] is [code]0[/code] (the default), all peers' visibilties are updated.
2022-07-09 18:45:30 +00:00
</description>
</method>
</methods>
2021-10-08 12:13:06 +00:00
<members >
2022-07-09 18:45:30 +00:00
<member name= "public_visibility" type= "bool" setter= "set_visibility_public" getter= "is_visibility_public" default= "true" >
2022-07-28 23:30:30 +00:00
Whether synchronization should be visible to all peers by default. See [method set_visibility_for] and [method add_visibility_filter] for ways of configuring fine-grained visibility options.
2022-07-09 18:45:30 +00:00
</member>
2022-05-24 06:31:44 +00:00
<member name= "replication_config" type= "SceneReplicationConfig" setter= "set_replication_config" getter= "get_replication_config" >
2022-07-28 23:30:30 +00:00
Resource containing which properties to synchronize.
2021-10-08 12:13:06 +00:00
</member>
2022-05-23 00:24:14 +00:00
<member name= "replication_interval" type= "float" setter= "set_replication_interval" getter= "get_replication_interval" default= "0.0" >
2022-07-28 23:30:30 +00:00
Time interval between synchronizes. When set to [code]0.0[/code] (the default), synchronizes happen every network process frame.
2021-10-08 12:13:06 +00:00
</member>
2022-05-23 00:24:14 +00:00
<member name= "root_path" type= "NodePath" setter= "set_root_path" getter= "get_root_path" default= "NodePath("..")" >
2022-07-28 23:30:30 +00:00
Node path that replicated properties are relative to.
If [member root_path] was spawned by a [MultiplayerSpawner], the node will be also be spawned and despawned based on this synchronizer visibility options.
2021-10-08 12:13:06 +00:00
</member>
2022-07-09 18:45:30 +00:00
<member name= "visibility_update_mode" type= "int" setter= "set_visibility_update_mode" getter= "get_visibility_update_mode" enum= "MultiplayerSynchronizer.VisibilityUpdateMode" default= "0" >
2022-07-28 23:30:30 +00:00
Specifies when visibility filters are updated (see [enum VisibilityUpdateMode] for options).
2022-07-09 18:45:30 +00:00
</member>
2021-10-08 12:13:06 +00:00
</members>
2022-07-09 18:45:30 +00:00
<signals >
<signal name= "visibility_changed" >
2022-08-06 18:11:48 +00:00
<param index= "0" name= "for_peer" type= "int" />
2022-07-09 18:45:30 +00:00
<description >
2022-07-28 23:30:30 +00:00
Emitted when visibility of [code]for_peer[/code] is updated. See [method update_visibility].
2022-07-09 18:45:30 +00:00
</description>
</signal>
</signals>
<constants >
<constant name= "VISIBILITY_PROCESS_IDLE" value= "0" enum= "VisibilityUpdateMode" >
2022-07-28 23:30:30 +00:00
Visibility filters are updated every idle process frame.
2022-07-09 18:45:30 +00:00
</constant>
<constant name= "VISIBILITY_PROCESS_PHYSICS" value= "1" enum= "VisibilityUpdateMode" >
2022-07-28 23:30:30 +00:00
Visibility filters are updated every physics process frame.
2022-07-09 18:45:30 +00:00
</constant>
<constant name= "VISIBILITY_PROCESS_NONE" value= "2" enum= "VisibilityUpdateMode" >
2022-07-28 23:30:30 +00:00
Visibility filters are not updated automatically, and must be updated manually by calling [method update_visibility].
2022-07-09 18:45:30 +00:00
</constant>
</constants>
2021-10-08 12:13:06 +00:00
</class>