CooperationMode class
Cooperation game mode.
Classic shared-progress cooperative play: there is no win condition, coins are shared between all players, players respawn at their own checkpoint, and reaching the level exit advances everyone to the next level. The pre-game wait and countdown are skipped so the level starts immediately. The lives/game-over system (handled by the player and host) stays active, exactly like classic splitscreen co-op.
Base classes
- class IGameMode
- Rules of a single multiplayer 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.