x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Spawned character has Role Authority and RemoteRole SimulatedProxy on the client

This is related to the question link text

I've noticed that the spawned drone has
Role=ROLE_Authority and RemoteRole=ROLE_SimulatedProxy
on the client.

As explained in the question linked, in multi-players the main player's character spawn a drone on the server.

On the server, when the player's character is spawned, the server log shows that the player's character has the right roles

 [2018.10.19-16.45.39:762][835]LogKSGMDebug: Verbose: AKBaseCharacter::AKBaseCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:771][835]LogKSGMDebug: Verbose: AKPlayerCharacter::AKPlayerCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:785][835]LogKSGMDebug: Verbose: AKBaseCharacter::PostInitializeComponents  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:793][835]LogKSGMDebug: Verbose: AKPlayerCharacter::PostInitializeComponents  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:806][835]LogKSGMDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy    IsLocalPlayerController()=0   InPawn=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:815][835]LogKSGMDebug: AKPlayerController::Possess   Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy    IsLocalPlayerController()=0   PawnToPossess=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:826][835]LogKSGMDebug: Verbose: AKBaseCharacter::PossessedBy  -  this=BP_PlayerCharacter_C_0  NewController=KPlayerController_3
 [2018.10.19-16.45.39:837][835]LogKSGMDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy    IsLocalPlayerController()=0   InPawn=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:848][835]LogKSGMDebug: Verbose: AKPlayerCharacter::Restart  -  Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.39:859][835]LogKSGMDebug: Verbose: AKBaseCharacter::Restart  -  Role=ROLE_Authority   IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0


On the server the character has the Role=ROLE_Authority and the RemoteRole=ROLE_AutonomousProxy and IsLocallyControlled=0

And on the client the player's character has the adequate roles as shown in client's log

 [2018.10.19-16.45.40:008][692]LogKSGMDebug: Verbose: AKBaseCharacter::AKBaseCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:009][692]LogKSGMDebug: Verbose: AKPlayerCharacter::AKPlayerCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:009][692]LogKSGMDebug: Verbose: AKBaseCharacter::PostInitializeComponents  -  Role=ROLE_SimulatedProxy   RemoteRole=ROLE_Authority     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:009][692]LogKSGMDebug: Verbose: AKPlayerCharacter::PostInitializeComponents  -  Role=ROLE_SimulatedProxy   RemoteRole=ROLE_Authority     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogOnline: AKPlayerController::OnRep_Pawn  -  Role=ROLE_AutonomousProxy   RemoteRole=ROLE_Authority    IsLocalPlayerController()=1   GetPawn()=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogKSGMDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_AutonomousProxy   RemoteRole=ROLE_Authority    IsLocalPlayerController()=1   InPawn=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogPlayerController: Verbose: ClientRetryClientRestart_Implementation BP_PlayerCharacter_C_0, AcknowledgedPawn: None
 [2018.10.19-16.45.40:010][692]LogKSGMDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_AutonomousProxy   RemoteRole=ROLE_Authority    IsLocalPlayerController()=1   InPawn=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogPlayerController: Verbose: ClientRestart_Implementation BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogKSGMDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_AutonomousProxy   RemoteRole=ROLE_Authority    IsLocalPlayerController()=1   InPawn=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:010][692]LogKSGMDebug: Verbose: AKPlayerCharacter::Restart  -  Role=ROLE_AutonomousProxy   RemoteRole=ROLE_Authority     IsLocallyControlled=1   Actor=BP_PlayerCharacter_C_0
 

On the client the player's character has the Role=ROLE_AutonomousProxy and the RemoteRole=ROLE_Authority and IsLocallyControlled=1

