Joystick identification

I was looking for a way to identify what type of joystick is plugged
into the system.

I am working on building a database of controllers. This consists of
a svg image of the controller, and also where on the image a
particular button is located.

The piece of the puzzle that is missing, is having the ability to
identify what controller is plugged in. That way, a game knows what
to query.

So far, it looks like SDL_JoystickName() is the only tool available to
me via SDL, but it sounds like getting the usb Vendor/Product would be
better if that was possible.

I did some investigating to see if SDL_JoystickName() would be a viable option

[Linux LFS]
0 "Microsoft X-Box 360 pad"
Axes: 8 Buttons:11 Balls:0
1 "Logitech Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[Windows Vista]
0 "XBOX 360 For Windows (Controller)"
Axes: 5 Buttons:10 Balls:0
1 "Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[cat /proc/bus/input/devices]
I: Bus=0003 Vendor=045e Product=028e Version=0110
N: Name="Microsoft X-Box 360 pad"
I: Bus=0003 Vendor=046d Product=c214 Version=0110
N: Name=“Logitech Logitech Attack 3”

Looking at the above, looks like the layout is “Manufacturer
DeviceName” layout. (Both USB BTW). As for the SDL code, I think the
name is from evdev. This makes it sound like a stable enough source.
(no clue how a gameport joystick would show up though, if evdev even
handles that. It is either 2 2axis/2button joysticks, or one
4axis/4button)

Windows, I only have guesses. If it was defined in a .inf file, then
in theory it could change at any time. As long as it is not user
modifiable, then it could be an ok source for information.

no experiments on the mac at this time–
Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Right now the name is your best bet.

Not all the devices have a USB identifier, and I’m not sure you can get at
it on all systems even for those that do. I’m not opposed to adding an API
for that though, if you can figure out how to get at it. :)On Tue, Dec 27, 2011 at 2:48 AM, Nathan Coulson wrote:

I was looking for a way to identify what type of joystick is plugged
into the system.

I am working on building a database of controllers. This consists of
a svg image of the controller, and also where on the image a
particular button is located.

The piece of the puzzle that is missing, is having the ability to
identify what controller is plugged in. That way, a game knows what
to query.

So far, it looks like SDL_JoystickName() is the only tool available to
me via SDL, but it sounds like getting the usb Vendor/Product would be
better if that was possible.

I did some investigating to see if SDL_JoystickName() would be a viable
option

[Linux LFS]
0 "Microsoft X-Box 360 pad"
Axes: 8 Buttons:11 Balls:0
1 "Logitech Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[Windows Vista]
0 "XBOX 360 For Windows (Controller)"
Axes: 5 Buttons:10 Balls:0
1 "Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[cat /proc/bus/input/devices]
I: Bus=0003 Vendor=045e Product=028e Version=0110
N: Name="Microsoft X-Box 360 pad"
I: Bus=0003 Vendor=046d Product=c214 Version=0110
N: Name=“Logitech Logitech Attack 3”

Looking at the above, looks like the layout is “Manufacturer
DeviceName” layout. (Both USB BTW). As for the SDL code, I think the
name is from evdev. This makes it sound like a stable enough source.
(no clue how a gameport joystick would show up though, if evdev even
handles that. It is either 2 2axis/2button joysticks, or one
4axis/4button)

Windows, I only have guesses. If it was defined in a .inf file, then
in theory it could change at any time. As long as it is not user
modifiable, then it could be an ok source for information.

no experiments on the mac at this time


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks Sam, I’ll do some research and see what I can do. (Linux I
think I can do this, but the rest is unknown territory)

For USB, the vendor/product ID would be enough to uniquely identify a device

The PC Gamepad allows up to 4 axis/4buttons (or 2 joysticks each with
2 axis/2buttons).

I imagine there is probably dozens of other interfaces that I have
never dreamed about on top of the above two. And any proposed design
should not limit itself to a single interface.

If I was going to ask for a interface, I think a single string (or
fixed sized byte array) would be best. It would not have to be user
readable as we already have the name of the device.

It should be generated based upon the interface, as well as enough
information to identify what it is. The information that is chosen to
identify

