I’ve made a character pawn and enabled replication. Character movement is smooth but as soon as the client tries to run it’s extremely choppy for them and I’m not sure what I’m doing incorrectly. Any advice or help is more than welcome.
Is it possible that I am running too quickly? My Max Run Speed is set to 250.
Input actions (and input in general) only runs on the client, so when you press the button, your client has a different speed than the server, which causes the corrections
It’s generally a not-so-easy problem to solve, because you will have to compromise in some way
The best way would be to implement this through the character movement component in C++ via actual saved moves, but it’s not too easy to set up
But you could set up a GAS backed approach, and leverage the gameplay effect prediction to avoid corrections, although I don’t think this approach can eliminate all issues, especially as latency increases
Otherwise, you could set the IsRunning variable on the server using a Server RPC, and use that to notify the server to also start running, but that will also cause some jitter based on latency
So to me some sort of lag is to be expected. What’s really confusing me though is that walking is relatively smooth; but when I try to run there is noticeable lag and the client doesn’t even get to full run speed. If my server and client walk in a straight line they both get to the end at roughly the same time but if my server and client run instead the server gets to the end almost 2x faster than the client. I also know that my Input action is taking place.
Do I maybe need to change some settings in the character?
My max speed for walking is 170 while my max speed for running is 250.
Edit: It seems upon further testing that my client is setting the speed to 250 while the server is keeping it at 170. Am I doing OnRep incorrectly?
I think I understand this better now? Please let me know if I’m doing something incorrectly. So RepNotify should only be getting set on the server so that it also sets the clients values. To do that I should be calling a Run on Server custom event.
that seems like it would work if you are somehow using CurrentMaxSpeed and CurrentAcceleration in your movement
For example if you set the respective values in the character movement component (can do that in the OnRep, which runs on both the server and the client)