GetOwner()->GetRemoteRole() == ROLE_SimulatedProxy

Can someone explain this if statement in a little more detail and confirm my understanding?

if (GetOwnerRole() == ROLE_AutonomousProxy || GetOwner()->GetRemoteRole() == ROLE_SimulatedProxy)
{
LastMove = Move(Throttle, SteeringThrow, DeltaTime, GetWorld()->TimeSeconds);
SimulateMove(LastMove);
}

The first part of the if statement takes care of the case if the actor is client side and is controlled by the client. In the diagram below, the blue client will pass this first condition only on the blue stick man. Easy enough. But the RemoteRole is where I get a little lost.

If I’m looking at the Blue client in the diagram, what are the RemoteRoles of the actors? Is it Authority (because of the green server) or is the RemoteRole of the green box and blue man simulated proxy and the RemoteRole is autonomous proxy of the red man (because of the red client)? After reading https://docs.unrealengine.com/en-us/Gameplay/Networking/Actors/Roles, I want to believe that a client doesn’t ‘care’ about the other clients roles, so the remote role for all actors in the blue client would be Authority?

Now if I’m looking at the green server, the remote role for the green box is certainly a simulated proxy. In KrazyKarts, this is the case for the server’s GoKart. But in a three player game, would the actors on the server computer that represent the other two players have a RemoteRole of AutonomousProxy or SimulatedProxy? Couldn’t they be both?

I decided to do some experimentation.
I changed the UE_LOG in our KrazyKart project to display the RemoteRole instead of the Role and hosted a game with three players. I discovered that I was correct about the remote roles on clients. They will always be Authority, so they don’t care about the other clients.
I also learned that the remote role for both of the client controlled cars was autonomous proxy. I’m not sure how this happens, but it appears that the server will get the remote role of an actor based on if the actor is controlled by any client. The remote role for the server controlled car on the server was Simulated Proxy as well.

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

Privacy & Terms