Multiplayer & Platform behavior - position syncing

Discussion and feedback on Construct 2

Post » Tue May 05, 2015 8:27 am

@troublesum
Can you help me with this? I tried this, but I did not get. :(
B
16
S
2
G
2
Posts: 8
Reputation: 1,391

Post » Fri May 08, 2015 5:41 am

@troublesum
Sorry to bother you.
Maybe you have another example of an optimized platform multiplayer?
B
16
S
2
G
2
Posts: 8
Reputation: 1,391

Post » Fri May 08, 2015 6:28 am

@mdvgames - unfortunately i don't... The example I provided in this thread needs work to enable the ability for peers to call functions on specific peers instead of just being able to call them on all peers all the time. (and the process is complicated enough as it is) it was just a proof of concept i created but lead me to work on my plugin instead. You will need to hack it to correct for any imbalances. (Ie if peerid already exists dont re-respawn it.)

I would release my plugin that simplifies the whole thing but i'm not supporting it as it hooks into official (multiplayer & function) plugins maintained by Ashley and as he makes changes to them could break mine and would leave your project broken unless i correct for any changes he might make which i don't want to be responsible for. :( .. If you message me ill provide you a link to download it for personal use but to use at your own risk that someday it could be broken and I might not be around to fix it.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Fri May 08, 2015 1:46 pm

I found that stop using sync - is the best way to make smooth and undercontrol game.
Just send to host all inputs + id variables, and then broadcast to another peers.
B
5
S
1
Posts: 31
Reputation: 441

Post » Sun Jul 26, 2015 8:57 pm

You sir, are a god! thank you so much!
B
9
S
3
Posts: 32
Reputation: 708

Post » Mon Oct 12, 2015 12:47 pm

@troublesum @mdvgames
The reason is that the peer creates it`s own player object then calls the "Sync_SpawnPlayer" function which tells the host to spawn a new player and then signal the peers to spawn all player objects. So the host tells the peer to create a player for itself but it already has one.
This will happen again and again as more peers connect. The simple fix is in the "SpawnPlayer" function, it just needs a test to see if a player object with the requested peerid already exists, which can be achieved using an event for the PlayerObject.PeerID = peerid (as above) and then adding an Else (IE didn`t find one).
B
16
S
4
Posts: 35
Reputation: 2,393

Post » Mon Oct 12, 2015 12:50 pm

While I am here just wanted to add my thanks to @troublesum for this lovely bit of code, it took me a while to get my head around (I eventually took to carefully re-writing it, event by event, in my game, just so I could get a clear understanding of it).
B
16
S
4
Posts: 35
Reputation: 2,393

Post » Sun Nov 15, 2015 1:45 pm

@troublesum
@RattyRat

"PlayerObject.PeerID = peerid (as above)" don't work. It's work only once. Please help me :(
B
16
S
2
G
2
Posts: 8
Reputation: 1,391

Post » Mon Mar 07, 2016 6:38 pm

You need to use a counter inside the function, you can use a global variable, and everytime the functions is executed you can add 1 point to the global variable, so you can add a filter: system counter = 2 (empty) and a ELSE with the function ;)

Is working fine for me with this counter.
B
3
Posts: 6
Reputation: 179

Post » Tue Sep 13, 2016 9:49 pm

Good evening.
I'm straight to the point. Has anyone managed to solve this problem and adapted for mobile devices. In other words find an optimized solution. And I hope that someone will appear.
B
5
S
1
Posts: 19
Reputation: 417

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: bobcgausa and 14 guests