Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Is Controller Support Possible? #536

Closed
Big-the-Fat opened this issue Nov 3, 2023 · 50 comments
Closed

Request: Is Controller Support Possible? #536

Big-the-Fat opened this issue Nov 3, 2023 · 50 comments

Comments

@Big-the-Fat
Copy link

I can't play with mouse and keyboard for more than a few minutes these days. I can only properly play games with a controller. I would love to play Dhewm3 but I have to use Doom 3 BFG.

I would consider this an accessibility issue. :)

@DanielGibson
Copy link
Member

Yeah, it has been on my Todo list for a long time.. I hope to get around to it eventually ;)

@Big-the-Fat
Copy link
Author

Thank you. :)

@RinMaru
Copy link

RinMaru commented Nov 4, 2023

really would be an amazing edition allowing me to get rid of BFG one and for all.

@ViperAcidZX
Copy link

I'm curious: could rumble support be implemented too if this gets controller support one day?

@DanielGibson
Copy link
Member

I'm currently working on gamepad support in this branch: https://github.com/dhewm/dhewm3/tree/controller-input

It already mostly works, but still has some issues, esp. in multiplayer.

I don't have any plans to work on rumble support, and I'm not sure how to implement it anyway (where/how to get the information when to rumble), but if someone figures it out: patches/pull requests are welcome ;)

@RinMaru
Copy link

RinMaru commented Jan 17, 2024

I'm currently working on gamepad support in this branch: https://github.com/dhewm/dhewm3/tree/controller-input

It already mostly works, but still has some issues, esp. in multiplayer.

I don't have any plans to work on rumble support, and I'm not sure how to implement it anyway (where/how to get the information when to rumble), but if someone figures it out: patches/pull requests are welcome ;)

I hope this gets merged soon. We don't need rumble. Not having my fingers cramp on kb&m is a godsend thank you for your work x3

@DanielGibson
Copy link
Member

DanielGibson commented Jan 17, 2024

I think it's pretty much ready. I'll upload Windows-Binaries for testing later, if you build yourself anyway you can use the current state of the aforementioned branch.

@DanielGibson
Copy link
Member

Here's a build for Windows: dhewm3-1.5.3pre-gamepad.zip

@wof8317
Copy link
Contributor

wof8317 commented Jan 18, 2024

Just tested on my PS3 controller. I loved how the game displayed the proper name of the buttons like Cross, Triangle, etc. Stick navigation in the menus was smooth and easy. Unless you need to polish the controller code more, I'd say that it is ready to ship.

@DanielGibson
Copy link
Member

Great, thanks a lot for testing!

I loved how the game displayed the proper name of the buttons like Cross, Triangle

Yeah, today I found out that SDL2 (from 2.0.12 on) supports detecting the kind of gamepad, so implementing this was easy enough.

I guess I'll merge it in a few days, I hope I'll get some more feedback in the meantime :)

@DanielGibson
Copy link
Member

Note: I did some small improvements for the displayed button names, especially with Nintendo-like controllers, which aren't in the windows build linked above.

Please test the build anyway, as this is a pretty cosmetic change.

@Big-the-Fat
Copy link
Author

This is great. I've played around with it for a couple of hours and all seems to work as expected. Movement is smooth with no noticeable lag even with a Bluetooth controller. All buttons were recognised on my DS4 and 360 controllers.

All in all, pretty great at this end. :)

@DanielGibson
Copy link
Member

As you have a DS4 controller: What button is detected as "Pad Back"? The "Share" button, I guess?

@Big-the-Fat
Copy link
Author

Yeah, the "Share" button is detected (and named) "PAD_Back" when setting the button to an action in the bindings menu.

Just a thought, muscle memory causes me to hit 'fire' (in my case Right Shoulder) to confirm things in-menu but the game only recognises the "A" button. Dunno if I'm just being weird or not. Just thought perhaps whatever button is assigned to "fire" could also be used as a confirm button just like when in-game. Hope that makes sense. I have a habit of typing a lot of words and not really conveying what I mean!

