Maybe it would be helpful, maybe not, but we created a definition
file for a bunch of joysticks that maps out what each button looks
like (color, shape, size, label), then we use that description to
draw a button map for each supported joystick.
The definition file is here:
https://code.google.com/p/bitfighter/source/browse/exe/joystick_presets.ini
If this looks interesting, stop by the #bitfighter irc channel on
freenode, and I can walk you through it and point you to some parsing
and rendering code.
I appreciate the offer, but I’m not sure it’ll be especially useful
for something I’m throwing into the test directory. Just getting
something that represents the basic XBox 360 controller is probably
sufficient, though, since the GameController API of SDL does and is
intended to expose exactly that controller.
The fact that the DualShock and clones, the Wii classic controller,
and even the venerable SNES controller have reasonably equivalent
mapping to the XBox 360’s controller is merely coincidental and
reflects that the basic SNES-derived controller has changed little,
with ironically enough Nintendo being the major exception.
Oh, sure, Sony added motion control. And Sony’s buttons are pretty
much all analog now. And Microsoft kept them digital, except for the
triggers which have a longer pull (and thus more precise range) than
Sony. Not much else has changed. They’re basically still souped up
SNES controllers with analog inputs and extra buttons. The only
real variance from the SNES style outside of Nintendo are fighting
pads/sticks that tend to be all digital and move the two shoulder
buttons to the face, and flight sticks/yokes, which vary heavily even
from one model to the next by the same manufacturer.
The games that use flight sticks are very carefully configured and
customized on a per-user basis, so they’re beyond our scope.
That common game written for the generic modern controller would
therefore expect basically a digital DPad, two analog sticks, four
face buttons, at least two (but probably four) shoulder buttons, and
at least two or three control buttons (start, etc). That sounds
remarkably like the generic Playstation clone controllers made by
just about everybody starting like 10 years ago, right?
Well sure, but if you’re making something a standard, it’d be stupid
to limit it to 10 year old least common denominator technology. And
frankly, most PC gamers use Windows. On Windows, there is a game
controller standard that closely matches those minimal specs. The
XBox 360 controller. It’s the standard because Microsoft says so,
and it’s their OS.
So, SDL uses that standard. Again, since nearly everything even
close to a standard controller basically follows the SNES archetype,
less capable controllers still map to within that framework pretty
gracefully. Maybe you have no rumble motors. Maybe you have no
guide button. Maybe instead of analog triggers you have digital
L2/R2 buttons. Maybe instead of A, B, X, Y, you have X, Circle,
Square, Triangle or 2, 3, 1, 4 or even B, A, Y, X. Doesn’t matter.
As long as you show the physical relationship between your standard
controls on screen, any controller with a compatible mapping will be
instantly understood by gamers and intuitively used regardless of
what they see on the screen.
I’m a great fan of the GameController API, if you can’t tell. My
major reasons for getting elbow-deep into the Joystick code are:
-
Neither API was well-enough documented for me to use.
-
A bug in the test told me my GameController was not recognized as
such, even though it was, so I had to start figuring out how to map
it myself (even though I didn’t need to?)
-
Making this “just work” is going to require a lot more entries to
the database OR a sane and easy GameController mapping editor. The
only one that exists is in Steam, and while Sam might be able to talk
them into sharing some graphics from their configurator, the code is
closed and wouldn’t be useful anyway.
-
It needs to “just work” if users are gonna be able to use it. And
if users aren’t gonna be able to use it, developers won’t bother.
Besides, I needed a hobby that didn’t involve keeping tabs on cancer
research and screaming at the computer screen reading news about
corrupt, petty, self-centered [CENSORED] [CENSORED] [CENSORED]? The
doctors told me I needed to watch my blood pressure.
Chris (watusimoto on irc)
It’s been a long time since I opened an IRC client? I’m firmly stage
6 by now. But it might be worthwhile to pop in and say hi to people
I haven’t seen in ages.
JosephOn Tue, Oct 08, 2013 at 10:30:04AM +0200, Watusimoto wrote: