Multiplayer game - simple host switching?

0 favourites
  • 8 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • Anyone have the code for simple automatic host switching?

    It sounds a quite promising solution to one of my Apps.

    What if switching would work like this:

    There are always two room(name)s reserved per one game

    - RoomPrimary

    - RoomBackup

    When a new game starts, everyone goes to RoomPrimary.

    If RoomPrimary host drops, each (currently playing) client automatically connect to RoomBackup, where the 1st one becomes new Host. This 1st host will send the latest game status to everyone else.

    After this switch, the only problem is that new players would go to RoomPrimary that is empty/wrong...ideas how to notify them ?

    I assume one game can be in just one room at once, right?

    Tagged:

  • recconect everyone to thge same room, first to recconnect is host

  • This isn't recommended... there are going to be issues.

    First off, your peers don't contain the game state data by default, when they reconnect to a second "backup" room they won't have all of the game state information. They would need to get it from the host... which disconnected unexpectedly in the first place.

    There isn't a way to redirect new joining players to a second room from the first.

    If you manage to preserve the game state data on each peer client side, then it would make more sense for everyone to rejoin the same room with a new host, and try to match up the player aliases with their new peerids and reassign objects (this is going to be a major headache).

    Again, while it is possible to do some sort of host migration, it is going to have problems and probably end up being way more effort than it is worth. It makes much more sense to use a proper dedicated host or use a third party backend service.

  • Again, while it is possible to do some sort of host migration, it is going to have problems and probably end up being way more effort than it is worth. It makes much more sense to use a proper dedicated host or use a third party backend service.

    host migration is more effort than:

    - learning a whole new programming language

    - learning about domains and hosting

    - being forced to host servers for each game you produce regardless of the revenue they generate instead of having a simple peer to peer host migration and not manage servers or infrastructure or scaling

    Nah

  • Thanks for comments, yes I have all data synced into each peer all the time, so I think my solution will be to reconnect to same room if DROPPED even occurs, and just let the 1st peer to become host automatically in case the host was dropped causing each one to drop.

    Also, I dont need the names of players at all, so its enough that "game data remains" when even a few players remain online playing.

  • I made this when someone asked for help a while ago and I don'T think they care so, it'S yours now drive.google.com/file/d/1FmEtzZJt_18EVaAoL5sBFS6h69xCr1OD/view

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Excellent, good work with binary object!

  • yeah i should have polished it and sold it on the asset store but it is what it is

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)