Large delta time for first player movement update on server

Hi All,

We seem to have found the following issue. When a player joins a game that has been running for a while the delta time passed into the movementcomponent is very high. If the spawn point the player character is spawning at is above the ground and the player starts in the falling movement mode then they will have an extremely high velocity when they hit the ground. We have falling damage implemented in our game so the player instantly dies on spawn. Looking inside APlayerController::TickActor this is where the first delta time gets calculated

FNetworkPredictionData_Server* ServerData = NetworkPredictionInterface->GetPredictionData_Server();
				const float TimeSinceUpdate = ServerData ? GetWorld()->GetTimeSeconds() - ServerData->ServerTimeStamp : 0.f;

Initially ServerTimeStamp is 0 as the ServerData is a newly created FNetworkPredictionData_Server_Character. You can see then that the time is getting set to the time that has passed since the game started which could be an extremely large amount of time. Is this the desired functionality and if so would it be ok to just skip the NetworkPredictionInterface->ForcePositionUpdate(PawnTimeSinceUpdate); line if the ServerTimeStamp is 0 or would there be a better way to go about it?

Thanks in advance,

Tristan

Good catch. I think we’d probably want to detect if ServerTimeStamp is 0 and in that case set it to the current time instead. Then the ensuing comparison to current time would just be zero, and the rest of the code would be skipped. I suppose UCharacterMovementComponent::GetPredictionData_Server() could initialize it as well instead of setting it to zero.