Ali Şahan Yalçın
DocsHost migration

More features

Host migration

Keeping a match alive when the host leaves, and the honest limits of it.

A listen server match normally dies with its host. Host migration turns that into a pause: the session survives, someone else is elected, the match state comes back, and everyone travels to the new host.

What it does and does not do

It does: detect the host leaving, elect a replacement using Steam's own lobby ownership transfer, restore the state you gave it, travel the new host, and travel everyone else to them. It reports every phase so you can show the player what is happening instead of appearing to freeze.

It does not migrate actors, physics, AI or anything else living in your world. No plugin can. That state is yours and only you can serialize it.

The interruption is visible. Both hosts travel, which means a loading screen. Migration turns "the match ended" into "the match hiccuped". It is not seamless, and no listen server migration on any engine is.

Turning it on

Call Enable Host Migration on the SteamForge Host Migration subsystem. It is off by default.

InputMeaning
EnabledOn or off
Snapshot Interval SecondsHow often the host is asked for state
Timeout SecondsHow long to wait for a new host before giving up

Publishing state

Bind On Snapshot Requested. It fires on the host at your chosen interval. Serialize whatever a new host would need, and pass it to Set Migration Snapshot.

A game that never answers this migrates successfully with no state, which is usually worse than a stale snapshot.

The snapshot has a Version field. It is handed back on restore so you can reject a snapshot written by a different build rather than deserialising garbage.

WARNING: The budget is about 80 KB. State travels through Steam lobby metadata, which caps a value at 8 KB, so the payload is chunked and encoded. That is enough for a scoreboard and match state. It is not enough for a world snapshot. Games needing more should replicate over the networking layer continuously and use this only for the authoritative summary that decides how a new host starts.

Check the exact limit with Get Max Snapshot Size.

The events

EventWhat to do
On Host LostPause and show the player something. This is the moment their game stopped responding, and silence reads as a crash.
On Became HostYou were elected. Restore from the snapshot handed to you.
On Migration Phase ChangedDrive a "reconnecting" UI.
On Migration FinishedIt ended, one way or the other.

Get Migration Status gives you the phase, who was elected, whether it is you, seconds remaining and how many players are left. Cancel Migration abandons it, for a player who would rather quit than wait.