|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?>
|
2 | 2 | <class name="MultiplayerSynchronizer" inherits="Node" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
3 | 3 | <brief_description>
|
| 4 | + Synchronizes properties from the multiplayer authority to the remote peers. |
4 | 5 | </brief_description>
|
5 | 6 | <description>
|
6 |
| - The [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. |
| 7 | + By default, [MultiplayerSynchronizer] synchronizes configured properties to all peers. |
| 8 | + Visiblity can be handled directly with [method set_visibility_for] or as-needed with [method add_visibility_filter] and [method update_visibility]. |
| 9 | + |
| 10 | + [MultiplayerSpawner]s will handle nodes according to visibility of synchronizers as long as the node at [member root_path] was spawned by one. |
| 11 | + |
| 12 | + 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. |
7 | 13 | </description>
|
8 | 14 | <tutorials>
|
9 | 15 | </tutorials>
|
|
12 | 18 | <return type="void" />
|
13 | 19 | <argument index="0" name="filter" type="Callable" />
|
14 | 20 | <description>
|
| 21 | + Adds a peer visibility filter for this synchronizer. |
| 22 | + |
| 23 | + [code]filter[/code] should take a peer id [int] and return a [bool]. |
15 | 24 | </description>
|
16 | 25 | </method>
|
17 | 26 | <method name="get_visibility_for" qualifiers="const">
|
18 | 27 | <return type="bool" />
|
19 | 28 | <argument index="0" name="peer" type="int" />
|
20 | 29 | <description>
|
| 30 | + Queries the current visibility for peer [code]peer[/code]. |
21 | 31 | </description>
|
22 | 32 | </method>
|
23 | 33 | <method name="remove_visibility_filter">
|
24 | 34 | <return type="void" />
|
25 | 35 | <argument index="0" name="filter" type="Callable" />
|
26 | 36 | <description>
|
| 37 | + Removes a peer visiblity filter from this synchronizer. |
27 | 38 | </description>
|
28 | 39 | </method>
|
29 | 40 | <method name="set_visibility_for">
|
30 | 41 | <return type="void" />
|
31 | 42 | <argument index="0" name="peer" type="int" />
|
32 | 43 | <argument index="1" name="visible" type="bool" />
|
33 | 44 | <description>
|
| 45 | + 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. |
34 | 46 | </description>
|
35 | 47 | </method>
|
36 | 48 | <method name="update_visibility">
|
37 | 49 | <return type="void" />
|
38 | 50 | <argument index="0" name="for_peer" type="int" default="0" />
|
39 | 51 | <description>
|
| 52 | + 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. |
40 | 53 | </description>
|
41 | 54 | </method>
|
42 | 55 | </methods>
|
43 | 56 | <members>
|
44 | 57 | <member name="public_visibility" type="bool" setter="set_visibility_public" getter="is_visibility_public" default="true">
|
| 58 | + 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. |
45 | 59 | </member>
|
46 | 60 | <member name="replication_config" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config">
|
| 61 | + Resource containing which properties to synchronize. |
47 | 62 | </member>
|
48 | 63 | <member name="replication_interval" type="float" setter="set_replication_interval" getter="get_replication_interval" default="0.0">
|
| 64 | + Time interval between synchronizes. When set to [code]0.0[/code] (the default), synchronizes happen every network process frame. |
49 | 65 | </member>
|
50 | 66 | <member name="root_path" type="NodePath" setter="set_root_path" getter="get_root_path" default="NodePath("..")">
|
| 67 | + Node path that replicated properties are relative to. |
| 68 | + If [member root_path] was spawned by a [MultiplayerSpawner], the node will be also be spawned and despawned based on this synchronizer visibility options. |
51 | 69 | </member>
|
52 | 70 | <member name="visibility_update_mode" type="int" setter="set_visibility_update_mode" getter="get_visibility_update_mode" enum="MultiplayerSynchronizer.VisibilityUpdateMode" default="0">
|
| 71 | + Specifies when visibility filters are updated (see [enum VisibilityUpdateMode] for options). |
53 | 72 | </member>
|
54 | 73 | </members>
|
55 | 74 | <signals>
|
56 | 75 | <signal name="visibility_changed">
|
57 | 76 | <argument index="0" name="for_peer" type="int" />
|
58 | 77 | <description>
|
| 78 | + Emitted when visibility of [code]for_peer[/code] is updated. See [method update_visibility]. |
59 | 79 | </description>
|
60 | 80 | </signal>
|
61 | 81 | </signals>
|
62 | 82 | <constants>
|
63 | 83 | <constant name="VISIBILITY_PROCESS_IDLE" value="0" enum="VisibilityUpdateMode">
|
| 84 | + Visibility filters are updated every idle process frame. |
64 | 85 | </constant>
|
65 | 86 | <constant name="VISIBILITY_PROCESS_PHYSICS" value="1" enum="VisibilityUpdateMode">
|
| 87 | + Visibility filters are updated every physics process frame. |
66 | 88 | </constant>
|
67 | 89 | <constant name="VISIBILITY_PROCESS_NONE" value="2" enum="VisibilityUpdateMode">
|
| 90 | + Visibility filters are not updated automatically, and must be updated manually by calling [method update_visibility]. |
68 | 91 | </constant>
|
69 | 92 | </constants>
|
70 | 93 | </class>
|
0 commit comments