Bug 5837 - 360 Controller Does not Work
Status: ASSIGNED
Alias: None
Product: Dungeon Defenders
Classification: Unclassified
Component: everything
Version: unspecified
Hardware: PC Linux
: P3 normal
Assignee: Ryan C. Gordon
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2012-12-22 10:16 EST by d10sfan
Modified: 2014-01-05 16:30:58 EST
11 users (show)

See Also:


Attachments
test programs for game controllers (288.28 KB, application/octet-stream)
2013-03-08 16:28 EST, Ryan C. Gordon

Description d10sfan 2012-12-22 10:16:10 EST
Using a 360 controller ingame (using the default drivers or xboxdrv) does not work ingame. Never sees it if I hit start.
Comment 1 Tim 2012-12-27 03:31:17 EST
Confirmed here too. No known workaround that I can find.
Comment 2 m.zaki.bilgi 2012-12-27 04:04:29 EST
Confirmed here too. I think this function is not implemented to the game.
Comment 3 jarironk 2012-12-28 05:10:36 EST
I haven't gotten any controller to work with the game.  (I've tried two different Playstation 2 controllers via adapter, Thrustmaster PS/PC combo controller and few cheap USB controllers now.)  Other applications seem to work with the controllers.
Comment 4 Christopher W 2012-12-28 11:21:19 EST
I can also confirm that no controller seems to work. My PS3 Afterglow
controller and DragonRise (super cheap) do not work. For the fun of it I even
tried a wiimote.
Comment 5 Ryan C. Gordon 2012-12-31 00:49:08 EST
Yes, this is straight up busted in the current build. I'm hoping to get this fixed soon. Stay tuned.  :)

--ryan.
Comment 6 targol_lagadec 2013-01-07 02:11:00 EST
Confirmed here for 2 USB joysticks : a "Microsoft SideWinter plug and play game pad" and a "Microsoft SideWinter game pad pro".
None of them is seen by the game disallowing local multiplayer.

