This document is about: QUANTUM 2
SWITCH TO

Gameplay

Overview

The GameplaySystem provides a way to run high-level scene logic such as spawning players/enemies, evaluating win conditions and activating various parts of the scene. The system itself is very sparse, it mainly serves to tick the state machine implemented in GameplayController where the actual logic is implemented.

Controller

Main gameplay logic is defined in the GameplayController and can be extended by the user in GameplayController.User.cs. The GameplayController is an asset and is _required to run the Quantum simulation. This asset contains static EGameplayState configurations (enter-exit state pairs and their duration). States can be also dynamically set from script at runtime, effectively overriding the static configuration.

The GameplayController API includes:

  • OnInitialize(): called once upon simulation initialization
  • OnDeinitialize(): called once upon simulation destroy
  • OnEnterState(): called when entering gameplay state
  • OnUpdateState(): called every frame for a specific gameplay state
  • OnExitState(): called when exiting gameplay state
  • GetNextState(): called when the current state is about to finish, you decide next state
  • GetStateDuration(): returns duration for a specific state

State Machine

The FPS Template implements these EGameplayState:

  • Initialization: Used for one time scene initialization
  • Waiting For Players: Waiting for players to send their data and create Player entity, spawning AI for missing players on the end
  • Game Start: Can be used for match introduction sequence, players overview, ...
  • Round Start: Short warmup sequence, countdown, ...
  • Round Progress: Main gameplay, time based, team elimination, ...
  • Round End: Short round winning/losing sequence
  • Round Replay: Optional replay, last kill, best player of the round, ...
  • Game End: Final gameplay sequence, ending animation, ...
  • Game Replay: Optional replay, best moment of the game, MVP moments, ...
  • Game Summary: Showing match statistics, rewards, post match interactions, ...
  • Deinitialization: Cleanup

The following diagram presents the gameplay state machine's default flow:

fps template gameplay fsm
FPS Template Gameplay FSM

Data

The data supporting the gameplay is saved in the GameplayData asset. This asset contains baked data for a specific scene. By default the GameplayData asset contains Waypoints and NavMeshLinks. It can be extended in GameplayData.User.cs.

Back to top