CharacterMovementComponent spawned MID game wants to catch up time since START

I’ve ran into an issue with 4.6 and I’m wondering if you can help me figure out what I’m missing. First of all, this is an issue that only seems to occur in multiplayer sessions.

I’m spawning a pawn at a specified position, but as the game progresses the pawn doesn’t spawn exactly at that position but with an offset that increases with the game duration. I’ve noticed that the initial spawn location is applied correctly: when reading the position in BeginPlay() both server-side and client-side the location matches the location I specified when calling World->SpawnActor(). But within the first tick the actor is displaced with a huge offset, but only in that first tick. During that first tick I get the following warning in the Log which I think is related to the issue:



LogCharacterMovement:Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 26.038601 > MaxSimulationTimeStep (0.050) for 'MyPawn_C_6'


The value 26.038601 is always equal to the duration of the game session. It seems to me that for some reason the CharacterMovementComponent thinks it has 26 seconds of simulation to catch up (as long as the session duration), while it shouldn’t because it was only spawned an instant ago. Does anyone know how to resolve this?

Edit: My code for spawning the new pawn and initializing CharacterMovementComponent below. Nothing special- but am I missing some “init” call that is required for replicated character movement?

In MyPawn class constructor:



	UCharacterMovementComponent * CharMove = GetCharacterMovement();
	CharMove->NavAgentProps.bCanCrouch = false;
	CharMove->NavAgentProps.bCanSwim = false;
	CharMove->NavAgentProps.bCanJump= false;
	CharMove->NavAgentProps.bCanFly = false;
	CharMove->NavAgentProps.bCanWalk = true;
	CharMove->GroundFriction = 0;
	CharMove->SetIsReplicated(true);


Code to spawn and possess a new pawn mid-game, only executed server-side:



	FActorSpawnParameters SpawnParams;
	SpawnParams.bNoFail = true;
	SpawnParams.bNoCollisionFail = true;
	AMyPawn * NewPawn = Cast<AMyPawn>(GetWorld()->SpawnActor(MyPawnClass, &Loc, &Rot, SpawnParams));
	if (!NewPawn)
		return;

	// Give the player control
	Player->Possess(NewPawn);


did you ever figure this one out? i’m having the same issue

I found at least one cause of this issue here. As far as I know, engine still hasn’t been updated to fix it.

I know I’m a little late to the party SlimeQ, but in my case this was caused because my set “Is Moving?” was too far down my pipeline and Unreal did not like that. This was using 4.18 however. The solution was easy, just make this portion of the first few bools to set in your AnimBP event graph.

Was fixed in 4.16:
https://forums.unrealengine.com/unreal-engine/feedback-for-epic/105854-bug-hard-to-find-error-with-networkpredictioninterface-charactermovement?133204-BUG-Hard-to-find-error-with-NetworkPredictionInterface-CharacterMovement=

It’s still happening in 4.24 with some player start positions. Maybe a regression

2 Likes