Peer-to-Peer communication (experimental)

Allow game instances to communicate remotely using messages sent via WebRTC (P2P). Read more explanations about it.

Actions

Connect to another client
Connects the current client to another client using its id.

Get event data (variable)
Store the data of the specified event in a variable. Check in the conditions that the event was received using the “Event received” condition.

Trigger event on all connected clients
Triggers an event on all connected clients

Trigger event on all connected clients (variable)
Triggers an event on all connected clients

Trigger event on a specific client
Triggers an event on a specific connected client

Trigger event on a specific client (variable)
Triggers an event on a specific connected client

Connect to the default broker server
Connects to the default broker server.

Connect to a broker server
Connects the extension to a broker server.

Conditions

Is P2P ready
True if the peer-to-peer extension initialized and is ready to use.

Peer Connected
Triggers once when a remote peer initiates a connection.

Peer disconnected
Triggers once when a peer disconnects.

An error occurred
Triggers once when an error occurs. Use P2P::GetLastError() expression to get the content of the error if you want to analyse it or display it to the user.

Event triggered by peer
Triggers once when a connected client sends the event

Expressions

Expression Description
P2P::GetEventData(string) Returns the data received when the specified event was last triggered
string Event name
P2P::GetEventSender(string) Returns the id of the peer that triggered the event
string Event name
P2P::GetID() Gets the client ID of the current game instance
P2P::GetLastConnectedPeer() Gets the ID of the newly connected peer.
P2P::GetLastDisconnectedPeer() Gets the ID of the latest peer that has disconnected.
P2P::GetLastError() Gets the description of the last P2P error

This page is an auto-generated reference page about the Peer-to-Peer communication (experimental) feature of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop features here.