In a network game, How can I keep the game going even when the server leaves the game?

I have a multiplayer game working for the iPhone and I have the server set up where one of the players becomes the server and hosts the game. The other players then connect to this player and they can begin the match.

The problem with this is that if the server player leaves the game the entire match is gone and everything is lost. Is there a way that when the server player leaves the game, can I then make one of the other players the server of the game so everyone can keep going?

Thanks

@AnOrdinarySandwich I checked everything again and I think I found what was wrong Maybe I will add an answer later Thank u so much for your help <3

1 Answer

1

Of course it is possible but it’s not easy. That’s why there’s no game i know that supports something like that (except maybe some very simple games like pong :D).

If you really want that feature you have to collect ALL necessary information on the server and send it to one client. Every client should be informed that a “server change” has been initialized and the game has to be freezed. The new server have to recreate the state of the game and start it’s own server. You have to find a way to connect the other players to the new server. You can do something like that by modifying the MasterServer. Using some kind of game-IDs (similar to the lobby system of L4D).

However, the more complex your game is the more complicated is the server-switching.

You should be a good programmer if you want to do this.

@Sakura1707 You're very welcome!