Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

MultiplayerPeer

Inherits: PacketPeer < RefCounted < Object

Inherited By: ENetMultiplayerPeer, MultiplayerPeerExtension, OfflineMultiplayerPeer, WebRTCMultiplayerPeer, WebSocketMultiplayerPeer

Abstract class for specialized PacketPeers used by the MultiplayerAPI.

Description

Manages the connection with one or more remote peers acting as server or client and assigning unique IDs to each of them. See also MultiplayerAPI.

Note: The MultiplayerAPI protocol is an implementation detail and isn't meant to be used by non-Godot servers. It may change without notice.

Note: When exporting to Android, make sure to enable the INTERNET permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.

Tutorials

Properties

bool

refuse_new_connections

false

int

transfer_channel

0

TransferMode

transfer_mode

2

Methods

void

close ( )

void

disconnect_peer ( int peer, bool force=false )

int

generate_unique_id ( ) const

ConnectionStatus

get_connection_status ( ) const

int

get_packet_channel ( )