panzi / qjoypad

fork of qjoypad http://qjoypad.sourceforge.net/
GNU General Public License v2.0
120 stars 25 forks source link

Axis Zone/Range Configuration #9

Open prg318 opened 8 years ago

prg318 commented 8 years ago

Some joystick configuration software suites include the ability for a user to define "zones" or "ranges" for a given axis. For example, an axis could be configured to press "X" when the axis value crosses a given threshold, and "Y" when the axis crosses another given threshold. I will try to explain this better with an example:

For the purpose of this illustration, the minimum axis value is 0, the maximum axis value is 255. Let's say the user configures four zones: Zone 1: 0-63 Zone 2: 64-128 Zone 3: 129-192 Zone 4: 192-255

Each zone could be configured to an action (a key or mouse movement). When the axis value crosses the threshold from one zone to another, the zone's action will be pressed. To illustrate this, let's give each zone an action: Zone 1: Press W Zone 2: Press E Zone 3: Press R Zone 4: Press T

If the axis is incremented from a value of 5 to a value of 100, the zone 2 action will be performed: the E key will be pressed. If an axis was decremented from a value of 200 to a value of 150 (crossing the zone 4-3 boundary), the zone 3 action would occur (the R key would be pressed).

This type of zone/range configuration can be very useful for a throttle - especially in older simulation games that do not directly support an axis controlling the throttle (such as TIE FIGHTER, X-WING, and X-Wing vs Tie Fighter). These games provide keys to set the throttle to nominal values (no power, 1/3rd power, 2/3rd power, and full throttle). Zone/range support allows a joystick throttle to be used with these types of games by assigning each zone to one of these keys. A common user case for the games I mentioned would be: if the throttle axis was moved to 0-25%, the no throttle key would be pressed once when the axis value crossed the 25% threshold. If the axis was moved to 25-50%, the 1/3rd throttle button would be pressed when the axis crossed the threshold. The 2/3rd throttle button would be activated for 50-75%, and full throttle for 75-100%.

~~I believe anti-micro supports a similar feature but I have not gotten around to testing it: https://github.com/Ryochan7/antimicro/wiki/Advanced-Slot-Explanation#distance~~ edit: after getting around to testing this in antimicro; it doesn't appear that you can setup zones in antimicro like I am describing in this post

Essentially this allows a throttle axis to be used to discrete actions when the axis is in a given state. The axis configuration GUI would need additional widgets to allow this configuration to allow for multiple zones

Thanks again for your work and maintenance on qjoypad; it works very well and I'm glad that someone is maintaining it.

prg318 commented 8 years ago

I think the simplest way to implement this into the "Set Axis" GUI would be to add a entry to the "No Throttle/Neg Throttle/Pos Throttle" entry box named "Zone Throttle" (or something similiar). When selected, two buttons on each side of the combo box would appear - one for each of the four zones. The blue arrows above this could be used to set the four throttle zones. Using four zones would minimize the amount the GUI changes needed and satisfy most needs users of applications that would want this type of zone throttling.

I might get around to submitting a patch for this, but I wanted to open an issue for this somewhere that the code for qjoypad is maintained.

panzi commented 8 years ago

I would be happy to merge any pull requests! But these features aren't anything I need so I won't implement them myself.

prg318 commented 8 years ago

Okay cool! I'll submit a PR if I get around to patching this