Can I use host for multiplayer game with 2 player?

  • Hi,

    i am trying to create game like clash royal, normally if i set a host and peer for game, when host disconnect form internet, the game can not continue without it.

    is there any chance to create host for this? i mean the host do nothing , just sync the peer action . ( sorry for english)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • any idea please?

  • You can create a system where the peer becomes the host if the current host leaves.

    you just need to make sure all the details of the game states are preserved on the peer end.

    Mind you, these approaches are quite advanced.

  • thank you lennaert

    i have some idea for this, by your help on another post witch you answer me.

    can you write more about " you just need to make sure all the details of the game states are preserved on the peer end. " ??

  • I think u need a dedicated server, try look photon.

  • You can reconnect to the room when the host disconnects, and become host; if you kept track of the peerids you can swap out the game state variables after the previous host reconnects as peer.

    If the previous host got a new ID but was able to reconnect to the previous room ending up with the same peer (which is now host) it can inform the new host of its presence and they can swap out game states and the new host can update the peerids on the objects of the previous host. (This assuming the previous host also preserved game state of various objects, such as peerid of the peers.)

    You can keep track of objects and states in various ways, like saving an objects state asJson in an array or other variable, and build a new object based on that info after successful reconnecting with the known peer.

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