Client-responsive and secure hit registration?

For any FPS game, the two things that are absolutely paramount when designing a projectile system are responsiveness and security. Hit feedback needs to be accurate and immediate for the client, while also being secure from cheaters on the server. This is a difficult thing to solve, but the most common method ive seen mentioned is a rewind system. The server logs player positions throughout the game, and all projectile registration occurs on the client. When a projectile is first fired on the client, the server logs that projectile (with the client’s timestamp and projectile origin). When a projectile on the client hits something that can be damaged (i.e. another player), it tells the server that it hit that thing. The server then looks back at the projectile that was fired, rolls the collider back to the timestamp provided by the client, and then simulates the projectile. If the projectile hits on the server, then the server validates the hit and damages the object.

What I’ve been stuck on for a while now is the rewind system, i havent even gotten to projectiles yet. I have a client script that creates a client copy of a target entity at that moment, then sends the server a timestamp and a reference to the target entity. The server looks through its snapshots for where that entity was at that time, then makes its own copy. I can see them together in game, with the server log represented in red and the client copy represented in blue:

No matter what I test and what I do, there always appears to be a desync and I have not been able to figure it out. I have rebuilt this system from scratch on 3 separate occasions over the past year and this is always the result. Personally im not really interested in debugging this anymore, I just want to know if anyone is aware of any other methods of cleanly registering hits, or if anyone has a reference to a public resource where someone made the rewind system work correctly? Thank you for reading

I did find a possible solution to this issue, suggested by AxisAngle in another post:

Kinda similar to what he suggested, but creating a spread of hitboxes pulled from near the timestamp would mostly ensure that an accurate verification could be made. This would make the system slightly more vulnerable to exploiters because the margin of error is greater, but exploiters are already capable of aimbot anyways so I dont think that this will cause any extra issues.

What do you guys think of this solution?

Maybe you could detect the hit on all clients, and if they all say that the hit is correct, deal the damage on the server

that would take a while and potato devices/someone’s bad connection will slow down it even more

Since communicating with other clients requires going through the server first, this would be slower than just communicating with the server. Also, since all clients will have different pings and different game states, the desync issue will still be present

3 Likes