Struct NetworkedMultiplayerPeer

A high-level network interface to simplify multiplayer interactions.

struct NetworkedMultiplayerPeer ;

Manages the connection to network peers. Assigns unique IDs to each client connected to the server.

Properties

NameTypeDescription
refuseNewConnections[get, set] boolIf true, this NetworkedMultiplayerPeer refuses new connections.
transferMode[get, set] NetworkedMultiplayerPeer.TransferModeThe manner in which to send packets to the target_peer. See transfermode.

Methods

NameDescription
getConnectionStatus Returns the current state of the connection. See connectionstatus.
getPacketPeer Returns the ID of the NetworkedMultiplayerPeer who sent the most recent packet.
getTransferMode
getUniqueId Returns the ID of this NetworkedMultiplayerPeer.
isRefusingNewConnections
poll Waits up to 1 second to receive a new network event.
setRefuseNewConnections
setTargetPeer Sets the peer to which packets will be sent. The id can be one of: constant TARGET_PEER_BROADCAST to send to all connected peers, constant TARGET_PEER_SERVER to send to the peer acting as server, a valid peer ID to send to that specific peer, a negative peer ID to send to all peers except that one. By default, the target peer is constant TARGET_PEER_BROADCAST.
setTransferMode

Enums

NameDescription
ConnectionStatus
Constants
TransferMode