: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` **<** :ref:`PacketPeer` **<** :ref:`Reference` **<** :ref:`Object` A :ref:`NetworkedMultiplayerPeer` implementation that can be controlled from a script. .. rst-class:: classref-introduction-group Description ----------- A :ref:`NetworkedMultiplayerPeer` implementation that can be used as a :ref:`MultiplayerAPI.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` **(** :ref:`PoolByteArray` buffer, :ref:`int` from_peer_id **)** | +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`initialize` **(** :ref:`int` self_peer_id **)** | +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_connection_status` **(** :ref:`ConnectionStatus` connection_status **)** | +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_max_packet_size` **(** :ref:`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` peer_id, :ref:`PoolByteArray` buffer, :ref:`int` transfer_mode **)** Emitted when the local :ref:`MultiplayerAPI` generates a packet (e.g. when calling :ref:`Node.rpc`). Your script should take this packet and send it to the requested peer over the network (which should call :ref:`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` buffer, :ref:`int` from_peer_id **)** Deliver a packet to the local :ref:`MultiplayerAPI`. When your script receives a packet from other peers over the network (originating from the :ref:`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` 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`. See :ref:`set_connection_status`. .. rst-class:: classref-item-separator ---- .. _class_NetworkedMultiplayerCustom_method_set_connection_status: .. rst-class:: classref-method void **set_connection_status** **(** :ref:`ConnectionStatus` connection_status **)** Set the state of the connection. See :ref:`ConnectionStatus`. This will emit the :ref:`NetworkedMultiplayerPeer.connection_succeeded`, :ref:`NetworkedMultiplayerPeer.connection_failed` or :ref:`NetworkedMultiplayerPeer.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` from :ref:`NetworkedMultiplayerPeer.CONNECTION_DISCONNECTED` and to :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTED` from :ref:`NetworkedMultiplayerPeer.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` 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.)`