Have gone through all multiplayer tutorials.
Its been mentioned that if the host goes down all the peers will be disconnected. Wondering if there is any way to switch the host to next peer when the first user goes offline/disconnected?
Any inputs is appreciated!
Automatically? No but...
It's doable but it is astronomically advanced events. There are 2 category to approach this, whether a forced kick or a permitted leave. However, I only managed to create mechanism for chat only, for games it would be crazy and might be not doable by just sheer patience and will, preserving game state is a big job.
All peer should keep the log on live events. Once the host left forcefully, peer can have the on kicked trigger to initiate the room creation again. In this case, it's like a race of who can connect to signal first. Upon room creation, connected peers will be updated with logged message, and resume chat like usual.
This allows more control on who's get to be the host, which the host can choose one of the peers name, broadcast the name of the newroom and the chosen peer name, once all peer confirmed to receive the data, everybody can safely leave the current room and wait for the new host to create room and all peer can join in once the room is available on roomlist. Then update the chat state as usual.
For games, it depends on the complexity of your game, the difficulty of events setup goes exponentially with the complexity of games. Note that the suggested method, will need 1~5 seconds of recovery, so it's pretty advance.