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 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 [MultiplayerAPI], with 'r_buffer_size' being the size of the binary 'r_buffer' in bytes. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI GetPacket(r_buffer gdextension.Pointer, r_buffer_size *int32) error // 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. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI PutPacket(p_buffer gdextension.Pointer, p_buffer_size int) error // Called when the available packet count is internally requested by the [MultiplayerAPI]. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI GetAvailablePacketCount() int // Called when the maximum allowed packet size (in bytes) is requested by the [MultiplayerAPI]. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI GetMaxPacketSize() int // Called when a packet needs to be received by the [MultiplayerAPI], if [GetPacket] isn't implemented. Use this when extending this class via GDScript. // // [GetPacket]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeerExtension#Interface // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI GetPacketScript() []byte // Called when a packet needs to be sent by the [MultiplayerAPI], if [PutPacket] isn't implemented. Use this when extending this class via GDScript. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI // [PutPacket]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeerExtension#Interface PutPacketScript(p_buffer []byte) error // Called to get the channel over which the next available packet was received. See [MultiplayerPeer.GetPacketChannel]. // // [MultiplayerPeer.GetPacketChannel]: https://pkg.go.dev/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 [MultiplayerPeer.GetPacketMode]. // // [MultiplayerPeer.GetPacketMode]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.GetPacketMode GetPacketMode() MultiplayerPeer.TransferMode // Called when the channel to use is set for this [MultiplayerPeer] (see [MultiplayerPeer.TransferChannel]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.TransferChannel]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.TransferChannel SetTransferChannel(p_channel int) // Called when the transfer channel to use is read on this [MultiplayerPeer] (see [MultiplayerPeer.TransferChannel]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.TransferChannel]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.TransferChannel GetTransferChannel() int // Called when the transfer mode is set on this [MultiplayerPeer] (see [MultiplayerPeer.TransferMode]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.TransferMode]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.TransferMode SetTransferMode(p_mode MultiplayerPeer.TransferMode) // Called when the transfer mode to use is read on this [MultiplayerPeer] (see [MultiplayerPeer.TransferMode]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.TransferMode]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.TransferMode GetTransferMode() MultiplayerPeer.TransferMode // Called when the target peer to use is set for this [MultiplayerPeer] (see [MultiplayerPeer.SetTargetPeer]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.SetTargetPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.SetTargetPeer SetTargetPeer(p_peer int) // Called when the ID of the [MultiplayerPeer] who sent the most recent packet is requested (see [MultiplayerPeer.GetPacketPeer]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.GetPacketPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.GetPacketPeer GetPacketPeer() int // Called when the "is server" status is requested on the [MultiplayerAPI]. See [MultiplayerAPI.IsServer]. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI // [MultiplayerAPI.IsServer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI#Instance.IsServer IsServer() bool // Called when the [MultiplayerAPI] is polled. See [MultiplayerAPI.Poll]. // // [MultiplayerAPI]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI // [MultiplayerAPI.Poll]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerAPI#Instance.Poll Poll() // Called when the multiplayer peer should be immediately closed (see [MultiplayerPeer.Close]). // // [MultiplayerPeer.Close]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.Close Close() // Called when the connected 'p_peer' should be forcibly disconnected (see [MultiplayerPeer.DisconnectPeer]). // // [MultiplayerPeer.DisconnectPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.DisconnectPeer DisconnectPeer(p_peer int, p_force bool) // Called when the unique ID of this [MultiplayerPeer] is requested (see [MultiplayerPeer.GetUniqueId]). The value must be between 1 and 2147483647. // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.GetUniqueId]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.GetUniqueId GetUniqueId() int // Called when the "refuse new connections" status is set on this [MultiplayerPeer] (see [MultiplayerPeer.RefuseNewConnections]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.RefuseNewConnections]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.RefuseNewConnections SetRefuseNewConnections(p_enable bool) // Called when the "refuse new connections" status is requested on this [MultiplayerPeer] (see [MultiplayerPeer.RefuseNewConnections]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.RefuseNewConnections]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.RefuseNewConnections IsRefusingNewConnections() bool // Called to check if the server can act as a relay in the current configuration. See [MultiplayerPeer.IsServerRelaySupported]. // // [MultiplayerPeer.IsServerRelaySupported]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.IsServerRelaySupported IsServerRelaySupported() bool // Called when the connection status is requested on the [MultiplayerPeer] (see [MultiplayerPeer.GetConnectionStatus]). // // [MultiplayerPeer]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer // [MultiplayerPeer.GetConnectionStatus]: https://pkg.go.dev/graphics.gd/classdb/MultiplayerPeer#Instance.GetConnectionStatus GetConnectionStatus() MultiplayerPeer.ConnectionStatus }