Hey guys,
So I'm trying to change the settings of my actor based on where it is. Is the following a functional way, in BeginPlay()? (it doesn't seem to be). The ships in question are used as the default pawn for the active gamemode.
When I have 2 clients connected to a dedicated server, each with a locally-controlled Ship, I get 'Remote Ship' 4 times, and 'On Server (pure)' twice.
EDIT: With only 1 client connected to a dedicated server, I get 'Remote ship on client' and 'On Server(pure)'.
EDIT#2: Changed the first two to;
GetNetMode() == NM_Client && !IsLocallyControlled() // remote
GetNetMode() == NM_Client && IsLocallyControlled() // locally-controlled on client
It seems that 'IsLocallyControlled()' returns false even on clients, for their locally-controlled actors?
EDIT #3:
Seems that all ships not on the server are treated as ROLE_SimulatedProxy, even replicated copies. Have I done something wrong here?
So I'm trying to change the settings of my actor based on where it is. Is the following a functional way, in BeginPlay()? (it doesn't seem to be). The ships in question are used as the default pawn for the active gamemode.
Code:
// remote on client if (!HasAuthority() && !IsLocallyControlled()) { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("Ship remote on client.")); } else if (!HasAuthority() && IsLocallyControlled()) // local client { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Blue, TEXT("Ship local on client.")); } else if (HasAuthority() && IsLocallyControlled()) // local to listen server { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Black, TEXT("Ship local on listen server.")); } else if (HasAuthority() && !IsLocallyControlled()) // server (pure) { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Cyan, TEXT("Ship on server (pure).")); } else { GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Green, TEXT("Ship case not handled!")); }
EDIT: With only 1 client connected to a dedicated server, I get 'Remote ship on client' and 'On Server(pure)'.
EDIT#2: Changed the first two to;
GetNetMode() == NM_Client && !IsLocallyControlled() // remote
GetNetMode() == NM_Client && IsLocallyControlled() // locally-controlled on client
It seems that 'IsLocallyControlled()' returns false even on clients, for their locally-controlled actors?
EDIT #3:
Seems that all ships not on the server are treated as ROLE_SimulatedProxy, even replicated copies. Have I done something wrong here?
Comment