How do I SYNC Mouse click between peer to host

Get help using Construct 2

Post » Sat Jul 16, 2016 5:57 pm

Hello Everybody I Have A Problem With Multiplayer. What I'm Trying to do is when the peer clicks a bullet will get shot out of the peer and all other peers and the host can see it. but the problem is how do I sync it? is there anyway I could make some way the host would know what peer and if the peer is clicking so it could create the object at the peer and sync it. any help would be great!
B
21
S
9
G
1
Posts: 15
Reputation: 2,055

Post » Sun Jul 17, 2016 1:14 am

Assuming you've followed the multiplayer tutorial, the answer to your question can be found here. https://www.scirra.com/tutorials/915/mu ... ame/page-7

If you have your inputs set up correctly, then the host can get the peer inputs using the multiplayer.peerstate expression. Then the host can proceed with actions per peer (creating projectiles, moving) depending on each peer's inputs. You bullet will also need to be set up ahead of time as a synced object.



I'm going to add a bit of advanced info here, as I've gone through this process before, and I'm guessing you'll run into issues regarding lag compensation and input prediction like I did. Basically you'll want your synced, authoritative projectile to be invisible, and have a local representation of your projectile be displayed immediately for the peer which gets it's position corrected over time to the synced projectile. Otherwise the lag time for bullet creation and destruction is pretty horrendous even on a 0 latency connection because of the way interpolation is built in to the plugin.

If you have no idea what I'm talking about, don't worry about it. You'll get there eventually ;)
Mistakes were made.
B
52
S
26
G
111
Posts: 1,629
Reputation: 62,679


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag, Yahoo [Bot] and 26 guests