Regardless, I'm super thankful that I can finally play Doom 3 with proper controller support. :)

@DanielGibson
Copy link
Member

DanielGibson commented Jan 18, 2024

Thanks!

Isn't fire usually right trigger?

Not sure if I can make it use whatever button is bound to fire, the menu is pretty independent of the key binding system. I could make right trigger behave like Pad A (or left mouse button) though.

Also note that ingame GUIs, including the PDA, do you the fire button (whichever it is) for clicking, just the main menu and similar don't.

@Big-the-Fat
Copy link
Author

No worries. Yeah, it's usually the right trigger, I just prefer the click of the shoulder buttons.

Regarding the PDA, yeah, that's the reason why my muscle memory goes for the 'fire' button.

Like I say, it was just a thought. I don't think it would be a big deal for anyone else. I'm just a bit of a weirdo! :P

@DanielGibson
Copy link
Member

nevermind, turns out using the attack button is easy enough!

@Big-the-Fat
Copy link
Author

Oh cool beans. Thanks for your kindness. :)

@DanielGibson
Copy link
Member

Updated build for Windows: dhewm3-1.5.3pre-gamepad2.zip

@brad86m
Copy link

brad86m commented Jan 19, 2024

Controller is awesome. Thank you for this.

Messed with the seta joy_ commands a bit to get a good acceleration for turning, and it's great.

@DanielGibson
Copy link
Member

DanielGibson commented Jan 20, 2024

I created gamepad configs for the base game and d3xp (Resurrection of Evil), based on the standard bindings of Doom3 BFG: gamepad_cfgs.zip
Put them in your base/ and d3xp/ folders, for the base game, open the console and enter exec gamepad.cfg, and for d3xp, do the same with exec gamepad-d3xp.cfg.
While the bindings are set immediately, you may have to restart dhewm3 for them to show up in the "Controls" menu.

The control scheme is like this (assuming an XBox-style gamepad):

  • Left Stick: Move (Forward, Backpedal, Move Left, Move Right)
    • Press Left Stick: Sprint
  • Right Stick: Look around (Turn Left, Turn Right, Look Up, Look Down)
    • Press Right Stick: Crouch
  • A: Jump
  • X: Reload
  • Right Trigger: Attack
  • Left Trigger: Flashlight
  • Left Shoulder Button: Previous Weapon
  • Right Shoulder Button: Next Weapon
  • DPad Up: Grenade
  • DPad Down: BFG
  • DPad Left: Soulcube
  • DPad Right: Fists/Grabber
  • Back: PDA
  • Start: Open/Close Menu (just like the Escape key)

Buttons "B" and "Y" are unused - in D3BFG, Y was "use", but no such action exists in Vanilla Doom3, and "B" seemed to be entirely unused in D3BFG (except in menus), for whatever reason. But you can of course bind them yourself to whatever you like ;)

@RinMaru
Copy link

RinMaru commented Jan 20, 2024

I created gamepad configs for the base game and d3xp (Resurrection of Evil), based on the standard bindings of Doom3 BFG: gamepad_cfgs.zip Put them in your base/ and d3xp/ folders, for the base game, open the console and enter exec gamepad.cfg, and for d3xp, do the same with exec gamepad-d3xp.cfg. While the bindings are set immediately, you may have to restart dhewm3 for them to show up in the "Controls" menu.

The control scheme is like this (assuming an XBox-style gamepad):

  • Left Stick: Move

    • Press Left Stick: Sprint
  • Right Stick: Look around

    • Press Right Stick: Crouch
  • A: Jump

  • X: Reload

  • Right Trigger: Attack

  • Left Trigger: Flashlight

  • Left Shoulder Button: Previous Weapon

  • Right Shoulder Button: Next Weapon

  • DPad Up: Grenade

  • DPad Down: BFG

  • DPad Left: Soulcube

  • DPad Right: Fists/Grabber

  • Back: PDA

  • Start: Open/Close Menu (just like the Escape key)

