x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I create a split-screen game?

I have begun creating a game where I need one player to be controlled by the mouse and keyboard and at least one other player controlled by a gamepad. I can create the second player and enable splitscreen, however I have no control over the second player. How do I do this? My first player that I created is a blueprint "character" and I have extensive blueprint coding within this character to make him move and do other misc tasks. I need the second player to be the exact same, but be controlled by the gamepad instead of the keyboard. Here is the blueprint for my game mode where I create the new characters.

alt text

Additionally, here is the blueprint for my first player. As of now, I have my first player being controlled by both the gamepad and the keyboard for testing reasons, but now I need the 2nd player to be controlled by the gamepad instead.

alt text

Any help would be appreciated! Thanks a lot guys!

Product Version: Not Selected
Tags:
gamemode.png (171.9 kB)
player1.png (237.4 kB)
more ▼

asked Jun 10 '15 at 12:38 AM in Using UE4

avatar image

Anaklosmos
190 35 29 54

avatar image 12121212121fs435 Oct 24 '16 at 01:18 PM

can i have the link (download) for the blueprints? I'm making a split screen game but idk how

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

For anyone still unable to get a local splitscreen system working, I have created a short tutorial to get you going on your multiplayer game.

NOTE**** This is a blueprint system for creating players driven by separate character blueprints. I used this to help differentiate what each of my players could do in my game. If you are looking for a system where all players are driven by a single character blueprint, simply follow this tutorial until you reach the "Create blueprint characters for each player" screenshot. However, I do believe that this is the most effective method. Let's get started.

-First you will need to create a blueprint enumeration. This will help to control the amount of players in your game. This is optional, but I recommend it.

alt text

-Open your enumeration and create an input for 2 players, 3 players, and 4 players.

alt text

-Next we will set up the gamemode to create the players. First, open your gamemode event graph and create a variable that will control the number of players in your game. Change your variable type to your enumeration that you created previously. This should be "E - Whatever you named your enumeration". Compile and you should now be able to switch between two, three, and four players in your variable.

alt text

-Now we need to set up the gamemode blueprint to create the players. Simply use a setup like this one to create a number of players based on the variable that you just created.

alt text

-Now, create a blueprint character for each player that will be playing your game. These can be duplicates of each other or they can have very different behavior, this is up to you. In this case, I only have 2 players so I created only 2 blueprint characters.

-Last step! This step is VERY IMPORTANT. Open each player character and search for the PAWN section in the detail panel. Find auto possess player and by default it will be disabled. For your player 1 character, you must set auto possess player to player 0. This will allow the first player created in game to possess this character. Next set your player 2 character to be auto possessed by player 1, your player 3 character to be auto possessed by player 2, and your player 4 character to be possessed by player 3. This allows each character to be correctly controlled by the players in the game.

alt text

That's it! Simply drop each player character into your game! As I stated previously, you can now customize each player individually and reference each player separately in the level blueprint. This is very helpful and will better allow your game to distinguish which players are performing which action!

I really hope this helps somebody get started with local multiplayer! This system, simple as it was, took me over a year to figure out, as I am still relatively new to the software. Let me know if you guys are having any problems with the system! Also, please let me know if something I have posted here is incorrect, seeing as I have only used this setup once, but it worked flawlessly. Thanks so much!

enum1.png (964.7 kB)
enum2.png (102.2 kB)
gamemode.png (510.1 kB)
char2.png (616.9 kB)
more ▼

answered Nov 04 '16 at 12:41 AM

avatar image

Anaklosmos
190 35 29 54

avatar image regeteyt Jun 15 '17 at 02:20 AM

great thanks. But the second character does not move by pressing the key. help me

avatar image Anaklosmos Sep 04 '17 at 03:08 AM

Sorry about the wait! I was not aware that I had a response. You can not use the keyboard for multiple players with this setup unless you make each player have different input keys. This system works perfectly for multiple gamepad support. So keep plugging in gamepads to control the players that you add. I believe the keyboard will only control player 1.

avatar image Jevon Rowlands Mar 04 '19 at 12:14 PM

Hi i'm still having an issue where three screens are made although I only have two characters. I've also got a respawn system that only works to respawn player 1 but onto one of the other two screens and the other players don't respawn. Finally I have a HUD created that is only appearing on the top screen.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

the easy way to do it, is to buy a second wired xbox controller. it would be nice if Epic would add the option to split keyboard and the first controller as separate LocalPlayers with different controller IDs in the same window.

the next easiest way to do it, (although it wont give you splitscreen, it will instead give you 2 separate windows), you can go to your EditorPreferences > Play and set the number of players to 2 and check Route1stGamepadToSecondClient: alt text

the hard way to do it, is to route all of your input for both players through the same playerController, and using the gamepad to control the pawn of a separate PlayerController. you would have to set up input actions and input axis events that are just for the keyboard, and separate events just for the controller.

then you give your playerController a SecondPawn reference variable. you check if this reference is valid, and if it is, your controller input events tell this SecondPawn's movementComponent what to do, instead of telling its possessed pawn what to do. if the reference is invalid, you might want the gamepad to do the same things as the keyboard.

when you want to add an extra player, you do it from the gameMode, and make sure to get the pawn from the spawned player controller, and pass it to the first playerController to set its SecondPawn variable. if you spawn a third player, you can pass its pawn to the second playerController, and a fourth player would give its pawn to the third playerController.

then you will have a setup where each gamepad controls the pawn of a different playercontroller than its owner.

https://answers.unrealengine.com/questions/87715/control-2-pawns-with-1-controller.html

and the hardest way to do it, is to hack into the C++ and figure out where the first controller is getting its controller ID from, and changing that code. i haven't been able to figure out how that works yet. at some point, your gameViewportClient recieves an inputAction or InputAxis, and it knows whether its a gamepad or a keyboard input, so you can probably make a custom GameViewportClient that overrides inputAxis and InputAction, and increment the controllerID if its comming from a gamepad.

more ▼

answered Jun 10 '15 at 08:21 AM

avatar image

ScottSpadea
9.6k 320 205 450

avatar image Anaklosmos Jun 10 '15 at 12:38 PM

I attempted doing the level editor method and it worked. However, physics objects in the two windows would move independently, rather than on both windows. As of now, I have simply connected a second controller and it is working perfectly! Thank you so much for the help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi!

For local multiplayer, Unreal cannot do split controllers. Because first keyb/mouse/gamepad/joystick always assign to Player 0. And all other game controllers assign to next player accordingly. Other words, you need to connect 2 or more gamepads.

more ▼

answered Jun 10 '15 at 11:09 AM

avatar image

svv3dUDN
8.4k 254 42 399

avatar image Anaklosmos Jun 10 '15 at 12:39 PM

Thanks a lot bud! It worked perfectly!

avatar image vonSchmu Jun 10 '15 at 01:27 PM

As this question is raising here. I have another question:

Is it maybe possible to connect two keyboards and use 2 keyboards as controllers instead of 2 gamepads?

Did anybody try this?

avatar image svv3dUDN Jun 10 '15 at 03:08 PM

No. It is work only for game controllers.

avatar image ZungryWare Mar 19 '16 at 03:50 AM

Would it be possible to create a dummy controller to take the player 0 slot? One that doesn't actually connect to a real controller, but just takes up space?

avatar image VRTherapy Nov 04 '16 at 01:47 PM

That sounds like it would work- have you had any luck with the dummy controller?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question