Uses:

  • If a user saves a control profile, they could identify what
    controller it was made under.
  • Could be used as a index in a database of controllers.

Cavets:

  • between linux & windows, the xbox 360 gamepad looks like it could
    map buttons differently then expected. (never experimented, but
    reporting 5 axis instead of 8 is a telltale sign there will be some
    adjustments). If someone used this to identify that someone had a
    xbox 360 and gave default controls, they would need different layouts
    for windows & linux

example interface:
char* Joystick_GetDeviceIdentifier(int joy) {}

returns

"[INTERFACE][UNIQUE ID]"
so far, I only know 2 interfaces, so this is what I would return for each.
“USB[VENDOR]:[PRODUCT]”
"GPD"On Wed, Dec 28, 2011 at 6:13 PM, Sam Lantinga wrote:

Right now the name is your best bet.

Not all the devices have a USB identifier, and I’m not sure you can get at
it on all systems even for those that do. ?I’m not opposed to adding an API
for that though, if you can figure out how to get at it. :slight_smile:

On Tue, Dec 27, 2011 at 2:48 AM, Nathan Coulson <@Nathan_Coulson> wrote:

I was looking for a way to identify what type of joystick is plugged
into the system.

I am working on building a database of controllers. ?This consists of
a svg image of the controller, and also where on the image a
particular button is located.

The piece of the puzzle that is missing, is having the ability to
identify what controller is plugged in. ?That way, a game knows what
to query.

So far, it looks like SDL_JoystickName() is the only tool available to
me via SDL, but it sounds like getting the usb Vendor/Product would be
better if that was possible.

I did some investigating to see if SDL_JoystickName() would be a viable
option

[Linux LFS]
0 "Microsoft X-Box 360 pad"
Axes: 8 Buttons:11 Balls:0
1 "Logitech Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[Windows Vista]
0 "XBOX 360 For Windows (Controller)"
Axes: 5 Buttons:10 Balls:0
1 "Logitech Attack 3"
Axes: 3 Buttons:11 Balls:0

[cat /proc/bus/input/devices]
I: Bus=0003 Vendor=045e Product=028e Version=0110
N: Name="Microsoft X-Box 360 pad"
I: Bus=0003 Vendor=046d Product=c214 Version=0110
N: Name=“Logitech Logitech Attack 3”

Looking at the above, looks like the layout is “Manufacturer
DeviceName” layout. ?(Both USB BTW). ?As for the SDL code, I think the
name is from evdev. ?This makes it sound like a stable enough source.
(no clue how a gameport joystick would show up though, if evdev even
handles that. ?It is either 2 2axis/2button joysticks, or one
4axis/4button)

Windows, I only have guesses. ?If it was defined in a .inf file, then
in theory it could change at any time. ?As long as it is not user
modifiable, ?then it could be an ok source for information.

no experiments on the mac at this time


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Hey, Any news about your controller database project?
What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller layouts, and its buttons/axes positions, labels, etc, so every PC gamedeveloper could contribute and use it for creating presets for its games with apropriate graphical representations at for free. =]

It is something I am looking into.

Nathan Coulson wrote:> I was looking for a way to identify what type of joystick is plugged

into the system.

I am working on building a database of controllers. This consists of
a svg image of the controller, and also where on the image a
particular button is located.

(…)

no experiments on the mac at this time


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Still just a dream, but you have a good summary of the dream :slight_smile: Was
planning on it being opensource (didn’t see a reason to do it any other
way, have not yet considered licensing), and wanted it open for people to
contribute. (I like you’re description better then mine).

Right now, I have some ideas on how I want it to work, a theoretical api,
and my brother made a svg of an xbox 360 controller. I also have a draft
standard on how a profile for a controller should work, and some
abstraction so 1 entry can work with multiple os’s, similar devices, as
well as different button/axis configuration.

Part 1 was going to be finding a way to generate a unique UUID for a
joystick (I should be able to do this for linux myself, but other os’s will
need more research). [basically for a USB device, grab the
Vendor/ProductID, is what I was planning for the start]. Depending on the
controller, may also have the OS in the UUID (ex:/ xbox 360 controller,
axes/button count are different between linux/windows]

Part 2, was going to be the database itself. I wanted it in two forms. 1)
as a file (or files) that can be queried on the local computer indexed by
the UUID, and 2) from a website (Probably coded in php) that can return the
information if queried.

I’ll do a writeup of my vision in the next couple weeks, and add that to my
site. There are a few parts I need to define in my specification, (ex:/
size to return for controller images [I want to use svg, but aspect ratio is still a factor]).On Sat, Feb 11, 2012 at 10:39 AM, RodrigoCard wrote:

**
Hey, Any news about your controller database project?
What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller
layouts, and its buttons/axes positions, labels, etc, so every PC
gamedeveloper could contribute and use it for creating presets for its
games with apropriate graphical representations at for free. =]

It is something I am looking into.

Nathan Coulson wrote:

I was looking for a way to identify what type of joystick is plugged
into the system.

I am working on building a database of controllers. This consists of
a svg image of the controller, and also where on the image a
particular button is located.

(…)

no experiments on the mac at this time


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-[image: Cool]
Webpage: http://www.nathancoulson.com


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Hello !

Hey, Any news about your controller database project?
What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller layouts, and its buttons/axes positions, labels, etc, so every PC gamedeveloper could contribute and use it for creating presets for its games with apropriate graphical representations at for free. =]

It is something I am looking into.

I would say, create something like that initial with the XBOX 360 Pad,
the PSX Pad Family and you are basically done for 99% within the game market.

Before SVG, even a high quality, creative commons, BMP would help.

Developers only have limited time to think about good default button layouts
on a small number of gamepads, so even if i had a db with thousands of gamepad layouts,
it would be only used for the config window, nobody has the time to create good default layouts
for every gamepad, because buttonlayout depends on the game.

CU

Well, some useful info that can be put in this database are the physical buttons positions.
With a database like that, would be possible to make a API to retreive the button by its position or meaning.
Like “MainActionButton”, “TopShoulderButton”, “DPadDown” (some controllers map them as buttons/povhat/axis, it is a mess).

For example, considering a generic joystick with 4 face buttons, starting at the bottom one, clockwise, they are 0, 1, 2, 3, and are labeled the same way. for a xbox controller, let’s say they are 1, 0, 3, 2, labeled as A, X, Y, B. for a PS3 controller, let’s say they are 3, 1, 0, 2 and labeled with that shapes you know.

In this example querying for BottomActionButton for the gereneric gamepad would return 0 with 0 as label, for xbox, 1 with ‘A’ as label, for ps3, button 3, with ‘X’ as label. =]

So, Developers could map its actions by button’s positions and/or meaning, no matter how much joystick combination possibilites you can have.—

@Nathan Coulson
What you think about it? Were you thinking in something like that?
If you want to talk about it, drop me a mail: “rodrigo[DOT]alfenas[AT]gmail[DOT]com” :wink:

See you,
Rodrigo

Torsten Giebl wrote:

Hello !

Hey, Any news about your controller database project?
What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller layouts, and its buttons/axes positions, labels, etc, so every PC gamedeveloper could contribute and use it for creating presets for its games with apropriate graphical representations at for free. =]

It is something I am looking into.

I would say, create something like that initial with the XBOX 360 Pad,
the PSX Pad Family and you are basically done for 99% within the game market.

Before SVG, even a high quality, creative commons, BMP would help.

Developers only have limited time to think about good default button layouts
on a small number of gamepads, so even if i had a db with thousands of gamepad layouts,
it would be only used for the config window, nobody has the time to create good default layouts
for every gamepad, because buttonlayout depends on the game.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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.

RodrigoCard: That could be interesting. I was actually planning on using
the device key as a index for controller configurations, and allow users to
upload/download created profiles.

Torsten Giebl: I agree. (still, thought having a image of the controller,
and lines pointing to the buttons/axis on the config page was a neat idea)

For my own game project (not the controller database), I was going to allow
users to program and upload their controller profiles. I thought that
since It would be next to impossible to figure out good layouts for every
controller, I could give the users the abilities to provide controller
layout feedback in a easy manner.On Sun, Feb 12, 2012 at 8:14 AM, RodrigoCard wrote:

