128 lines
7 KiB
Text
128 lines
7 KiB
Text
|
:github_url: hide
|
||
|
|
||
|
.. DO NOT EDIT THIS FILE!!!
|
||
|
.. Generated automatically from Godot engine sources.
|
||
|
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
|
||
|
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/NetworkedMultiplayerCustom.xml.
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom:
|
||
|
|
||
|
NetworkedMultiplayerCustom
|
||
|
==========================
|
||
|
|
||
|
**Inherits:** :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` **<** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
|
||
|
|
||
|
A :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` implementation that can be controlled from a script.
|
||
|
|
||
|
.. rst-class:: classref-introduction-group
|
||
|
|
||
|
Description
|
||
|
-----------
|
||
|
|
||
|
A :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` implementation that can be used as a :ref:`MultiplayerAPI.network_peer<class_MultiplayerAPI_property_network_peer>` and controlled from a script.
|
||
|
|
||
|
Its purpose is to allow adding a new backend for the high-Level multiplayer API without needing to use GDNative.
|
||
|
|
||
|
.. rst-class:: classref-reftable-group
|
||
|
|
||
|
Methods
|
||
|
-------
|
||
|
|
||
|
.. table::
|
||
|
:widths: auto
|
||
|
|
||
|
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
| void | :ref:`deliver_packet<class_NetworkedMultiplayerCustom_method_deliver_packet>` **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` from_peer_id **)** |
|
||
|
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
| void | :ref:`initialize<class_NetworkedMultiplayerCustom_method_initialize>` **(** :ref:`int<class_int>` self_peer_id **)** |
|
||
|
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
| void | :ref:`set_connection_status<class_NetworkedMultiplayerCustom_method_set_connection_status>` **(** :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>` connection_status **)** |
|
||
|
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
| void | :ref:`set_max_packet_size<class_NetworkedMultiplayerCustom_method_set_max_packet_size>` **(** :ref:`int<class_int>` max_packet_size **)** |
|
||
|
+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
|
||
|
.. rst-class:: classref-section-separator
|
||
|
|
||
|
----
|
||
|
|
||
|
.. rst-class:: classref-descriptions-group
|
||
|
|
||
|
Signals
|
||
|
-------
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom_signal_packet_generated:
|
||
|
|
||
|
.. rst-class:: classref-signal
|
||
|
|
||
|
**packet_generated** **(** :ref:`int<class_int>` peer_id, :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` transfer_mode **)**
|
||
|
|
||
|
Emitted when the local :ref:`MultiplayerAPI<class_MultiplayerAPI>` generates a packet (e.g. when calling :ref:`Node.rpc<class_Node_method_rpc>`).
|
||
|
|
||
|
Your script should take this packet and send it to the requested peer over the network (which should call :ref:`deliver_packet<class_NetworkedMultiplayerCustom_method_deliver_packet>` with the data when it's received).
|
||
|
|
||
|
.. rst-class:: classref-section-separator
|
||
|
|
||
|
----
|
||
|
|
||
|
.. rst-class:: classref-descriptions-group
|
||
|
|
||
|
Method Descriptions
|
||
|
-------------------
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom_method_deliver_packet:
|
||
|
|
||
|
.. rst-class:: classref-method
|
||
|
|
||
|
void **deliver_packet** **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` from_peer_id **)**
|
||
|
|
||
|
Deliver a packet to the local :ref:`MultiplayerAPI<class_MultiplayerAPI>`.
|
||
|
|
||
|
When your script receives a packet from other peers over the network (originating from the :ref:`packet_generated<class_NetworkedMultiplayerCustom_signal_packet_generated>` signal on the sending peer), passing it to this method will deliver it locally.
|
||
|
|
||
|
.. rst-class:: classref-item-separator
|
||
|
|
||
|
----
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom_method_initialize:
|
||
|
|
||
|
.. rst-class:: classref-method
|
||
|
|
||
|
void **initialize** **(** :ref:`int<class_int>` self_peer_id **)**
|
||
|
|
||
|
Initialize the peer with the given ``self_peer_id`` (must be between 1 and 2147483647).
|
||
|
|
||
|
Can only be called if the connection status is :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>`. See :ref:`set_connection_status<class_NetworkedMultiplayerCustom_method_set_connection_status>`.
|
||
|
|
||
|
.. rst-class:: classref-item-separator
|
||
|
|
||
|
----
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom_method_set_connection_status:
|
||
|
|
||
|
.. rst-class:: classref-method
|
||
|
|
||
|
void **set_connection_status** **(** :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>` connection_status **)**
|
||
|
|
||
|
Set the state of the connection. See :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>`.
|
||
|
|
||
|
This will emit the :ref:`NetworkedMultiplayerPeer.connection_succeeded<class_NetworkedMultiplayerPeer_signal_connection_succeeded>`, :ref:`NetworkedMultiplayerPeer.connection_failed<class_NetworkedMultiplayerPeer_signal_connection_failed>` or :ref:`NetworkedMultiplayerPeer.server_disconnected<class_NetworkedMultiplayerPeer_signal_server_disconnected>` signals depending on the status and if the peer has the unique network id of ``1``.
|
||
|
|
||
|
You can only change to :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>` from :ref:`NetworkedMultiplayerPeer.CONNECTION_DISCONNECTED<class_NetworkedMultiplayerPeer_constant_CONNECTION_DISCONNECTED>` and to :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTED<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTED>` from :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>`.
|
||
|
|
||
|
.. rst-class:: classref-item-separator
|
||
|
|
||
|
----
|
||
|
|
||
|
.. _class_NetworkedMultiplayerCustom_method_set_max_packet_size:
|
||
|
|
||
|
.. rst-class:: classref-method
|
||
|
|
||
|
void **set_max_packet_size** **(** :ref:`int<class_int>` max_packet_size **)**
|
||
|
|
||
|
Set the max packet size that this peer can handle.
|
||
|
|
||
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
||
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
||
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
||
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|