Now when the drone is spawned on the server, we can see in the server log that the roles are reversed

 [2018.10.19-16.45.40:255][837]LogKSGMDebug: Verbose: AKBaseCharacter::ServerSpawnDrone_Implementation  -  Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy     IsLocallyControlled=0   Actor=BP_PlayerCharacter_C_0
 [2018.10.19-16.45.40:265][837]LogKSGMDebug: Verbose: AKBaseCharacter::LocalSpawnDrone  -  Role=ROLE_Authority   RemoteRole=ROLE_AutonomousProxy     IsLocallyControlled=0
 [2018.10.19-16.45.40:276][837]LogKSGMDebug: VeryVerbose: AKPlayerCharacter::LocalSpawnDrone  -  Drone=BP_Drone_C
 [2018.10.19-16.45.40:287][837]LogKSGMDebug: Verbose: AKPlayerCharacter::DestroyDrone  -  Role=ROLE_Authority    RemoteRole=ROLE_AutonomousProxy     Actor=BP_PlayerCharacter_C_0    SpawnedDrone=None   IsLocallyControlled=0
 [2018.10.19-16.45.40:298][837]LogKSGMDebug: VeryVerbose: AKPlayerCharacter::LocalSpawnDrone  -  GetActorRotation=P=0.000000 Y=-90.000183 R=0.000000  GetActorLocation=X=-0.001 Y=11350.000 Z=462.063
 [2018.10.19-16.45.40:309][837]LogKSGMDebug: Verbose: AKDroneCharacter::AKDroneCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_Drone_C_0
 [2018.10.19-16.45.40:320][837]LogKSGMDebug: VeryVerbose: AKPlayerCharacter::LocalSpawnDrone  -  CreatedDrone=BP_Drone_C_0   CreatedDrone->Instigator=BP_PlayerCharacter_C_0   CreatedDrone->MasterController=KPlayerController_3
 [2018.10.19-16.45.40:333][837]LogOnline: AKDroneCharacterController::AKDroneCharacterController   this=KDroneCharacterController_0    Role=ROLE_Authority   RemoteRole=ROLE_None     IsLocalController()=1
 [2018.10.19-16.45.40:342][837]LogOnline: AKDroneCharacterController::Possess  -  this=KDroneCharacterController_0    Role=ROLE_Authority   RemoteRole=ROLE_None     IsLocalController()=1   InPawn()=BP_Drone_C_0
 [2018.10.19-16.45.40:353][837]LogKSGMDebug: Verbose: AKDroneCharacter::PossessedBy  -  this=BP_Drone_C_0  NewController=KDroneCharacterController_0
 [2018.10.19-16.45.40:364][837]LogOnline: AKDroneCharacterController::SetPawn   this=KDroneCharacterController_0    Role=ROLE_Authority   RemoteRole=ROLE_None     IsLocalController()=1   InPawn=BP_Drone_C_0
 [2018.10.19-16.45.40:375][837]LogOnline: AKDroneCharacterController::SetPawn   this=KDroneCharacterController_0    Role=ROLE_Authority   RemoteRole=ROLE_None     IsLocalController()=1   InPawn=BP_Drone_C_0
 [2018.10.19-16.45.40:386][837]LogKSGMDebug: Verbose: AKDroneCharacter::Restart  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_Drone_C_0
 [2018.10.19-16.45.40:397][837]LogKSGMDebug: Verbose: AKDroneCharacter::PostInitializeComponents  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=1   Actor=BP_Drone_C_0
 

When the drone's controller is created on the server, it has the Role=ROLE_Authority and the RemoteRole=ROLE_None and IsLocalController()=1
And the drone's character created on the server has the Role=ROLE_Authority and the RemoteRole=ROLE_SimulatedProxy and IsLocallyControlled=1

If I check on the client's log for the drone

 [2018.10.19-16.45.40:728][730]LogKSGMDebug: Verbose: AKDroneCharacter::AKDroneCharacter  -  Role=ROLE_Authority   RemoteRole=ROLE_SimulatedProxy     IsLocallyControlled=0   Actor=BP_Drone_C_0
 [2018.10.19-16.45.40:729][730]LogKSGMDebug: Verbose: AKDroneCharacter::PostInitializeComponents  -  Role=ROLE_SimulatedProxy   RemoteRole=ROLE_Authority     IsLocallyControlled=0   Actor=BP_Drone_C_0
 

The problem is that the drone has the wrong role in the PostInitializeComponents Role=ROLE_SimulatedProxy and RemoteRole=ROLE_Authority and IsLocallyControlled=0
As for the player's character it should be Role=ROLE_AutonomousProxy and RemoteRole=ROLE_Authority and IsLocallyControlled=1

My question is why the drone spawned on the server have reversed role. Normally when you spawn something on the server it should have Role=ROLE_Authority RemoteRole=ROLE_AutonomousProxy IsLocallyControlled=0 and on the client Role=ROLE_AutonomousProxy RemoteRole=ROLE_Authority IsLocallyControlled=1

For the code check the link.

Product Version: UE 4.19
Tags:
more ▼

asked Oct 27 '18 at 09:13 AM in C++ Programming

avatar image

domzorg
714 50 56 128

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I've solved the problem by removing the controller and calling SetAutonomousProxy(true);

In the DroneCharacter constructor I've sets the bRunPhysicsWithNoController to true.

 AKDroneCharacter::AKDroneCharacter(const FObjectInitializer& ObjectInitializer)
     : Super(ObjectInitializer)
 {    
 .        GetCharacterMovement()->bRunPhysicsWithNoController = true;  
 

and the AIControllerClass to null.

 AutoPossessAI = EAutoPossessAI::Spawned;   
 AIControllerClass = nullptr;  



After object construction in PostInitialize I call the SetAutonomousProxy to change the RemoteRole

 void AKDroneCharacter::PostInitializeComponents()
 {
     Super::PostInitializeComponents();
 
 
     if (GetNetMode() != NM_Standalone && Role == ROLE_Authority)
     {
         SetAutonomousProxy(true);
     }
 

more ▼

answered Nov 29 '18 at 06:24 AM

avatar image

domzorg
714 50 56 128

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question