GameMode class

Constructors, destructors, conversion operators

~GameMode() virtual
GameMode() protected defaulted

Public functions

void OnPreload() virtual
auto AreUploadsReady() const -> bool virtual
void Initialize(WorldBase* world) virtual
Called after the GameMode is created and the World is ready.
void OnPlayerJoined(Soul& soul) virtual
void OnPlayerLeft(Soul& soul) virtual
Called when a Soul disconnects or leaves.
auto OnPlayerBeginRequest(Soul& soul, const PlayerBeginRequestPayload& req) -> PlayerBeginResult virtual
void OnWorldTeardown() virtual
Called when the World is about to be destroyed (cleanup before teardown).
auto GetModeName() const -> const char* virtual
Display name for debugging/logging.
auto GetWorld() const -> WorldBase*

Protected variables

WorldBase* OwnerWorld

Function documentation

void GameMode::OnPreload() virtual

Called before Initialize() and before any spawn window opens. Dispatched on a General worker so the Sentinel thread stays responsive to client connections during the load. Do not spawn entities here.

bool GameMode::AreUploadsReady() const virtual

Non-blocking poll called each Tick() after OnPreload() completes. Return true when all GPU upload jobs dispatched in OnPreload() are done. Initialize() will not be called until this returns true.

void GameMode::OnPlayerJoined(Soul& soul) virtual

Called when a Soul requests to join this World. Override to implement spawn logic (pick spawn point, create Body, etc.).

PlayerBeginResult GameMode::OnPlayerBeginRequest(Soul& soul, const PlayerBeginRequestPayload& req) virtual

Called when the server receives a PlayerBeginRequest from a client. Pick a spawn point, create a Body, call soul.ClaimBody(result.Body). Return PlayerBeginResult::Accepted = true to confirm, false to reject. The engine sends Confirm/Reject based on the returned result — do not send wire packets from this method.