Pinning and unpinning objects to player in multiplayer?

  • Hi, I'm having an annoying issue in my current project.

    I'm trying to make an online multiplayer game in which you can pickup pieces from a board and drop them somewhere else in the board. It's basically a real-time tic-tac-toe game.

    Everything works fine, except on the peer's side. If they're moving and they drop a piece, the moment the piece is dropped its position gets readjusted slightly, which causes an annoying effect. It looks like so :

    cdn.discordapp.com/attachments/253490735268102144/588880808304050186/Jun-13-2019_20-01-41.gif

    Is anyone familiar with this issue? I think overall, I'm having a hard time wrapping my head around how objects that are not directly controlled by a player should be handled. From my understanding, their actual position should only be handled on the host's side, but the peer should be able to run their own version of the simulation, which then gets adjusted by the host in case of discrepancy.

    Anyway, as you can see I'm a bit confused and could use some pointers. Is this an issue you're familiar with? If so, how did you fix it? Any pointers, resources?

    Thanks in advance :)

  • its because the pin behavior acts last so it overwrites where the multiplayer plugin is placing the object, but once you let go of it then that's not true anymore.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • its because the pin behavior acts last so it overwrites where the multiplayer plugin is placing the object, but once you let go of it then that's not true anymore.

    Is the fact that I'm using the pin behaviour in itself the issue then? I don't think so but I'm sort of confused by your answer at the moment.

    There seems to be something essential that I'm missing. If you could give me some pointers, that'd be awesome.

    Thanks for your help so far :)

  • contact me on social media and I'll try explaining it to you if you want

  • For something like this I wouldn't sync the Xs and Os with the sync action

    You might want to try using 'send message' to tell the peers when a peer has picked up an X or O, and then another 'send message' to tell the peers where the X and O has been dropped. Inbetween those two events you could pin the X and O to the peer's hand on both the Host and the peer's side so things would match up nicely

  • For something like this I wouldn't sync the Xs and Os with the sync action

    You might want to try using 'send message' to tell the peers when a peer has picked up an X or O, and then another 'send message' to tell the peers where the X and O has been dropped. Inbetween those two events you could pin the X and O to the peer's hand on both the Host and the peer's side so things would match up nicely

    yup! Tried this last night on a tiny project (just pickup and drop objects) and it worked flawlessly.

    Implementing it as we speak on my main project.

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