Inherits: PacketPeer < Reference < Object
Inherited By: MultiplayerPeerGDNative, NetworkedMultiplayerENet, WebRTCMultiplayer, WebSocketMultiplayerPeer
A high-level network interface to simplify multiplayer interactions.
Manages the connection to network peers. Assigns unique IDs to each client connected to the server.
bool | refuse_new_connections | true |
TransferMode | transfer_mode | 0 |
ConnectionStatus | get_connection_status ( ) const |
int | get_packet_peer ( ) const |
int | get_unique_id ( ) const |
void | poll ( ) |
void | set_target_peer ( int id ) |
Emitted when a connection attempt fails.
Emitted when a connection attempt succeeds.
Emitted by the server when a client connects.
Emitted by the server when a client disconnects.
Emitted by clients when the server disconnects.
enum TransferMode:
enum ConnectionStatus:
Default | true |
Setter | set_refuse_new_connections(value) |
Getter | is_refusing_new_connections() |
If true
, this NetworkedMultiplayerPeer
refuses new connections.
Default | 0 |
Setter | set_transfer_mode(value) |
Getter | get_transfer_mode() |
The manner in which to send packets to the target_peer
. See TransferMode.
Returns the current state of the connection. See ConnectionStatus.
Returns the ID of the NetworkedMultiplayerPeer
who sent the most recent packet.
Returns the ID of this NetworkedMultiplayerPeer
.
Waits up to 1 second to receive a new network event.
Sets the peer to which packets will be sent.
The id
can be one of: TARGET_PEER_BROADCAST to send to all connected peers, 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 TARGET_PEER_BROADCAST.
© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_networkedmultiplayerpeer.html