Local Multiplayer - How do I get input from multiple gamepads?

Hey everyone,

I started working on a local multiplayer game this weekend. With local multiplayer I mean something like Super Smash Bros, all players on one screen.

I haven’t had any luck so far with getting input from anything other than the first gamepad. I’d think that you’d just create two pawns. One with “Auto recieve input” set to player0, the other one with that property set to player1.
This unfortunately doesn’t work.
Do you have any idea how I could go about solving that problem?

Cheers!

As input is tied to the player controller, you need to create a second player controller and it will pick up the second controller automatically.

You can see an example of this with the console command “debugcreateplayer 1” (which should autocomplete when you start typing it). It will, by default be split screen when you create the second player controller and I don’t recall off hand where the mechanism for specifying to use a single panel is. But if you don’t find it I can look it up later when I have the code in front of me.

Thanks for the answer!

I’m coming from Unity and UE4 is my first UnrealEngine so I’m still getting used to the GameMode/Controller/Pawn architecture :slight_smile:
“debugcreateplayer 1” does indeed split the screen, though the second half just stays black. (I guess that’s because the controller doesn’t possess a pawn yet, right?).
Do I have to set up the Pawn/Controller relations in the scene editor before starting the game? I’ve been mostly using the PlayerStart object until now and that creates those automatically.

Hey Ira,

I think that if you move player 1 out of the initial spawn point, player 2 will spawn correctly there. There is definitely some rough edges on the splitscreen stuff there so I’m going to have QA get some testing on that and file some bugs for me to look at.

As for avoiding it displaying as a splitscreen there doesn’t appear to be any values exposed in the project settings yet so the only way I see to get your single screen would be to change the code in GameViewportClient.cpp, something else I will be sure to get bugged so that there is flexibility.

Apologies for that

I’m actually working on something very similar.

You can change how it decides what split type to use by overriding “UpdateActiveSplitscreenType()” in GameViewportClient. If you want to not split the screen when another player is added, just set ActiveSplitscreenType to eSST_NONE, like so:


void UBB_GameViewportClient::UpdateActiveSplitscreenType()
{
	if (bDoNotSplitScreen)
		ActiveSplitscreenType = eSST_NONE;
	else 
		Super::UpdateActiveSplitscreenType();
}

The issue I’ve run into now is how to get input from controllers that aren’t tied to a player controller, so I can tell when for example, a player presses the start button to join the game.

Edit: Oops, found this thread from searching, didn’t see it was in the blueprint section.

I think it’s because you don’t have a camera in the Pawn-class.
I tried it now in my project and also got it black because the player missed a camera. (I had my camera in the level script.) Once I put it in the pawn it worked.

I’ve been trying to find a way to control the character created by DebugCreateCharacter too :confused: Anyone had any luck with this?

Did we figure it out? I am pretty stuck on this, HELP!!!

I know this is an old thread, but I have run into the same problem, but only once the project is compiled. In the editor, it works perfectly fine, no problemo with moving all characters with all controllers. (I’m using official Xbone wireless controllers with the wireless PC adapter too).
I have followed this tutorial:Blueprint Implementing Local Multiplayer | Live Training | Unreal Engine - YouTube several others… it is not rocket science to set up, which is fantastic, but for whatever reason, I just cannot get more than one player moving.

Due to a bit of frustration and randomly hitting keys on the keyboard, clicking the mouse etc, I figured out that once I click the mouse, suddenly all of the controllers work…

I thought perhaps it has something to do with screen focus, but tried a few things to no avail.

Any idea why it would only work after clicking? Is there a way I can automate whatever the click is doing?