Projectile collides on different locations for the server and client.

I have an enemy mesh that once a projectile collides with it, it prints which bone was hit. If the enemy is in T pose, the server and client prints the same bone names. However, when the enemy has its running animation on, the server and client (sometimes) prints different bone names. In both cases the enemy is in the same location (his walk speed is 0).
unreal debug
What is happening? Are the animations slightly different for the server and client? I’m testing with ‘New Editor Window (PIE)’ with 2 players and net mode as ‘Play as listen server’.

Yes you will have some form of lag always between client and server. They will periodically sync up using the update rate.

You may see what is called rubber banding when the client “catches up” to what the server has. You can use predictions based on player rotation & velocity to predict where the player might be, but if the other player suddenly changes direction or stops then the prediction will fail & you will get 2 different results.

Always trust the server. Using the client to decide what is happening will open up your game to cheating. Register the trigger pull on the client but the server side hit should be what matters.

I’m doing like this, but it prints different bone names on the server and client. Do you know the correct setup?

Do an has authority check after the overlap (will ensure it’s on server). Find the bone on the server and pass it back through the multicast as an input.

So far this is working for weapons that spawn one projectile at once (like a pistol for example). The shotgun spawns 5 projectiles at once that spreads out over time. The server prints all 5 bone names, but the client prints only 2 . Any idea of what is happening? The projectiles disable its collision as soon it hits something.

image

No need to call overlap server. You are already on the server. Once you have the bone pass it to the multicast function.

Ok I changed that. The client still can’t print all 5 times, only 2 or 3 times.
image

Try setting your multicast to reliable. You are probably firing in rapid succession and losing information due to packet drops.

Thanks! this seems to fix it

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.