Skip to main content

API Reference

UHostMigrationSubsystem​

GameInstance subsystem. #include "HostMigrationSubsystem.h"

FunctionDescription
void LeaveSession(const FString& TravelURL)Leave and travel to TravelURL. On the host, migrate the others first.
void QuitGame()Quit the game. On the host, migrate the others first and quit ~1.5 s later.
void BeginGracefulMigration()Host: final snapshot, everyone migrates now. Leave about 1 s later.
EHostMigrationState GetState()Current state.
int32 GetEpoch()Increases with each migration.
FText GetStatusText()Localized status line. Empty while Running.
int32 GetNumPlayersAwaited()Players the new host is still waiting for.
bool IsLocalHost()True on the hosting machine.
bool IsMigrating()True during a migration.
FString GetHostAddress()Address of the current host.
bool FindHostInLobby(FString& Address, int32& Epoch)For players not connected yet.
int32 GetNumInactivePlayers()Host: players whose state is kept.
FHostMigrationSnapshotStats GetSnapshotStats()Host: snapshot sizes and traffic.
UHostMigrationSessionAdapter* GetAdapter()The active adapter.
void RefreshHostAnnouncement()Publish the host announcement again.
DelegateParameters
OnStateChangedEHostMigrationState OldState, EHostMigrationState NewState
OnPlayerRestoredAPlayerController* PlayerController
OnHostChangedconst FUniqueNetIdRepl& HostId, const FString& HostAddress, bool bIsLocalHost, int32 Epoch

States​

EHostMigrationState

StateMeaning
RunningNormal play.
ElectingThe host was lost; picking a successor.
BecomingHostThis machine is the successor and is loading the map.
WaitingForHostWaiting for the successor to announce itself.
ReconnectingConnecting to the new host.
GracePeriodNew host: waiting for previous players.
RejoiningHostConnection dropped but the host is still in the session; reconnecting to it.
FailedThe migration did not succeed.

UHostMigrationBlueprintLibrary​

FunctionDescription
FGuid GetMigrationId(const AActor*)Id across migrations. Invalid without a Host Migration Id.
AActor* FindActorByMigrationId(WorldContext, FGuid)The actor with that id now.
bool IsHostMigrationInProgress(WorldContext)True during a migration.
bool IsMigrationHost(WorldContext)True on the hosting machine.
FString UniqueNetIdToString(const FUniqueNetIdRepl&)Player id string form.

Components and interfaces​

TypeDescription
UMigrationIdComponentHost Migration Id. Stable id for an actor. GetMigrationId().
IHostMigrationEventsOnHostMigrationSave, OnHostMigrationRestored. Blueprint and C++.
IHostMigratableSaveMigrationState, RestoreMigrationState, PostMigrationRestore. C++ only.

Adapters​

ClassModule
UHostMigrationSessionAdapterBase class. See Custom Adapter.
UHostMigrationAdapter_NullHostMigrationCore. LAN.
UHostMigrationAdapter_BlueprintHostMigrationCore. See Blueprint Adapter.
UHostMigrationAdapter_SteamHostMigrationCoreSteam. SetSteamLobby, GetSteamLobby.

Structs​

FHostMigrationAnnouncement: HostKey, Address, Epoch, NumPlayers.

FHostMigrationCandidate: NetId, IpAddress, Score (lower is better).

FHostMigrationSnapshotStats: FullBytes, LastDeltaBytes, LastChangedRecords, TotalRecords, BytesPerSecond, FullsSent, DeltasSent, ResyncRequests.