Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Pages: [1] 2

Author Topic: Joystick axis enumeration order  (Read 5452 times)

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Joystick axis enumeration order
« on: October 09, 2007, 03:28:37 AM »

Hi pjcast,

I have just bought a new joystick (Logitech Extreme 3d PRO) and noticed some issue (I was using a Thrustmaster game pad before).

Actually, the issue is that the axis Y is now the first axis (0) and axis X the second one (1). With the gamepad the order was X=0 and Y=1.

The problem seems to come from the EnumObject() enumeration order, as the Y axis is the first one enumerated, which is why is get the ID 0.

I have noticed there is a "guidType" field in the LPCDIDEVICEOBJECTINSTANCE structure that give which axis is currently enumerated. This information is not used at all, but could actually help making sure the enumeration order remains consistent across different configuration.

What is your opinion about this ?

Cheers,
Gregory
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #1 on: October 09, 2007, 04:32:07 AM »

pjcast,

I have implemented the changes required.

If you are interested by these changes simply ask me.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: Joystick axis enumeration order
« Reply #2 on: October 11, 2007, 06:18:09 PM »

Patches are of course welcome :) Please submit a diff/patch against the head version and submit to sourceforge tracker.

Thanks :)
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #3 on: October 12, 2007, 05:27:50 AM »

OK i will do that.

Please not that I had to introduce an interface breaking change. Also, I have updated the linux version, so it might be updated as well (I have no linux system here).

The patch also contains a Wiimote bug fix.

Don't pay attention to the .vcproj modification (which i mainly made to have a 32-bits version).
« Last Edit: October 12, 2007, 05:30:17 AM by gjaegy »
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #4 on: October 12, 2007, 09:23:16 AM »

Interface breaking?  In what way?
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #5 on: October 14, 2007, 10:14:17 AM »

Hi OvermindDL1

The proposition I made was that you have to provide a parameter that is an enum (like AXIS_X, AXIS_Y, ...) instead of a axis ID when you request the value of an axis. I think that was all (I have no access to my work computer right now).

So, it is in fact a very small change. In my opinion is it clearer than the previous one, and actually allow to get the same result with all joysticks, which is quite important.

However, I just sent a proposition, no idea if pjcast will integrate it or not.

On my local workstation I have to work with that modified version however, so I would be quite happy if I could work with an unpatched version in the future (lots easier) ;) don't see any kind of advertisement there ;)

A side effect of that is that the linux and macos implementation should be modified as well, so...
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #6 on: October 15, 2007, 02:16:37 AM »

I would really, *really* hate that.  I prefer axis to be numbered from 0 on up, I don't care what is what, the user can rebind it in my app if something is wonky with their specific device.  I've seen controllers that just have sliders in a row (generally around 16 of them, not really for game use, but could be used as such) that identifies itself as a standard joystick device and those are just axis, what would be X, or Y, or what-not.
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #7 on: October 16, 2007, 02:55:07 AM »

I definitively disagree with you on that point.

I don't want the user to have a lot of complicated (or even simple) things to do in order to define what is the X axis. This seems logical. I have never played any game or used any application that request you to move the axis to the left to get the right X axis. Oh yes I did. But that was 10 years ago ;)

There is no argument for having the user do what could be done by the software.

An X axis is an X axis, when I request the value of an X axis I want to be sure that I am requesting the same X axis independently from any hardware difference. I don't want to get the value of the Y instead without being told of !
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #8 on: October 16, 2007, 11:07:31 AM »

But not all joysticks report the x-axis as the x-axis (yes, those ones suck, but they do exist), and on most everything else, 0 would still be x, 1 would be y, etc... etc...
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #9 on: October 16, 2007, 10:02:39 PM »

No, that is wrong, and that is why I open this topic.

My Logitech Extreme 3D pro (which is a very common joystick) reports Y axis first and then X axis on XP. I was as well quite surprised, but that is real !
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: Joystick axis enumeration order
« Reply #10 on: October 17, 2007, 10:49:37 AM »

I've had a difficult going with detecting proper axes under Linux and Win32. Both present problems where different joystick drivers report things totally different, this led to issues of having axis on different thumb sticks showing up with the wrong thump stick. Or other wierdness. So, to prevent that, I moved to the you get an axis list and a button list... combine them however you want, and configure them however you want. At least that way, the end user really gets the best experience. I don't think users really have a problem spending 2-3 minutes configuring the controls - people who have joysticks and use them often know that they act different in just about every game, and need a bit of tweaking - either at the control panel level or in game. At least, that is my experience.

But, I'll still take a look at this and see if it can be incorporated.
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #11 on: October 17, 2007, 12:26:16 PM »

So, to prevent that, I moved to the you get an axis list and a button list... combine them however you want, and configure them however you want.
That is *exactly* how I like it, best configurability then.
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #12 on: October 17, 2007, 09:34:34 PM »

The changes I made simply replaced the axis ID with an value that is part of an enum.

instead of using 0, 1, 2... you would use AXIS_X (=1), AXIS_Y(=2), ...

However, there is nothing that prevent you from getting the axis count and using axis ID instead of their "semantic" (not sure on my English there ;)

Maybe, in order to find a consensus, the solution would be to simply have two axis value retrieval methods (even if it might make the interface a littlbe bit more confusing): one which retrieves an axis value by "semantic", and one per ID (ID <= axis count) as it was until now.

And everybody would be happy ;)

The axis "semantinc" is simply a new additional information. There is nothing that could force you to use it. By ignoring it you would simply ignore the changes...

I hope this helped convincing you. I know you OvermindDL1 are not stupid at all (i guess you are the same as the raknet forum one?) but  I defintively think my proposition makes sense.

A solution that would satisfy everybody can be found, I am sure...
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Re: Joystick axis enumeration order
« Reply #13 on: October 18, 2007, 11:09:10 AM »

You know, an enum is already an int, do not need to change the interface, just add enum's as you wish for your own and it matches.

I still do not yet see a logical reason for the change though, it is all code-side, not anything any client would ever have or even be able to deal with.

And yes, I am at Rakkarsoft, among many other places.
Logged

gjaegy

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 29
    • View Profile
Re: Joystick axis enumeration order
« Reply #14 on: October 18, 2007, 11:08:18 PM »

Yes I know that.

The problem is, for Axis X you would request axis 0, for Axis Y you would request axis 1 (logical).

But which value would you use to request the slider ? 2 ? 3 ? 4 ?

Moreover, how would you react if you get the values of the Y axis when requesting axis 0 ? DirectInput provide a semantic for each axis, OIS should definitively make it accessible to the developer (doesn't matter how).

I don't see any solution, apart that the user push the joystick to the left during configuration, what I really don't want (as it can be avoided).

« Last Edit: October 18, 2007, 11:11:56 PM by gjaegy »
Logged
Pages: [1] 2