How to specify that client player is playercontroller 1 on a listen server?

Hello everyone,

I’m developing a multiplayer game using steam DevApp and running it on a listen server. I made the players (2) connect to the session but it seems that both player gets player controller 0, since I use a simple debug to print if the player 1 or 2 is connected and it always prints player1 on both sides. Right now, no pawn/character are spawn and i would like, if possible, to assign player controller ID 0 to the host and ID 1 to the client. Can anyone could explain if i need to spawn pawn/character first or the way to do it through game mode/game state.

Thank you for your awnsers.

You can do this with this:

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Game/SetPlayerControllerID/

Note that client side you only have PlayerControllers of local players, if you want to interact with all PlayerControllers you should do that on service side, any game rules management should be done on server for security, as user can do anything with memory on there local machine.

You also don’t need to relay on PlayerController IDs which just recently became reliable by ability to set ID. you can monitor who joins and leaves the game using events in gamemode (they also in blueprints) like PostLogin:

And Logout:

They give PlayerController that log in and out, with this you can list and memorize PlayerControllers however you like in GameMode. You can also use those events to set IDs

Check all the events that GameMode has to offer you might find even more useful events which can help you keep PlayerControllers in check