**
Well, some useful info that can be put in this database are the physical
buttons positions.
With a database like that, would be possible to make a API to retreive the
button by its position or meaning.
Like “MainActionButton”, “TopShoulderButton”, “DPadDown” (some controllers
map them as buttons/povhat/axis, it is a mess).

For example, considering a generic joystick with 4 face buttons, starting
at the bottom one, clockwise, they are 0, 1, 2, 3, and are labeled the same
way. for a xbox controller, let’s say they are 1, 0, 3, 2, labeled as A, X,
Y, B. for a PS3 controller, let’s say they are 3, 1, 0, 2 and labeled with
that shapes you know.

In this example querying for BottomActionButton for the gereneric gamepad
would return 0 with 0 as label, for xbox, 1 with ‘A’ as label, for ps3,
button 3, with ‘X’ as label. =]

So, Developers could map its actions by button’s positions and/or meaning,
no matter how much joystick combination possibilites you can have.


@Nathan Coulson
What you think about it? Were you thinking in something like that?
If you want to talk about it, drop me a mail:
“rodrigo[DOT]alfenas[AT]gmail[DOT]com” [image: Wink]

See you,
Rodrigo

Torsten Giebl wrote:

Hello !

Quote:

Hey, Any news about your controller database project?
What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller
layouts, and its buttons/axes positions, labels, etc, so every PC
gamedeveloper could contribute and use it for creating presets for its
games with apropriate graphical representations at for free. =]

It is something I am looking into.

I would say, create something like that initial with the XBOX 360 Pad,
the PSX Pad Family and you are basically done for 99% within the game
market.

Before SVG, even a high quality, creative commons, BMP would help.

Developers only have limited time to think about good default button
layouts
on a small number of gamepads, so even if i had a db with thousands of
gamepad layouts,
it would be only used for the config window, nobody has the time to create
good default layouts
for every gamepad, because buttonlayout depends on the game.

CU


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Voxatron dev is asking people to contribute with joystick profiles more or less the same way you want to do for your own game project.
http://www.lexaloffle.com/bbs/?tid=1025

About my idea, I think this way will be far more easier for devs to create default layouts that works with any controller.
knowing where is the right shoulder button is and, in a FPS game for example, by default map that for shoot, and yet showing its label name with any controller would be great.

Btw, don’t rush for doing this, a project like this one needs some time to plan. Take your time =]
As soon as I have time I will organize my ideas and contribute. :wink:

Nathan Coulson wrote:> http://nathancoulson.com/proj_conndb.php (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.

RodrigoCard: That could be interesting.?? I was actually planning on using the device key as a index for controller configurations, and allow users to upload/download created profiles.

Torsten Giebl: I agree.?? (still, thought having a image of the controller, and lines pointing to the buttons/axis on the config page was a neat idea)

For my own game project (not the controller database), I was going to allow users to program and upload their controller profiles.?? I thought that since It would be next to impossible to figure out good layouts for every controller, I could give the users the abilities to provide controller layout feedback in a easy manner.

On Sun, Feb 12, 2012 at 8:14 AM, RodrigoCard <@Rodrigo_C_Rocha (@Rodrigo_C_Rocha)> wrote:

   	Well, some useful info that can be put in this database are the physical buttons positions.

With a database like that, would be possible to make a API to retreive the button by its position or meaning.
Like “MainActionButton”, “TopShoulderButton”, “DPadDown” (some controllers map them as buttons/povhat/axis, it is a mess).

For example, considering a generic joystick with 4 face buttons, starting at the bottom one, clockwise, they are 0, 1, 2, 3, and are labeled the same way. for a xbox controller, let’s say they are 1, 0, 3, 2, labeled as A, X, Y, B. for a PS3 controller, let’s say they are 3, 1, 0, 2 and labeled with that shapes you know.

In this example querying for BottomActionButton for the gereneric gamepad would return 0 with 0 as label, for xbox, 1 with ‘A’ as label, for ps3, button 3, with ‘X’ as label. =]

