BattleMode class
Battle game mode (free-for-all).
Every player fights for themselves. A kill increments the killer's score and the victim's death count; players respawn at a fresh spawn point with brief invulnerability. The round ends when a player reaches the kill target, or — with elimination enabled — when only one player is still within their death limit.
Base classes
- class IGameMode
- Rules of a single multiplayer game mode.
Derived classes
- class TeamBattleMode
- Team Battle game mode.
Public functions
- auto GetMode() const -> MpGameMode override
- Returns the game mode identifier.
- auto IsTeamBased() const -> bool override
- Returns whether players are split into teams.
- auto SkipsPreGameCountdown() const -> bool override
- Returns whether the pre-game wait and countdown are skipped (Cooperation starts immediately).
- auto HasUnlimitedHealth() const -> bool override
- Returns whether players have unlimited health in this mode.
- auto LowerScoreWins() const -> bool override
- Returns whether a lower round score ranks higher (Race finishes first).
- void OnRoundStarted(IGameModeContext& ctx) override
- Called when the round starts (after the countdown) to reset/initialize mode state.
- void OnUpdate(IGameModeContext& ctx, float timeMult) override
- Called every host tick while the round is running.
-
void OnPlayerSpawned(IGameModeContext& ctx,
Actors::
Player* player) override - Called after a player (re)spawns.
-
void OnPlayerKilled(IGameModeContext& ctx,
Actors::
Player* victim, Actors:: Player* killer) override - Called when a player dies, for mode-specific reactions (e.g. dropping a carried flag); kill/death counts are maintained by the host.
killermay benullptr(environmental death). -
auto DecideRespawn(IGameModeContext& ctx,
Actors::
Player* player) -> RespawnDecision override - Decides whether and where the specified player should respawn.
-
void OnCoinsCollected(IGameModeContext& ctx,
Actors::
Player* player, std:: int32_t prevCount, std:: int32_t newCount) override - Called when a player's coin count changes.
-
void OnGemsCollected(IGameModeContext& ctx,
Actors::
Player* player, std:: uint8_t gemType, std:: int32_t prevCount, std:: int32_t newCount) override - Called when a player's gem count changes.
-
auto OnLevelExitReached(IGameModeContext& ctx,
Actors::
Player* player) -> LevelExitAction override - Decides what happens when the specified player reaches the level exit.
- auto CheckGameEnds(IGameModeContext& ctx) -> GameEndResult override
- Checks whether the round should end now, and who won.
- void AssignTeams(IGameModeContext& ctx) override
- (Re)assigns players to teams (free-for-all modes assign one team per player)
-
auto GetRoundScore(IGameModeContext& ctx,
Actors::
Player* player) -> std:: uint32_t override - Returns the ranking metric of the specified player (kills / laps / treasure / ...).
-
void OnDrawHUD(IGameModeContext& ctx,
IGameModeHUD& hud,
Actors::
Player* player, const Rectf& view) override - Draws the mode-specific part of the HUD for the given player's split-screen view.