I know there’s some topics on this already, but I’m looking for specifics here and I have some questions hopefully someone with experience in this can help. I want hit-detection to be client sided so the game feels good to play.
My plan is this: Client sends server a bunch of information when they shoot; The origin of the shot, it’s direction, and when it was shot (Can I trust this information from the client or should I calculate it on the server using their ping?) so other clients will know where to position it initially.
My main concern here is efficiency. The current project I’m working on is going to have a lot of projectiles being shot at each-other with potentially a lot of players.
Lets say a player fires a shotgun that creates 10 projectiles at once.
Is the best way to literally just send a big table of positions and directions?
Then how should the server store this information for when the client says they hit another player?
When that DOES happen what checks should the server make to ensure that it makes sense? my ideas are: When they shoot a projectile I check their character position compared to the origin of the projectile to make sure it makes sense they’re firing where they say they are. Make a ray from the origin to the thing they hit making sure it’s a reasonable distance, and no obstacles are in the way.
I’m still theorizing what to do here so any and all advice would be appreciated.