Buttons "B" and "Y" are unused - in D3BFG, Y was "use", but no such action exists in Vanilla Doom3, and "B" seemed to be entirely unused in D3BFG (except in menus), for whatever reason. But you can of course bind them yourself to whatever you like ;)

what was the Xbox layout? not the BFG but Original Xbox Port. Also loving this everything works great.

@DanielGibson
Copy link
Member

DanielGibson commented Jan 20, 2024

from the original manual (https://archive.org/details/xboxmanual_Doom_3_Collectors_Edition/page/n3/mode/2up)
doom3-og-xbox

not overly useful for modern gamepads, IMO
(AFAIK "quick weapon select" allowed you to bind your 4 favorite weapons to the DPad - you can do that in dhewm3 in the normal controls menu)

@RinMaru
Copy link

RinMaru commented Jan 20, 2024

from the original manual (https://archive.org/details/xboxmanual_Doom_3_Collectors_Edition/page/n3/mode/2up)
doom3-og-xbox

not overly useful for modern gamepads, IMO
(AFAIK "quick weapon select" allowed you to bind your 4 favorite weapons to the DPad - you can do that in dhewm3 in the normal controls menu)

I have the Hyperkin Duke so i wanted to replicate it. I think the only thing left to do is document the values for gamepads so we can tune the acceleration like in the above post.

@IlDucci
Copy link

IlDucci commented Jan 20, 2024

I'm trying to test this with a DualShock 4, but so far I can't move the camera with the right stick. How can I restart the setup so I can see if my config is breaking things or this mod?

Also, on a bit of a different subject, are you planning on adding assets to the game to include button icons or localized texts for the button names?

@DanielGibson
Copy link
Member

For the right stick to work, you need to bind Turn Left, Turn Right and Look Up and Look Down accordingly

Also, on a bit of a different subject, are you planning on adding assets to the game to include button icons or localized texts for the button names?

No

@ViperAcidZX
Copy link

I tried the controller support test build that was shared and so far it has worked pretty good with an official Xbox Series Controller and I tried hotplugging from swapping that controller out for the 8BitDo (in XInput mode) and it works pretty flawlessly with that one, I might have to do some more testing with other controllers I have access to. I do have some issues with navigation in the PDA screen. The simulated mouse controls work fine but I feel it's kinda slow in the PDA screen, even when tilting the stick all the way, and there's also the issue of having to use the simulated mouse to move a scroll bar down for long e-mail messages. I don't know if it can be implemented, but is there a way to have a joy CVAR command for scrolling up/down? Apart from the lack of rumble support, it is working out nice from what I experienced using the original Xbox controls; I might mess around and try to recreate the BFG Edition/Doom 3 (2019) controllers with this build of dhewm 3.

@DanielGibson
Copy link
Member

Sorry, but the way the PDA is implemented just sucks, so it's very hard to improve. That's why the mousewheel doesn't work in the PDA either, even though it works in regular menus..

@DanielGibson
Copy link
Member

@IlDucci
Copy link

IlDucci commented Jan 22, 2024

I think it reads alright, but you should also add the mappings in simple text format (just copypaste this part: #536 (comment) ) for people like me, who thought could just copypaste the files and run the EXE without running the command, thinking the game would get those cfg files automatically. You know, making it a bit more dumb-proof.

@DanielGibson
Copy link
Member

Merged gamepad support into the main branch and added the default mappings configuration as suggested:
https://github.com/dhewm/dhewm3/blob/master/Configuration.md#using-gamepads

As this is merged, I'll close this issue, but if you have further remarks feel free to add them here; however if you find actual bugs (or something that is so annoying that I should change it) please create a new issue for that.

@ViperAcidZX
Copy link

ViperAcidZX commented Feb 3, 2024

from the original manual d3xbox_manual_screenshot

not overly useful for modern gamepads, IMO (AFAIK "quick weapon select" allowed you to bind your 4 favorite weapons to the DPad - you can do that in dhewm3 in the normal controls menu)

I happen to have the original Xbox port of Doom 3 and playing it through backwards compatibility on Xbox 360, I found in the Options menu under the Buttons configuration, the ALTERNATIVE button layout on an Xbox 360 controller translates pretty well on newer modern controllers since the Xbox's White and Black buttons are moved to LB and RB (or similar) respectively, and in my opinion works better for original Doom 3 than the BFG Edition-styled layout since the Sprint button is consistent with the other classic Doom games and the flashlight mechanics of original Doom 3 works in its favor. For reference, I took photos of the button and stick configurations of the game that can be found in this album (sorry for the poor picture quality, I don't have a camera on me that's up with the times). I can also confirm that the Xbox port of Doom 3 (and presumably RoE as well) also lets you assign any weapon as a shortcut on the D-Pad whereas the BFG Edition does not on consoles (tested from the 2019 re-release of Doom 3 on the original Xbox One model).

I put together some pre-made gamepad config files. These include a modern-styled layout that is based on a modified version of the Alternative configuration, a slightly tweaked BFG Edition configuration, and the original Xbox version's Default and Alternative configuration for those who want to try them out a Hyperkin Xbox Duke Controller.

EDIT: See the next posts below for an updated set of configs.

@DanielGibson
Copy link
Member

which one is the "Alternative" layout on the screenshots? "Expert"? "Legacy"?

@ViperAcidZX
Copy link

ViperAcidZX commented Feb 4, 2024

The "Alternative" button layout is this one:
IMG_0007

The only difference that the "Expert" layout does is only swap the Black and Back buttons to Quick Save/Ready in multiplayer and PDA/Scoreboards, respectively which is why I didn't make a configuration for that one.

"Legacy" is one of the stick options in a separate menu that changes the Left-Stick to tank controls while the Right-Stick handles looking and strafing ("SP Legacy" swaps the sticks with said layout).

@DanielGibson
Copy link
Member

Thanks, for some reason the linked album doesn't show that image.
BTW, you don't need to use weird image hosting sites, Github comments allow attaching images directly, see
image

@DanielGibson
Copy link
Member

I just released 1.5.3 RC1 - testing is welcome! :)
https://github.com/dhewm/dhewm3/releases/tag/1.5.3_RC1

@ViperAcidZX
Copy link

I've updated and fix the configurations I put together for dhewm3, apologizes for the inconvenience when using them with Resurrection of Evil/The Lost Mission expansions with some misplaced buttons.

dhewm3_v1.5.3_gamepad_configs_v1.1..zip

@DanielGibson
Copy link
Member

Cool, thanks, I'll add a link to the documentation!

@DanielGibson
Copy link
Member

https://github.com/dhewm/dhewm3/blob/master/Configuration.md#using-gamepads now has a link to your comment with the alternative configs, thanks again! :)

@ViperAcidZX
Copy link

Thank you as well!

@ViperAcidZX
Copy link

Minor issue, but on a V1 DualShock 4, the touchpad button doesn't seem to work nor mappable to anything I tried. Haven't tested on a V2 controller yet.

@RinMaru
Copy link

RinMaru commented Feb 25, 2024

Minor issue, but on a V1 DualShock 4, the touchpad button doesn't seem to work nor mappable to anything I tried. Haven't tested on a V2 controller yet.

Not sure the touchpad is recognized on any controller.

@ViperAcidZX
Copy link

ViperAcidZX commented Feb 29, 2024

Anyone having problems where out of nowhere the bottom face button stops working as a gamepad button and suddenly acts like Left Mouse Button? I had this happen at least 3 times already with RC1 of 1.5.3, and I tried forcibly unbinding the button face button (which in my case happens to be the A button on an Xbox controller) which didn't solve the problem. I've been experiencing this problem from a 64-bit build I compiled with the most recent commits of dhewm3. I also had the Enhanced Edition mod and HD Essentials Pack installed when this happened but I also encountered this problem without any mods installed. I have the recent log files from my play session if that might help isolate the cause of the issue.

UPDATE: I think I found the cause of the issue, it seems to happen when interacting with clickable panels with the game while using a controller. It also sadly affects the Y button (or equivalent ). It even happens with mouse on clickable panels and trying to use the controller afterwards.

UPDATE 2: I can get this problem somewhat consistently in base Doom 3 early into Delta Labs 1 and always consistently in The Lost Mission campaign port in the elevator before the Trite ambush in Underground Site 1.

dhewm3log.txt
stderr.txt

Minor issue, but on a V1 DualShock 4, the touchpad button doesn't seem to work nor mappable to anything I tried. Haven't tested on a V2 controller yet.

Not sure the touchpad is recognized on any controller.

There are some games I have tried, even without SDL2 support used for some of them, that may have worked with Touchpad button but I could be misremembering.

@DanielGibson
Copy link
Member

Argh, I knew this code was gonna bite me in the ass :-/

dhewm3/neo/sys/events.cpp

Lines 1012 to 1027 in 0d4405b

/*
===============
Sys_SetInteractiveIngameGuiActive
Tell the input system that currently an interactive *ingame* UI has focus,
so there is an active cursor.
Used for an ungodly hack to make gamepad button south (A) behave like
left mouse button in that case, so "clicking" with gamepad in the PDA
(and ingame GUIs) works as expected.
Not set for proper menus like main menu etc - the gamepad hacks for that
are in idUserInterfaceLocal::HandleEvent().
Call with ui = NULL to clear the state.
I hope this won't explode in my face :-p
===============
*/
bool D3_IN_interactiveIngameGuiActive = false;
void Sys_SetInteractiveIngameGuiActive( bool active, idUserInterface* ui )

I think I can reproduce the issue, and it seems to happen when switching from one ingame panel to another so quick that the first one doesn't get "deactivated" when activating the second, so when leaving the second only that one gets deactivated and my ugly hack thinks that one ingame GUI is still active..

And the problem is, it can happen that two ingame GUIs are active at the same time (or rather, that one needs to "remember" the old one when a new one becomes active), because the PDA is implemented in such an ugly way that it looks to my detection logic like just another ingame GUI (like a panel). So when a normal panel is active and the PDA is opened, the panels UI must remain in my list, so after closing the PDA the gamepad still works with it (as it only becomes inactive when moving the cursor away from it).

Not sure yet how to fix this, but at least I can reproduce the problem.. so thanks for reporting :)

@DanielGibson
Copy link
Member

I think I fixed the bug, can you try the new build: dhewm3-1.5.3_RC2_win32.zip

Note that it only properly fixes the bug in the base game and Resurrection of Evil, for the mods I'll have to adjust their DLLs as well (I'll do that before the proper 1.5.3 release).

I hope I get around to properly release 1.5.3 RC2 soon, but for now here's a Windows build, based on the code currently in the git master branch..

@DanielGibson
Copy link
Member

Now there's also updated mod DLLs: https://github.com/dhewm/dhewm3/releases/tag/1.5.3_RC2

testing is very welcome!

@ViperAcidZX
Copy link

I tried Lost Mission with the RC2 release of v1.5.3 at the same spot I was having the problems I reported earlier and it still happens sadly. Even compiled 64-bit builds I compiled via source code reproduces the issue. I haven't tried base Doom 3 or Resurrection of Evil yet though.

@DanielGibson
Copy link
Member

I'll take a look at D3LE, thanks!

(I reproduced the issue in Delta Labs 1 and I think I fixed what caused it there, I assumed that it would be the same problem in D3LE so I didn't test that :-/)

@DanielGibson
Copy link
Member

I opened an extra issue for this: #566

@DanielGibson
Copy link
Member

DanielGibson commented Mar 20, 2024

(in #566 you can also find an updated build that fixes this issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants