MultiplayerPeerExtension
Class that can be inherited to implement custom multiplayer API networking layers via GDExtension.
MultiplayerPeerExtension.swift:17class MultiplayerPeerExtension
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
.
Superclasses
class MultiplayerPeer
Abstract class for specialized
PacketPeer
s used by theMultiplayerAPI
.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
Show implementation details (21)
Hide implementation details
func _close(
) Called when the multiplayer peer should be immediately closed (see
close
).func _disconnectPeer(pPeer: Int32, pForce: Bool
) Called when the connected
pPeer
should be forcibly disconnected (seedisconnectPeer(_:force:)
).func _getAvailablePacketCount(
) -> Int32 Called when the available packet count is internally requested by the
MultiplayerAPI
.func _getConnectionStatus(
) -> MultiplayerPeer.ConnectionStatus Called when the connection status is requested on the
MultiplayerPeer
(seegetConnectionStatus
).func _getMaxPacketSize(
) -> Int32 Called when the maximum allowed packet size (in bytes) is requested by the
MultiplayerAPI
.func _getPacketChannel(
) -> Int32 Called to get the channel over which the next available packet was received. See
getPacketChannel
.func _getPacketMode(
) -> MultiplayerPeer.TransferMode Called to get the transfer mode the remote peer used to send the next available packet. See
getPacketMode
.func _getPacketPeer(
) -> Int32 Called when the ID of the
MultiplayerPeer
who sent the most recent packet is requested (seegetPacketPeer
).func _getPacketScript(
) -> PackedByteArray Called when a packet needs to be received by the
MultiplayerAPI
, if_getPacket(rBuffer:rBufferSize:)
isn’t implemented. Use this when extending this class via GDScript.func _getTransferChannel(
) -> Int32 Called when the transfer channel to use is read on this
MultiplayerPeer
(seetransferChannel
).func _getTransferMode(
) -> MultiplayerPeer.TransferMode Called when the transfer mode to use is read on this
MultiplayerPeer
(seetransferMode
).func _getUniqueId(
) -> Int32 Called when the unique ID of this
MultiplayerPeer
is requested (seegetUniqueId
). The value must be between1
and2147483647
.func _isRefusingNewConnections(
) -> Bool Called when the “refuse new connections” status is requested on this
MultiplayerPeer
(seerefuseNewConnections
).func _isServer(
) -> Bool Called when the “is server” status is requested on the
MultiplayerAPI
. SeeisServer
.func _isServerRelaySupported(
) -> Bool Called to check if the server can act as a relay in the current configuration. See
isServerRelaySupported
.func _poll(
) Called when the
MultiplayerAPI
is polled. Seepoll
.func _putPacketScript(pBuffer: PackedByteArray
) -> GodotError Called when a packet needs to be sent by the
MultiplayerAPI
, if_putPacket(pBuffer:pBufferSize:)
isn’t implemented. Use this when extending this class via GDScript.func _setRefuseNewConnections(pEnable: Bool
) Called when the “refuse new connections” status is set on this
MultiplayerPeer
(seerefuseNewConnections
).func _setTargetPeer(pPeer: Int32
) Called when the target peer to use is set for this
MultiplayerPeer
(seesetTargetPeer(id:)
).func _setTransferChannel(pChannel: Int32
) Called when the channel to use is set for this
MultiplayerPeer
(seetransferChannel
).func _setTransferMode(pMode: MultiplayerPeer.TransferMode
) Called when the transfer mode is set on this
MultiplayerPeer
(seetransferMode
).