0 Favourites

Quick question regarding multiplayer

  • For every room created there is a server and peers ?

    Each room is "independant" regarding the others ? Can an event interact with another room ?

  • no.

    The first client to "join" a room, is not 'just' joining it, he creates the actual room on the signalling server , then joins it. and instantly becomes "Host"

    Clients that follow join the room and become "Peers".

  • Okay. So, to have it written as straightfoward as possible, for each room there are 1 host and X peers, right ?

  • Ah ! Another question while I'm here : the multiplayer objet can sync instances positions and variables.

    So, what's the best way to synchronize attributes like visibility ?

    Send a broadcast message to the peers, the peer receives it and changes the instance visibility ?

    Or just to add an instance variable "visibility" on the object which will synchronize automatically, and add a global event (availble for the host and peers) like "if sprite visibility = true -> sprite ; set visible" ?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Okay. So, to have it written as straightfoward as possible, for each room there are 1 host and X peers, right ?

    Yes

    Ah ! Another question while I'm here : the multiplayer objet can sync instances positions and variables.

    So, what's the best way to synchronize attributes like visibility ?

    Send a broadcast message to the peers, the peer receives it and changes the instance visibility ?

    Or just to add an instance variable "visibility" on the object which will synchronize automatically, and add a global event (availble for the host and peers) like "if sprite visibility = true -> sprite ; set visible" ?

    For those kind of actions I often just send a message to the peer.

    send to peer xxxx, tag "setVisible" message = "no" (or yes)

    Peer on received message "setVisible"

    sub compare 2 values: Multiplayer.Message = "yes" , action set visible

    sub compare 2 values: Multiplayer.Message = "no" , action set invisible

  • Thank you

    What would be the benefits of this method compared to the other one (synchronized instance variable + peer event) I described ? More control on what's happening ?

  • Less synchronizing.

    Depending on how you synchronize it, the state gets transferred between 10 and 30 times per second using synchronization methods, which would be a massive overhead on the bandwidth compared to just using a single transmitted command. Less overhead, less chance of lag.

  • Thank you for this essential information.

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