Table of Contents

Class MultiplayerPeerExtension

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class MultiplayerPeerExtension : MultiplayerPeer, IDisposable
Inheritance
MultiplayerPeerExtension
Implements
Inherited Members

Constructors

MultiplayerPeerExtension()

public MultiplayerPeerExtension()

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

_Close()

Called when the multiplayer peer should be immediately closed (see Close()).

public virtual void _Close()

_DisconnectPeer(int, bool)

Called when the connected pPeer should be forcibly disconnected (see DisconnectPeer(int, bool)).

public virtual void _DisconnectPeer(int pPeer, bool pForce)

Parameters

pPeer int
pForce bool

_GetAvailablePacketCount()

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

public virtual int _GetAvailablePacketCount()

Returns

int

_GetConnectionStatus()

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

public virtual MultiplayerPeer.ConnectionStatus _GetConnectionStatus()

Returns

MultiplayerPeer.ConnectionStatus

_GetMaxPacketSize()

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

public virtual int _GetMaxPacketSize()

Returns

int

_GetPacketChannel()

Called to get the channel over which the next available packet was received. See GetPacketChannel().

public virtual int _GetPacketChannel()

Returns

int

_GetPacketMode()

Called to get the MultiplayerPeer.TransferModeEnum the remote peer used to send the next available packet. See GetPacketMode().

public virtual MultiplayerPeer.TransferModeEnum _GetPacketMode()

Returns

MultiplayerPeer.TransferModeEnum

_GetPacketPeer()

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

public virtual int _GetPacketPeer()

Returns

int

_GetPacketScript()

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.

public virtual byte[] _GetPacketScript()

Returns

byte[]

_GetTransferChannel()

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

public virtual int _GetTransferChannel()

Returns

int

_GetTransferMode()

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

public virtual MultiplayerPeer.TransferModeEnum _GetTransferMode()

Returns

MultiplayerPeer.TransferModeEnum

_GetUniqueId()

Called when the unique ID of this MultiplayerPeer is requested (see GetUniqueId()). The value must be between 1 and 2147483647.

public virtual int _GetUniqueId()

Returns

int

_IsRefusingNewConnections()

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

public virtual bool _IsRefusingNewConnections()

Returns

bool

_IsServer()

Called when the "is server" status is requested on the MultiplayerApi. See IsServer().

public virtual bool _IsServer()

Returns

bool

_IsServerRelaySupported()

Called to check if the server can act as a relay in the current configuration. See IsServerRelaySupported().

public virtual bool _IsServerRelaySupported()

Returns

bool

_Poll()

Called when the MultiplayerApi is polled. See Poll().

public virtual void _Poll()

_PutPacketScript(byte[])

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.

public virtual Error _PutPacketScript(byte[] pBuffer)

Parameters

pBuffer byte[]

Returns

Error

_SetRefuseNewConnections(bool)

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

public virtual void _SetRefuseNewConnections(bool pEnable)

Parameters

pEnable bool

_SetTargetPeer(int)

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

public virtual void _SetTargetPeer(int pPeer)

Parameters

pPeer int

_SetTransferChannel(int)

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

public virtual void _SetTransferChannel(int pChannel)

Parameters

pChannel int

_SetTransferMode(TransferModeEnum)

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

public virtual void _SetTransferMode(MultiplayerPeer.TransferModeEnum pMode)

Parameters

pMode MultiplayerPeer.TransferModeEnum