Skip to content

Add per-axis joystick deadzone and sensitivity options - #7857

Open
dustinspace217 wants to merge 2 commits into
scp-fs2open:masterfrom
dustinspace217:input/per-axis-joystick
Open

dustinspace217 wants to merge 2 commits into
scp-fs2open:masterfrom
dustinspace217:input/per-axis-joystick

Conversation

@dustinspace217

@dustinspace217 dustinspace217 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What?

Adds Heading, Pitch, Bank and Relative Throttle deadzone and sensitivity options. Each defaults to "Use Global", which keeps using the existing Deadzone and Sensitivity settings; a value set for one of them applies to whatever stick axis is bound to that action. Addresses #4480.

Why?

Different axes on the same device often need different settings. The example in #4480 is a twist axis that needs a bigger deadzone than the main X and Y axes, which today means either living with a drifting twist or a mushy stick. MjnMixael asked that the new settings go through the options manager like the global ones, so that's how they're exposed.

How?

joy_get_scaled_reading() takes the axis action as an optional argument. When a per-action deadzone or sensitivity is set, it's used; otherwise the global value is, exactly as before. A per-action deadzone also takes precedence over -deadzone, since it's the more specific setting. Absolute throttle isn't included because it never used deadzone or sensitivity.

The settings are per action rather than per physical device and axis: a value applies to every joystick axis bound to that action (an action has a primary and a secondary binding). That covers the twist case in the issue, and it keeps the list to eight options with names players recognize, instead of thirty-two "Joystick 2, axis 5" entries. If per-device settings are still wanted, they could sit underneath these later.

  • The eight per-axis rows sit under the global Sensitivity and Deadzone rows. A per-axis deadzone applies to its axis even when -deadzone is on the command line; the global slider is the one -deadzone replaces.

Testing?

  • Linux, GCC, Release: builds with 0 warnings; unittests pass (new JoyScalingTest, 8 tests).
  • JoyScalingTest covers: a per-axis deadzone overriding the global one and beating -deadzone; a per-axis sensitivity overriding the global one and falling back when unset; a per-axis deadzone using exactly the global deadzone's scale; actions outside the range using the global settings; a stick axis bound through scale_invert() picking up its action's deadzone; and each of the eight options binding to its own action and being an integer range. Removing the call-site change, changing the deadzone scale, binding one option to another action, or dropping the integer flag each fails a named test.
  • In-game, the eight options appear in the Input section showing "Use Global", next to the unchanged global Deadzone and Sensitivity.
  • Not tested with a physical joystick (the headless test setup has none).

Anything Else?

I used Claude Code to trace the joystick scaling path and to write the feature and tests.

Adds Heading, Pitch, Bank and Relative Throttle deadzone and sensitivity
options. Each defaults to Use Global, which keeps the existing global
Deadzone and Sensitivity settings; a value set for an axis action
overrides them for whatever stick axis is bound to that action, and an
axis deadzone also takes precedence over -deadzone. Absolute throttle
is unaffected because it never used a deadzone or sensitivity.

Addresses scp-fs2open#4480
Options sort by importance from highest to lowest, so the eight per-axis rows
now sit below Sensitivity and Deadzone as one block, heading first. The
-deadzone help now says a per-axis deadzone still applies to its axis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant