How do I sync hundreds of pinned objects in multiplayer?

Get help using Construct 2

Post » Mon Aug 15, 2016 11:12 am

Hi,
I'm working on a multiplayer game right now and I want to have 2 players that have 60 seconds to build themselves a machine to fight against each other.
These "machines" are made out of hundreds of lines that the players can create. I already made everything work as a singleplayer game, but now I want to sync these lines. I think it would be a waste of bandwidth to sync every single line. What is the best way to sync hundreds of objects that are pinned to a core which the player can move?
Any help is appreciated :)
Thanks!
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Tue Aug 16, 2016 8:12 am

Have you tried it? Bandwidth is generally more of a concern as you add number of players as the amount of data sent is exponential per peer. 1v1 you should have a pretty large amount of room to work with.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Tue Aug 16, 2016 9:03 am

I would send an array containing the origin and finish of each lines (or various modules those lines are meant to link together) and have it being "built" as well on each peer side on start of the session.

Once the overall structure is built, the fact that they are pinned will move them automatically on all peers equally when you move the core (since in the end they are pinned to it and all depends on the core, the angle, position, etc...).
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,328
Reputation: 71,288

Post » Tue Aug 16, 2016 2:28 pm

@oosyrag, @Kyatric,
Thanks for your help! I just created a program that will put the building of each player in an array and load it again later from the json string. It works perfectly! :)
But how should I send the array to the other player? Should I do it with the broadcast action? Because the array is quite large.
Thanks again! :)
Image
B
5
S
3
Posts: 193
Reputation: 1,063

Post » Wed Aug 17, 2016 12:56 pm

You need all peers to have those data, so yes, I would broadcast the informations and prevent play/session start as long as the informations haven't been completely broadcasted.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,328
Reputation: 71,288


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests