Why do controls only work for one player in local multiplayer?

I’ve been banging my head against this for a while now. I’ve every related Q/A or forum post I could possibly find on the topic, and none of it has provided an answer. Hopefully you guys can help.

I’m building a local multiplayer game and so I have a loop that spawns 4 different characters into their respective corners of the map. The players spawn in just fine, but while my first character receives input from the first gamepad just fine, the second character refuses to receive input from the second gamepad (and I assume the same would be true for 3,4 supposing I had more gamepads plugged in).

I also tried running an “Is Local Controller” test on the playerControllers just out of curiosity. The first controller returns false, while the latter 3 return true?? I don’t know if this is related to the problem, but it makes my head hurt.

Here is the blueprint I’m using to spawn the characters. The right half of the BP is the real meat and where the issue seems to lie (I think).

Thanks in advance to any and all help.

1 Like

Has anyone successfully gotten local multiplayer working with blueprints?

Hey -

In your Spawn Actor node you are setting Player Num to 0 each time a player is added which will override the previous player. What you’ll want to do is create a variable that starts at 0 and connect it to the Player Num of your Spawn Actor node. After the SpawnActor node, include a set node for that variable that increments the value by one. When the loop runs again it will assign the next player a different player number.

Cheers

Hi , thanks for the reply. PlayerNum is a variable I created in MyCharacter, and is currently doing nothing. This shouldn’t have an affect on anything, should it? Also, previously I had the loop index plugged into PlayerNum and things still weren’t working. Since I figured PlayerNum has no impact I removed this connection for the screenshot to reduce spaghetti clutter.

As far as i know, on a local machine, different players are seperated by the controller id. So if you want to get a specific player, you call “Get Player Controller” with the ID of the player.

Note: Only for LOCAL Multiplayer.

So including this information into our spawning process, would say you need to increment the “Controller ID” of the Create Player node by 1 everytime you spawn an additional player.

So the first player is 0, the second is 1 etc.

You are only using -1 (i don’t even know what UE4 does with -1, maybe it just makes a 0 out of it) for every player you spawn, so every player you spawn, overrides the Controller ID. If i’m correct, the last spawned player should be the one you are controlling with your gamepad.

The -1 tells it to assign the next available ID, so in theory it should just iterate through 0,1,2,3. Also, I’ve tried using Get Player Controller, but that wasn’t working either, so I went back to directly referencing the Controller through the CreatePlayer node. Is that wrong?

I haven’t used create player till now, so could you answer me a question? The Create Player node does return what? The Player Controller? Just to be sure, plug the Index of the for loop into the Controller ID.

Hey -

The setup in your screenshot did work for me, however after clicking the play in editor button I was only able to move around using the second game pad after clicking in the viewport window.

UPDATE: so I’ve discovered that player 0 is actually the only player of the 4 that is not working properly. When I start the game with the players spawned a ways above the ground plane, players 1-3 fall down to the ground plane while player 0 stays floating where he spawned.

Before I had been using 2 XBone controllers and a controller and it wasn’t working, but I went out and bought a third XBone controller, and now with the 3 xbox controllers plugged in I am getting control over 2 characters. So, I assume the first controller is assigned to the playerController that isn’t properly connected to Player 0, and so then the subsequent controllers are working fine.

So ultimately the question now is- why isn’t my Player 0 working properly while the others are?

Hey -

I have a few questions to make sure that I understand what you’re seeing. Are you able to use the keyboard to control player 0? Also, what do the other players (1-3) see when they look at player 0? Is he still in the air in their view as well? Which version of the engine are you working in and do you see the same behavior if you open a new project?

Cheers

Hi .

The keyboard does not seem to work either to control player 0. This game is a single screen (not split) local multiplayer, so everyone is seeing the same thing and there are no individual views. I tried migrating my character and game mode to blank project- this produced slightly confusing results. In the blank project player 0 at least fell to the ground, but I was still unable to control him, while I could control the other players.

In my actual project while player 0 is the only one that doesn’t fall to the floor, he at least is receiving his idle animation. Any thoughts?

Hey -

This problem has been addressed internally and should be fixed in a future update for the engine. Thanks for bringing it to our attention and best of luck in your projects.

Cheers

That’s great to hear! Thanks .

Hi . Was this expected to be fixed in 4.6? I’ve made a copy of my project in 4.6 and the problem only seems to have gotten worse. Now, the 4 characters spawn, player 0 remains in the air in his idle animation, players 1-3 fall to the ground, but none of them respond to the controller input anymore. Any thoughts?

Hey -

Using a slightly modified version of your blueprint above, I was able to create 4 players, each controlled by their own controller. The changes I made were to create a variable out of the Index coming from the ForLoop and connect it as part of the loop body before the Switch o Int. Then rather than use the SapwnActor node I added a Set Actor Transform with the Spawn Location variable set as the New Transform. I added a Get Player Character node with the Player Index set to the index variable from the ForLoop and connected this to the Target of the Set Actor Transform. I was able to set this up inside the level blueprint however you should be able to set this up inside the player controller as well.

Hey ,

I seem to be suffering from the same issues stated above. I’m in 4.6 and “create player” doesn’t seem to be making anything. After spawning I can check my outliner and see there is only one instance of my controller. Any ideas why or what is going on with this node in 4.6? I can get other controllers to show up IF I check spawn pawn on create player.

My setup is very close to , and I have tried it several different ways. I had a similar setup to this working perfectly in 4.1, not its broken. I get one of several results. No players controlled. player index 0 works, but not 2-3. Or 2-3 works but 0 will not work.

I must admit… I feel a bit stupid.

After a little persistence and trying different methods I got it working, but something is fishy. I noticed each time I was testing debugging, I was losing focus on the game window, therefore NO INPUT was being sent to it, Appearing as those my controller were not working. Also, I feel like I was getting different results based on where I hit Play from. Either in my controller or in my level BP. I also had to separate out the creation of players, spawning characters and possession into 3 different steps. Not sure if I go back and try it all in one loop if it will work this time. Here is a shot of my BP if anyone else is interested.

Top portion is in the level BP. Bottom portion goes into each of my characters that I setup.

I actually use a “player number” variable so that I can capture a reference straight to my characters controller (player1-4), since their isn’t currently a way to do that it seems like, at least not that I know of. It would be nice to have a Get Controller, or Get Owner node that works for characters or actually returned a Player Controller.

Hey esquire-

It is expected that the SpawnPawn checkbox of the Create Player node needs to be checked in order for addition controllers/pawns to be created. After some additional testing I found that the “SpawnActor” , “Possess” , and “Enable Input” nodes from ’ original setup are not necessary for creating players as each of these processes are handled by Create Player. In a fresh 3rd person template project I was able to use the setup shown in the screenshot below to create four players in each of the corners of the level. This is primarily the same setup that posted originally with a few extra nodes for setting the location of the actors.

I was wondering if a solution has been found to issue with player0 as in 4.20 I am seeing a very similair if not the same issue. I’ve placed two PlayerStart points and in just starting up regularly Player0 works fine, but in spawning in a second player the camera for Player0 teleports behind the level and Player0 no longer recieves input from the first gamepad, but the second player is controlled by the second gamepad. Spawning more players does not effect the second player and they function normally.

I am guessing your problem is not due to that bug because it has been solved. I would recommend you start a new thread for your problem and post a blueprint showing how you spawn player pawns and possess them. That should give most of the information needed to solve the problem.