Players translate input into actions to be performed by characters or requested over the network.
obj_player represents a human. Exist on all clients specific to game
obj_player_interface contains what the player would see and what the player can interact with (GUI).
Player's interface with the game
Hold player specific information like name, character, whether they are ready in game
Uniquely identifiable for each player
Persistent through entire game including the lobby
Methods a player can join
Locally
Hybrid
Network
Only lobby can create, anywhere can destroy
The player system is independent of the lobby. It can initialize the lobby and the lobby output determines the players, but they are not updated concurrently.
This is to allow common lobbies to be shared across games, isolating the systems.
Connecting a client or hybrid controller does not mean a player is created. This is only done when joining the lobby so a player id has to be sent back then.
Certain games may need an authoritative copy of the players controlled by networking clients. This is implemented by the game, not the networking system.
player_id is reserved by the rollback system
https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/Rollback/Rollback_System.htm
Create
// Instance to take care of player's team
Team = noone
Character = noone
// Which virtual controller to use
// stc_controller
controller = {}
Game interface state switch from STATE_LOBBY prompts the game to translate lobby players into game players.
Accessing players
var game_player_ids = ds_map_keys_to_array(Players)
for (var i=0; i<array_length(game_player_ids); i++) {
var Player = Players[? game_player_ids[i]]
instance_destroy(Player)
}