Players and Connections

Overview

In CRYENGINE, each player is represented by an entity instance - created by game code when clients connect to the server.

Custom code can listen for client connection events by implementing INetworkedClientListener. This allows the creation of entities from the game side whenever a client connects, starting gameplay after the player finishes connecting, and finally exposes a disconnection event to allow removal of any entities spawned for a particular client.

Local Player

The engine currently assumes that the local player entity is always spawned with the id of 30583, defined via LOCAL_PLAYER_ENTITY_ID. This is covered in the networked client listener example above. In addition, local players must set the ENTITY_FLAG_LOCAL_PLAYER entity flag.

Channel Identifiers

The client connection events are primarily only sent to the server, and identify each player by channel identifiers. For more information, see Networking.

Conclusion

This concludes the article on Players and Client Connections, you may be interested in: