#Host Migration - Clarity

1 messages · Page 1 of 1 (latest)

cursive smelt
#

Hey everyone,

I’m working on implementing Host Migration in Unity 6 with a simple Netcode for GameObjects setup. If anyone has solid references, examples, or lessons learned, I’d love to see them.

Here’s my current understanding:

  • The most common approach is to use a Lobby (Unity service) to keep track of all connected players.
    • When the host disconnects, the Lobby designates a new host.
    • The new host ensures it has the latest game/application state, starts its server, and notifies the clients to reconnect.
  • To use a Lobby, you must pair it with the Relay transport.
    • If your NetworkManager uses Relay, then all communications must flow through it — including NGO messages.
    • This requires a separate join code for Netcode for GameObjects (different from the Lobby join code).

That raises a couple of questions:

  1. Does this mean all NGO traffic (including large messages or streaming data) will be routed through Unity’s servers, potentially adding lag and hurting performance?
  2. Is there an alternative way to handle host migration that keeps NGO traffic on the local network, while still benefiting from a Lobby-like coordination service? Or does this implementation keep the network traffic on the local network and use the services for the bookkeeping?
    Thanks in advance for any insights!
    — Blaine
radiant jungle
#

To use a Lobby, you must pair it with the Relay transport.
Lobby is just an abstract way to group players together. It does not need to be used explicitly with Relay.

Does this mean all NGO traffic (including large messages or streaming data) will be routed through Unity’s servers, potentially adding lag and hurting performance?
If you are using any sort of Relay for your game, all data has to go through the Relay and the Host, which adds an additional step for messages to and from clients, and thus more latency.

#

Is there an alternative way to handle host migration that keeps NGO traffic on the local network, while still benefiting from a Lobby-like coordination service? Or does this implementation keep the network traffic on the local network and use the services for the bookkeeping?
I'm not exactly sure what you mean by this. Most of the Host Migration logic you're describing will be handled by the Lobby. It's not until clients reconnect to the new NGO session that NGO would be involved. And by that point the migration is over and you're back to your regular gameplay loop.

eager trellis
#

I'm pretty sure that will only work with Netcode for Entities that just added host migration as well.

radiant jungle
eager trellis
#

True. nothing stopping you from making your own IMigrationDataHandler

cursive smelt
#

Thanks so much for the detailed responses!
@radiant jungle - Really appreciate the clarification on Lobby vs Relay. Your point about the migration logic being handled by Lobby before NGO gets involved makes perfect sense - that helps clarify the flow considerably. Also, thanks for pointing out the new Multiplayer SDK features.
@eager trellis - Good catch on the N4E focus for the new host migration features. Seems like the IMigrationDataHandler is the essence of being flexible.
Thanks again for taking the time to help out, much appreciated!