Edit: This code here is wrong, look in the replies for my final solution.
Whether it was just my project, or Unreal Engine 5.2, I’m not sure. But I was getting odd behavior with the authority/server side of simulation, specifically with it not even working, no movement or anything out of the authority. I checked and made sure my code matched exactly with the instructor’s, still nothing. If anyone else has this issue my solution was this:
Code must be modified in 2 places, one in the Server_SendMove_Implementation function on GoKartMovementReplication.cpp, you must add an if statement explicitly telling the authority to not simulate movement from here.
void UGoKartMovementReplication::Server_SendMove_Implementation(FGoKartMove Move)
{
if (MovementComponent == nullptr) return;
if (GetOwner()->GetLocalRole() != ROLE_Authority)
MovementComponent->SimulateMove(Move);
UpdateServerState(Move);
}
Secondly in GoKartMovementComponent.cpp, TickComponent function. Give the authority explicit permission to simulate from here in the if statement. (specifically GetOwner()->GetLocalRole() == ROLE_Authority) It may be possible to remove the entire if statement without anything breaking at this point since it’s letting everything through, I haven’t personally tried it.
void UGoKartMovementComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (GetOwnerRole() == ROLE_AutonomousProxy || GetOwner()->GetRemoteRole() == ROLE_SimulatedProxy || GetOwner()->GetLocalRole() == ROLE_Authority)
{
LastMove = CreateMove(DeltaTime);
SimulateMove(LastMove);
}
}
Again I’m not sure if this was just my project, or a version difference. Hope it helps someone.