[SOLVED] How do I custom movement Multiplayer

Get help using Construct 2

Post » Fri Jun 26, 2015 5:44 am

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 !
Last edited by gamecorpstudio on Sat Jun 27, 2015 9:01 am, edited 1 time in total.
B
75
S
22
G
68
Posts: 1,337
Reputation: 43,271

Post » Fri Jun 26, 2015 4:27 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Fri Jun 26, 2015 10:17 pm

lennaert wrote: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
B
75
S
22
G
68
Posts: 1,337
Reputation: 43,271

Post » Sat Jun 27, 2015 7:19 am

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
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Sat Jun 27, 2015 8:58 am

lennaert wrote: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!
B
75
S
22
G
68
Posts: 1,337
Reputation: 43,271


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi and 56 guests