[SDL] joystick identification

Jared Maddox absinthdraco at gmail.com
Tue Feb 14 23:00:30 PST 2012


> Date: Tue, 14 Feb 2012 21:10:16 +0100
> From: Gerry Jo Jellestad <trick at icculus.org>
> To: sdl at lists.libsdl.org
> Subject: Re: [SDL] joystick identification
> Message-ID: <4F3ABFA8.8010209 at icculus.org>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Den 13. feb. 2012 08:32, skrev Nathan Coulson:
>> http://nathancoulson.com/proj_conndb.php has a very quickly thrown
>> together document on my ideas, and a very basic specification for this.
>> (Looks like I'll be starting this project a bit earlier then I was
>> expecting to.  Was planning on getting the game I was going to use this
>> in working first).  Still, it will be a couple weeks before I can sit
>> down and start coding this out.
>
> I'm not sure about this. Most games don't have SVG rendering
> capabilities, and it's not exactly lightweight to add either. Also,
> there's simply no way a single SVG image will be able to fit the UI
> style of, well, every game.
>

Ah, but there's the trick: the game doesn't necessarily have to
support SVG, you just need a controller mapping editor to be part of
the controller database, and a controller-translator library to be
built as part of compilation (so that you can link that with your
game). Here's how it could work:

1) The game looks for controllers, you select one, it doesn't find a
configuration for that controller in it's own database, so it:
2) invokes the mapping editor (specifying the controller, and a set of
description/identifier pairs), so that the user will be prompted to
create a new configuration.
3) If it does find a configuration, then it can either use that one,
or give the user the option of that configuration or a new one.
4) Once the configuration is chosen, the game feeds it into the
above-mentioned controller-translator which converts joystick/gamepad
actions into the actions specified in the configuration file.

The controller-translator is needed because some joysticks/gamepads
apparently report things differently on different OSes. To compensate
for that you need a 'virtual joystick/gamepad' that gets it's state
from the real joystick/gamepad, translating it to the form that it
theoretically should have. This should hopefully be simple enough that
a configuration file (to tell the translator which of it's inputs
translate to which of it's outputs) is all you would need.

The job of the controller mapping editor is in turn, to allow the user
to associate a label with a control (e.g. an axis-pair control, like
an analog stick), use those associations to create a configuration
file that the controller-translator can use to translate the actual
device's events into virtual-device events, and then give that
configuration file to the invoking program.

This would also simplify the actual control assignments, since the
game won't have to know the names of the controls, just an id of some
sort (probably just an integer) that IT specified.

There would presumably be a lot of ABI-breaking (and occasionally API
breaking) updates at first, as weird controllers requiring extensions
to the system were added, but that would probably settle down fairly
quickly, and a first release would probably just need to support the
PS & XBOX families of controllers.

It would also be pretty easy for a game to let users upload their own
configurations to the internet, it would just need a way to provide
them access to the configurations (e.g. store them all as files in a
'controllers' directory).


> Date: Tue, 14 Feb 2012 12:10:55 -0800
> From: Nathan Coulson <conathan at gmail.com>
> To: SDL Development List <sdl at lists.libsdl.org>
> Subject: Re: [SDL] joystick identification
> Message-ID:
> 	<CAFvYhDCpyqSGvuqYWThzEDK48WNh3fGFW93syk8XrV-3bOWm3A at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Tue, Feb 14, 2012 at 12:36 AM, Jared Maddox <absinthdraco at gmail.com>
> wrote:

>> Could you provide a link for libconndb? I half remember running across
>> some mention before, but it's proving impossible to google. Is there
>> any particular advantage over SQlite on the client side, or is it a
>> 'different strokes' sort of thing (note: I'm assuming that your plan
>> is to store the SVGs & such in the local database)?
>>

> at the moment, it does not exist yet,  And when it does, not even sure
> if I will actually be using a database for it.
>
> http://nathancoulson.com/proj_conndb.php (Page was created 2-3 days ago)
>

Oops, I saw the name and automatically assumed it was a library for
connecting to remote databases, sorry about that.


> Date: Tue, 14 Feb 2012 14:33:48 -0800
> From: "RodrigoCard" <cuecax at gmail.com>
> To: sdl at lists.libsdl.org
> Subject: Re: [SDL] joystick identification
> Message-ID: <1329258828.m2f.32012 at forums.libsdl.org>
> Content-Type: text/plain; charset="iso-8859-1"
>

[snip]

> This would be useful when the position matters (say, you, the gamedev, want
> that the bottom buttons jumps, and the left ones shoots) but still addering
> to conventions when the position of the button does not really matter (as I
> said, the confirm/cancel buttons).
>
> What you all think?
>

I REALLY don't think that the game devs should have absolute say on
control assignments (see my initial response above), especially since
there may be some really weird controllers out there (I'm hoping to
eventually make an acoustic pen with pressure sensitivity).



More information about the SDL mailing list