Move is not being processed by the server

Hello! You have fantastic courses and I never had any issues, but this time I’m unapologetically stuck.

When I’m trying to move as AutonomousProxy my car moves a little and then resets to original position.
It seems this is happening because it isn’t moving on the server.
Here is the video:

What would be the best way to log out if info has been received by the server via Server_SendMove_Implementation?
I have made this log in MovementComponent::SimulateMove:

	if (GetOwner()->GetRemoteRole() == ENetRole::ROLE_AutonomousProxy)
	{
		UE_LOG(LogTemp, Warning, TEXT("Throttle: %f, SteeringThrow: %f, Force: %d"), InMove.Throttle, InMove.SteeringThrow, Force.Size());
	}

It was indicating that SteeringThrow and Throttle were processed correctly.
Both components have “ReplicationEnabled = true”;

As far as I can see, my code is nearly identical to Sam’s, please help.

Ok, from what I can tell from the video, this is one client and one client/server and one of them is not replicating correctly.

This is almost always something different from the code. I found sometimes doing a rebuild fixed issues too, by removing the binaries folder. I’m not saying this is the issue but the best thing you can do here is make sure that your code is exactly the same as the course code.

Back yours up and update from the end of lecture. If it works, then there is an issue with your code.

Without the project, it is hard to say what exactly is wrong.

Thank you for the suggestion, but it didn’t help.
Here is the link to my repository:

I will be very thankful if you find a moment to have a look at it.
It’s in unreal engine 5.2

1 Like

Ok, Your rotation code doesn’t match the function of the lecture you posted against but I think it is correct. One thing I did notice is that you are using SetIsReplicatedByDefault(true);
but should be
SetIsReplicated(true);

and this should not be in the movement component, only the replication component.

Other than this, nothing else jumps out at me.

Give this a try and let me know how you get on.

I have removed Replicated(true) from movement component and replaced SetIsReplicatedByDefault(true) with SetIsReplicated(true) in Replicator.
This didn’t resolve the issue - it persists as before.

Ok. I will try and look into it further. It may be the weekend so thanks your your patience.

1 Like

Hi there,
Just spent the last 2 hours trying to debug your project. First, your movement component and the calculations for both rotation and movement are wrong. You are basing these on a rolling resistance of 1 when it should be 0.015, and drag coefficient should be 16.

You are also multiplying by 100 in the wrong place and it should be in UpdateLocationFromVelocity.

Of course, this doesn’t solve the replication issue - this is failing but am not sure why this is.

On the surface it looks ok but it takes a deep dive in the code to see the differences.

The following methods are incorrect:

  • CalculateRollingResistanceForce
  • UpdateLocationFromVelocity
  • UpdateRotationFromInput
  • SimulateMove (force should not be multiplied by 100 here)

There’s something strange going on with replication too. I’ve yet to figure it out but basically the times are not coming through so the move is reset as if it didn’t happen.

This is possibly a quirk with UE5.2 but I do know where were also differences with UE4.27/4.26 as well and I can’t remember if something was needed.

This should keep you busy for a bit anyway.

Thank you, for your attempt, beegeedee.
I understand that my movement component calculations are not one to one with the courses, however they produce acceptable result, so I have decided to keep my solution after I learned Sam’s solution.
As you have said yourselves - it is irrelevant to replication issues - which is my concern.
Thank you for looking into it, I will keep looking for the solution.
I would be very grateful, if you could give me any advice where to look.
At the moment, my only idea is to find out how can I debug the engine’s code and see what values are actually passed to the server through replication functionality.

The easiest way is to add a lot of logging into the code and look at what is output. You can step through the code a lot easier using visual studio or rider instead of vs code.

I’ve made some kind of a progress. If I comment out function calls related to ServerState.Transform and ServerState.Velocity (“setting” and “getting”) - car stops from rubber bending to original position. It is not replicated on the server (but the server is replicated on the client screen). Gonna keep looking in this direction.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms