The Controller Database will be a database that can provide a svg image of the controller in question, as well as showing where on the image each axis/button is. As there are numerous gamepad/joysticks in the world, I would like to see this supported by the players who would make use of it.
Stage1: Identifying what controller is on the system
The first stage will be generating a key that can be used to look up the device in question. This key should be the same between any operating system platform.
I am familiar with 2 interfaces for controllers. USB, and the original gameport (probably about a million others exist in the wild).
USB, each device has a VendorID, and a ProductID. A key could be made up as follows:
- USB[BUS]_####[VendorID]####[ProductID] - ex:/ USB_046DC214 (from my Logitec Attack 3)
As for the gameport, identification probably falls apart. I believe that it can be used to represent up to 4 axis's, and up to 4 buttons in most cases (or 2 devices, with 2 axis's, and 2 buttons each). Under linux, it is able to autodetect the Microsoft Sidewinder Joystick though on this interface.
- GPAD#[Axis]A#[Buttons]B - ex:/ GPAD2A2B for a 2 axis 2 button generic joystick
- GPADMSSIDE - for a microsoft sidewinder gamepad
Stage2: The database
The goal of this database, is to take the Stage1 Key, as well as the OS, and provide the following to the game in question
- Image of controller in a SVG format [I imagine a horizontal rectangle would be the best way to represent most gamepad's]
- A list of axis's, Buttons, Hats, and Ball's, and where to find them on the above image.
- Names for each axis/button
- Enough information, so that someone could label a function of a button. ex:/ if button 1 was "jump", then they could draw a line to button 1, and put "jump" beside it
- Axis/Buttons should be defined per OS, Name/Image will be global.
Cavets: It looks like axis/button configuration can change from OS to OS. I was using the XBox 360 wired controller to experiment with posibilities.
- Windows Vista:
- 0 "XBOX 360 For Windows (Controller)"
- Axes: 5 Buttons:10 Balls:0
- 1 "Logitech Attack 3"
- Axes: 3 Buttons:11 Balls:0
- Linux cat /proc/bus/devices
- 0 "Microsoft X-Box 360 pad"
- Axes: 8 Buttons:11 Balls:0
- 1 "Logitech Logitech Attack 3"
- Axes: 3 Buttons:11 Balls:0
The left/right triggers on windows are mapped to one of the axis's on windows, while mapped as buttons on linux. The database will have to have different results for controllers that change between operating systems. I suppose it could be possible that a gamepad/joystick could behave differently between os's as well
There will also be cases where a controller is not yet added to the database. It should keep track of failed queries so that entries can be added in if desired.
- [BUS]=USB, KEY=USB_####[VendorID]####[Product ID]. ex:/ USB_046DC214 (from my Logitec Attack 3) Gameport:
- [BUS]=GMPT, KEY=GMPTA[Axis]#B#[Buttons], ex:/ GMPTA2B2 (2 axis 2 button generic joystick
For each device key,
- controller.svg: A wide aspect ratio [Todo: Define actual aspect ration]
- layout.xml: (Not sure if this should be XML, binary, or a sql db)
- Name: UTF8, allow different names for different languages
- Buttons/Axis/Hats/Balls: x/y of button, x/y of button use text. Allow for multiple configurations per os.
- Name of Button/Axis: UTF8, allow different names for different languages
Querying the db online
Returns the layout.xml
- query_spec.php?key=USB_046DC214,os=linux,lang= Returns the controller.svg
- export.php: export entire database
- Note: This information should be cached on the local machine to prevent excessive bandwidth use
Querying the local db (if included w/ game)
- Licencing: I want this available for use in open and closed source projects.
- Content Licensing: How should content entered into the database be licensed/tracked? Is there problems making images of a controller's likeness?
- What aspect ratio should controller images be? Should there be more then one ratio?
- Who should be able to upload content? How will moderation work?