Set a client ID to differentiate between them

Hey,

I am not sure why I am not finding anything on this topic, I’m hoping there’s a painfully obvious way to do this ; )

In my 4man Multiplayer setup I am replicating my game objects from the server to 3 other clients, and have their actions forwarded via RPC, this works nicely now. However I need a way to differentiate my clients, to know who is player #0, player #1,player#2 and player #3. This is especially relevant because I need them to have different camera angles, and to know wether it’s their turn or not. They can however always be the same, as in:
server == player#0,
client#1 == player#1,
etc…

So at what point do I get a chance to set a simple Integer on my client to increment on the server? Again, this should be fairly simple, right?

Cheers

Hm there are multiple ways. For example the server contains all Player Controllers (the clients only have their own).

So you could let the server just iterate through the Player Controllers and set their Camera angle etc.

Also there is a “PlayerArray” inside the “GameState” class. It contains a replicated array of “PlayerState” which is also replicated. The PlayerState has a variable for the PlayerName AND a PlayerId. This PlayerId would also be used if you use something like Steam. This would be the SteamID then. But if you only use the UE4 network, it will have a random unique ID.

If this doesn’t solve your problem, feel free to ask me. I will add some API side to the mentioned classes below:

AGameState:

PlayerArray inside AGameState:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameState/PlayerArray/index.html

APlayerState:

PlayerId inside APlayerState

Thank you so much for your help,
but I’m having trouble making this work. I can iterate my PlayerControllers, but in my current setup they do not
actually possess a pawn, since I just want the camera to be static. This means however that the pawns do not have a PlayerState object, so that option isn’t working for me.

And simply iterating the PlayerControllers should work, but they do not replicate to the Client, so whatever I change on them doesn’t help me either.

Any idea how i can do this without possessing anything?

Thanks again!