Documentation
¶
Overview ¶
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 graphics.gd/classdb/MultiplayerAPI.
Index ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsMultiplayerPeer() MultiplayerPeer.Instance
- func (self *Extension[T]) AsMultiplayerPeerExtension() Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsPacketPeer() PacketPeer.Instance
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- type ID
- type Implementation
- type Instance
- func (self Instance) AsMultiplayerPeer() MultiplayerPeer.Instance
- func (self Instance) AsMultiplayerPeerExtension() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsPacketPeer() PacketPeer.Instance
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) ID() ID
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.
func (*Extension[T]) AsMultiplayerPeer ¶
func (self *Extension[T]) AsMultiplayerPeer() MultiplayerPeer.Instance
func (*Extension[T]) AsMultiplayerPeerExtension ¶
func (*Extension[T]) AsPacketPeer ¶
func (self *Extension[T]) AsPacketPeer() PacketPeer.Instance
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Implementation ¶
type Implementation = implementation
Implementation implements Interface with empty methods.
type Instance ¶
type Instance [1]gdclass.MultiplayerPeerExtension
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsMultiplayerPeer ¶
func (self Instance) AsMultiplayerPeer() MultiplayerPeer.Instance
func (Instance) AsMultiplayerPeerExtension ¶
func (Instance) AsPacketPeer ¶
func (self Instance) AsPacketPeer() PacketPeer.Instance
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
type Interface ¶
type Interface interface { // Called when a packet needs to be received by the [graphics.gd/classdb/MultiplayerAPI], with 'r_buffer_size' being the size of the binary 'r_buffer' in bytes. GetPacket(r_buffer gdextension.Pointer, r_buffer_size *int32) error // Called when a packet needs to be sent by the [graphics.gd/classdb/MultiplayerAPI], with 'p_buffer_size' being the size of the binary 'p_buffer' in bytes. PutPacket(p_buffer gdextension.Pointer, p_buffer_size int) error // Called when the available packet count is internally requested by the [graphics.gd/classdb/MultiplayerAPI]. GetAvailablePacketCount() int // Called when the maximum allowed packet size (in bytes) is requested by the [graphics.gd/classdb/MultiplayerAPI]. GetMaxPacketSize() int // Called when a packet needs to be received by the [graphics.gd/classdb/MultiplayerAPI], if [Interface.GetPacket] isn't implemented. Use this when extending this class via GDScript. GetPacketScript() []byte // Called when a packet needs to be sent by the [graphics.gd/classdb/MultiplayerAPI], if [Interface.PutPacket] isn't implemented. Use this when extending this class via GDScript. PutPacketScript(p_buffer []byte) error // Called to get the channel over which the next available packet was received. See [graphics.gd/classdb/MultiplayerPeer.Instance.GetPacketChannel]. GetPacketChannel() int // Called to get the transfer mode the remote peer used to send the next available packet. See [graphics.gd/classdb/MultiplayerPeer.Instance.GetPacketMode]. GetPacketMode() MultiplayerPeer.TransferMode // Called when the channel to use is set for this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.TransferChannel]). SetTransferChannel(p_channel int) // Called when the transfer channel to use is read on this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.TransferChannel]). GetTransferChannel() int // Called when the transfer mode is set on this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.TransferMode]). SetTransferMode(p_mode MultiplayerPeer.TransferMode) // Called when the transfer mode to use is read on this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.TransferMode]). GetTransferMode() MultiplayerPeer.TransferMode // Called when the target peer to use is set for this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.SetTargetPeer]). SetTargetPeer(p_peer int) // Called when the ID of the [graphics.gd/classdb/MultiplayerPeer] who sent the most recent packet is requested (see [graphics.gd/classdb/MultiplayerPeer.Instance.GetPacketPeer]). GetPacketPeer() int // Called when the "is server" status is requested on the [graphics.gd/classdb/MultiplayerAPI]. See [graphics.gd/classdb/MultiplayerAPI.Instance.IsServer]. IsServer() bool // Called when the [graphics.gd/classdb/MultiplayerAPI] is polled. See [graphics.gd/classdb/MultiplayerAPI.Instance.Poll]. Poll() // Called when the multiplayer peer should be immediately closed (see [graphics.gd/classdb/MultiplayerPeer.Instance.Close]). Close() // Called when the connected 'p_peer' should be forcibly disconnected (see [graphics.gd/classdb/MultiplayerPeer.Instance.DisconnectPeer]). DisconnectPeer(p_peer int, p_force bool) // Called when the unique ID of this [graphics.gd/classdb/MultiplayerPeer] is requested (see [graphics.gd/classdb/MultiplayerPeer.Instance.GetUniqueId]). The value must be between 1 and 2147483647. GetUniqueId() int // Called when the "refuse new connections" status is set on this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.RefuseNewConnections]). SetRefuseNewConnections(p_enable bool) // Called when the "refuse new connections" status is requested on this [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.RefuseNewConnections]). IsRefusingNewConnections() bool // Called to check if the server can act as a relay in the current configuration. See [graphics.gd/classdb/MultiplayerPeer.Instance.IsServerRelaySupported]. IsServerRelaySupported() bool // Called when the connection status is requested on the [graphics.gd/classdb/MultiplayerPeer] (see [graphics.gd/classdb/MultiplayerPeer.Instance.GetConnectionStatus]). GetConnectionStatus() MultiplayerPeer.ConnectionStatus }