akien-mga / dynadungeons

Bomberman clone using Godot Engine - Not actively developed since 2015.
GNU General Public License v3.0
216 stars 36 forks source link

Support gamepad input #35

Open 27thLiz opened 8 years ago

27thLiz commented 8 years ago

As the title says, I think (local-) multiplayer games like this are best played with gamepads in front of a tv ^^

I tried to do this by simply adding gamepad bindings to the project settings, but it seems they are overwritten by the config system which only supports keyboard input using scancodes. So the changes would be a bit more intrusive...

akien-mga commented 8 years ago

Thanks for looking into this :) Indeed my quick and dirty input config UI assumes keyboard input, I'll have to have a deeper look at how to handle joystick input and display it properly in-game (might need adding some additional bindings as was done for keyboard input scancodes).

Need to buy a new gamepad :D

mischiefaaron commented 8 years ago

Godot had gamepad support before 2.0 even if it needed a bit of work, so I think it's crucial we reimplement the support if it's now missing. I mean aside from my own self interests in developing gamepad oriented games. I haven't tried the 2.0 beta yet, so I'm unsure how it's changed.

akien: I recommend getting a Zhidong N, which allows for switching between Direct Input & X Input driver modes, great for testing this very scenario so you can get many controllers working just from testing the one controller.

It's also great if you something that works with damn near every game old or new :)

Only issue is it's binding is not like the 360, which the XInput drivers were obviously designed after so some games that don't have binding options just assume it must be the same buttons :/

akien-mga commented 8 years ago

Well Godot still has gamepad support, and enhanced a lot by @Hinsbart actually :) I just mentioned not being sure if there is a way to retrieve the name of a joystick button/axis based on events, but I haven't looked into it yet.

27thLiz commented 8 years ago

Well, on windows and linux the gamepad situation changed quite a bit. OSX on the other hand still completely lacks joystick support. We updated the joystick code to use both DirectInput and XInput (instead of an ancient media API) on windows, and evdev instead of js* on linux. With this also came built-in gamepad remapping using SDL2 compatible mappings :)

See this database for a list of included mappings.

So seeing that this project needs godot 2.0 to run, I don't think it's a good idea to code for any case other than the default gamepad layout.

Also: An XInput compatible controller that actually sends different events from the official one is just broken. I also own two devices that are a complete failure at the hardware level. What are those vendors thinking when they release such a product...? not much, I guess :P

27thLiz commented 8 years ago

Getting the name of a button/axis is not possible currently, but might be a nice idea actually. thanks :)