On Wed, Apr 24, 2013 at 5:03 PM, Rick Yorgason <r...@firefang.com> wrote:

>>     The core of my argument here is that there should be a standard
>> gamepad coming through the event system, much like the standard mouse
>> does.  The standard gamepad would be: <snip>
>
> For reference, in the Windows XP days joystick input was done with
> DirectInput, which was designed to be as flexible as possible, work with any
> input device, and even went as far as to let you query human-readable names
> for devices and buttons.
>
> Now they've deprecated DirectInput for the much simpler XInput, which lays
> out the controller like so:
>
> http://msdn.microsoft.com/en-ca/library/windows/desktop/microsoft.directx_sdk.reference.xinput_gamepad%28v=vs.85%29.aspx

    They can get away with that these days because things are so much
more homogeneous these days; when DirectInput was new, PC game
controllers were all over the place in terms of functionality;
gamepads tended to be modelled on the SNES controller (with no analog
controls) and joysticks were becoming grotesquely baroque collections
of axis values, force feedback systems and buttons as the flight
simulator market gradually specialized itself to death.

    These days everyone has pretty much settled down to the same
formula, because it works reasonably and is generally familiar.  There
are things the basic gamepad doesn't cover (racing wheels, proper
flight sim controls, motion devices...), and maybe some day it would
be nice to have standards for those too, but I think right now the
time is more than ripe for gamepads.

> That's a nice set of buttons/axes to use as a standard abstraction, although
> it would be nice if they had built that on top of DirectInput's flexibility.
> Having a sane default configuration is great, but in XInput it comes at the
> cost of not allowing players to customize their controls to support more
> exotic hardware. It would be amazing if Wayland/evdev was designed around
> this middle-ground.

    In its current state with evdev, it appears what we get is a
stream of axis and button events, but the index of those events is
arbitrary (ie: the ps3 right stick doesn't use the same axes as the
xbox 360 controller, and the buttons have no overlap at all), and
there's no way to query what the actual axis or button values are
without a priori knowledge.  You need to know that if the device
string is "Microsoft X-Box 360 pad" you need to map the incoming
events according to the template for that device.

    I don't mind that for the functionality beyond the basic gamepad
abstraction, but without the basic gamepad abstraction there it makes
something that should be simple a hassle both for the developer and
the end user.  If we can get the core gamepad into evdev and pass the
nonstandard events through at higher index values, I think we get
everything we want out of it, at least on Linux.

> One thing I would expect a joystick abstraction to do that I don't expect a
> mouse abstraction to do is, if I plug two mice into a system I expect them
> both to control the same cursor, but with joysticks I always want to know
> which joystick is sending each message.

    Yes, definitely.  Which also leads to the whole device naming
question; ie: if someone unplugs a controller and plugs it back in,
how do you make sure player 2 stays player 2?  But I think as long as
the rules are simple (if one controller disappears and reappears,
assume it's the same player, if multiple controllers disappear and
reappear at the same time, well, pilot error, user gets whatever they
get), it's largely a problem that can be papered over.

> (By the way, I like Todd's north/east/south/west abstraction for the face
> buttons. It's probably also safe to abstract start/back into
> startnext/backselect. XInput notably does not allow access to the home
> button, and even on Linux it would probably be bad form for games to use the
> home button, but a low-level protocol would need to define it so it could be
> used for things like Steam's Big Picture or media centre compositors.)

    Our game engine has been running on all sorts of stuff over the
years, so we've seen controls called all sorts of things.  The best
part is the XBox controllers vs. the Nintendo controllers; Nintendo is
(clockwise from the top) xaby, while XBox is ybax.  So, the x and y
buttons are in the swapped and the a and b buttons are swapped.  As a
result, I tend to prefer something more abstract.

    Actually, IIRC for a while in the original PlayStation libraries
you had the option of referring to the face buttons as if they were a
second dpad; there was a parallel set of #defines for the button masks
that were RPAD_UP, RPAD_RIGHT and so forth.

                                           Todd.

--
 Todd Showalter, President,
 Electron Jump Games, Inc.
_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to