Multiplayer question about host switching

Discussion and feedback on Construct 2

Post » Wed Oct 22, 2014 3:51 am

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!
B
3
Posts: 1
Reputation: 184

Post » Wed Oct 22, 2014 4:24 am

Hina wrote: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.

Forced kick:
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.

Permitted leave:
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.
B
28
S
8
G
4
Posts: 553
Reputation: 4,914


Return to Construct 2 General

Who is online

Users browsing this forum: Hiran Rodrigues and 2 guests