[SOLVED] How do I custom movement Multiplayer

0 favourites
  • 5 posts
From the Asset Store
A template for a grid movement , grid tactics type game like Dofus , click on the grid you want to move to and the
  • hey.. doing this multiplayer thing, i added 2 new variables to save the mouse click destination target x and y and a boolean to trigger the movement, on the default multiplayer example, now the host moves and updates perfect by default dident had to do really nothing to him, the problem is the peer, is moving at the first click towards destination of mouse where was pressed but then starts wobbling and if u click again wont move, its weird, cause its taking the movement for each individual peer id, just something keeps him pinned, not sure what..... anyone can help? much appreciated, you can take a look at the code bellow, the new movement for mouse is between big comments in host group

    download Capx if you can help with an edit is cool if not a post about the issue its ok thanks !

  • The peer its targetx , targety are not known on the host, nor synched, nor transmitted.

    Hence the host never fires the events for peer related movement in event 75.

    I would try and add a mouse button clicked (getbit on host's end) to grab the current lookx and looky and set those as targetx and targety. (would prevent synching more variables)

    Also, the movement related bit on event 75 is run under a Multiplayer.MyID, that will never fire on the hosts end for other peers, it would need to be in a loop for all peers and host.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The peer its targetx , targety are not known on the host, nor synched, nor transmitted.

    Hence the host never fires the events for peer related movement in event 75.

    I would try and add a mouse button clicked (getbit on host's end) to grab the current lookx and looky and set those as targetx and targety. (would prevent synching more variables)

    Also, the movement related bit on event 75 is run under a Multiplayer.MyID, that will never fire on the hosts end for other peers, it would need to be in a loop for all peers and host.

    thanks for reply

    i know they are not synched the problem is, that the host is updating his movement and i can see it move on other peer browser

    the peer however doesn't update movement, cause i dident added it to.. sincerely i dont even know how... it does not make any sense at all.. i cant really tell why the events are working for host, even though the event sheet it can act as common, since picks each individual peer or no peer by checking multiplayer.myid that means all players no matter host or peer will have same event sheet based on the commented events lines.

    doesn't really matter if i place them into the common group or not, cause the code is separated i can place it even outside the groups it will still have the issue of updating the current and old position of the peer, that seems to be having some problems cause of the testfire events, where there are some local variables that are stored when players start firing ... and updated .... hmm... so in my case i tried remove them, or even adapt them to the click for the movement they still dont acts as they should. any suggestions? the weird part is that the peer does move when you first log as peer and click on a range of 200 pixels, then after he moved and reached the destination, he stops moving, and yes its not updating his position so others can see... i know

  • Here I solved it for you, only required some smart tweaking of event 72.

    The idea behind it:

    all peers synch their lookx looky, when a peer is holding down the mouse it will update its targetx, targety, used for movement. When you let go it takes it current self.x self.y and sets that as targetx targety, making the player stop.

    The host determines the actual movement while the peer is trying to force its own, these combined leave you with a somewhat smoother mechanic.

    https://dl.dropboxusercontent.com/u/713 ... ement.capx

  • Here I solved it for you, only required some smart tweaking of event 72.

    The idea behind it:

    all peers synch their lookx looky, when a peer is holding down the mouse it will update its targetx, targety, used for movement. When you let go it takes it current self.x self.y and sets that as targetx targety, making the player stop.

    The host determines the actual movement while the peer is trying to force its own, these combined leave you with a somewhat smoother mechanic.

    https://dl.dropboxusercontent.com/u/713 ... ement.capx

    ah yes now makes sense, i was trying to use the actual mouse and update the movement, but then LookAtx is the same ... hah that was simple...

    ... im just frustrating myself with overwork but i now understand better how the multiplayer synching works thanks man ! love ya!

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