summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/MultiplayerAPI.xml2
-rw-r--r--doc/classes/MultiplayerReplicator.xml191
-rw-r--r--doc/classes/MultiplayerSpawner.xml47
-rw-r--r--doc/classes/MultiplayerSynchronizer.xml17
-rw-r--r--doc/classes/SceneReplicationConfig.xml61
5 files changed, 125 insertions, 193 deletions
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index e0da08f5bd..426d902983 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -79,8 +79,6 @@
<member name="refuse_new_connections" type="bool" setter="set_refuse_new_connections" getter="is_refusing_new_connections" default="false">
If [code]true[/code], the MultiplayerAPI's [member multiplayer_peer] refuses new incoming connections.
</member>
- <member name="replicator" type="MultiplayerReplicator" setter="" getter="get_replicator">
- </member>
<member name="root_node" type="Node" setter="set_root_node" getter="get_root_node">
The root node to use for RPCs. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed.
This effectively allows to have different branches of the scene tree to be managed by different MultiplayerAPI, allowing for example to run both client and server in the same scene.
diff --git a/doc/classes/MultiplayerReplicator.xml b/doc/classes/MultiplayerReplicator.xml
deleted file mode 100644
index c2e93ddeab..0000000000
--- a/doc/classes/MultiplayerReplicator.xml
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiplayerReplicator" inherits="Object" version="4.0">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="decode_state">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <argument index="2" name="data" type="PackedByteArray" />
- <argument index="3" name="initial" type="bool" default="true" />
- <description>
- Decode the given [code]data[/code] representing a spawnable state into [code]object[/code] using the configuration associated with the provided [code]scene_id[/code]. This function is called automatically when a client receives a server spawn for a scene with [constant REPLICATION_MODE_SERVER]. See [method spawn_config].
- Tip: You may find this function useful in servers when parsing spawn requests from clients, or when implementing your own logic with [constant REPLICATION_MODE_CUSTOM].
- </description>
- </method>
- <method name="despawn">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <argument index="2" name="peer_id" type="int" default="0" />
- <description>
- Request a despawn for the scene identified by [code]scene_id[/code] to the given [code]peer_id[/code]. This will either trigger the default behavior, or invoke the custom spawn/despawn callables specified in [method spawn_config]. See [method send_despawn] for the default behavior.
- </description>
- </method>
- <method name="encode_state">
- <return type="PackedByteArray" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <argument index="2" name="initial" type="bool" default="true" />
- <description>
- Encode the given [code]object[/code] using the configuration associated with the provided [code]scene_id[/code]. This function is called automatically when the server spawns scenes with [constant REPLICATION_MODE_SERVER]. See [method spawn_config].
- Tip: You may find this function useful when requesting spawns from clients to server, or when implementing your own logic with [constant REPLICATION_MODE_CUSTOM].
- </description>
- </method>
- <method name="send_despawn">
- <return type="int" enum="Error" />
- <argument index="0" name="peer_id" type="int" />
- <argument index="1" name="scene_id" type="int" />
- <argument index="2" name="data" type="Variant" default="null" />
- <argument index="3" name="path" type="NodePath" default="NodePath(&quot;&quot;)" />
- <description>
- Sends a despawn request for the scene identified by [code]scene_id[/code] to the given [code]peer_id[/code] (see [method MultiplayerPeer.set_target_peer]). If the scene is configured as [constant REPLICATION_MODE_SERVER] (see [method spawn_config]) and the request is sent by the server (see [method MultiplayerAPI.is_server]), the receiving peer(s) will automatically queue for deletion the node at [code]path[/code] and emit the signal [signal despawned]. In all other cases no deletion happens, and the signal [signal despawn_requested] is emitted instead.
- </description>
- </method>
- <method name="send_spawn">
- <return type="int" enum="Error" />
- <argument index="0" name="peer_id" type="int" />
- <argument index="1" name="scene_id" type="int" />
- <argument index="2" name="data" type="Variant" default="null" />
- <argument index="3" name="path" type="NodePath" default="NodePath(&quot;&quot;)" />
- <description>
- Sends a spawn request for the scene identified by [code]scene_id[/code] to the given [code]peer_id[/code] (see [method MultiplayerPeer.set_target_peer]). If the scene is configured as [constant REPLICATION_MODE_SERVER] (see [method spawn_config]) and the request is sent by the server (see [method MultiplayerAPI.is_server]), the receiving peer(s) will automatically instantiate that scene, add it to the [SceneTree] at the given [code]path[/code] and emit the signal [signal spawned]. In all other cases no instantiation happens, and the signal [signal spawn_requested] is emitted instead.
- </description>
- </method>
- <method name="send_sync">
- <return type="int" enum="Error" />
- <argument index="0" name="peer_id" type="int" />
- <argument index="1" name="scene_id" type="int" />
- <argument index="2" name="data" type="PackedByteArray" />
- <argument index="3" name="transfer_mode" type="int" enum="TransferMode" default="2" />
- <argument index="4" name="channel" type="int" default="0" />
- <description>
- Sends a sync request for the instances of the scene identified by [code]scene_id[/code] to the given [code]peer_id[/code] (see [method MultiplayerPeer.set_target_peer]). This function can only be called manually when overriding the send and receive sync functions (see [method sync_config]).
- </description>
- </method>
- <method name="spawn">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <argument index="2" name="peer_id" type="int" default="0" />
- <description>
- Request a spawn for the scene identified by [code]scene_id[/code] to the given [code]peer_id[/code]. This will either trigger the default behavior, or invoke the custom spawn/despawn callables specified in [method spawn_config]. See [method send_spawn] for the default behavior.
- </description>
- </method>
- <method name="spawn_config">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="spawn_mode" type="int" enum="MultiplayerReplicator.ReplicationMode" />
- <argument index="2" name="properties" type="StringName[]" default="[]" />
- <argument index="3" name="custom_send" type="Callable" />
- <argument index="4" name="custom_receive" type="Callable" />
- <description>
- Configures the MultiplayerReplicator to track instances of the [PackedScene] identified by [code]scene_id[/code] (see [method ResourceLoader.get_resource_uid]) for the purpose of network replication. When [code]mode[/code] is [constant REPLICATION_MODE_SERVER], the specified [code]properties[/code] will also be replicated to clients during the initial spawn. You can optionally specify a [code]custom_send[/code] and a [code]custom_receive[/code] to override the default behavior and customize the spawn/despawn proecess.
- Tip: You can use a custom property in the scene main script to return a customly optimized state representation.
- </description>
- </method>
- <method name="sync_all">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="peer_id" type="int" default="0" />
- <description>
- Manually request a sync for all the instances of the scene identified by [code]scene_id[/code]. This function will trigger the default sync behavior, or call your send custom send callable if specified in [method sync_config].
- [b]Note:[/b] The default implementation only allow syncing from server to clients.
- </description>
- </method>
- <method name="sync_config">
- <return type="int" enum="Error" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="interval" type="int" />
- <argument index="2" name="properties" type="StringName[]" default="[]" />
- <argument index="3" name="custom_send" type="Callable" />
- <argument index="4" name="custom_receive" type="Callable" />
- <description>
- Configures the MultiplayerReplicator to sync instances of the [PackedScene] identified by [code]scene_id[/code] (see [method ResourceLoader.get_resource_uid]) for the purpose of network replication at the desired [code]interval[/code] (in milliseconds). The specified [code]properties[/code] will be part of the state sync. You can optionally specify a [code]custom_send[/code] and a [code]custom_receive[/code] to override the default behavior and customize the synchronization proecess.
- Tip: You can use a custom property in the scene main script to return a customly optimized state representation (having a single property that returns a PackedByteArray is highly recommended when dealing with many instances).
- </description>
- </method>
- <method name="track">
- <return type="void" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <description>
- Track the given [code]object[/code] as an instance of the scene identified by [code]scene_id[/code]. This object will be passed to your custom sync callables (see [method sync_config]). Tracking and untracking is automatic in [constant REPLICATION_MODE_SERVER].
- </description>
- </method>
- <method name="untrack">
- <return type="void" />
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="object" type="Object" />
- <description>
- Untrack the given [code]object[/code]. This object will no longer be passed to your custom sync callables (see [method sync_config]). Tracking and untracking is automatic in [constant REPLICATION_MODE_SERVER].
- </description>
- </method>
- </methods>
- <signals>
- <signal name="despawn_requested">
- <argument index="0" name="id" type="int" />
- <argument index="1" name="scene_id" type="int" />
- <argument index="2" name="parent" type="Node" />
- <argument index="3" name="name" type="String" />
- <argument index="4" name="data" type="PackedByteArray" />
- <description>
- Emitted when a network despawn request has been received from a client, or for a [PackedScene] that has been configured as [constant REPLICATION_MODE_CUSTOM].
- </description>
- </signal>
- <signal name="despawned">
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="node" type="Node" />
- <description>
- Emitted on a client before deleting a local Node upon receiving a despawn request from the server.
- </description>
- </signal>
- <signal name="replicated_instance_added">
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="node" type="Node" />
- <description>
- Emitted when an instance of a [PackedScene] that has been configured for networking enters the [SceneTree]. See [method spawn_config].
- </description>
- </signal>
- <signal name="replicated_instance_removed">
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="node" type="Node" />
- <description>
- Emitted when an instance of a [PackedScene] that has been configured for networking leaves the [SceneTree]. See [method spawn_config].
- </description>
- </signal>
- <signal name="spawn_requested">
- <argument index="0" name="id" type="int" />
- <argument index="1" name="scene_id" type="int" />
- <argument index="2" name="parent" type="Node" />
- <argument index="3" name="name" type="String" />
- <argument index="4" name="data" type="PackedByteArray" />
- <description>
- Emitted when a network spawn request has been received from a client, or for a [PackedScene] that has been configured as [constant REPLICATION_MODE_CUSTOM].
- </description>
- </signal>
- <signal name="spawned">
- <argument index="0" name="scene_id" type="int" />
- <argument index="1" name="node" type="Node" />
- <description>
- Emitted on a client after a new Node is instantiated locally and added to the SceneTree upon receiving a spawn request from the server.
- </description>
- </signal>
- </signals>
- <constants>
- <constant name="REPLICATION_MODE_NONE" value="0" enum="ReplicationMode">
- Used with [method spawn_config] to identify a [PackedScene] that should not be replicated.
- </constant>
- <constant name="REPLICATION_MODE_SERVER" value="1" enum="ReplicationMode">
- Used with [method spawn_config] to identify a [PackedScene] that should be automatically replicated from server to clients.
- </constant>
- <constant name="REPLICATION_MODE_CUSTOM" value="2" enum="ReplicationMode">
- Used with [method spawn_config] to identify a [PackedScene] that can be manually replicated among peers.
- </constant>
- </constants>
-</class>
diff --git a/doc/classes/MultiplayerSpawner.xml b/doc/classes/MultiplayerSpawner.xml
new file mode 100644
index 0000000000..8bfecfce41
--- /dev/null
+++ b/doc/classes/MultiplayerSpawner.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MultiplayerSpawner" inherits="Node" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="_spawn_custom" qualifiers="virtual">
+ <return type="Object" />
+ <argument index="0" name="data" type="Variant" />
+ <description>
+ </description>
+ </method>
+ <method name="spawn">
+ <return type="Node" />
+ <argument index="0" name="data" type="Variant" default="null" />
+ <description>
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="auto_spawn" type="bool" setter="set_auto_spawning" getter="is_auto_spawning" default="false">
+ </member>
+ <member name="replication" type="PackedScene[]" setter="set_spawnable_scenes" getter="get_spawnable_scenes" default="[]">
+ </member>
+ <member name="spawn_limit" type="int" setter="set_spawn_limit" getter="get_spawn_limit" default="0">
+ </member>
+ <member name="spawn_path" type="NodePath" setter="set_spawn_path" getter="get_spawn_path" default="NodePath(&quot;&quot;)">
+ </member>
+ </members>
+ <signals>
+ <signal name="despawned">
+ <argument index="0" name="scene_id" type="int" />
+ <argument index="1" name="node" type="Node" />
+ <description>
+ </description>
+ </signal>
+ <signal name="spawned">
+ <argument index="0" name="scene_id" type="int" />
+ <argument index="1" name="node" type="Node" />
+ <description>
+ </description>
+ </signal>
+ </signals>
+</class>
diff --git a/doc/classes/MultiplayerSynchronizer.xml b/doc/classes/MultiplayerSynchronizer.xml
new file mode 100644
index 0000000000..242d4589a4
--- /dev/null
+++ b/doc/classes/MultiplayerSynchronizer.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MultiplayerSynchronizer" inherits="Node" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <members>
+ <member name="replication_interval" type="float" setter="set_replication_interval" getter="get_replication_interval" default="0.0">
+ </member>
+ <member name="resource" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config">
+ </member>
+ <member name="root_path" type="NodePath" setter="set_root_path" getter="get_root_path" default="NodePath(&quot;&quot;)">
+ </member>
+ </members>
+</class>
diff --git a/doc/classes/SceneReplicationConfig.xml b/doc/classes/SceneReplicationConfig.xml
new file mode 100644
index 0000000000..e846740dd3
--- /dev/null
+++ b/doc/classes/SceneReplicationConfig.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="SceneReplicationConfig" inherits="Resource" version="4.0">
+ <brief_description>
+ </brief_description>
+ <description>
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="add_property">
+ <return type="void" />
+ <argument index="0" name="path" type="NodePath" />
+ <argument index="1" name="index" type="int" default="-1" />
+ <description>
+ </description>
+ </method>
+ <method name="get_properties" qualifiers="const">
+ <return type="NodePath[]" />
+ <description>
+ </description>
+ </method>
+ <method name="property_get_index" qualifiers="const">
+ <return type="int" />
+ <argument index="0" name="path" type="NodePath" />
+ <description>
+ </description>
+ </method>
+ <method name="property_get_spawn">
+ <return type="bool" />
+ <argument index="0" name="path" type="NodePath" />
+ <description>
+ </description>
+ </method>
+ <method name="property_get_sync">
+ <return type="bool" />
+ <argument index="0" name="path" type="NodePath" />
+ <description>
+ </description>
+ </method>
+ <method name="property_set_spawn">
+ <return type="void" />
+ <argument index="0" name="path" type="NodePath" />
+ <argument index="1" name="enabled" type="bool" />
+ <description>
+ </description>
+ </method>
+ <method name="property_set_sync">
+ <return type="void" />
+ <argument index="0" name="path" type="NodePath" />
+ <argument index="1" name="enabled" type="bool" />
+ <description>
+ </description>
+ </method>
+ <method name="remove_property">
+ <return type="void" />
+ <argument index="0" name="path" type="NodePath" />
+ <description>
+ </description>
+ </method>
+ </methods>
+</class>