What is the "gold standard" for making raycasting guns?

I’ve always wanted to make a game where guns are involved, however, I have been putting this off purely because the best way I can make said guns, are very exploitable. There are front page games that do use guns in their games so there is definitely a way to securely create firearms/projectile based weapons.

Usually how I would do this is by making a ray cast on the client side and if the raycast hits another player, then the client would tell the server that this is the case. This, of course, is very bad design as exploiters are able to tell the server they have hit every single player in the game regardless of where they are. So these are my options and why I cannot use them.

  1. Create the ray of the server side. This would solve the entire problem altogether, however the response time between server and client communication has never been too friendly on things that are suppose to happen instantly.

  2. When a player sends to the server that they hit another player, then use the server to do a sanity check to see if there is indeed a line between the player and the player being hit. But why not just use that sanity checker as the ray cast itself if it responds just as fast.

  3. Check on the server if the player is firing too often for the firerate of the gun they have. This too is not great to use, as mentioned before, the lag between the client and server side can affect this, plus this doesn’t solve the problems with methods 1 and 2.

4 Likes

I’d recommend using this module: Fastcast

1 Like