Download

Networked game collision detection (overlap events) and hit sounds

Hey guys!

I am currently working on a networked game with swords.
Since the server is authoritative it makes sense that collision detection of any sort should be done on the server.
I was wondering if my solution for playing sounds when being hit (or hitting somebody) make sense.

I check for an overlap between the weapon (a sword) and the mesh of a character. OnBeginOverlap
I apply damage (if HasAuthority()) and play the right sounds. The problem is that I reset to server state
once I receive it (and do client side prediction) which constantly moves a simulated proxy, even if the position
doesn’t change. This triggers the Begin and EndOverlap events each time the character gets an update, causing
the sounds to be played very fast and a lot too.

Right now I have solved this by just completely moving the collision to the server and checking the server state if damage
was received and then playing the right sounds. This works as intended, but when lag is turned on you can literally hear the lag.

Is there a way to circumvent the problem with overlap events so that I can simulate the collision on the client side ?
Should I even try to do so or is my setup right now acceptable? I was thinking of games like CS:GO but those are a little different,
you don’t constantly hear when you hit someone, and when you are being hit it is fine anyway since that is in sync with the lag.