Hi there!
I've noticed when using an analogue joystick to control my game, there is a considerable 'deadzone'. By deadzone, I mean the distance I have to move the joystick from its centre position, to where Allegro first gives me a non-zero reading (and recognizes I've actually moved the stick). Once out of the deadzone, Allegro gives me very accurate stick positions.
I notice this when running Allegro 5.0.10 on Windows (For many years I've been using 5.0.10 Windows binaries downloaded from
https://www.allegro.cc/files/)
On Linux however, using a more recent version of Allegro (5.2), when running the same game with the same joystick, there is no deadzone (The game behaves perfectly).
Does anyone know how I can eliminate the deadzone on windows? I've really like to avoid updating the version of Allegro I'm building with (Because I like my game to run on an old XP PC I have in an arcade machine).
Many thanks,
Ben
Sounds like it may be more of a Windows calibration thing, rather than Allegro specifically. Have you tried re-calibrating the joystick in Windows?
I know what you mean, I thought so too.
Yes, I've recalibrated it. I'm just using the standard 'USB game controllers' app that's shipped with windows to set it up / calibrate it. There is no additional driver/app shipped with the joystick, its a very simple analog joystick.
Interestingly enough, I can use the 'USB game controllers' app to test the joystick is working, and see the x and y values its reporting as I move the stick. There isn't any deadzone apparent when I do this. I can see the values change in a way I'd expect even with very tiny movements away from the stick's centre position.
I've just rebuilt my game on Windows using Allegro v5.2.9 and its still the same.
I would say could you post some code, but seeing as it works ok on Linux I'm not sure if that would help! Other than that, will have to wait for some of the other guys to see if they've got experience of this issue.
No worries, I think I might be onto something Just been looking at the source in github and found this going on in allegro5\src\win\wjoydxnu.cpp and was dubious about what the 2000 value was for:
Then after googleing DIPROP_DEADZONE I found this...
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee417929(v=vs.85)
Which explains that DIPROP_DEADZONE..
Sets the value for the dead zone of a joystick, in the range from 0 through 10,000, where 0 indicates that there is no dead zone, 5,000 indicates that the dead zone extends over 50 percent of the physical range of the axis on both sides of center, and 10,000 indicates that the entire physical range of the axis is dead. When the axis is within the dead zone, it is reported as being at the center of its range. This setting can be applied to either the entire device or to a specific axis
So I reckon changing that 2000 to 0 might get rid of my deadzone
Oh sweet! I think you may have cracked it
I had a bit of a struggle but managed to build allegro 5.2.9 from source. Changed the 2000 thing to 0 and, yes, the that got rid of the deadzone.
I guess a big deadzone is desirable for analog thumb sticks on gamepads. It's not the best though when you need high precision controls (flight yokes or steering wheels).
I'll see if I can raise an issue on github about it and see what happens
Awesome, nice one geecab! Would be cool to be able to set that from Allegro.