TLDR: Even though 4 player controllers are being created for a local multiplayer game, only the first two get assigned to multiple gamepads, which means multiple gamepads share the same player controller and are able to control the same character.
Hi everyone,
We are in the process of porting our local multiplayer (1-4 players) game to Xbox consoles and have run into an issue with the gamepads that only happens on this console: the same player controllers are being assigned to multiple gamepads.
I’m posting this in the general forum and not in the Xbox sub because I believe it’s the engine that handles these associations and I’m not sure how it relates to the XDK. However, it’s important to note that the same setup / code works fine on PC and other consoles. We are not doing anything special to handle Xbox gamepads. If there are only 2 gamepads connected, everything works fine.
This is the setup in question:
On Begin Play, three local players are created in addition to the first player that is created automatically. Their Controller Ids are -1 because according to the docs “a value of -1 specifies to use the next available ID." So these players should be automatically assigned to controllers/gamepads 1 to 3 (0 being already assigned to the first player automatically). We have also tried assigning the ids (1-3) directly in the nodes.
Then we use Get All Actors of Class (Player Controller) and it finds 4 different player controllers, which is correct.
What’s weird is that these player controllers are supposed to print a message on Begin Play, but only the first two controllers that are created actually print it. But they exist according to Get All Actors Of Class…
If we use function Get All Input Devices, it returns 4, which confirms all 4 gamepads are connected. If we loop through them and use function Get Player Controller from Input Device, we find that multiple gamepads share the same player controller. For example, if we create player controllers A, B, C and D, we usually get the following combinations:
-Player Controller A is assigned to Gamepad 1. B is assigned to Gamepads 2, 3 and 4.
-Player Controller A is assigned to Gamepads 1 and 2. B is assigned to 3 and 4.
-Player Controller A is assigned to Gamepads 1 and 3. B is assigned to 2 and 4.
-Player Controllers C and D are never used.
As you can see in the screenshot, we have also tried to assign the controller IDs manually with Set Local Player Controller ID, but we get the same result.
The fact that only the first two controllers get assigned to gamepads and are the only ones that print their message on Begin Play, makes me think that something is going wrong with the other two, even though they exist when we use Get All Actors Of Class.
Other than that, I have no clue why the same player controller is being shared by several gamepads.
Has anyone experienced anything like this before, even if it wasn’t related to Xbox? How or where does the association of player controllers to gamepads happen?
Any bit of info is very welcome. Thanks!