Note that both controllers work for other games.
Comment 7 d10sfan 2013-03-05 23:53:43 EST
Problem persists in the newest version
Comment 8 Ryan C. Gordon 2013-03-06 02:06:45 EST
(In reply to comment #7)
> Problem persists in the newest version

The new version uses the new SDL Game Controller API: you can tell it how your joystick maps to an Xbox360 controller, with an environment variable.

Here's what a standard wired X360 and PS3 controller looks like:

http://hg.libsdl.org/SDL/file/959d9bbbbea0/src/joystick/SDL_gamecontroller.c#l100

So on my system, this would make the X360 controller work:

export SDL_HINT_GAMECONTROLLERCONFIG="030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5"

The SDL we shipped with the game _should_ have PS3 and X360 controller support out of the box, but it doesn't. We'll fix that next build. In the meantime, you can set the environment variable (or make your own for your joystick).

ProTip: the controller config UI in Steam's Big Picture Mode takes what you configured, and sets this environment variable before launching games.

I'll leave this bug open until we update SDL with those built-in configurations, but you should have the tools you need to get your controller working now. Feel free to post working strings for your controller here.

--ryan.
Comment 9 d10sfan 2013-03-06 08:01:59 EST
Tried this (the config I created using steam big picture mode and one that worked with The Cave) and it's didn't recognize it.

export SDL_HINT_GAMECONTROLLERCONFIG="00000000000000000000000000000000,360w,a:b0,b:b1,y:b3,x:b2,start:b6,guide:b7,back:b10,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5"


I use xboxdrv with the --mimic-xpad flag
Comment 10 Ryan C. Gordon 2013-03-08 03:06:31 EST
Err, that should be SDL_GAMECONTROLLERCONFIG, not SDL_HINT_GAMECONTROLLERCONFIG, my mistake.

--ryan.
Comment 11 d10sfan 2013-03-08 10:40:06 EST
Just tried it with SDL_GAMECONTROLLER, still dosen't work
Comment 12 d10sfan 2013-03-08 10:41:44 EST
Meant SDL_GAMECONTROLLERCONFIG.
Comment 13 Ryan C. Gordon 2013-03-08 16:28:21 EST
Created attachment 3335 [details]
test programs for game controllers

(In reply to comment #9)
> SDL_HINT_GAMECONTROLLERCONFIG="00000000000000000000000000000000,

All zeroes can't possibly be right. Can you try the attached program?

Unpack and run ./testjoystick, and it'll show you all the joysticks it sees. Run ./testgamecontroller with and without your SDL_GAMECONTROLLERCONFIG string and see what it says.

--ryan.
Comment 14 d10sfan 2013-03-08 16:39:46 EST
This was generated by Steam's Big Picture mode, not sure why it comes out as all zeros, but works fine in big picture mode and The Cave.

Used the package and found the actual guid of the controller and changed the line to this:

export SDL_GAMECONTROLLERCONFIG="000000004d6963726f736f6674205800,360w,a:b0,b:b1,y:b3,x:b2,start:b6,guide:b7,back:b10,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5"

Start button works and A works, but can't move menu around (can't pick play single player, stuck on Quit Game)

(In reply to comment #13)
> Created attachment 3335 [details]
> test programs for game controllers
> 
> (In reply to comment #9)
> > SDL_HINT_GAMECONTROLLERCONFIG="00000000000000000000000000000000,
> 
> All zeroes can't possibly be right. Can you try the attached program?
> 
> Unpack and run ./testjoystick, and it'll show you all the joysticks it sees.
> Run ./testgamecontroller with and without your SDL_GAMECONTROLLERCONFIG
> string and see what it says.
> 
> --ryan.
Comment 15 targol_lagadec 2013-03-13 10:29:40 EDT
(In reply to comment #13)
> Created attachment 3335 [details]
> test programs for game controllers
> 
> (In reply to comment #9)
> > SDL_HINT_GAMECONTROLLERCONFIG="00000000000000000000000000000000,
> 
> All zeroes can't possibly be right. Can you try the attached program?
> 
> Unpack and run ./testjoystick, and it'll show you all the joysticks it sees.
> Run ./testgamecontroller with and without your SDL_GAMECONTROLLERCONFIG
> string and see what it says.
> 
> --ryan.

I tried to download attachment but my browser detects an invalid redirection. Am I the only one with this issue ?
Comment 16 m.zaki.bilgi 2013-03-13 11:36:20 EDT
You are doing it wrong I have downloaded the attachment and it works too. Whatever if you are using steam you can add the game with "Add non-steam game" after adding the game connect your controller and go to steam big picture mod. In this mode from settings make your contoller configurations. After that you can start dungeon defenders from steam big picture mod. Sometimes controller do not work i don't know why  but in these cases restart the game from steam. If you don't have steam you should find the testjoystick it can be also found internet. But i suggest you to use steam it is much eiseir and dungeon defenders soon will be avaible on steam too. I wonder where can I find beta test key ? Maybe --ryan helps??
Comment 17 Ryan C. Gordon 2013-03-14 13:24:14 EDT
(In reply to comment #16)
> wonder where can I find beta test key ?

It'll be public soon.

--ryan.
Comment 18 Isak Lindbeck 2013-03-14 19:36:19 EDT
(In reply to comment #14)
> Start button works and A works, but can't move menu around (can't pick play
> single player, stuck on Quit Game)

I can confirm this, I have the same behavior. For me it seems to only affect the main menu. I can join the controller as player two in a local game. Once the game has started all the buttons/axis map correctly and I can even navigate in the pause menu with the controller.
Comment 19 Ryan C. Gordon 2013-03-14 23:58:03 EDT
(In reply to comment #18)
> (In reply to comment #14)
> > Start button works and A works, but can't move menu around (can't pick play
> > single player, stuck on Quit Game)
> 
> I can confirm this, I have the same behavior. For me it seems to only affect
> the main menu. I can join the controller as player two in a local game. Once
> the game has started all the buttons/axis map correctly and I can even
> navigate in the pause menu with the controller.

Have you tried the d-pad instead of the thumb sticks on the main menu?

(It's possible we need a larger deadzone for the thumb sticks, though, and they are accidentally pushing around. Try wiggling them a little.)

--ryan.
Comment 20 m.zaki.bilgi 2013-03-15 06:13:53 EDT
Yes Ryan you are right D-pad works correctly but game does not respect mode button on the controller when in menus you can use both in the menu regardless of mode button. But after manage to start game you can navigate freely in the game menus without a problem so I don't think there is a Dead Zone problem. After starting game and exitting to main menu will work for navigating with controller in game menus flawlessly.
Comment 21 Isak Lindbeck 2013-03-15 09:01:58 EDT
(In reply to comment #19)
> Have you tried the d-pad instead of the thumb sticks on the main menu?
> 
> (It's possible we need a larger deadzone for the thumb sticks, though, and
> they are accidentally pushing around. Try wiggling them a little.)

The D-pad works correctly in game play but not in the main menu. 


(In reply to comment #20)
> After starting game and exitting to main menu will work for
> navigating with controller in game menus flawlessly.

This does not happen for me, if I exit to the main menu the controller will still not work there.
Comment 22 freestyler 2013-03-21 10:00:33 EDT
Thanks. I was able to make it work with your test tools and enviroment variable.
I had the same problem as the people above me with menu selections stucked and camera moving by itself.
Obviously a deadzone problem i thought. I tried messing around a bit with xboxdrv settings but the bahaviour was very strange.
I finally falled back to stock xpad kernel module and even tho the menu problem is here, it dissapears once you get in-game and fiddle with the sticks a bit.
Comment 23 d10sfan 2013-03-26 14:26:03 EDT
Steam version does not work with controllers, even after using the export command
Comment 24 m.zaki.bilgi 2013-03-27 17:54:40 EDT
You don't have to use export command with steam. You should make your controller configs in big picture mode from settings. After that I suggest you to re-open steam and start the game in big picture mode. Mine worked well with steam version of the game.
Comment 25 d10sfan 2013-03-27 19:10:18 EDT
Ok, using big picture mode made the controllers start responding, but the sticks and dpad are basically stuck. I try to move to another menu option and it goes back to quit.
Comment 26 d10sfan 2013-03-27 19:14:13 EDT
Was able to get past the menu using the mouse, but when I started the game, the controller characters kept spinning endlessly without any input from the controls.
Comment 27 freestyler 2013-03-27 20:10:57 EDT
You can simply rotate both analog sticks randomly for 2 seconds and then it will get back to normal.
Comment 28 jarironk 2013-03-31 09:29:23 EDT
Seems to work now, but only for one controller type at a time.

Is there a way to use two different kinds of controllers at the same time?  

Haven't managed to get this to work, even though even Steam recognises all of the controllers, or is this a Steam <-> SDL communication issue?
Comment 29 jarironk 2013-04-01 10:09:17 EDT
(In reply to comment #28)
> Seems to work now, but only for one controller type at a time.
> 
> Is there a way to use two different kinds of controllers at the same time?  
> 
> Haven't managed to get this to work, even though even Steam recognises all
> of the controllers, or is this a Steam <-> SDL communication issue?

Nevermind, I got this to work by recompiling SDL with strings for the joypads I have.

Thanks for the good work. :)
Comment 30 m.zaki.bilgi 2013-04-01 10:27:19 EDT
Can you write a "HOW TO" to here. I am thinking to buy a second controller for this game and I thought steam could handle this easly. But this was not the case as I understood.
Comment 31 d10sfan 2013-04-09 16:19:30 EDT
(In reply to comment #29)
> (In reply to comment #28)
> > Seems to work now, but only for one controller type at a time.
> > 
> > Is there a way to use two different kinds of controllers at the same time?  
> > 
> > Haven't managed to get this to work, even though even Steam recognises all
> > of the controllers, or is this a Steam <-> SDL communication issue?
> 
> Nevermind, I got this to work by recompiling SDL with strings for the
> joypads I have.
> 
> Thanks for the good work. :)

Could you show how you did this? I can trying to use two controllers with no luck so far.

Also, I was able to get into the character selection menu by using my keyboard for the first player, but I would like to be able to use just two controllers. If I try to navigate the main menu with the controller, it never moves to any of the options whether I use the sticks or dpad. Once inside the character select I can select a keyboard user and then select a controller user.
Comment 32 jarironk 2013-04-09 17:25:56 EDT
Well, here is a quick howto, I'm not going to write more detailed one -- not here at least, since this technically isn't a fix for any issue with Dungeon Defenders, but one with SDL's gamecontroller support.  If you need more instructions, I suggest you ask SDL forums, which is more appropriate place for this.

But anyways, I already am writing something, so might as well:

If you just want to see the changes I made to the library, I submitted a patch here: http://bugzilla.libsdl.org/show_bug.cgi?id=1783

First, you need to make sure you can compile 32-bit libraries.

Get SDL 2.0 source code from Mercurial repository.  (http://www.libsdl.org/hg.php)
Find SDL_gamecontroller.c (IIRC it is in src/joystick)

Find lines under #elif defined(__LINUX__) with long lines like this one:
"030000005e0400008e02000014010000,X360 controller,a:b0,b:b1,y:b3,x:b2,start:b7,guide:b8,back:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5"

Find out your controller's uuid (use the test program previously attached to this thread or something)
Copy the line and replace the new line's value before the first comma with your controller's uuid.  Then the rest of the line just tells where each button is.  b0 refers to your controllers button 0 (use Steam big picture mode or something to find out what number is assigned to your controller's buttons, or just guess at random), a0 refers to axis 0, h0.1 etc. refer to directional pad values (they're the same with most controllers, so you don't probably need to change them)

Compile SDL with the changes.

Backup your old SDL libraries, whether they are under steam runtime or in the system or wherever non-steam Dungeon Defenders keeps libraries it uses.

Replace the library with the one you just compiled and the controllers should work.
Comment 33 d10sfan 2013-04-09 17:35:26 EDT
(In reply to comment #32)

Ok thanks. I'll take a look at that. Did this fix the controller not working in the main menu for you?
Comment 34 jarironk 2013-04-10 01:03:20 EDT
> Ok thanks. I'll take a look at that. Did this fix the controller not working
> in the main menu for you?

I didn't have such a problem in the first place, beats me.
Comment 35 d10sfan 2013-04-23 02:21:04 EDT
Anything new?
Comment 36 d10sfan 2013-05-15 16:24:13 EDT
Anything new here?
Comment 37 Ryan C. Gordon 2013-05-15 23:30:19 EDT
(In reply to comment #36)
> Anything new here?

It works here with a wired 360 controller, so I don't have anything new to report.

--ryan.
Comment 38 d10sfan 2013-05-16 01:02:59 EDT
You're able to use two controllers (no keyboard & mouse)?

Have is been tried on wireless 360 controllers? That did work for me on the pc version

(In reply to comment #37)
> (In reply to comment #36)
> > Anything new here?
> 
> It works here with a wired 360 controller, so I don't have anything new to
> report.
> 
> --ryan.
Comment 39 Evgeny 2013-06-16 15:16:08 EDT
Any news here?

I use xboxdrv in mimic-xpad mode and have the same problem.
In the main menu cursor stuck on "quit" button. So I can't navigate at all =(
Comment 40 d10sfan 2013-07-22 13:01:26 EDT
Any new news? Being able to use two controllers would be great.

Right now, I can use one controller just fine, the menu is a bit messed up but if I hold the right stick in the direction I want to go, then I can pick the menu options.

The second controller doesn't work though (also a 360 controller). I hit the start button on it, and other buttons but nothing happens.
Comment 41 Lauri Tirkkonen 2014-01-05 16:30:58 EST
I'm also seeing a controller mess up the menu (HIB build). I think it might be caused by some controller events being interpreted as keyboard input: if I make a local game with player one as keyboard+mouse and the second as the controller, player two's character responds correctly to controller input, but the same input input also makes player one's character do (different) things. I have made all gamepad input devices floating with 'xinput float' (if I don't, some trigger button axis sends core pointer events and moves the mouse :)