diff --git a/classes/class_file.rst b/classes/class_file.rst index 6eb926e4..cbcec60e 100644 --- a/classes/class_file.rst +++ b/classes/class_file.rst @@ -150,13 +150,13 @@ Here's a sample on how to write and read from a file: func save(content): var file = File.new() - file.open("user://save_game.dat", file.WRITE) + file.open("user://save_game.dat", File.WRITE) file.store_string(content) file.close() func load(): var file = File.new() - file.open("user://save_game.dat", file.READ) + file.open("user://save_game.dat", File.READ) var content = file.get_as_text() file.close() return content diff --git a/classes/class_multiplayerapi.rst b/classes/class_multiplayerapi.rst index 81180083..0a8c4694 100644 --- a/classes/class_multiplayerapi.rst +++ b/classes/class_multiplayerapi.rst @@ -100,10 +100,10 @@ enum **RPCMode** - **RPC_MODE_DISABLED** = **0** --- Used with :ref:`Node.rpc_config` or :ref:`Node.rset_config` to disable a method or property for all RPC calls, making it unavailable. Default for all methods. - **RPC_MODE_REMOTE** = **1** --- Used with :ref:`Node.rpc_config` or :ref:`Node.rset_config` to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the ``remote`` keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves. -- **RPC_MODE_SYNC** = **2** --- Behave like constant RPC_MODE_REMOTE but also make the call or property change locally. Analogous to the ``sync`` keyword. +- **RPC_MODE_SYNC** = **2** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Analogous to the ``sync`` keyword. - **RPC_MODE_MASTER** = **3** --- Used with :ref:`Node.rpc_config` or :ref:`Node.rset_config` to set a method to be called or a property to be changed only on the network master for this node. Analogous to the ``master`` keyword. Only accepts calls or property changes from the node's network slaves, see :ref:`Node.set_network_master`. - **RPC_MODE_SLAVE** = **4** --- Used with :ref:`Node.rpc_config` or :ref:`Node.rset_config` to set a method to be called or a property to be changed only on slaves for this node. Analogous to the ``slave`` keyword. Only accepts calls or property changes from the node's network master, see :ref:`Node.set_network_master`. -- **RPC_MODE_REMOTESYNC** = **5** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Same as constant RPC_MODE_SYNC which is only kept for compatibility. Analogous to the ``remotesync`` keyword. +- **RPC_MODE_REMOTESYNC** = **5** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Same as ``RPC_MODE_SYNC`` which is only kept for compatibility. Analogous to the ``remotesync`` keyword. - **RPC_MODE_MASTERSYNC** = **6** --- Behave like ``RPC_MODE_MASTER`` but also make the call or property change locally. Analogous to the ``mastersync`` keyword. - **RPC_MODE_SLAVESYNC** = **7** --- Behave like ``RPC_MODE_SLAVE`` but also make the call or property change locally. Analogous to the ``slavesync`` keyword. @@ -162,11 +162,9 @@ Returns ``true`` if this MultiplayerAPI's :ref:`network_peer` override or you set :ref:`SceneTree.multiplayer_poll` to ``false``. By default :ref:`SceneTree` will poll its MultiplayerAPI for you. -You only need to worry about this if you are using :ref:`Node.custom_multiplayer` override. - -SceneTree will poll the default MultiplayerAPI for you. +NOTE: This method results in RPCs and RSETs being called, so they will be executed in the same context of this function (e.g. ``_process``, ``physics``, :ref:`Thread`). .. _class_MultiplayerAPI_send_bytes: diff --git a/classes/class_scenetree.rst b/classes/class_scenetree.rst index 3fc30bfc..d4b88abd 100644 --- a/classes/class_scenetree.rst +++ b/classes/class_scenetree.rst @@ -178,6 +178,12 @@ Member Variables - :ref:`MultiplayerAPI` **multiplayer** - The default :ref:`MultiplayerAPI` instance for this SceneTree. + .. _class_SceneTree_multiplayer_poll: + +- :ref:`bool` **multiplayer_poll** - If ``true`` (default) enable the automatic polling of the :ref:`MultiplayerAPI` for this SceneTree during :ref:`idle_frame`. + +When ``false`` you need to manually call :ref:`MultiplayerAPI.poll` for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual :ref:`Mutex` protecion when accessing the :ref:`MultiplayerAPI` from threads. + .. _class_SceneTree_network_peer: - :ref:`NetworkedMultiplayerPeer` **network_peer** - The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with :ref:`is_network_server()`) and will set root node's network mode to master (see NETWORK_MODE\_\* constants in :ref:`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.