ALL players have the same controller ID

Hi again.

When pressing play with 2 players simulated (or more), all of the players have the same playercontroller id (0).
When I use 2 or more simulated players in standalone mode, only one window launches.

If I simulate 2 players, why can’t I treat them as separate players? I’ve done this multiple times in previous projects and got to the point where players could chat/ vote kick in lobbies etc… and now I can’t manage to get two screens owned by two separate players… it’s just not working for me now.

Any input would be greatly appreciated!

The Index of a Player Controller means the index of a list of players that use the same connection (splitscreen clients).
If you open different windows to run the program, you are simulating different connections for each window, thus a new list for every window, and so the index 0 will be a different player controller for each window.

So when you do GetPlayerController(0), you will always get the local controller for that window, and you will be unable to directly get the Player Controller of the other players, because that is how Unreal works; everything must be first passed onto the server. You can’t communicate from client to client.
Check the “NetPlayerIndex” variable in the PlayerController Reference page here.

Standalone mode will only launch one screen only. That is just how that works, since it uses a different flow than the PIE mode. You can check that out here.

So as to give a short answer to your question. They are different players, just that they will be on different lists and so they will always be at the 0 index, unless you implement local players (splitscreen).

Let me know if you need more info about this :slight_smile:

EDIT: Grammar :frowning:

2 Likes

Thank you Xyah_ :slight_smile: