Portal 2

Portal 2

595 ratings
How to play Local Co-op with Controller + Keyboard
By Eetami
Regarding this topic information is scarce. How to play offline co-op? Pressing "X" doesn't do anything? These questions and more are answered in this guide.
   
Award
Favorite
Favorited
Unfavorite
In case you didn't know...

High five!

Yes, there is an offline splitscreen co-op mode in the PC version of Portal 2. To play it, all you need is a couple controllers, go Play Co-op game and press X (SQUARE on PS3 controller) on the second controller. Pictures:

Step one: Play cooperative game
Step two: Press X (SQUARE on a PS3 controller) on the controller.
You should know: Playing offline splitscreen disables achievements. The game considers it "cheating".
Pictures: Click on the images to enlarge them. Recommended for people with bad eye-sight.

Now in case you don't have multiple controllers and want to play with a friend using mouse/keyboard and a controller respectively, read on.

First up a couple notes!
- Enable controller from Options! Check that controller control is enabled.

- This guide does not cover how to play custom co-op maps in offline splitscreen mode. For that, check this link.

- This guide does also not cover how to play offline co-op with two keyboards and two mouses.

- If your controller is something other than Xbox 360 controller for Windows or Xbox One controller, and you can't get it to start offline splitscreen, check your button bindings! Some cases might require you to install 3rd party software to emulate Xbox 360 controller, MotioninJoy seems to work for most controllers.

- Some pictures have finnish text in them. Don't worry, I've translated the important stuff for you.

- The depicted method isn't supported in Linux or OS X version of Portal 2.
What to do if I have only one controller?
Upon entering co-op mode you'll notice the text "Offline splitscreen: Press X on controller 2". If you're like me, and have only one controller, pressing X does absolutely nothing. The problem is that your controller is assigned to player 1 by default. That means you can play single-player and online co-op game with both your mouse/keyboard and your controller, perhaps even at the sime time, but not offline splitscreen mode. The game doesn't know you have another player.

In order for the offline co-op mode to work you don't need elaborate config setups or 3rd party executables like JoyID, but you do need to tinker a bit...
Messing with Launch options
The fastest and probably the easiest way to map your controller 1 to player 2 is to type this to launch options:
-joy_remap_player_for_controller1 2
Below a picture:

A picture of the launch options in finnish. It says "for advanced users only", don't let it spook you.

To get to launch options press right mouse button while hovering over Portal 2 library entry, select Properties and press Set launch options. Another picture:

Finnish grammar: "Ominaisuudet" means Properties.
Developer console
You've now succesfully assigned your controller to player 2! But it also presents a problem: your controller is now always mapped to player 2: that means you now can't play single-player or online co-op with your controller (they're always played as player 1!) This is why you have to enable developer console. You can do this in-game like this:



The default key to open developer console is '~', the squiggly button next to '1' key in the US keyboard layout. However the scandinavian layout doesn't have this button, so you'll have to use other means to open it.

One way to do this is to type this to launch options:
-console
Again a picture:

You can actually write any commands here: every subsequent command is introduced with '-'.

Now you you have the developer console visible every time you start the game and you can type in the same command:
joy_remap_player_for_controller1 2 // The number value tells the game which player is taking over the controller. 0 means default, 1 is player 1, 2 is player 2 etc.
A picture of the developer console. This is what you're looking for. Only this time you type commands without '-'.
More on developer console
There are various other ways to bring up developer console that don't require typing any launch options. Below I will depict one of them.

Creating an autoexec.cfg
otherwise known as user configuration

The most preferable way is to create a new file called autoexec.cfg in the cfg folder in your Portal 2 install directory. Here's mine:


My autoexec.cfg highlighted in the top. Take note of the directory: it's fairly similar in every Windows system. In Linux or iOS the default install directories are found in Steam Support.

To create the file you need to create a new text file like this:


Press right mouse button while in the cfg folder, left click on New ("uusi" in finnish) and press Text file (again "tekstitiedosto" in finnish).

Text files automatically have the extension .txt. Rename the file to autoexec.cfg and remove the .txt extension. Make sure your folder settings is set to show file extensions. If you rename it to anything else, it is not automatically executed! Hence the name "autoexec".

None of your text editing programs probably know how to open it, but once you double-click it select "Open with notepad". You should see a blank text file. Copy this to your autoexec.cfg:
// This automatically enables console so you don't have to con_enable 1 // These aliases create an automatic toggle for remapping your controller alias "togglecontroller" "remap1to2" alias "remap1to2" "joy_remap_player_for_controller1 2; alias togglecontroller remap2to1; echo Xbox 360 controller 1 remapped to Player 2" alias "remap2to1" "joy_remap_player_for_controller1 1; alias togglecontroller remap1to2; echo Xbox 360 controller 1 remapped to Player 1" // These aliases create an automatic toggle for remapping your keyboard alias "togglekeyboard" "sv_cheats 1; key_remap_keyboard_for_player1" alias "key_remap_keyboard_for_player1" "in_forceuser 0; alias togglekeyboard key_remap_keyboard_for_player2; echo Keyboard remapped to Player 1" alias "key_remap_keyboard_for_player2" "in_forceuser 1; alias togglekeyboard key_remap_keyboard_for_player1; echo Keyboard remapped to Player 2" // Keybindings to togglecontroller, togglekeyboard and toggleconsole bind "F9" "togglekeyboard" bind "F10" "togglecontroller" bind "F11" "toggleconsole" // The most important part host_writeconfig

It should look something like this. "Muistio" means notepad.

You're open to edit any part you deem necessary. If you don't want to bind anything to toggleconsole you can remove it, or if you don't want to bind F-keys, just type in any key you wish to bind inside the quotation marks. (The main reason for binding toggleconsole command is because the scandinavian keyboard layout doesn't have the key that is defaulted to it.)

