NetworkedMultiplayerCustom

Inherits: NetworkedMultiplayerPeer < PacketPeer < Reference < Object

A NetworkedMultiplayerPeer implementation that can be controlled from a script.

Description

A NetworkedMultiplayerPeer implementation that can be used as a MultiplayerAPI.network_peer and controlled from a script.

Its purpose is to allow adding a new backend for the high-Level multiplayer API without needing to use GDNative.

Methods

void

deliver_packet ( PoolByteArray buffer, int from_peer_id )

void

initialize ( int self_peer_id )

void

set_connection_status ( ConnectionStatus connection_status )

void

set_max_packet_size ( int max_packet_size )


Signals

packet_generated ( int peer_id, PoolByteArray buffer, int transfer_mode )

Emitted when the local MultiplayerAPI generates a packet (e.g. when calling Node.rpc).

Your script should take this packet and send it to the requested peer over the network (which should call deliver_packet with the data when it's received).


Method Descriptions

void deliver_packet ( PoolByteArray buffer, int from_peer_id )

Deliver a packet to the local MultiplayerAPI.

When your script receives a packet from other peers over the network (originating from the packet_generated signal on the sending peer), passing it to this method will deliver it locally.


void initialize ( int self_peer_id )

Initialize the peer with the given self_peer_id (must be between 1 and 2147483647).

Can only be called if the connection status is NetworkedMultiplayerPeer.CONNECTION_CONNECTING. See set_connection_status.


void set_connection_status ( ConnectionStatus connection_status )

Set the state of the connection. See ConnectionStatus.

This will emit the NetworkedMultiplayerPeer.connection_succeeded, NetworkedMultiplayerPeer.connection_failed or NetworkedMultiplayerPeer.server_disconnected signals depending on the status and if the peer has the unique network id of 1.

You can only change to NetworkedMultiplayerPeer.CONNECTION_CONNECTING from NetworkedMultiplayerPeer.CONNECTION_DISCONNECTED and to NetworkedMultiplayerPeer.CONNECTION_CONNECTED from NetworkedMultiplayerPeer.CONNECTION_CONNECTING.


void set_max_packet_size ( int max_packet_size )

Set the max packet size that this peer can handle.