Skip to main content
Blueprint

Blueprint Overview

Everything you need for host migration works without C++.

State​

Tick SaveGame on Blueprint variables (variable details → Advanced → SaveGame). They travel like UPROPERTY(SaveGame) in C++, on actors and components alike, including object references to other migrated actors.

Add the Host Migration Id component to every actor that should survive.

Subsystem​

Get it with Get HostMigrationSubsystem (it's a GameInstance subsystem).

NodeWhat it does
Leave SessionLeave the match. On the host, hands it over first.
Quit GameQuit the game. On the host, hands it over first. Use instead of the engine's Quit Game.
Begin Graceful MigrationHost: send a final snapshot and tell everyone to migrate now.
Get StateCurrent state.
Is MigratingTrue during a migration (not Running, not Failed).
Is Local HostTrue on the machine that hosts.
Get EpochIncreases with each migration.
Get Status TextLocalized status line for UI.
Get Num Players AwaitedPlayers the new host is still waiting for.
Get Host AddressAddress of the current host.
Find Host In Lobby (out Host Address, Epoch)For players not connected yet: where the current host is. Pure node, returns false if no host has announced itself.
Get Num Inactive PlayersHost: players whose state is kept for a rejoin.
Get Snapshot StatsHost: snapshot sizes and traffic.
Notify Game ReadyWith Wait For Game Ready: the game has set up the match, the new host can restore. See Games that set up the match later.
Is Restore PendingNew host: the map is loaded but the saved state is not restored yet.
Move Party To Host (Host Address)Host: move every client to the host at this address, then follow them. Use it to bring your players into another match. A client that cannot connect ends up in Failed. The players stay in the old lobby: have them join the new host's lobby once they arrive, so migrations work there (see EOS and Steam).

Move Party To Host on the Host Migration subsystem, called only when Is Local Host is true

Subsystem events​

EventWhen
On State Changed (Old State, New State)Every state change, on every machine.
On Player Restored (Player Controller)Host: a returning player got their state back.
On Host Changed (Host Id, Host Address, Is Local Host, Epoch)The session has a new host. Use it to update lobby data or rich presence.
On Host Connection Lost (Reason)Host: this machine seems to have lost its own connection. Steam or EOS reports it logged off, or at least two clients and all of them timed out within 5 seconds. The clients migrate without it; show a message or return to the menu.

Bind them in your GameInstance (Event Init). A migration loads the map again, which destroys actors and widgets together with the events bound in them.

GameInstance Event Init binding On State Changed, On Host Changed and On Player Restored, each printing what happened

Library nodes​

NodeWhat it does
Get Migration IdThe id that identifies an actor across migrations.
Find Actor By Migration IdThe actor that carries an id now.
Is Host Migration In ProgressSame as Is Migrating, from any world context.
Is Migration HostTrue on the machine that hosts.
Unique Net Id To StringThe string form used for player ids.
Set Debug Overlay VisibleShows or hides the debug overlay.

Steam​

Get Steam Lobby returns the lobby in use, or an empty string if there is none or the Steam adapter is not active. Set Steam Lobby overrides the detected lobby. Both work from any Blueprint. See Steam.

EOS​

Get EOS Lobby returns the lobby in use, or an empty string if there is none or the EOS adapter is not active. Set EOS Lobby overrides the detected lobby. Both work from any Blueprint. See EOS.

States​

EHostMigrationState, returned by Get State and passed to On State Changed.

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.