Now click save and you're done! Once you start Portal 2 you can try out opening console with the key you just binded as well as toggling your controller remaps.

Or alternatively you can download my autoexec.cfg from this link[www.dropbox.com] and paste it to the aforementioned directory. It is identical to the one above. Disclaimer: this is a secure link to dropbox so feel not afraid.
Two players, one ... keyboard?
Appearantly it is very possible to play through co-op mode with just one keyboard. Below a direct quote from comments:
Originally posted by quaternary:
For 2 players with 1 keyboard and mouse - pop open the console, and type sv_cheats 1, press enter, BindToggle "z" in_forceuser, press enter, and then ss_map mp_coop_start. Press Z and hand off the keyboard and mouse to the other person to switch players (tedious, but the only way really). You can also use this to play co-op by yourself (FOREVER ALONE MODE!!) Sometimes this breaks the pause menu so you can't keep it open for more than 1 frame - I don't know why.

Every map is possible - but very difficult at times when two players need to do something in tandem - to complete like this. One map is way too hard, though - I think it's one of the speed gel maps. You can use noclip to complete it if you want. Open the console again, type in noclip, fly around the level, and type noclip again to fall. It helps to type bind "u" noclip so you have easy access to it. Reminder that it only works if sv_cheats is set to 1, and that will disable achievements and stats (like in the coop lobby) until you restart the game!

Note that the autoexec.cfg that you can download from my DropBox already has this functionality and keybinding...

... but thanks quoternary!
FAQ
I'm running on Linux/OSX and this doesn't work?
The command "joy_remap_player_for_controller1" doesn't work on Linux or OSX. I don't know why that is, you'll have to ask people at Valve.

Though there is a way to move the keyboard + mouse to player 2:
in_forceuser 1 forces the keyboard and mouse to be played as player 2.
in_forceuser 0 resets the keyboard and mouse back to player 1.
This requires running sv_cheats 1 command first.

I can't use the emote/taunt wheel!
Currently the emote wheel does not work on Xbox controllers (360 and One) or keyboard. Furthermore, the camera can't be controlled with an Xbox controller (i.e. you cannot turn). Everything seems to work properly with the Steam Controller though.

Does this work with the Steam Controller?
After preliminary testing, I couldn't transfer the SC control over to player 2 with the method glossed in this guide.. I'll try investigating further.
Afterthoughts
I made this guide because there wasn't one already and the information across internet was hugely disappointing. If you found this guide useful or otherwise entertaining, thumbs up and high five.

If you have any questions regarding developer console or other related/unrelated, post them in the comments and I'll update the guide accordingly.

Special thanks to Suomis for further translations and tips!


Enjoy!
420 Comments
Fiji_Water Aug 2 @ 8:34pm 
I was able to get this to work by following the guide, I ran into the issue of having the controller control both screens. Starting in big picture mode with controller worked to fix the issue .
n0qz Aug 2 @ 6:58am 
I got the game working on PC with a KB+mouse and PS4 controller, but the controller controls both players. Any fixes to this?
Hatsune Miku Apr 10 @ 6:24am 
thanks, man

i can finally torture my aunt by making her think
t2d | no.SkiLLz @ Nobara Feb 15 @ 3:09am 
You can setup the display configuration to report both displays combined to a single big screen to windows. It act's like an ultrawide in this case.

Example: two screens with 1920x1080 (16:9), both are reported to windows. If you change the config like I said, it is reported as 3840x1080 (32:9) in the form of one screen. The game thinks it is an ultrawide and it shows one half on the frist screen, the second on the second.

Just follow my previous comment.

Disclaimer: I neither use Nvidia, nor Windows. I can't guide you along.
TheJerilla Feb 14 @ 8:01pm 
How do you make it handle like an ultrawide? I've never messed with the Nvidia display options, so I don't want to mess it up.
t2d | no.SkiLLz @ Nobara Jan 27 @ 6:32am 
You could try merging your displays (Nvidia Control Panel, Display, Set up multiple displays, Surround spanning options) and handle it like an ultrawide.. it should "split" between your monitors.
staruch ;) Jan 26 @ 3:23pm 
Hey, how about playing on one pc and two monitors?
slightlyundead Jan 19 @ 7:04pm 
A more elegant solution for swapping back and forth would be to add your startup command for controller reassign command, but change the last digit "2" to a "1" whenever you want to play single player with a controller. Then, when your friend comes over, just change that last digit back to a "2".
Thanks for this, btw.
Eetami  [author] Aug 25, 2023 @ 9:42am 
If you're playing on Linux or Mac, it doesn't exist. If you're own Windows, it might have been removed at some point. This guide is quite old already, and might not be up-to-date.
Szupryt Aug 22, 2023 @ 3:18am 
Console says command does not exist
joy_remap_player_for_controller1 2