How do I make this multiplayer sync work?

0 favourites
  • 11 posts
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • I'm playing around with a test game board that will let players move pieces around a grid. Right now, as far as I can tell, I have all of the necessary events to make this work (client input, syncing, etc.), but it's only working for host input. When the host moves a piece around, everyone is seeing it and it's staying where it should. When a peer moves a piece, it's only moving on their screen, and snapping back when released. So, sync works, piece moving works, but not peers moving pieces "for real"; it looks like a client input issue but I can't find the problem. Here's the thing. Feeling clueless. (Yes, a lot of this is chopped out of the tutorial files. Like I said, playing around. Forgive me!)

  • It looks like peers update ControllingUser, but that information is never sent to the host, so the host never knows which players are trying to move the token. If the host never moves the token, on the peers any changes will be overridden as the object is synced with wherever it is on the host.

    In general anything the peers do needs to be sent to the host, and then the host actually does it.

  • Oh hey, thanks for the reply! So... hm. Is this not the proper way -- OH! The Instance variable! I get it!


    It works! Thanks so much.

  • Hi. I tried something similar and added a new client input value and the value is stored in an instance variable of a sprite which was added to "Sync", too.

    I modified the Pong demo and when I added a new variable to the paddles it worked fine. But as soon as I add a new object with synced variables it seems nothing is sent to peers or received by the host anymore. :/

    On Start of Layout:

    Peer Code:

    Host Code:

    The only difference between paddle and the tiledBG is that only the paddle (and only 1 object has to be?) has the "Multiplayer Associate" action.

    When I open it in 2 browser windows and hit space on the Host the left number is increaded (in both windows) and if I hit it in the peer window the right number increases. But the value of the TiledBG (or other sprites I tried) is not updated. Does anyone know why or how to fix this?

    btw: Is there a way to restore/redownload the original examples when you accidentially overwrite the sample file?

  • Hi. I talked to someone with a similar problem and he used Boardcast message to send data and variables and it seems to work fine for him.

    Is the "Sync Variable" action (initialized on Startup) only working for the player object or should it work with all objects?

  • OMG! I think I found the problem. I forgot to destroy the objects when you are the peer. It seems to work now but the size/scale of objects is not synced.

    I reduced the object size on the host to make it fit better into the UI but on the peers the synced objects are all much bigger.

  • I am having issues with the ball going through the peer paddle. Does anyone have a fix for this??

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi, old thread! Are you sure you have the "bounce" code under the host section of your project, and not the peer section?

  • hey guy, can any body help me? I cant control my peer side. how does it work?

  • That's a big ol' question in a pretty old thread! I'd recommend going through the multiplayer tutorials very slowly, beginning to end. The way MP works in C2 is far from intuitive, and I know I missed a lot of the little "rules" over and over. All it takes is one wrong character and the whole multiplayer thing shatters.

    Best of luck!

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