Quick question regarding multiplayer

Just started using Construct 2? Post your questions here

Post » Mon Aug 31, 2015 4:22 pm

For every room created there is a server and peers ?
Each room is "independant" regarding the others ? Can an event interact with another room ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Mon Aug 31, 2015 4:45 pm

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".
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Mon Aug 31, 2015 5:06 pm

Okay. So, to have it written as straightfoward as possible, for each room there are 1 host and X peers, right ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Mon Aug 31, 2015 5:14 pm

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" ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Mon Aug 31, 2015 5:23 pm

Coin-coin le Canapin wrote:Okay. So, to have it written as straightfoward as possible, for each room there are 1 host and X peers, right ?


Yes :)

Coin-coin le Canapin wrote: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
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Mon Aug 31, 2015 8:09 pm

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 ?
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Tue Sep 01, 2015 12:14 am

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu Sep 03, 2015 11:02 am

Thank you for this essential information. :)
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 5 guests