I’m trying to have a fast paced combat hit box system, and I want the hit sounds to play on the client upon impact for maximum responsiveness: My issue however lies in the way my hit box checking system functions, which is:
The hit box is checked on the client upon the player attacking, if a character is found then a hit event is fired to the server, and the server does a check using the characters that were found on the client and does a magnitude check, and then it plays the sounds and effects for every other client for each of the characters that passed both client and server checks.
So, the issue is due to this: Let’s say the player hits something on the client, if I were to play the hit sounds on the client, but then the server didn’t find anything in the hit box, it would still play the sound despite not hitting the other player. Is there any way to avoid this without using a remote function (since this would take away from the responsiveness having to go from client to server back to client). If I have to use a remote function then so be it, but maximum responsiveness on sounds and effects would be nice and I don’t generally see these issues happening on other fast-paced combat games.
you could make the server side check less harsh, say if the radius for the hitbox on the client was 3 studs, the server could have a radius of 6. this help accounts for ping and makes the game’s hitreg a lot nicer
In all client server type games, you go ahead and play the animation and the sounds on client, when the client says you hit something.
If the server then decides you didn’t hit anything, this should really only happen rarely and you don’t worry about the fact you played a sound on the client.
That’s how every non Roblox, client server game I have ever worked on did it.
I think I’m going to go a different path. I realized that since I’m going to have some very “quick” combat abilities where hit boxes may be moving too fast for accurate client → server sanity checks on average, I’m instead going to play the majority of combat effects with FireAllClients and using an FX module in order to handle all those effects. With the testing I’ve done so far, it’s accurate enough. However, I have it setup to be able to swap to the method you mentioned easily where the client that used the abilities effects will be played immediately from their client.