Incorrect synchronization of AddMovementInput method

Hey!

We use scale by Lerp with some speed, while user put forward key. It allows for us to make accelerative ans deccelerative moving of our Actor. We do not use Ground Friction becouse it is not looks well for anthropomorphic character.

In UE 4.8 AddMovementInput take correct scale from 0 to 1 and on standalone mode it is cool. But when we turn on server on scale value around 0 - 0.8 velocity on client race in wide range around 120 - 400 or worse. If we take a look on server speed incrace to maximum value until we put scale to “0”.

Can anybody explain what we can do wrong? Or if it is newest bug in CharacterMovementComponent, does anybody have an idea what can we do with that?

This is the implementation of AddMovementInput:


void APawn::AddMovementInput(FVector WorldDirection, float ScaleValue, bool bForce /*=false*/)
{
	UPawnMovementComponent* MovementComponent = GetMovementComponent();
	if (MovementComponent)
	{
		MovementComponent->AddInputVector(WorldDirection * ScaleValue, bForce);
	}
	else
	{
		Internal_AddMovementInput(WorldDirection * ScaleValue, bForce);
	}
}

I.e. the scale value is directly applied, thus i can’t think how that would be the cause of your problems.

Yeh, thank you, it is happened before replication as I see. “Magic” is starting on CharacterMovmentComponent somewhere around MoveAutonomous on Server side.

We decide this problem by overriding MoveAutonomous in child class. And change MovmentComponent for our Character.

The core problem was in this line


Acceleration = ScaleInputAcceleration( ConstrainInputAcceleration(NewAccel) );

so we change it to the old version of this line from 4.7


Acceleration = ConstrainInputAcceleration(NewAccel);

We do not know in really if it bad or good way OR if we fix some bug. But spend A LOT of time with this problem and, thanks god, finally its works.

Hi Puxx,

There was recently an issue that was reported where Analog Input was not working correctly for clients in 4.8 and 4.8.1 and it has been verified as fixed. It seems that this bug could be causing your current issues and the fix should be integrated into a future build soon.

Have a nice day,