Sixze / ALS-Refactored

Completely reworked and improved C++ version of Advanced Locomotion System V4.
MIT License
943 stars 261 forks source link

Lag / Desync with the latest commits #534

Closed PokiP closed 1 month ago

PokiP commented 1 month ago

I updated from June 19th to the latest as of July 21st. Everything looks okay until you play as client. You can see when going from 0 to sprinting there is a lot of obviously visible lag and jitter that was not there before. Suspect to do with the new direction dependant speed?

PokiP commented 1 month ago

https://streamable.com/6b11dp

Sixze commented 1 month ago

Could you please reupload the video?

I tried to reproduce this issue, but lags usually only occur under very bad network conditions, but I am aware that the current implementation of direction-dependent movement speed is not ideal, so I added a setting to disable it in UAlsMovementSettings.

PokiP commented 1 month ago

Could you please reupload the video?

I tried to reproduce this issue, but lags usually only occur under very bad network conditions, but I am aware that the current implementation of direction-dependent movement speed is not ideal, so I added a setting to disable it in UAlsMovementSettings.

https://streamable.com/6b11dp

Yup, it was on 5.4.2 if that matters. Great about the switch!

Sixze commented 1 month ago

Still can't reproduce this issue, I can only get something like this under bad network conditions, which is actually expected to happen.

PokiP commented 1 month ago

Sadly still seeing this with the very latest commits/branch and UE 5.4.3

Happens every about 2 out of 3 sprints for me. I noticed the independant movement direction defaults off now too, tried it both ways.

Sixze commented 1 month ago

I did as you said, but still no luck. There shouldn't be any lags if you have network simulation turned off at all, so make sure it's really off and other actions, like rolling, work without lags.

PokiP commented 1 month ago

I've looked deeper and think I have found a reason I see it but you do not. My usual FPS is 120 and it caps at that in the editor window.

image If I add fixed client fps to 60 here

Then the problem is completely gone. Even though my editor window still shows 120. Theres no lag on sprinting

Sixze commented 1 month ago

Fixed in 3d4d50291d1f7bc1fa4c8d2b1f6c0add0820319e.

In ALS, the change of velocity depends on acceleration, and acceleration depends on velocity, so there is a kind of loop that usually causes no problems except in this case.

The CV_Als_AccelerationAndDecelerationAndGroundFriction_Normal curve controls this dependency, but since there was constant interpolation between the acceleration for running and sprinting, for some unknown reason it caused the server to not be able to change the character's speed correctly, and so it pulled the client back thinking the client wasn't sprinting, causing lags.

Removing the constant interpolation seems to have fixed this issue, but I'm still not quite sure why it was causing problems on the server.