How to pull off Client side projectile hit detection

Hello when i fire my weapon i let server know that he needs to spawn a projectile and replicate it to all clients, and that is working. My problem is that i want to use client side detection and i only want to tell server about hit when hit is processed by client that fired projectile. I have a OnHit callback that is called on OnComponentHit event of Sphere component, and i’m running game with 2 clients and a dedicated server. When i hit target with a client, each client triggers OnHit callback 3 times (i assume that it is one for projectile instance in server, another for original client and another for current client). If i put condition Owner->IsLocallyControlled() then i can filter 2 cases (ther server and current client instances), but i still need another filter condition to allow me to only execute hit code on client that shot projectile and not replicated versions in other clients.

Why do you want to do client side detection?

server should have authority over what projectile hits. It is true version of game world. client replicated versions of projectile are just simulated copies of server projectile. client projectile afaik really should have no need to talk back to server.

From what i’ve read, more modern shooters are resorting to client side hit detection, for example this link tells that Red Orchestra 2 default hit detection method is client side and not server side. I assume that is something related to be more fair to lagged players and also to make feel of gunplay be more responsive, i.e you don’t have to wait for communication and verification of server to register hit. Cheating is not a problem in my game so i’m not worried about that.

Hello

After doing a bit of digging I was able to find a page in documentation that appears to handle type of issue that you are facing and I have provided a link below. If you look under the “Run on owning client” section I believe you will find what you are looking for. I hope that this information helps.

Link: Networking Overview for Unreal Engine | Unreal Engine 5.1 Documentation

Make it a great day

Thanks for info, do you know C++ equivalent?

There’s more on RPCs in code here:

Thanks for info :slight_smile: