Download

Multiplayer Projectile Server not always hitten

Hi guys, just a “simple” problem.

The projectiles are correctly spawned by server and clients can see them. The damage event works fine.

But when a client fires a projectile and this has to hit the server, not always it works. Well, on the client you see that the projectile hits the server, but on the server where basically there is the real projectile, in reality this one does not hit the server player.

So the problem is onlt from clients to server. Maybe in the server the projectile is spawned in a quite different location? Maybe a little offset about 10 points on axis and so in reality the projectile isn’t directed towards to the server.

UP, answer please

Are you simply having the server handle all of the spawning logic or are you passing a vector/location from the client?

To be honest we/I need to see what’s happening (video) and some of the code (RPC’s, Fire event, spawn logic).

What are you using for collision on the client, round hit boxes or square? if they are round make them square ones. Round ones do not seem to collide with projectiles. That is what i experienced as a problem. Changed mine to square and they hit every time. Might miss once in awhile, i notice that.

More than likely its a bit more complex than collision shape. I use the skeletal mesh colliders and have zero issue with hit detection.

Could be server tick rate, projectile actor tick rate, not using ccd, projectile velocity/speed, input delay, lag, not having lag compensation etc.

Seeing your answers I’m testing with bigger sphere collision. If not, as @Rev0verDrive said, could be the fact that I trace lines on client and then I transfer the hit location to the fire event which is done by the server. Maybe I should also make the tracing by the server… I will let you know with useful photos

Yeah, i just figured i would throw that out as i seen that causing me a problem. Thought if that was it, it would be an easy fix. Probably one of what you are saying.

Just to be clear…

Any value you pass from client to server can be used for cheating. In your case a Line of Sight firing cheat could be used.

Client has no direct line of sight to target. Cheat calcs clear angle and provides a muzzle vector. Passes that to server server uses it to spawn projectile for a hit. Basically a hit anywhere, from anywhere cheat.

A solid approach would be to send a network clock time on fire. Server can rewind player position to match time, get muzzle and camera locations and do its own trace for spawn. Then use projectile path prediction (adv) to sync and check for pre-spawn hits (use PPP adv output). Then spawn server-side.

Next have the server rpc all other nearby clients to have the shooting client fake fire from their proxies current local position (fx only, no projectile).