#I m making a MOBA game and ran into a

1 messages · Page 1 of 1 (latest)

forest basin
#

Alright so this is due to server client delay, your issue is that you

1 check on the client if they can attack
2 they request the server to attack
3 server confirms that the attack was successful
4 attackTimer is being set
There's a delay from 2-4 because it is being send over the network
and thus if another update on your cleint happens between 2-4 it'll send another server RPC
and since you don't check on the server if the unit has recently attacked, it will just say "yeah cool let me spawn a bunch of projectiles"
so you get 3-4 projectiles (depending on your ping to the server) Then it waits the attack timer out and then another 3-4 projectiles
You can fix this by setting the attack timer when you send the server RPC
But again, you should also check the attack timer inside the server RPC itself, that way this would have never been a problem in the first place
Got it?

#

(I now see that you did in fact post the code, missed that my bad!)

@graceful fractal

graceful fractal
graceful fractal
graceful fractal
forest basin
#

Update code?

#

That error is from a different class that you send

#

@graceful fractal

forest basin
#

you then set the attack timer on the client to prevent it from spamming the server, and you set the attack timer in the serverrpc to avoid cheating

forest basin
#

Alright same class but need updated code