So, Developers could map its actions by button’s positions and/or meaning, no matter how much joystick combination possibilites you can have.


@Nathan Coulson
What you think about it? Were you thinking in something like that?
If you want to talk about it, drop me a mail: “rodrigo[DOT]alfenas[AT]gmail[DOT]com”

See you,
Rodrigo

Torsten Giebl wrote:

Hello !





Quote:

Hey, Any news about your controller database project?

What are you going to do with this?
Is it going to be open source?

I always wanted to create a crowdsourced and open database with controller layouts, and its buttons/axes positions, labels, etc, so every PC gamedeveloper could contribute and use it for creating presets for its games with apropriate graphical representations at for free. =]

It is something I am looking into.

I would say, create something like that initial with the XBOX 360 Pad,
the PSX Pad Family and you are basically done for 99% within the game market.

Before SVG, even a high quality, creative commons, BMP would help.

Developers only have limited time to think about good default button layouts
on a small number of gamepads, so even if i had a db with thousands of gamepad layouts,
it would be only used for the config window, nobody has the time to create good default layouts
for every gamepad, because buttonlayout depends on the game.

CU


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)


SDL mailing list
SDL at lists.libsdl.org (SDL at lists.libsdl.org)
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org (http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com (http://www.nathancoulson.com)

This topic had my interest for some time now too, and I was pondering a
possibility of making a similar library myself. Great discussion so far!

My 2 cents:

  • Some conventions are different across countries. For example,
    consider a standard Xbox/PS3 controller with
    Y
    X B
    A
    face buttons. As far as I know, “B” would be the default “action"
    button and “Y” would be a default “cancel” button in Japan, unlike,
    say, Europe, where “A” is the default “action” and “B” is the default
    "cancel” button.

I’m mentioning this, because we should be very careful with labels
such as “BottomActionButton”.

  • Please do not discard non-Xbox/PS3 shaped controllers. There are
    plenty of them, and they all have their good uses. For example, one
    of the gamepads I use is shaped like a Sega Genesis controller, i.e.
    it has 6 “face” buttons in this configuration:

    3 4 5
    0 1 2

  • What are we supposed to do with actual joysticks and gasp wheels?
    I guess “guitar” and similar novelty controllers fall into same
    category.

  • The state of gamepad/joysticks support in current games is absolutely
    atrocious, more so in closed-source games. I believe such a library
    would be a great thing, and suggest BSD or zlib license.On Tue, 14 Feb 2012 21:10:16 +0100 Gerry Jo Jellestad wrote:

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. Having an SVG image of controllers would
be nice for reference, but I don’t think this is something that games
should be expected to use. Also, the exact position of every button
doesn’t really matter that much, it’s more important with relative
positions than absolutes.

I’ve actually been thinking about this problem for a while though,
and there’s one system I think might work: Most gamepads seem to have
somewhat similar layouts. Kind of a W-shape (view with fixed width
font):

F G
| |
A C E
\ / \ /
B D

If each of the letters in that graph could be configured as either an
analog stick, a dpad, a button group, or absent, you’d already be
able to cover the vast majority of gamepads out there (A-E on front,
F-G on shoulder). Button groups would be shapes, like e.g. a strip of
2 or 3 buttons, two lines of 3 buttons, a diamond shape of 4 buttons,
etc. Each shape would have to also define button order, and
preferably also short names/symbols and colors for each button for
display in in-game config.

With this system, an Xbox360 controller would have analog sticks at A
and D, d-pad at B, a horizontal strip of three buttons at C, a
diamond shape of buttons at E, and one digital and one analog trigger
at each of F and G (maybe add H and I groups to separate these?). A
Playstation style controller would be similar, but with A and B
swapped, different button names, and probably different button
ordering. A classic NES controller would have a d-pad at A, two
buttons at C (select/start), two buttons at E (A/B), and everything
else absent. etc.

There could also be a simple library that games can ask for specific,
standard layouts. A game could for example ask for a dpad and two
buttons, or something as close to a SNES style pad as possible,
whatever the game needs. If all the game wants is two analog sticks
and a button, it could ask for that, too, not caring whether the left
analog stick is at position A or B or where the button is. Input
could be fed to the library for remapping to the requested layout,
and the game could simply work with standard button names, like
BUTTON_NES_A or something, with the layout and position then being
implicit.

Not really sure about all the details here, but it’s an idea.
Thoughts?

-g


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Message-ID:
<CAFvYhDBNaUU_1O7uKVFh9-8oP+B5t2bUaNYpg7N4RiffVMMQJA at mail.gmail.com>
Content-Type: text/plain; charset=“utf-8”

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.

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)?> Date: Sun, 12 Feb 2012 23:32:29 -0800

From: Nathan Coulson
To: sdl at lists.libsdl.org
Subject: Re: [SDL] joystick identification

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. Having an SVG image of controllers would be
nice for reference, but I don’t think this is something that games
should be expected to use. Also, the exact position of every button
doesn’t really matter that much, it’s more important with relative
positions than absolutes.

I’ve actually been thinking about this problem for a while though, and
there’s one system I think might work: Most gamepads seem to have
somewhat similar layouts. Kind of a W-shape (view with fixed width font):

F       G
|       |
A   C   E
 \ / \ /
  B   D

If each of the letters in that graph could be configured as either an
analog stick, a dpad, a button group, or absent, you’d already be able
to cover the vast majority of gamepads out there (A-E on front, F-G on
shoulder). Button groups would be shapes, like e.g. a strip of 2 or 3
buttons, two lines of 3 buttons, a diamond shape of 4 buttons, etc. Each
shape would have to also define button order, and preferably also short
names/symbols and colors for each button for display in in-game config.

With this system, an Xbox360 controller would have analog sticks at A
and D, d-pad at B, a horizontal strip of three buttons at C, a diamond
shape of buttons at E, and one digital and one analog trigger at each of
F and G (maybe add H and I groups to separate these?). A Playstation
style controller would be similar, but with A and B swapped, different
button names, and probably different button ordering. A classic NES
controller would have a d-pad at A, two buttons at C (select/start), two
buttons at E (A/B), and everything else absent. etc.

There could also be a simple library that games can ask for specific,
standard layouts. A game could for example ask for a dpad and two
buttons, or something as close to a SNES style pad as possible, whatever
the game needs. If all the game wants is two analog sticks and a button,
it could ask for that, too, not caring whether the left analog stick is
at position A or B or where the button is. Input could be fed to the
library for remapping to the requested layout, and the game could simply
work with standard button names, like BUTTON_NES_A or something, with
the layout and position then being implicit.

Not really sure about all the details here, but it’s an idea. Thoughts?

-g

Message-ID:
? ? ? <CAFvYhDBNaUU_1O7uKVFh9-8oP+B5t2bUaNYpg7N4RiffVMMQJA at mail.gmail.com>
Content-Type: text/plain; charset=“utf-8”

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.

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)?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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)On Tue, Feb 14, 2012 at 12:36 AM, Jared Maddox wrote:

