Bug Tracker – Full Text Bug Listing

Bug 1269

Summary: SDL2 joystick input can't SR45, and other things
Product: Odamex Reporter: Ant P. <ant+odamex.bugs>
Component: ClientAssignee: Odamex Bug Reporter <odamex-bug-reporter>
Status: NEW ---    
Severity: normal CC: Ch0wW, odamex-bug-reporter
Priority: P5    
Version: 0.8.x   
Hardware: All   
OS: Linux   
Attachments: scale joystick values to allow full range of movement

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.