Making a weapon system

Hey. So, this is more of a theoretical question but;

My idea so far, in order to have a exploiting proof and fast system, is as following:

  • Client has a raycast, and send the information to the server.

  • The server does sanity checks, and damages the player.

  • After that, the server does a raycast itself (with the data it got) and sees if it corresponds with the client raycast.

    1. If yes: do nothing

    2. if no: give the player health back (the one who got shot)/dont give the player a kill (the one who shot)

What do you guys think? Looking forward to feedback.

Since your checking if the raycast hit on the server just do it on the server no need to do it on the client.

I know, but the client raycast will be much quicker and thus will not be prone to lag (if I do it on the server, people with high server latency will essentially not get registered kills, or at least it will not be instant).

The server is for verifiying in a worst case scenario where a hacker has hacked the raycast.

have a raycast on the client which is seen visually by that client (bullet trails etc) so that their is accurate and doesn’t have a huge delay
then have the server create a raycast of its own which will be reliable, and show other players that raycast, and damage based off of that raycast, no need to remove then add on damage, just determine if the damage should be dealt in the first place on the server

1 Like