Search Unity

Question (Boss Room) Confusion about what happens if host drops

Discussion in 'Netcode for GameObjects' started by hippocoder, Apr 4, 2022.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    If the host drops mid-game, say the cat spitefully pulled the internet cable out - can the remaining players continue? if so what circumstances will allow that?

    It's kind of mandatory to account for in the real world, as it happens all the time. But playing a game of GTA 5 for example (which is relay based) smoothly makes someone else the host.

    I don't mind if I have to pay for relay but dedicated server just for that seems out of touch. Photon has relay based migration so I am hoping it will become part of boss sample.

    Or is it already implemented and I can't find it?

    Thanks!
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    Netcode for GameObjects currently has no built in host migration. So if the host drops from the game and does not reconnect again the remaining players would have to start a new session.

    If you are using lobby + relay there are some possibilities to have all players which were in a session reconnect to a new game but it would need manual implementation. The way to do this is just to have all players connect again to a lobby based on the original lobby id and then designate a new host. The state of the game would be fully lost though so it would be up to you as well to implement some kind of system which can keep a simplified state of the game tracked on each client and use that to restore the session.

    Having built-in seamless host migration in Netcode for GameObjects and relay would be a really cool feature though. I hope we can get there at some point.
     
    Mj-Kkaya and hippocoder like this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Hmm yeah it seems like it! Thank you for clarification. The best way to do this would be using servers I guess.