How do I sync hundreds of pinned objects in multiplayer?

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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...).

  • 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!

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)