• Advertisement
Sign in to follow this  

Joystick sign conventions

This topic is 1798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quick question--it's so hard to Google for answers like this one: Is the sign convention for PC joysticks or D-pads something I can generally rely on?  It seems that the horizontal axis is positive right, and the vertical axis positive down, and the horizontal axis has the lower axis number.  If that's true for all joysticks, then all I'd have to do to detect the correct axis mappings is to ask the user to move the joystick around the perimeter a few times.  If this is inconsistent then I'd have to map the horizontal and vertical axes separately.  Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Generally yes.

It is always possible that somebody is using an obscure joystick from the 1970s with bad drivers and the axis values are reversed, but that is not normal.

Some players like the option of reversing up/down and left/right. You might decide to include the options as a convenience, not because of a hardware issue.

Calibrations are typically done by the system, and they also generally include a dead zone so you don't need to. They are nice options to provide to your users if you'd like, but less necessary than they were two decades ago.

Share this post


Link to post
Share on other sites

Under Windows, most gamepad interfaces (such as what DirectX and LWJGL expose) provide a way to query the names of each axis and sometimes button, so even if you're not sure about the numbering convention, you can check the human-readable string names for X+, Y-, et cetera.

 

This is particularly helpful if someone is using an XBox 360 controller. I discovered (quite to my consternation) that up until a year or so ago, it sometimes had the left joystick X/Y axis numbered 1/0, and the right joystick X/Y numbered 2/3. More recently, I've found it's consistently numbered the same as my other dual-stick gamepads (LX,LY,RX,RY numbered 0,1,2,3 in that order).

Share this post


Link to post
Share on other sites

It is always possible that somebody is using an obscure joystick from the 1970s with bad drivers and the axis values are reversed, but that is not normal.

 

For those people I have my "Advanced Controls Setup" option; namely editing the control settings file with a text editor.  :)  Thanks for the advice.

Share this post


Link to post
Share on other sites

Yeah, if you find a joystick that doesn't go by those conventions you can safely assume the user already knows and already had problem with the majority of games out there. Allowing remapping of axes is still a good idea (just like allowing remapping of buttons), but where needed you can pretty much assume that's the case for the first two axes.

 

The second set of two axes (right stick) is a different issue. So far I think pretty much about all controllers in use these days would map axes 2 and 3 to those, but not all controllers are designed to gimmick the 360 or PS3 ones. In particular, some controllers with different layouts are bound to lack the second stick (e.g. there are some controllers around that gimmick the Saturn controllers).

 

And the D-pad is usually mapped to the hat on controllers that have sticks. Take this into account too.

Share this post


Link to post
Share on other sites

And the D-pad is usually mapped to the hat on controllers that have sticks. Take this into account too.

 

I actually just noticed this.  The game is multiplatform, and the D-Pad is considered a joystick on Linux but a D-pad on Windows.  Furthermore, the D-pad sign convention is positve up.  Nice of them to keep things simple.  Since the distinction is irrelevant to my game I'm going to make hats into honorary joysticks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement