Skip to content

AMIPBaseGameMode

File: Public/GameFramework/MIPBaseGameMode.h Base: AGameModeBaseIMIPCommonGameModeComponentsInterface

The GameMode is the server-authoritative entry point for the game world. It handles JWT-based authentication, player spawning, session lifecycle, and optional Agones integration for Kubernetes orchestration.


Owned Components

Component Type Purpose
MIPItemPickupSpawner UMIPItemPickupSpawnerComponent Spawns personal loot pickups around dead mobs
MIPServerSaveComponent UMIPBaseServerSaveComponent Server-side save orchestration
ServerQuestManager UMIPServerQuestManager Server-authoritative quest state
PlayerSessionListenerComponent UMIPPlayerSessionListenerComponent Listens for player session events from the backend
SpawnedActorLifeCycleManager UMIPSpawnedActorLifeCycleManager Tracks spawned actor lifetime
ServerPartyStateComponent UMIPServerPartyStateComponent Server-authoritative party roster

JWT Authentication

Authentication is server-authoritative and happens during the standard UE login flow:

Client connects with JWT in Options string
PreLogin()
    Extracts JWT from Options
    Verifies signature against JWT_SECRET (initialized in InitGame)
    Rejects with error if invalid or if server is not yet accepting players
Login()
    Decodes JWT claims into FMIPPlayerInfo:
      • FamilyId, FamilyName
      • CharacterId, CharacterName
      • PlayerClass (index → gameplay tag)
      • PartyId
      • PlayerSessionId
      • LastTownMapName/Transform, LastAreaMapName/Transform
      • LastDungeonSessionId/Transform
      • FullHealth flag
    Calls InitPlayerInfoAfterJWTToken() on the PlayerController
PostLogin()
    Player is fully authenticated and ready for loading

Player Spawning

Method Behavior
RestartPlayer() Override — spawns pawn using class from UMIPPlayerClassComponent
GetDefaultPawnClassForController_Implementation() Returns the pawn class assigned to the player's selected class (from PlayerState)
FindPlayerStart_Implementation() If LastAreaMapName is set, spawns at the saved transform; otherwise uses a random cached AMIPDefaultPlayerStart
CacheAllDefaultPlayerStarts() Collects all AMIPDefaultPlayerStart actors in the level at BeginPlay
CacheAllGates() Collects all AMIPGate actors for travel
CacheAllPortals() Collects portal actors for tagged spawning
FindPortalByTag() Returns the portal matching a FGameplayTag (used for dungeon entry points)

Session Lifecycle

Method / Delegate Purpose
SetGameWorldInitialized() Marks the world as ready for gameplay
OnGameWorldInitializedDelegate Fires when the world is initialized
OnReadyForPlayerConnectionDelegate Fires when the server is ready to accept players
SetGameSessionId(Options) Extracts game_session_id from the Options string
GetGameSessionId() Returns the current session ID
ShutDownSession() Gracefully shuts down the current session
RemoveAllConnectedPlayers() Disconnects all players

Socket.IO & Agones

Feature Details
ConnectSIO() Establishes Socket.IO connection to the NestJS backend
OnSocketIOConnected() Fires when backend connection is established
OnSocketIODisconnected() Fires on disconnect; can trigger shutdown
OnGetGameServer() Agones callback with server info
RequestExit() Agones-triggered shutdown (WITH_AGONES only)

Key Properties

Property Type Description
bAutoConnectSIO bool Whether to auto-connect Socket.IO on BeginPlay
bAcceptingPlayer bool Whether PreLogin should allow new connections
bGameWorldInitialized bool True after SetGameWorldInitialized()
GameSessionId FString The backend-assigned session identifier
CachedDefaultPlayerStarts TArray<AActor*> Cached spawn points
CachedGates TArray<AActor*> Cached travel gates

See Also