Skip to content

Game Mode Components

Overview

Game mode components attach to GameState and implement session/wave/dungeon logic: player list, respawn, mob spawn/destroy, mode start/end, and optional auto-shutdown when no players remain. UMIPBaseModeComponent is the base; MIPWaveBasedMode, MIPSessionDungeonMode, MIPSoulHuntMode, MIPEndlessColosseumMode are concrete modes.

Key traits:

  • UMIPBaseModeComponent – Extends UMIPBaseGameStateComponent; holds PlayerPawns, PlayerSessionListenerComponent, CurrentSpawnedMobNum, respawn counts, bModeStarted/bModeEnded (replicated), timers for shutdown and "remove all players" countdown.
  • Delegates: OnModeEndedDelegate, RemoveAllConnectedPlayersTimeLeftDelegate. Hooks: OnFirstPlayerLoggedIn, OnPossessedPawnChanged, OnPlayerPawnDead, OnPlayerRespawn, OnMobSpawned, OnMobDestroyed, OnNoMoreActivePlayer.
  • UMIPSessionDungeonEndTriggerComponent – Actor component that triggers on owner destroyed (e.g. end dungeon event).

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPBaseModeComponent Public/GameModes/MIPBaseModeComponent.h
UMIPWaveBasedMode Public/GameModes/MIPWaveBasedMode.h
UMIPSessionDungeonMode Public/GameModes/MIPSessionDungeonMode.h
UMIPSoulHuntMode Public/GameModes/MIPSoulHuntMode.h
UMIPEndlessColosseumMode Public/GameModes/MIPEndlessColosseumMode.h
UMIPSessionDungeonEndTriggerComponent Public/GameObjects/MIPSessionDungeonEndTriggerComponent.h

UMIPBaseModeComponent

  • Base: UMIPBaseGameStateComponent.
  • Attachment: GameState (AMIPBaseGameState).
  • API: OnMobSpawned(BaseMob) (virtual). Helpers: GetMIPGS(), GetMIPGM().
  • Blueprint events: ServerBeginPlay, ClientBeginPlay, EndMode(bInWon).
  • Flow: BeginPlay → bind to session listener (first player, possess, pawn dead, respawn, no more active player); StartMode(); when conditions met, EndMode; StartRemoveAllConnectedPlayersTimer / QuitDungeonForAllPlayers. Replicated: bModeEnded, RemoveAllConnectedPlayersTimeLeft (ReplicatedUsing).
  • Config: bAutoShutdownOnNoMorePlayer, AutoShutdownDelay, RemoveAllConnectedPlayersDelay.

Concrete Modes

  • UMIPWaveBasedMode – Wave-based spawn and completion logic.
  • UMIPSessionDungeonMode – Session dungeon lifecycle (enter/exit, duration).
  • UMIPSoulHuntMode – Soul hunt specific rules.
  • UMIPEndlessColosseumMode – Endless colosseum waves/rules.

Each overrides StartMode, EndMode, OnMobSpawned, and related as needed.


UMIPSessionDungeonEndTriggerComponent

  • Base: UActorComponent.
  • Attachment: Any actor (e.g. dungeon exit or objective).
  • Flow: BeginPlay → bind OnOwnerDestroyed; when owner is destroyed, can broadcast or notify game mode to end session (FMIPDungeonEndEventMessage struct exists for event payload).

Integration

  • AMIPBaseGameMode / AMIPBaseGameState – own the mode component; game mode uses it to drive session lifecycle.
  • UMIPPlayerSessionListenerComponent – tracks players and notifies mode (first login, pawn dead, respawn, no more active).
  • Mob spawners and UMIPBaseMob – OnMobSpawned/OnMobDestroyed keep CurrentSpawnedMobNum and mode logic in sync.