From 61cca26ddffdd634c332c1fc4274c954481996e7 Mon Sep 17 00:00:00 2001 From: Karol Walasek Date: Mon, 10 Oct 2016 15:35:06 +0200 Subject: [PATCH] Documentation of RPC-related methods and classes --- doc/base/classes.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index f7abc8a3d55..b3d19246a0d 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -22274,8 +22274,10 @@ + PacketPeer implementation using the ENet library. + A connection (or a listening server) that should be passed to [method SceneTree.set_network_peer]. Socket events can be handled by connecting to [SceneTree] signals. @@ -22630,6 +22632,7 @@ Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it. To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though. Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children. + [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to easily communicate over the network. By calling [method rpc] with a method name, it will be called locally, and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) on the receiving peer. To identify which [Node] receives the RPC call Godot will use it's [NodePath] (make sure node names are the same on all peers). @@ -23067,6 +23070,7 @@ + Send a remote procedure call request to all peers on the network (and locally), optionally sending additional data as arguments. Call request will be received by nodes with the same [NodePath]. @@ -23075,6 +23079,7 @@ + Change the method's RPC mode (one of RPC_MODE_* constants). @@ -23083,12 +23088,14 @@ + Send a [method rpc] to a specific peer identified by [i]peer_id[/i]. + Send a [method rpc] using an unreliable protocol. @@ -23097,6 +23104,7 @@ + Send a [method rpc] to a specific peer identified by [i]peer_id[/i] using an unreliable protocol. @@ -23105,6 +23113,7 @@ + Remotely change property's value on other peers (and locally). @@ -23113,6 +23122,7 @@ + Change the property's RPC mode (one of RPC_MODE_* constants). @@ -23123,6 +23133,7 @@ + Remotely change property's value on a specific peer identified by [i]peer_id[/i]. @@ -23131,6 +23142,7 @@ + Remotely change property's value on other peers (and locally) using an unreliable protocol. @@ -23141,6 +23153,7 @@ + Remotely change property's value on a specific peer identified by [i]peer_id[/i] using an unreliable protocol. @@ -23174,6 +23187,7 @@ + Change the networking mode of the [Node], where [i]mode[/i] is one of the constants NETWORK_MODE_*. Master nodes will only call gdscript methods defined as [i]master func[/i] if a RPC call is received (slave nodes will only call [i]slave func[/i]; both will call [i]remote func[/i] if the call is not local, and [i]sync func[/i] in any case). Inherit mode looks at the parent node to determine the value (root node depends on the [SceneTree] having a networking peer set with [method SceneTree.set_network_peer]) @@ -35273,6 +35287,7 @@ + Returns true if this SceneTree's [NetworkedMultiplayerPeer] is in server mode (listening for connections). @@ -35369,6 +35384,7 @@ + Set the peer object to handle the RPC system (effectively enabling networking). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. 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 SceneTree's signals.