Joystick handling

Does it make sense to return joystick motion as relative motion or absolute
axis coordinates, or both?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Joystick values are usually returned as just a change in the value of
the axis (-/+ x/y). That’s how all the joystick routines I’ve used in
the past always worked. So I vote for relative motion, but seperate
functions for both would probably be best.

Phoenix Kokido
members.xoom.com/kokido
@Wes_Poole

Sam Lantinga wrote:> Does it make sense to return joystick motion as relative motion or absolute

axis coordinates, or both?

-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Well, my input is that game ports (on PCs) are so bad that it would be best
to return
"actual" joystick values, so the game creator can fudge them himself.

From the point of view of physics, I’d want a value that “modeled” them as
acceleration
parameters.

Re: your prelim on the API from last post, I see no reason for floats on a
parameter that
is actually less than 8 bits of accuracy.

So far as my experience goes, USB joysticks have not made a big
improvement, although the potential is certainly there.

At 10:01 AM 1/5/00 -0800, you wrote:>Does it make sense to return joystick motion as relative motion or absolute

axis coordinates, or both?

    -Sam Lantinga                           (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Does it make sense to return joystick motion as relative motion or absolute
axis coordinates, or both?

It’s nice to be able to choose. I believe with DInput, you set a
device data format, which determines the reporting format. For
whatever that’s worth.

m.On Wed, Jan 05, 2000 at 10:01:28AM -0800, Sam Lantinga wrote:


Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC

Joystick values are usually returned as just a change in the value of
the axis (-/+ x/y). That’s how all the joystick routines I’ve used in
the past always worked. So I vote for relative motion, but seperate
functions for both would probably be best.

I see, so the joystick motion is a direction of translation?

What happens when the joystick gets all the way in one direction?
Since there is no more change in value, do joystick values stop
being reported?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Well, my input is that game ports (on PCs) are so bad that it would be best
to return
"actual" joystick values, so the game creator can fudge them himself.

Actual joystick values vary greatly between joysticks.

From the point of view of physics, I’d want a value that “modeled” them as
acceleration
parameters.

That’s why the values are floats, so you can clamp them to a range between
-1.0 and 1.0

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

I see, so the joystick motion is a direction of translation?

What happens when the joystick gets all the way in one direction?
Since there is no more change in value, do joystick values stop
being reported?

But when you start games or setup a joystick under Win32, you have to calibrate
the joystick. Then you get the upper and lower limits for each axis. When you
get to the limit of a direction, you would ocnstantly get back that limit.

Bryan

I see, so the joystick motion is a direction of translation?

What happens when the joystick gets all the way in one direction?
Since there is no more change in value, do joystick values stop
being reported?

But when you start games or setup a joystick under Win32, you have to calibrate
the joystick. Then you get the upper and lower limits for each axis. When you
get to the limit of a direction, you would ocnstantly get back that limit.

So you get absolute values in this case, not +/- axis motion.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Hmm, must’ve worded that wrong. By relative I meant relative to the
origin of the axis (that is assigned to be 0, 0). All that should be
returned is either a positive or negative change from the sticks
neutral posistion. I favor this as oposed to a mouse cursor like x, y
posistion. What I’m curious about is will SDL have a a predetermined
joystick max (like using a signed char for each axis so analog sticks
can return a range from -128 to 128) or will each joystick have it’s
own values?

Phoenix Kokido
members.xoom.com/kokido
@Wes_Poole

Sam Lantinga wrote:> > Joystick values are usually returned as just a change in the value of

the axis (-/+ x/y). That’s how all the joystick routines I’ve used in
the past always worked. So I vote for relative motion, but seperate
functions for both would probably be best.

I see, so the joystick motion is a direction of translation?

What happens when the joystick gets all the way in one direction?
Since there is no more change in value, do joystick values stop
being reported?

-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Hmm, must’ve worded that wrong. By relative I meant relative to the
origin of the axis (that is assigned to be 0, 0). All that should be
returned is either a positive or negative change from the sticks
neutral posistion. I favor this as oposed to a mouse cursor like x, y
posistion. What I’m curious about is will SDL have a a predetermined
joystick max (like using a signed char for each axis so analog sticks
can return a range from -128 to 128) or will each joystick have it’s
own values?

Both BeOS and the new Linux drivers range from ~-30000 to ~30000.
I believe the calibration software actually sets range mapping for these.
Win32 allows you to set the range yourself.

Okay, so the general word is that the drivers will return absolute values
+/- relative to zero, for each axis.

Now, when an axis changes, do you want JUST the axis that changed?
Or do you want the new complete X/Y/Z state for the controller?

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

My 2 cents is if we have dedicated joystick functions (I was too busy
to wade through the proposed API) then I would like to be able to
query all the axis’, but if we get the joystick info through events
then just the changed axis’ would be perfect.

Phoenix Kokido
members.xoom.com/kokido
@Wes_Poole

Sam Lantinga wrote:> > Hmm, must’ve worded that wrong. By relative I meant relative to the

origin of the axis (that is assigned to be 0, 0). All that should be
returned is either a positive or negative change from the sticks
neutral posistion. I favor this as oposed to a mouse cursor like x, y
posistion. What I’m curious about is will SDL have a a predetermined
joystick max (like using a signed char for each axis so analog sticks
can return a range from -128 to 128) or will each joystick have it’s
own values?

Both BeOS and the new Linux drivers range from ~-30000 to ~30000.
I believe the calibration software actually sets range mapping for these.
Win32 allows you to set the range yourself.

Okay, so the general word is that the drivers will return absolute values
+/- relative to zero, for each axis.

Now, when an axis changes, do you want JUST the axis that changed?
Or do you want the new complete X/Y/Z state for the controller?

-Sam Lantinga (slouken at devolution.com)

Lead Programmer, Loki Entertainment Software

“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

Does it make sense to return joystick motion as relative motion or absolute
axis coordinates, or both?

I think absolute is more useful, and from that, one could derive relative
motion (“oldcoord - newcoord” or something).

Of course, this is only because I can’t think of any use of relative off
the top of my head. :wink:

-bill!

Sam Lantinga wrote:

Does it make sense to return joystick motion as relative motion or absolute
axis coordinates, or both?

I think that depends on the devices you want to support. Today, all common
Joysticks, Wheels and so on seem to use absolute coordinates - relative
coordinates wouldnt make any sense for them (of course, in some cases the
library user would need relative coordinates, it is not the job of a low-level
library to help him converting the coordinates).

For Trackballs and Paddles relative motion is neccessary. But it is probably
not worth the effort, I have never seen them as gaming devices on PC style
hardware.

bye…

Sam Lantinga wrote:

Does it make sense to return joystick motion as relative motion or absolute
axis coordinates, or both?

I think that depends on the devices you want to support. Today, all common
Joysticks, Wheels and so on seem to use absolute coordinates - relative
coordinates wouldnt make any sense for them (of course, in some cases the
library user would need relative coordinates, it is not the job of a low-level
library to help him converting the coordinates).

For Trackballs and Paddles relative motion is neccessary. But it is probably
not worth the effort, I have never seen them as gaming devices on PC style
hardware.

There’s a trackball on my Panther XL, and it’s handled poorly by the Linux
driver - trying to convert unbounded relative motion to absolute motion.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

For Trackballs and Paddles relative motion is neccessary.

Actually, traditional paddles (like, Pong and Atari 2600 style) are absolute.
You can only twist them so far to the left or right.

In good ol’ Atari BASIC, the command:

PRINT PADDLE(0)

Returns a value between 0 and 228. 0 means “all the way to the right,” and
228 means “all the way to the left.”

But it is probably
not worth the effort, I have never seen them as gaming devices on PC style
hardware.

Argh! I want Paddle support! :wink: 'course, look at the games I’m writing:

http://www.newbreedsoftware.com/madbomber/
http://www.newbreedsoftware.com/circus-linux/

:slight_smile:

-bill!

Tim Jansen wrote:

I think that depends on the devices you want to support. Today, all common
Joysticks, Wheels and so on seem to use absolute coordinates - relative
coordinates wouldnt make any sense for them (of course, in some cases the
library user would need relative coordinates, it is not the job of a
low-level library to help him converting the coordinates).

I would agree. Absolute coordinates for bounded devices is best for one
reason in my mind: it allows to calibrate it in one central place
instead of in each games.

For Trackballs and Paddles relative motion is neccessary. But it is probably
not worth the effort, I have never seen them as gaming devices on PC style
hardware.

Hmm, I’d have to try a trackball with Quake one day… :slight_smile:

Trackballs can be handled as mouses anyway, but for paddles, if they are
unbounded, I wouldn’t know… If any exist, I would lie to the game,
returning the relative motion saying it is absolute coordinate, it
should have the wanted effect anyway… ;-)–
Pierre Phaneuf
Ludus Design, http://ludusdesign.com/
“First they ignore you. Then they laugh at you.
Then they fight you. Then you win.” – Gandhi

Trackballs can be handled as mouses anyway, but for paddles, if they are
unbounded, I wouldn’t know… If any exist, I would lie to the game,
returning the relative motion saying it is absolute coordinate, it
should have the wanted effect anyway… :wink:

:slight_smile: This is more like the “Driving Controllers” for the Atari 2600 game
Indy 500. They LOOK like paddles (except they’re only one controller per
controller port / cable), but they are unbounded.

There’s a hack to incorporate an Indy 500 controller into a Jaguar game pad
controller and use it as an unbounded 360-degree rotary knob for the
game Tempest 2000 (only because the almighty YaK decided to stick in a hidden
feature in the game. :slight_smile: )

I REALLY doubt we’d see anything like this hooked to a PC. More likely an
actual bounded Paddle controller. 'course I should look into a twistable
joystick… didn’t know about those until this thread. :slight_smile:

-bill!