Dev Log#25: Replicating Scatter and predicting Projectile paths
- camjhill737
- Jan 14
- 1 min read
Whilst I was implementing lag compensation techniques I noticed that the end points of the line traces were pretty different comparing the server to client.

The reason for this is because everything is happening on the server and then getting replicated down to the client the shoot function on the client simply calls the rpc function.
The solution to this was implemented by creating a local shoot function that is executed on the client alongside the server rpc.


Compared to the first comparison photo the end points of the line trace are a lot more similar across machines. It's important to note that I'm using FVector netquantize unreal engine has more precise vectors such as FVector netquantize100 however from testing I found FVector netquantize to be adequate. More precision leads to more bandwidth usage so if its not necessary to be more precise it make senses to use FVector netquantize for performance reasons.
You will also never have two 100% accurate versions of a game across the internet no matter what you implement in your code.
Another cool feature I came across was the function "UGameplayStatics::PredictProjectilePath"the purpose of this function says what it does on the tin. Here's a video that shows off what it does.
I use this technique when server side rewind confirms a hit by seeing if the predicted projectile collides with the player's hitboxes.
Commentaires