Multiplayer, Lag, and C2

Discussion and feedback on Construct 2

Post » Tue Jan 12, 2016 12:36 pm

Even if you occasionally send the position, you're still missing 90% of the multiplayer object's features. It can do things like smoothly correct the position over time so you never see the object jump if a correction is made.

I'm not sure why two tabs would have such a high latency between them - are both tabs open as their own windows or are you leaving one in the background? If you background a tab, it will basically go to sleep and stop responding to messages, which could explain the ~1s latency. All local testing should be done with both windows open.
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Tue Jan 12, 2016 4:35 pm

@Ashley

I don't think it's necessarily latency testing with 2 tabs, it's just the fact that I'm trying to set the position of the player animation sprite to the player collision box sprite and it's not 100% (so it looks like it's lagging 500 ms behind).

We're just worried that if there is a bit of lag on the hosts end, the peer basically can't play very well. Our game in particular is more important that each player feels literally no lag in their character (it's co-op instead of adversarial). I completely understand where you're coming from, though. We're just not 100% sure on how to implement the sync correctly.
B
29
S
7
G
1
Posts: 493
Reputation: 3,294

Post » Tue Jan 12, 2016 4:49 pm

ome6a1717 wrote:@Ashley

I don't think it's necessarily latency testing with 2 tabs, it's just the fact that I'm trying to set the position of the player animation sprite to the player collision box sprite and it's not 100% (so it looks like it's lagging 500 ms behind).

We're just worried that if there is a bit of lag on the hosts end, the peer basically can't play very well. Our game in particular is more important that each player feels literally no lag in their character (it's co-op instead of adversarial). I completely understand where you're coming from, though. We're just not 100% sure on how to implement the sync correctly.

For me this sounds a bit like a "suggestion" to sync the objects position and animations (including frames). :roll:
Note that I'm not suggesting a system like that, since the workaround with synced instance variables works OK, but @Ashley you can be sure that a lot of us would appreciate a built in system like that for sure. :)
ImageImageImageImage
B
48
S
16
G
75
Posts: 620
Reputation: 42,197

Post » Wed Jan 13, 2016 12:02 am

Have you actually made a measurement or are you guessing it's 500ms? People have guessed wrong before, assuming what is really a ~50ms delay is actually much longer. The multiplayer engine adds a short delay (80ms IIRC) for buffering purposes so maybe you're just seeing that?
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Wed Jan 13, 2016 12:12 am

@Ashley

I'm just guessing at that number - what do you mulitply the Multiplayer.Latency by to get the exact number of milliseconds?
B
29
S
7
G
1
Posts: 493
Reputation: 3,294

Post » Wed Jan 13, 2016 12:02 pm

ome6a1717 wrote:@Ashley

I'm just guessing at that number - what do you mulitply the Multiplayer.Latency by to get the exact number of milliseconds?

Nothing - it's already in milliseconds!
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Wed Jan 13, 2016 6:30 pm

@Ashley

It looks like if I do "set text to: Multiplayer.PeerLatency(Multiplayer.HostID)" it = ~0.6 to 3 connected in the same browser tab.
B
29
S
7
G
1
Posts: 493
Reputation: 3,294

Post » Wed Jan 13, 2016 6:55 pm

Yeah, that sounds about right - almost instantaneous, no lag at all!
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Wed Jan 13, 2016 7:03 pm

@Ashley,

Right, which is why I couldn't figure out why pinning an object to a sync'd object was creating so much delay. That's why we came up with going the message route.

We tried to simulate 0.5 seconds of latency with ~x4 the normal packet loss and the game was playable for each player, but the other player was (obviously) teleporting all over the place. For our game in particular, I think it's more important that your character is completely playable instead of relying on the host. I know we're losing a lot of features from the plugin, but maybe it would be worth doing a 5th tutorial on advanced multiplayer techniques (syncing animations, pinned sprites, enemies with health, etc.)
B
29
S
7
G
1
Posts: 493
Reputation: 3,294

Post » Tue Jan 19, 2016 5:32 pm

but maybe it would be worth doing a 5th tutorial on advanced multiplayer techniques (syncing animations, pinned sprites, enemies with health, etc.)


This would be great to hear, from @ashley 's perspective. I know I'm personally not using the multiplayer plugin properly, and would love to know best practices with syncing animation names, variable height jumping via platform+, etc.
B
14
S
3
G
3
Posts: 58
Reputation: 2,457

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests