summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-07-28 20:46:31 +0200
committerGitHub <noreply@github.com>2022-07-28 20:46:31 +0200
commit14d021287bced6a7f5ab9db24936bd07b4cfdfd0 (patch)
treed56647d7c1a68b282074afbab8ccf4bf890718c2 /doc
parent8e0f328a80a4c01bc4788a9aa6daaeb3097b4fab (diff)
parentca7d572908c58c587214b8f65bdd4078d0185ab2 (diff)
Merge pull request #63049 from Faless/mp/4.x_as_module
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/@GlobalScope.xml18
-rw-r--r--doc/classes/MultiplayerAPI.xml100
-rw-r--r--doc/classes/MultiplayerAPIExtension.xml141
-rw-r--r--doc/classes/MultiplayerPeer.xml11
-rw-r--r--doc/classes/MultiplayerSpawner.xml65
-rw-r--r--doc/classes/MultiplayerSynchronizer.xml69
-rw-r--r--doc/classes/Node.xml22
-rw-r--r--doc/classes/SceneReplicationConfig.xml67
-rw-r--r--doc/classes/ScriptExtension.xml4
9 files changed, 229 insertions, 268 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 30a2228294..709863b70f 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -2728,24 +2728,6 @@
<constant name="METHOD_FLAGS_DEFAULT" value="1" enum="MethodFlags">
Default method flags.
</constant>
- <constant name="RPC_MODE_DISABLED" value="0" enum="RPCMode">
- Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
- </constant>
- <constant name="RPC_MODE_ANY_PEER" value="1" enum="RPCMode">
- Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not.
- </constant>
- <constant name="RPC_MODE_AUTHORITY" value="2" enum="RPCMode">
- Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(authority)[/code] annotation. See [method Node.set_multiplayer_authority].
- </constant>
- <constant name="TRANSFER_MODE_UNRELIABLE" value="0" enum="TransferMode">
- Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters.
- </constant>
- <constant name="TRANSFER_MODE_UNRELIABLE_ORDERED" value="1" enum="TransferMode">
- Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data.
- </constant>
- <constant name="TRANSFER_MODE_RELIABLE" value="2" enum="TransferMode">
- Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly.
- </constant>
<constant name="TYPE_NIL" value="0" enum="Variant.Type">
Variable is [code]null[/code].
</constant>
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index 059d147979..06658bf004 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -1,88 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="MultiplayerAPI" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
<brief_description>
- High-level multiplayer API.
+ High-level multiplayer API interface.
</brief_description>
<description>
- This class implements the high-level multiplayer API. See also [MultiplayerPeer].
- By default, [SceneTree] has a reference to this class that is used to provide multiplayer capabilities (i.e. RPCs) across the whole scene.
+ Base class for high-level multiplayer API implementations. See also [MultiplayerPeer].
+ By default, [SceneTree] has a reference to an implementation of this class and uses it to provide multiplayer capabilities (i.e. RPCs) across the whole scene.
It is possible to override the MultiplayerAPI instance used by specific tree branches by calling the [method SceneTree.set_multiplayer] method, effectively allowing to run both client and server in the same scene.
- [b]Note:[/b] The high-level multiplayer API protocol is an implementation detail and isn't meant to be used by non-Godot servers. It may change without notice.
- [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
+ It is also possible to extend or replace the default implementation via scripting or native extensions. See [MultiplayerAPIExtension] for details about extensions, [SceneMultiplayer] for the details about the default implementation.
</description>
<tutorials>
</tutorials>
<methods>
- <method name="clear">
- <return type="void" />
+ <method name="create_default_interface" qualifiers="static">
+ <return type="MultiplayerAPI" />
+ <description>
+ Returns a new instance of the default MultiplayerAPI.
+ </description>
+ </method>
+ <method name="get_default_interface" qualifiers="static">
+ <return type="StringName" />
<description>
- Clears the current MultiplayerAPI network state (you shouldn't call this unless you know what you are doing).
+ Returns the default MultiplayerAPI implementation class name. This is usually [code]"SceneMultiplayer"[/code] when [SceneMultiplayer] is available. See [method set_default_interface].
</description>
</method>
- <method name="get_peers" qualifiers="const">
+ <method name="get_peers">
<return type="PackedInt32Array" />
<description>
Returns the peer IDs of all connected peers of this MultiplayerAPI's [member multiplayer_peer].
</description>
</method>
- <method name="get_remote_sender_id" qualifiers="const">
+ <method name="get_remote_sender_id">
<return type="int" />
<description>
Returns the sender's peer ID for the RPC currently being executed.
[b]Note:[/b] If not inside an RPC this method will return 0.
</description>
</method>
- <method name="get_unique_id" qualifiers="const">
+ <method name="get_unique_id">
<return type="int" />
<description>
Returns the unique peer ID of this MultiplayerAPI's [member multiplayer_peer].
</description>
</method>
- <method name="has_multiplayer_peer" qualifiers="const">
+ <method name="has_multiplayer_peer">
<return type="bool" />
<description>
Returns [code]true[/code] if there is a [member multiplayer_peer] set.
</description>
</method>
- <method name="is_server" qualifiers="const">
+ <method name="is_server">
<return type="bool" />
<description>
Returns [code]true[/code] if this MultiplayerAPI's [member multiplayer_peer] is valid and in server mode (listening for connections).
</description>
</method>
+ <method name="object_configuration_add">
+ <return type="int" enum="Error" />
+ <argument index="0" name="object" type="Object" />
+ <argument index="1" name="configuration" type="Variant" />
+ <description>
+ Notifies the MultiplayerAPI of a new [code]configuration[/code] for the given [code]object[/code]. This method is used internally by [SceneTree] to configure the root path for this MultiplayerAPI (passing [code]null[/code] and a valid [NodePath] as [code]configuration[/code]). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g. [SceneMultiplayer]) for details on how they use it.
+ [b]Note:[/b] This method is mostly relevant when extending or overriding the MultiplayerAPI behavior via [MultiplayerAPIExtension].
+ </description>
+ </method>
+ <method name="object_configuration_remove">
+ <return type="int" enum="Error" />
+ <argument index="0" name="object" type="Object" />
+ <argument index="1" name="configuration" type="Variant" />
+ <description>
+ Notifies the MultiplayerAPI to remove a [code]configuration[/code] for the given [code]object[/code]. This method is used internally by [SceneTree] to configure the root path for this MultiplayerAPI (passing [code]null[/code] and an empty [NodePath] as [code]configuration[/code]). This method can be further used by MultiplayerAPI implementations to provide additional features, refer to specific implementation (e.g. [SceneMultiplayer]) for details on how they use it.
+ [b]Note:[/b] This method is mostly relevant when extending or overriding the MultiplayerAPI behavior via [MultiplayerAPIExtension].
+ </description>
+ </method>
<method name="poll">
- <return type="void" />
+ <return type="int" enum="Error" />
<description>
Method used for polling the MultiplayerAPI. You only need to worry about this if you set [member SceneTree.multiplayer_poll] to [code]false[/code]. By default, [SceneTree] will poll its MultiplayerAPI(s) for you.
[b]Note:[/b] This method results in RPCs being called, so they will be executed in the same context of this function (e.g. [code]_process[/code], [code]physics[/code], [Thread]).
</description>
</method>
- <method name="send_bytes">
+ <method name="rpc">
<return type="int" enum="Error" />
- <argument index="0" name="bytes" type="PackedByteArray" />
- <argument index="1" name="id" type="int" default="0" />
- <argument index="2" name="mode" type="int" enum="TransferMode" default="2" />
- <argument index="3" name="channel" type="int" default="0" />
+ <argument index="0" name="peer" type="int" />
+ <argument index="1" name="object" type="Object" />
+ <argument index="2" name="method" type="StringName" />
+ <argument index="3" name="arguments" type="Array" default="[]" />
+ <description>
+ Sends an RPC to the target [code]peer[/code]. The given [code]method[/code] will be called on the remote [code]object[/code] with the provided [code]arguments[/code]. The RPC may also be called locally depending on the implementation and RPC configuration. See [method Node.rpc] and [method Node.rpc_config].
+ [b]Note:[/b] Prefer using [method Node.rpc], [method Node.rpc_id], or [code]my_method.rpc(peer, arg1, arg2, ...)[/code] (in GDScript), since they are faster. This method is mostly useful in conjunction with [MultiplayerAPIExtension] when augmenting or replacing the multiplayer capabilities.
+ </description>
+ </method>
+ <method name="set_default_interface" qualifiers="static">
+ <return type="void" />
+ <argument index="0" name="interface_name" type="StringName" />
<description>
- Sends the given raw [code]bytes[/code] to a specific peer identified by [code]id[/code] (see [method MultiplayerPeer.set_target_peer]). Default ID is [code]0[/code], i.e. broadcast to all peers.
+ Sets the default MultiplayerAPI implementation class. This method can be used by modules and extensions to configure which implementation will be used by [SceneTree] when the engine starts.
</description>
</method>
</methods>
<members>
- <member name="allow_object_decoding" type="bool" setter="set_allow_object_decoding" getter="is_object_decoding_allowed" default="false">
- If [code]true[/code], the MultiplayerAPI will allow encoding and decoding of object during RPCs.
- [b]Warning:[/b] Deserialized objects can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats such as remote code execution.
- </member>
<member name="multiplayer_peer" type="MultiplayerPeer" setter="set_multiplayer_peer" getter="get_multiplayer_peer">
The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_server]) and will set root node's network mode to authority, or it will become a regular client peer. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals.
</member>
- <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="root_path" type="NodePath" setter="set_root_path" getter="get_root_path" default="NodePath(&quot;&quot;)">
- The root path to use for RPCs and replication. 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.
- </member>
</members>
<signals>
<signal name="connected_to_server">
@@ -107,17 +127,21 @@
Emitted when this MultiplayerAPI's [member multiplayer_peer] disconnects from a peer. Clients get notified when other clients disconnect from the same server.
</description>
</signal>
- <signal name="peer_packet">
- <argument index="0" name="id" type="int" />
- <argument index="1" name="packet" type="PackedByteArray" />
- <description>
- Emitted when this MultiplayerAPI's [member multiplayer_peer] receives a [code]packet[/code] with custom data (see [method send_bytes]). ID is the peer ID of the peer that sent the packet.
- </description>
- </signal>
<signal name="server_disconnected">
<description>
Emitted when this MultiplayerAPI's [member multiplayer_peer] disconnects from server. Only emitted on clients.
</description>
</signal>
</signals>
+ <constants>
+ <constant name="RPC_MODE_DISABLED" value="0" enum="RPCMode">
+ Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
+ </constant>
+ <constant name="RPC_MODE_ANY_PEER" value="1" enum="RPCMode">
+ Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not.
+ </constant>
+ <constant name="RPC_MODE_AUTHORITY" value="2" enum="RPCMode">
+ Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(authority)[/code] annotation. See [method Node.set_multiplayer_authority].
+ </constant>
+ </constants>
</class>
diff --git a/doc/classes/MultiplayerAPIExtension.xml b/doc/classes/MultiplayerAPIExtension.xml
new file mode 100644
index 0000000000..c369977d57
--- /dev/null
+++ b/doc/classes/MultiplayerAPIExtension.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="MultiplayerAPIExtension" inherits="MultiplayerAPI" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
+ <brief_description>
+ Base class used for extending the [MultiplayerAPI].
+ </brief_description>
+ <description>
+ This class can be used to augment or replace the default [MultiplayerAPI] implementation via script or extensions.
+ The following example augment the default implemenation ([SceneMultiplayer]) by logging every RPC being made, and every object being configured for replication.
+ [codeblocks]
+ [gdscript]
+ extends MultiplayerAPIExtension
+ class_name LogMultiplayer
+
+ # We want to augment the default SceneMultiplayer.
+ var base_multiplayer = SceneMultiplayer.new()
+
+ func _init():
+ # Just passthourgh base signals (copied to var to avoid cyclic reference)
+ var cts = connected_to_server
+ var cf = connection_failed
+ var pc = peer_connected
+ var pd = peer_disconnected
+ base_multiplayer.connected_to_server.connect(func(): cts.emit())
+ base_multiplayer.connection_failed.connect(func(): cf.emit())
+ base_multiplayer.peer_connected.connect(func(id): pc.emit(id))
+ base_multiplayer.peer_disconnected.connect(func(id): pd.emit(id))
+
+ # Log RPC being made and forward it to the default multiplayer.
+ func _rpc(peer: int, object: Object, method: StringName, args: Array) -&gt; int: # Error
+ print("Got RPC for %d: %s::%s(%s)" % [peer, object, method, args])
+ return base_multiplayer.rpc(peer, object, method, args)
+
+ # Log configuration add. E.g. root path (nullptr, NodePath), replication (Node, Spawner|Synchronizer), custom.
+ func _object_configuration_add(object, config: Variant) -&gt; int: # Error
+ if config is MultiplayerSynchronizer:
+ print("Adding synchronization configuration for %s. Synchronizer: %s" % [object, config])
+ elif config is MultiplayerSpawner:
+ print("Adding node %s to the spawn list. Spawner: %s" % [object, config])
+ return base_multiplayer.object_configuration_add(object, config)
+
+ # Log configuration remove. E.g. root path (nullptr, NodePath), replication (Node, Spawner|Synchronizer), custom.
+ func _object_configuration_remove(object, config: Variant) -&gt; int: # Error
+ if config is MultiplayerSynchronizer:
+ print("Removing synchronization configuration for %s. Synchronizer: %s" % [object, config])
+ elif config is MultiplayerSpawner:
+ print("Removing node %s from the spawn list. Spawner: %s" % [object, config])
+ return base_multiplayer.object_configuration_remove(object, config)
+
+ # These can be optional, but in our case we want to augment SceneMultiplayer, so forward everything.
+ func _set_multiplayer_peer(p_peer: MultiplayerPeer):
+ base_multiplayer.multiplayer_peer = p_peer
+
+ func _get_multiplayer_peer() -&gt; MultiplayerPeer:
+ return base_multiplayer.multiplayer_peer
+
+ func _get_unique_id() -&gt; int:
+ return base_multiplayer.get_unique_id()
+
+ func _get_peer_ids() -&gt; PackedInt32Array:
+ return base_multiplayer.get_peers()
+ [/gdscript]
+ [/codeblocks]
+ Then in your main scene or in an autoload call [method SceneTree.set_multiplayer] to start using your custom [MultiplayerAPI]:
+ [codeblocks]
+ [gdscript]
+ # autoload.gd
+ func _enter_tree():
+ # Sets our custom multiplayer as the main one in SceneTree.
+ get_tree().set_multiplayer(LogMultiplayer.new())
+ [/gdscript]
+ [/codeblocks]
+ Native extensions can alternatively use the [method MultiplayerAPI.set_default_interface] method during initialization to configure themselves as the default implementation.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="_get_multiplayer_peer" qualifiers="virtual">
+ <return type="MultiplayerPeer" />
+ <description>
+ Called when the [member MultiplayerAPI.multiplayer_peer] is retrieved.
+ </description>
+ </method>
+ <method name="_get_peer_ids" qualifiers="virtual const">
+ <return type="PackedInt32Array" />
+ <description>
+ Callback for [method MultiplayerAPI.get_peers].
+ </description>
+ </method>
+ <method name="_get_remote_sender_id" qualifiers="virtual const">
+ <return type="int" />
+ <description>
+ Callback for [method MultiplayerAPI.get_remote_sender_id].
+ </description>
+ </method>
+ <method name="_get_unique_id" qualifiers="virtual const">
+ <return type="int" />
+ <description>
+ Callback for [method MultiplayerAPI.get_unique_id].
+ </description>
+ </method>
+ <method name="_object_configuration_add" qualifiers="virtual">
+ <return type="int" />
+ <argument index="0" name="object" type="Object" />
+ <argument index="1" name="configuration" type="Variant" />
+ <description>
+ Callback for [method MultiplayerAPI.object_configuration_add].
+ </description>
+ </method>
+ <method name="_object_configuration_remove" qualifiers="virtual">
+ <return type="int" />
+ <argument index="0" name="object" type="Object" />
+ <argument index="1" name="configuration" type="Variant" />
+ <description>
+ Callback for [method MultiplayerAPI.object_configuration_remove].
+ </description>
+ </method>
+ <method name="_poll" qualifiers="virtual">
+ <return type="int" />
+ <description>
+ Callback for [method MultiplayerAPI.poll].
+ </description>
+ </method>
+ <method name="_rpc" qualifiers="virtual">
+ <return type="int" />
+ <argument index="0" name="peer" type="int" />
+ <argument index="1" name="object" type="Object" />
+ <argument index="2" name="method" type="StringName" />
+ <argument index="3" name="args" type="Array" />
+ <description>
+ Callback for [method MultiplayerAPI.rpc].
+ </description>
+ </method>
+ <method name="_set_multiplayer_peer" qualifiers="virtual">
+ <return type="void" />
+ <argument index="0" name="multiplayer_peer" type="MultiplayerPeer" />
+ <description>
+ Called when the [member MultiplayerAPI.multiplayer_peer] is set.
+ </description>
+ </method>
+ </methods>
+</class>
diff --git a/doc/classes/MultiplayerPeer.xml b/doc/classes/MultiplayerPeer.xml
index 4a3559b0f7..6dde40f018 100644
--- a/doc/classes/MultiplayerPeer.xml
+++ b/doc/classes/MultiplayerPeer.xml
@@ -60,7 +60,7 @@
The channel to use to send packets. Many network APIs such as ENet and WebRTC allow the creation of multiple independent channels which behaves, in a way, like separate connections. This means that reliable data will only block delivery of other packets on that channel, and ordering will only be in respect to the channel the packet is being sent on. Using different channels to send [b]different and independent[/b] state updates is a common way to optimize network usage and decrease latency in fast-paced games.
[b]Note:[/b] The default channel ([code]0[/code]) actually works as 3 separate channels (one for each [enum TransferMode]) so that [constant TRANSFER_MODE_RELIABLE] and [constant TRANSFER_MODE_UNRELIABLE_ORDERED] does not interact with each other by default. Refer to the specific network API documentation (e.g. ENet or WebRTC) to learn how to set up channels correctly.
</member>
- <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" enum="TransferMode" default="2">
+ <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" enum="MultiplayerPeer.TransferMode" default="2">
The manner in which to send packets to the [code]target_peer[/code]. See [enum TransferMode].
</member>
</members>
@@ -109,5 +109,14 @@
<constant name="TARGET_PEER_SERVER" value="1">
Packets are sent to the server alone.
</constant>
+ <constant name="TRANSFER_MODE_UNRELIABLE" value="0" enum="TransferMode">
+ Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters.
+ </constant>
+ <constant name="TRANSFER_MODE_UNRELIABLE_ORDERED" value="1" enum="TransferMode">
+ Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data.
+ </constant>
+ <constant name="TRANSFER_MODE_RELIABLE" value="2" enum="TransferMode">
+ Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/MultiplayerSpawner.xml b/doc/classes/MultiplayerSpawner.xml
deleted file mode 100644
index 9de67068eb..0000000000
--- a/doc/classes/MultiplayerSpawner.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiplayerSpawner" inherits="Node" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
- <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="add_spawnable_scene">
- <return type="void" />
- <argument index="0" name="path" type="String" />
- <description>
- </description>
- </method>
- <method name="clear_spawnable_scenes">
- <return type="void" />
- <description>
- </description>
- </method>
- <method name="get_spawnable_scene" qualifiers="const">
- <return type="String" />
- <argument index="0" name="path" type="int" />
- <description>
- </description>
- </method>
- <method name="get_spawnable_scene_count" qualifiers="const">
- <return type="int" />
- <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="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
deleted file mode 100644
index 3766491a6c..0000000000
--- a/doc/classes/MultiplayerSynchronizer.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="MultiplayerSynchronizer" inherits="Node" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- <method name="add_visibility_filter">
- <return type="void" />
- <argument index="0" name="filter" type="Callable" />
- <description>
- </description>
- </method>
- <method name="get_visibility_for" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="peer" type="int" />
- <description>
- </description>
- </method>
- <method name="remove_visibility_filter">
- <return type="void" />
- <argument index="0" name="filter" type="Callable" />
- <description>
- </description>
- </method>
- <method name="set_visibility_for">
- <return type="void" />
- <argument index="0" name="peer" type="int" />
- <argument index="1" name="visible" type="bool" />
- <description>
- </description>
- </method>
- <method name="update_visibility">
- <return type="void" />
- <argument index="0" name="for_peer" type="int" default="0" />
- <description>
- </description>
- </method>
- </methods>
- <members>
- <member name="public_visibility" type="bool" setter="set_visibility_public" getter="is_visibility_public" default="true">
- </member>
- <member name="replication_config" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config">
- </member>
- <member name="replication_interval" type="float" setter="set_replication_interval" getter="get_replication_interval" default="0.0">
- </member>
- <member name="root_path" type="NodePath" setter="set_root_path" getter="get_root_path" default="NodePath(&quot;..&quot;)">
- </member>
- <member name="visibility_update_mode" type="int" setter="set_visibility_update_mode" getter="get_visibility_update_mode" enum="MultiplayerSynchronizer.VisibilityUpdateMode" default="0">
- </member>
- </members>
- <signals>
- <signal name="visibility_changed">
- <argument index="0" name="for_peer" type="int" />
- <description>
- </description>
- </signal>
- </signals>
- <constants>
- <constant name="VISIBILITY_PROCESS_IDLE" value="0" enum="VisibilityUpdateMode">
- </constant>
- <constant name="VISIBILITY_PROCESS_PHYSICS" value="1" enum="VisibilityUpdateMode">
- </constant>
- <constant name="VISIBILITY_PROCESS_NONE" value="2" enum="VisibilityUpdateMode">
- </constant>
- </constants>
-</class>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index b7591ed4f4..8cc8498609 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -622,7 +622,7 @@
</description>
</method>
<method name="rpc" qualifiers="vararg">
- <return type="void" />
+ <return type="int" enum="Error" />
<argument index="0" name="method" type="StringName" />
<description>
Sends a remote procedure call request for the given [code]method[/code] to peers on the network (and locally), optionally sending all additional arguments as arguments to the method called by the RPC. The call request will only be received by nodes with the same [NodePath], including the exact same node name. Behaviour depends on the RPC configuration for the given method, see [method rpc_config]. Methods are not exposed to RPCs by default. Returns [code]null[/code].
@@ -630,18 +630,24 @@
</description>
</method>
<method name="rpc_config">
- <return type="int" />
+ <return type="void" />
<argument index="0" name="method" type="StringName" />
- <argument index="1" name="rpc_mode" type="int" enum="RPCMode" />
- <argument index="2" name="call_local" type="bool" default="false" />
- <argument index="3" name="transfer_mode" type="int" enum="TransferMode" default="2" />
- <argument index="4" name="channel" type="int" default="0" />
+ <argument index="1" name="config" type="Variant" />
<description>
- Changes the RPC mode for the given [code]method[/code] to the given [code]rpc_mode[/code], optionally specifying the [code]transfer_mode[/code] and [code]channel[/code] (on supported peers). See [enum RPCMode] and [enum TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc(any)[/code], [code]@rpc(authority)[/code]). By default, methods are not exposed to networking (and RPCs).
+ Changes the RPC mode for the given [code]method[/code] with the given [code]config[/code] which should be [code]null[/code] (to disable) or a [Dictionary] in the form:
+ [codeblock]
+ {
+ rpc_mode = MultiplayerAPI.RPCMode,
+ transfer_mode = MultiplayerPeer.TranferMode,
+ call_local = false,
+ channel = 0,
+ }
+ [/codeblock]
+ See [enum MultiplayerAPI.RPCMode] and [enum MultiplayerPeer.TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc(any)[/code], [code]@rpc(authority)[/code]). By default, methods are not exposed to networking (and RPCs).
</description>
</method>
<method name="rpc_id" qualifiers="vararg">
- <return type="void" />
+ <return type="int" enum="Error" />
<argument index="0" name="peer_id" type="int" />
<argument index="1" name="method" type="StringName" />
<description>
diff --git a/doc/classes/SceneReplicationConfig.xml b/doc/classes/SceneReplicationConfig.xml
deleted file mode 100644
index 62c108a477..0000000000
--- a/doc/classes/SceneReplicationConfig.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="SceneReplicationConfig" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
- <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="has_property" qualifiers="const">
- <return type="bool" />
- <argument index="0" name="path" 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>
diff --git a/doc/classes/ScriptExtension.xml b/doc/classes/ScriptExtension.xml
index 91fa6206d7..4e432ca9a8 100644
--- a/doc/classes/ScriptExtension.xml
+++ b/doc/classes/ScriptExtension.xml
@@ -65,8 +65,8 @@
<description>
</description>
</method>
- <method name="_get_rpc_methods" qualifiers="virtual const">
- <return type="Dictionary[]" />
+ <method name="_get_rpc_config" qualifiers="virtual const">
+ <return type="Variant" />
<description>
</description>
</method>