Date: Sun, 12 Feb 2012 23:32:29 -0800
From: Nathan Coulson <@Nathan_Coulson>
To: sdl at lists.libsdl.org
Subject: Re: [SDL] joystick identification


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Yes, there is so much to take in consideration in this mess…
And I really, REALLY hate that different conventions for different countries.
CIRCLE means OK, and X… CANCEL… Why the hell sony swapped the convention outside of their isle? =|
And the Xbox is the opposite, “A” is Green, so it is a OK, and “B” is RED, so… You got it.
The only of the big three doing it right is nintendo.

Anyway, leaving all this into consideration, could be possible to assign multiple names for the same button (but I really wish to not support and spread that “different conventions for the same controller” crap =/… but surely it would be useful for different controllers anyway).

And, If the different conventions for the same controller is really important we could just create another profile for the same gamepad, but I think it will be horrible…

My idea:

Conventions apart,
For example, in the XBOX gamepad, we could assign the A B X Y buttons as BottomFaceButton, RightFaceButton, LeftFaceButton and TopFaceButton, respectively, and also A B buttons as ConfirmButton and CancelButton, respectively.
In the PS3 gamepad we could assign X O [] ^ the same way above and X O as CancelButton and ConfirmButton.

Then the game asking for the ConfirmButton and BottomFaceButton in this example will get different values.

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?

