I am working on a P2P game in Flash and I'm wondering what network topology would be most robust for dealing with people randomly joining/leaving. I was thinking the first user to join could be the host, but if the host leaves the whole session would be killed. I am looking for a way to deal with this with no (or little) disruption.
|
If you're using a model where there's a "host", you pretty much have star topology, however you dress it up. Recovery from loss of the central node in that model requires that all the nodes be able to find each other in that event (which makes it sound like mesh topology but it isn't), and either all of them have sufficient state to be able to take over the host role or they can reconstruct that state between them. Then you elect a new host by whatever method you like (I suggest lowest average ping to the rest of the nodes). You can potentially do that with no disruption if the host leaves "nicely"; you start the host-role transfer process when they hit Quit and let them leave when it's done. If they leave by network interruption, force-quit, power loss, etc. there will be disruption. If you do actual mesh topology, where each node has its own full state model and communicates about changes made to that out to everybody it's connected to, then you avoid the host role and the vulnerability that comes with it. The fun part then is conflict resolution -- working out what happens when two nodes try to propagate changes that contradict each other. |
|||||||||
|
