Best Way of Handling Projectile Hit Detection?

Hello! :wave:

I’m currently working on a fast-paced, multiplayer dungeon crawler game (take Soul Knight, for example) that heavily relies on the use of projectiles, and one of the things I’ve been struggling with is hit detection.

I’ve read some articles about hit detection for projectiles, and here are some of the options that I came up with based off from these links:

Server creates projectile, allows Client to do hit detection
A while back, I created a knife that when clicked, the server creates the knife and allows the client to find players and hurt them. Originally I was thinking about doing this again, but since I’m adding NPCs into the mix (NPCs can attack players with projectiles), this might not be a good idea.

Client creates projectile, allows Server to do hit detection
I might be wrong about this, but I think creating a projectile on the client and setting its NetworkOwnership to the client may cause the projectile to be exposed to exploits. Besides that, I feel like creating projectiles client-side will make the player experience feel/look smooth overall.

So far, I’m thinking about using the first option, but I’m all ears for suggestions.

2 Likes

Hello! I recommend you take a different approach, in terms of gameplay creating anything on the server will add more lag, the server should be used as a communicator, not a creator, try replicating the projectiles. Create a module that creates a bullet and gives it a force, now put that in replicated storage. When a player fires call on the module, make the client create the projectile and manage the projectile + damage, after this step fire the server passing ONLY the start position, end position etc, then the server should fire the client with the same information passed (make sure the clients that DID NOT fire don’t handle damage, only the client that originally fired does) Once the client that did not fire receives the request from the server use that same information and that same module to create a projectile on the client. (If that makes any sense?) Then you can manage the impact on each client, as each client has created the projectile and can manage whether it is touched.

I hope this helps!