Driedfruit wrote:> This topic had my interest for some time now too, and I was pondering a

possibility of making a similar library myself. Great discussion so far!

My 2 cents:

  • Some conventions are different across countries. For example,
    consider a standard Xbox/PS3 controller with
    Y
    X B
    A
    face buttons. As far as I know, “B” would be the default “action"
    button and “Y” would be a default “cancel” button in Japan, unlike,
    say, Europe, where “A” is the default “action” and “B” is the default
    "cancel” button.

I’m mentioning this, because we should be very careful with labels
such as “BottomActionButton”.

  • Please do not discard non-Xbox/PS3 shaped controllers. There are
    plenty of them, and they all have their good uses. For example, one
    of the gamepads I use is shaped like a Sega Genesis controller, i.e.
    it has 6 “face” buttons in this configuration:

3 4 5
0 1 2

  • What are we supposed to do with actual joysticks and gasp wheels?
    I guess “guitar” and similar novelty controllers fall into same
    category.

  • The state of gamepad/joysticks support in current games is absolutely
    atrocious, more so in closed-source games. I believe such a library
    would be a great thing, and suggest BSD or zlib license.

On Tue, 14 Feb 2012 21:10:16 +0100 Gerry Jo Jellestad wrote:

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. Having an SVG image of controllers would
be nice for reference, but I don’t think this is something that games
should be expected to use. Also, the exact position of every button
doesn’t really matter that much, it’s more important with relative
positions than absolutes.

I’ve actually been thinking about this problem for a while though,
and there’s one system I think might work: Most gamepads seem to have
somewhat similar layouts. Kind of a W-shape (view with fixed width
font):

F       G
|       |
A   C   E
\ / \ /
B   D

If each of the letters in that graph could be configured as either an
analog stick, a dpad, a button group, or absent, you’d already be
able to cover the vast majority of gamepads out there (A-E on front,
F-G on shoulder). Button groups would be shapes, like e.g. a strip of
2 or 3 buttons, two lines of 3 buttons, a diamond shape of 4 buttons,
etc. Each shape would have to also define button order, and
preferably also short names/symbols and colors for each button for
display in in-game config.

With this system, an Xbox360 controller would have analog sticks at A
and D, d-pad at B, a horizontal strip of three buttons at C, a
diamond shape of buttons at E, and one digital and one analog trigger
at each of F and G (maybe add H and I groups to separate these?). A
Playstation style controller would be similar, but with A and B
swapped, different button names, and probably different button
ordering. A classic NES controller would have a d-pad at A, two
buttons at C (select/start), two buttons at E (A/B), and everything
else absent. etc.

There could also be a simple library that games can ask for specific,
standard layouts. A game could for example ask for a dpad and two
buttons, or something as close to a SNES style pad as possible,
whatever the game needs. If all the game wants is two analog sticks
and a button, it could ask for that, too, not caring whether the left
analog stick is at position A or B or where the button is. Input
could be fed to the library for remapping to the requested layout,
and the game could simply work with standard button names, like
BUTTON_NES_A or something, with the layout and position then being
implicit.

Not really sure about all the details here, but it’s an idea.
Thoughts?

-g


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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 21:10:16 +0100

From: Gerry Jo Jellestad
To: sdl at lists.libsdl.org
Subject: Re: [SDL] joystick identification

Date: Tue, 14 Feb 2012 12:10:55 -0800
From: Nathan Coulson
To: SDL Development List
Subject: Re: [SDL] joystick identification
Message-ID:

Content-Type: text/plain; charset=UTF-8

On Tue, Feb 14, 2012 at 12:36 AM, Jared Maddox <@Jared_Maddox> 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”
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).

There has been a lot of great discussion and ideas, but I hate to say
I am not quite ready to begin working this out yet (or setting up a
proper home). Sorry it took so long to respond.

