res://addons/w4gd/game_server/game_server_sdk.gd

Inherits: Node

The public game server SDK, used by both clients and the server.

Methods

res://addons/w4gd/game_server/game_server_sdk.gd:W4Player

get_player ( String player_id )

res://addons/w4gd/game_server/game_server_sdk.gd:W4Player

get_player_by_peer_id ( int peer_id )

Array

get_players ( )

int

get_requested_server_state ( )

res://addons/w4gd/game_server/game_server.gd

get_server ( )

int

get_server_state ( )

bool

is_server ( )

void

set_server_state ( int p_state, Variant p_extra )

void

start_client ( String p_player_id, Variant p_password, Dictionary p_info )


Signals

match_failed ( )

Emitted when the match can't start. This happens when fewer than the minimum number of players have joined by the time the "Player Join Timeout" has elapsed.


match_ready ( )

Emitted when the match is ready to start. This can be because all of the players in the lobby have joined, or the minimum number of players have joined and the "Player Join Timeout" has elapsed.


player_joined ( Variant player )

Emitted when a new player has connected to the dedicated server.


player_left ( Variant player )

Emitted when a player has disconnected from the dedicated server.


Constants

ServerState = { "UNKNOWN": 0, "STARTING": 1, "RESERVED": 2, "READY": 3, "ALLOCATED": 4, "SHUTDOWN": 5 }


Method Descriptions

res://addons/w4gd/game_server/game_server_sdk.gd:W4Player get_player ( String player_id )

Gets the player object for a connected player by the UUID of their user in the database.


res://addons/w4gd/game_server/game_server_sdk.gd:W4Player get_player_by_peer_id ( int peer_id )

Gets the player object for a connected player by their peer id.


Array get_players ( )

Gets the list of players currently connected to the dedicated server.


int get_requested_server_state ( )

Gets the requested server state. This will be the last valid value set by set_server_state, before Agones has made the state change. This can only be called on the dedicated server.


res://addons/w4gd/game_server/game_server.gd get_server ( )

Gets the game server object. This can be used on the dedicated server for less common features that aren't exposed through this class. On clients, this will always return null.


int get_server_state ( )

Gets the current server state. This can only be called on the dedicated server.


bool is_server ( )

Returns true if this is the dedicated server; otherwise, false.


void set_server_state ( int p_state, Variant p_extra )

Sets the requested server state. The request will be sent to Agones, which will (after a short delay) update the server's current state. This can only be called on the dedicated server.


void start_client ( String p_player_id, Variant p_password, Dictionary p_info )

Starts the client. This must be called before connecting to the dedicated server via ENetMultiplayerPeer. The p_password parameter comes from the res://addons/w4gd/matchmaker/matchmaker.gd:ServerTicket received by res://addons/w4gd/matchmaker/matchmaker.gd:Lobby.received_server_ticket. The p_info paramater can contain arbitrary information that will be shared with the server and all clients connected to it.