MultiplayerPeerExtension

Inherits: MultiplayerPeer < PacketPeer < RefCounted < Object

Class that can be inherited to implement custom multiplayer API networking layers via GDExtension.

Description

This class is designed to be inherited from a GDExtension plugin to implement custom networking layers for the multiplayer API (such as WebRTC). All the methods below must be implemented to have a working custom multiplayer implementation. See also MultiplayerAPI.

Methods

int

_get_available_packet_count ( ) virtual const

ConnectionStatus

_get_connection_status ( ) virtual const

int

_get_max_packet_size ( ) virtual const

Error

_get_packet ( const uint8_t ** r_buffer, int32_t* r_buffer_size ) virtual

int

_get_packet_peer ( ) virtual const

PackedByteArray

_get_packet_script ( ) virtual

int

_get_transfer_channel ( ) virtual const

TransferMode

_get_transfer_mode ( ) virtual const

int

_get_unique_id ( ) virtual const

bool

_is_refusing_new_connections ( ) virtual const

bool

_is_server ( ) virtual const

void

_poll ( ) virtual

Error

_put_packet ( const uint8_t* p_buffer, int p_buffer_size ) virtual

Error

_put_packet_script ( PackedByteArray p_buffer ) virtual

void

_set_refuse_new_connections ( bool p_enable ) virtual

void

_set_target_peer ( int p_peer ) virtual

void

_set_transfer_channel ( int p_channel ) virtual

void

_set_transfer_mode ( TransferMode p_mode ) virtual

Method Descriptions

  • int _get_available_packet_count ( ) virtual const

Called when the available packet count is internally requested by the MultiplayerAPI.


Called when the connection status is requested on the MultiplayerPeer (see MultiplayerPeer.get_connection_status).


  • int _get_max_packet_size ( ) virtual const

Called when the maximum allowed packet size (in bytes) is requested by the MultiplayerAPI.


  • Error _get_packet ( const uint8_t ** r_buffer, int32_t* r_buffer_size ) virtual

Called when a packet needs to be received by the MultiplayerAPI, with r_buffer_size being the size of the binary r_buffer in bytes.


  • int _get_packet_peer ( ) virtual const

Called when the ID of the MultiplayerPeer who sent the most recent packet is requested (see MultiplayerPeer.get_packet_peer).


Called when a packet needs to be received by the MultiplayerAPI, if _get_packet isn't implemented. Use this when extending this class via GDScript.


  • int _get_transfer_channel ( ) virtual const

Called when the transfer channel to use is read on this MultiplayerPeer (see MultiplayerPeer.transfer_channel).


Called when the transfer mode to use is read on this MultiplayerPeer (see MultiplayerPeer.transfer_mode).


  • int _get_unique_id ( ) virtual const

Called when the unique ID of this MultiplayerPeer is requested (see MultiplayerPeer.get_unique_id).


  • bool _is_refusing_new_connections ( ) virtual const

Called when the "refuse new connections" status is requested on this MultiplayerPeer (see MultiplayerPeer.refuse_new_connections).


  • bool _is_server ( ) virtual const

Called when the "is server" status is requested on the MultiplayerAPI. See MultiplayerAPI.is_server.


  • void _poll ( ) virtual

Called when the MultiplayerAPI is polled. See MultiplayerAPI.poll.


  • Error _put_packet ( const uint8_t* p_buffer, int p_buffer_size ) virtual

Called when a packet needs to be sent by the MultiplayerAPI, with p_buffer_size being the size of the binary p_buffer in bytes.


Called when a packet needs to be sent by the MultiplayerAPI, if _put_packet isn't implemented. Use this when extending this class via GDScript.


  • void _set_refuse_new_connections ( bool p_enable ) virtual

Called when the "refuse new connections" status is set on this MultiplayerPeer (see MultiplayerPeer.refuse_new_connections).


  • void _set_target_peer ( int p_peer ) virtual

Called when the target peer to use is set for this MultiplayerPeer (see MultiplayerPeer.set_target_peer).


  • void _set_transfer_channel ( int p_channel ) virtual

Called when the channel to use is set for this MultiplayerPeer (see MultiplayerPeer.transfer_channel).


Called when the transfer mode is set on this MultiplayerPeer (see MultiplayerPeer.transfer_mode).