The source image will be a .svg, although I plan on making a library
that will interact with the online database. I imagine this can be
converted to raster form relatively easily (Never actually looked into
how easy it would be to get a svg to raster parser yet), but I wanted
something that can scale as needed.

I was also working out a way to have premade templates for controls.
(although I meant this to be used at the individual game level). I
suppose that a generic template or two could be part of the online
database, but not entirely sure having a simplified controller profile
defined for each gamepad is a great idea.

I suppose that the database can also contain the button options for
each game that uses the database, but maintenance could be a problem.

Let me start off by defining what should be in the database (and it
will be 2-3 weeks before I can dedicate the proper time for this), add
1 or 2 examples, and once I have a template see where it should go
from there. (for now, I don’t think I will be using an actual
database, and just have it as a collection of files).On Tue, Feb 14, 2012 at 11:00 PM, Jared Maddox wrote:

Date: Tue, 14 Feb 2012 21:10:16 +0100
From: Gerry Jo Jellestad
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 <@Nathan_Coulson>
To: SDL Development List
Subject: Re: [SDL] joystick identification
Message-ID:
? ? ?
Content-Type: text/plain; charset=UTF-8

On Tue, Feb 14, 2012 at 12:36 AM, Jared Maddox 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”
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).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Nathan Coulson (conathan)

Location: British Columbia, Canada
Timezone: PST (-8)
Webpage: http://www.nathancoulson.com

Message-ID:
<CAFvYhDDY_GhZLMBVvMWqp-E9ChrNZYrpeopnG5ieBP+GN9UiuA at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

There has been a lot of great discussion and ideas, but I hate to say
I am not quite ready to begin working this out yet (or setting up a
proper home). Sorry it took so long to respond.

No need to apologize, I’d volunteer to help but I have a few projects
I’m working on myself (and no idea what to help with :wink: ).

The source image will be a .svg, although I plan on making a library
that will interact with the online database. I imagine this can be
converted to raster form relatively easily (Never actually looked into
how easy it would be to get a svg to raster parser yet), but I wanted
something that can scale as needed.

Do you have any plans yet for how the button, etc., data will be
packaged? Since SVG is xml, maybe just have a single xml file that
contains both an SVG for an image, and then some additional markup for
the other info?

I was also working out a way to have premade templates for controls.
(although I meant this to be used at the individual game level). I
suppose that a generic template or two could be part of the online
database, but not entirely sure having a simplified controller profile
defined for each gamepad is a great idea.

Unless your game will be fine with the generic template, I’d say to
just let game developers package some with their games. They can store
them as files or whatever else makes sense for them, which should
hopefully simplify your work.

I suppose that the database can also contain the button options for
each game that uses the database, but maintenance could be a problem.

Yeah, if a game was uninstalled but didn’t remove itself correctly you
could be left with some of it’s data afterwards with no idea of what
it was.

(for now, I don’t think I will be using an actual
database, and just have it as a collection of files).

That seems like a reasonable way of doing it. After all, from an
external ‘black box’ view, it’ll probably look the same anyways.> Date: Tue, 21 Feb 2012 20:25:51 -0800

From: Nathan Coulson
To: SDL Development List
Subject: Re: [SDL] joystick identification

Hallo !

There has been a lot of great discussion and ideas, but I hate to say
I am not quite ready to begin working this out yet (or setting up a
proper home). Sorry it took so long to respond.

The source image will be a .svg, although I plan on making a library
that will interact with the online database. I imagine this can be
converted to raster form relatively easily (Never actually looked into
how easy it would be to get a svg to raster parser yet), but I wanted
something that can scale as needed.

I was also working out a way to have premade templates for controls.
(although I meant this to be used at the individual game level). I
suppose that a generic template or two could be part of the online
database, but not entirely sure having a simplified controller profile
defined for each gamepad is a great idea.

I suppose that the database can also contain the button options for
each game that uses the database, but maintenance could be a problem.

The basic idea is great, to have a SVG file for, at least the major gamepads,
to have the data, here this button is this rect selection or circle selection
in the SVG that connects to this button number.

But what is meant with this template thing ? Do you want to have, for example,
a “First Person Shooter” template for all the gamepads ?

CU