So, I am currently redesigning my input system to more easily allow for input mapping. In terms of mouse and keyboard, no issues there. However, I seem to be having a bit of trouble wrapping my head around what to do for controllers.
I use SDL2 to read input events. SDL2 has 2 similar yet different APIs for controller input; the Joystick API and the GameController API. The Joystick API is very generic; it basically tells you how many buttons and axes the controller has, and leaves the rest for you to figure out. The GameController API is built on top of this system, but tries to map everything in a fashion similar to an XBox 360 controller, meaning that axes and buttons are fairly standardized, but this is only if the controller exists in SDL's database of known game controllers.
I want to support as many control options as possible, while maximizing convenience for the players (and myself). Keeping that in mind, here are the questions I have regarding the design of the system:
- Should I actually bother using the Joystick API, or should I only accept GameControllers? The GameController API being standardized is certainly a strong positive, but this fundamentally limits the player's control options. As far as I understand the GameController API, it is strictly limited to mimicking a 360 controller. Meaning that if a controller is registered but has additional buttons or axes, I'm not sure how the API would handle it, or even if I would be allowed to use those.
- If I were to use the Joystick API, how would I handle things such as menu navigation? Joysticks are not in any way standardized, so I literally cannot tell up from right or what button should be the confirm button. I could have some sort of popup window forcing players to map those controls immediately, but that strikes me as intrusive and inelegant.
- This is not specifically SDL related necessarily, but should controllers that look similar have the same mappings? For example if a player has both a 360 controller and a DualShock, and he remaps controls on his 360 controller, should those carry over to the DualShock, or should they be treated separately? If so, this would seem to be a boon for using only the GameController API, but things like arcade sticks also can be considered GameControllers, it depends on if SDL2 recognizes it. In that case, would I try to treat the arcade stick GameController different than the first two, or just roll with the same mapping for all GameControllers?
A lot of these questions come from my relative inexperience with PC gaming with a controller; I'm not entirely sure what players expect and demand from controller-related options. Any help you could provide would be greatly appreciated.