Bug Tracker – Bug 1269

SDL2 joystick input can't SR45, and other things

Last modified: 2019-07-13 20:25:58 UTC
Bug 1269 - SDL2 joystick input can't SR45, and other things
Summary: SDL2 joystick input can't SR45, and other things
Status: NEW
Alias: None
Product: Odamex
Classification: Unclassified
Component: Client (show other bugs)
Version: 0.8.x
Hardware: All Linux
: P5 normal
Assignee: Odamex Bug Reporter
Depends on:
Reported: 2019-02-17 20:14 UTC by Ant P.
Modified: 2019-07-13 20:25 UTC (History)
2 users (show)

See Also:


scale joystick values to allow full range of movement (811 bytes, patch)
2019-02-17 20:14 UTC, Ant P.
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this bug.
Description Ant P. 2019-02-17 20:14:14 UTC
Created attachment 569 [details]
scale joystick values to allow full range of movement

I've got a PS4 joypad here, and decided to mess around with it in Odamex. It's kinda hard to play well with it; I know I shouldn't expect it to be on part with M+K but it feels pretty bad even compared to console shooters.

There's about a 3× ratio between the smallest and largest possible input that'll register on the freelook/turn axis. It's both hard to aim precisely at something and to turn/pitch quickly at default sensitivity, and setting it to either extreme only makes one of the two far worse.

More importantly, having run+strafe on one joystick makes straferunning at normal speeds impossible. Both axes max out at their respective speed caps (50/40), leading to oval movement and a diagonal speed cap a lot lower than normal (try the BFG jump on brit11 map01 - it's nearly impossible).

I'm not sure whether this is the right fix, but changing the strafe axis to scale by forwardmove instead of sidemove makes things much more consistent and playable. Both axes probably should be scaled a bit extra to account for most joysticks being confined to a circle - I used 1/cos(pi/4). Strafing is a bit twitchy with this but it doesn't seem like a big loss. Thoughts?
Comment 1 Maëllig Desmottes 2019-07-11 12:37:57 UTC
Very interesting patch, I tried it on my Switch and it restored the ability to properly do a SR40.

However, that patch also makes you lose the ability to move slightly with the joystick. So, maybe we can do a sort of joystick sensitivity to counter-balance everything ?
Comment 2 Ant P. 2019-07-13 20:25:58 UTC
(In reply to Maëllig Desmottes from comment #1)
Yeah, that makes sense. I tried cloning the code that scales mouse inputs by dynresval, but it looks like this'll take a bit more work; if I scale joystick X and Y naively it reintroduces the SR40 problem. I think the right fix here is going to be something that converts the JS axes to magnitude+angle, applies the sensitivity factor to the magnitude, then converts back.