This document is about: QUANTUM 2
SWITCH TO

Players

Overview

The PlayerSystem takes care of the player joining process as well as maintaining player state by updating the Player component.

Player Component

Every player, human and AI, is represented by an entity with a Player component. The Player component is responsible for processing player input and commands before converting them to InputDesires. It is also in charge of managing the connection state and -if necessary- AI takeover.

The "Player entity", i.e. the entity with a Player component, is independent from the "Actor entity" which holds all the information regarding the current state of the player in the game world. The Player entity holds global information about a player such as the SpawnCooldown / DespawnCooldown for its Actor entity as well as the EPlayerType defining whether the Player in question is controlled by a human or an AI.

In summary:

  • Player entity: an entity with a Player component. This contains the global information for a given Player and information on whether it is controlled by an AI or a Human. It holds a reference to its corresponding Actor entity.
  • Actor entity: the entity a player representing the current state of it in the game world. This is controlled by the Player entity.

Join Process

N.B.: This process is a default behavior and is expected to changed in accordance to the game's design.

The joining process is initialized by calling SendPlayerData() from the GameplayDirector.cs on the Unity side and the following steps are executed in order when receiving the ISignalOnPlayerDataSet signal by the PlayerSystem on the Quantum side:

  1. If the player is a spectator, exit immediately (there is no entity created for spectators).
  2. Try to reconnect to an existing Player entity by comparing the User ID held in the Player component.
  3. Try to find a Player entity without an assigned EPlayerType.
  4. Try to replace an AI Player in the same team without a predefined TeamConfig.
  5. Try to replace any AI Player in the same team.
  6. Try to replace any AI Player without spawned an Actor entity.
  7. Try to replace any AI Player.
  8. Create a new Player entity.

If a step succeeds, the process immediately terminated.

Back to top