bzflag icon indicating copy to clipboard operation
bzflag copied to clipboard

Improved joystick support

Open macsforme opened this issue 4 years ago • 1 comments

This PR implements improved joystick handling per my comments here on issue #72.

This video explains the changes better than I could by typing it out here, so I will leave it at that.

I tested this on my SteelSeries Nimbus, but it would help if anyone with a different model of joystick or controller could also give it a whirl and make sure the effects of the joystick input settings are as expected.

macsforme avatar Jun 21 '20 07:06 macsforme

The ramp options in the menu aren't named quite right, since they're really using a polynomial function, not exponential. I'd suggest being more concise and just calling the three options "Linear," "Quadratic," and "Cubic."

Ratfink avatar Jul 07 '20 23:07 Ratfink

This project kind of stalled after I learned that one of the most common controllers out there (the Xbox One controller) has triggers which are treated as axes rather than buttons. Our code currently has no support for the concept of an axis triggering a button event, so this makes the triggers on the Xbox One controller basically useless for their intended purpose. Implementing support for an axis to trigger a button would require consideration of actuation point, release point, etc. Expanding the underlying joystick support code is complicated by the number of platform implementations we have on top of it (EvDev, USB, Windows, SDL 1, SDL 2). Development time and available hardware for testing are also scarce resources.

Any thoughts on how to move forward would be welcome. One valid option may be to simply merge as-is, and ignore the lack of axis->button support for the time being, since we will be no worse off than we were before this patch. However, the EvDev/USB/Windows joystick code should be updated to use the new floating-point axis readings versus the old integer readings (I believe Windows is done, but may need testing), if any of that code is even connected to anything anymore.

macsforme avatar Nov 14 '22 09:11 macsforme

We should remove the non-SDL2 joystick code. That was my plan at least in master once we're done worrying about merging in 2.4 changes. The main reason the Windows joystick code is still in use is because of its Force Feedback support. I do have the start of code that added haptic feedback to our SDL2 joystick code, though.

I was considering an analog-to-digital conversion already to handle menu/UI navigation with analog sticks.

We could also look into use the GameController API that SDL2 provides which has mappings for various controllers.

blast007 avatar Nov 14 '22 12:11 blast007