Revision: 04.01.2014
Revision: 03.01.2014
Revision: 01.01.2014
Revision: 30.12.2013
Drafted: 23.12.2013

Game Controlls and the Web

Part 1: How come?

Since a few weeks I'm playing with a new project, a little Simulator for classic like CPU systems, written in JavaScript. As with most fun projects, it generates almost a new idea every other source line. Beside Canvas or Web Audio (Positional Audio for 8 Bit CPUs - wie cool ist das denn :) and others, the discovery of the Gamepad API (right in time for Christmas) has been the latest diversion. What a nifty idea. So I went ahead tried to get some information. Not easy, since there are quite some different implementation non concluding standard papers or look alikes and lots of outdated pages and code about. After a daylong search I learned that Firefox 24 already includes a complete implementation. Cool. If just the Mozilla documentation would already reflect this. This is basicly the the only 'official' info, and a bit outdated (I did try to make it more current, but my knowledge here is limited. Ted Mielczarek (one of the draft devs) offered additional insight in a recent Article on hacks.mozilla.org. There's also a Chrome implementation, but unlike Mozillas simple configuration switch you have to getsome kind of nightly builds, whatsoever. I'm not going down that road. So all Kudos to FF here (On the other hand, during this project I learned to like Chromes debugging and rather smooth handling - then again, both are more than just a little weired when it comes to timestamps (Fate.now/performance.now) and requestAnimationFrame implementation - I never thought I'd say this, but IE does a better job here).

Anyway, long story short, I did a little Implementation. I'm not realy satisfied with how the Interface has been designed, but thats a story for a different rant - beside that, a more important question sufaced: How to test? So I had to get me some gamepads. The developers offered a list of compatible devices like:

All rather high priced (Euro 50+) brands. Not exactly what I intended to spend. So I got me two 9.99 thingies (edit 3 by now (edit 6 :)) at different stores. Rather generic devices - one even included force feedback ... at 9.99 :))

Disclaimer

I'm a dinosaur when it comes to game controls. I grew up on coin ops, the first joystick I had was something weired (from todays point of view) where one had to _hold_ a stick in one hand and turn a *knob* with the other. After that joysticks had either digital buttons and where sold with 2600 systems or combined paddles, plugged into a DIP16 socket (*G*). Quickshot was already a next gerneration device, and Gamepads are something I first encontered at the Sega Megadrive of my younger daughter. Not my way. So some of my impressions may look weired to younger readers. Same goes for some definitions I made up to describe my findings. Also, all my discoveries are made using Windows 7. I do unse Linux, but for Development and more important testing I prefer to use what 70+ per cent of all users out there employ. I whish more developers of cross platform programs would also think more about their user base - we might have less weired behaviour (of recent features) in FF or Chrome. Then again ... I'm just a dinosaur. As support for this claim I might add, that my prefered development language is Assembler in any variation for any CPU :)

As longer as I dig into here, as more it seams like a darwineske field trip discovering evolution. I literaly collect and catalouge specimen in hope to find some hints about a hidden structure.

The Pads

About Variations

My intention is to learn what devices are out there and gather data to compare it's behaviour. Unlike joysticks, gamepads have quite some variations. As of not there are at least 3 basic gamepad styles and a bunch of variations. Most prevalent are two styles:

PlayStation(PS)-Style
Two little joysticks in the lower row, 4 buttons on the right upper side and an 8-way (4 button) rocker on the upper left
xBox-Style
Like before, but the left joystick switched position with the directional switch.
Both feature 4 fire buttons on top (shoulders). The default mapping used in the W3C Draft is much like the PS-Style type. The newest Draft (31.12.) added a plus a 13th button in the middle. I couldn't realy find any controller like that. Either it's supposed to reflect the xBox-Style Guide button or maybe the new PS4 touchpad - which again seams odd. While the 'old' Wii feaures GameCube/PlayStation style controllers, a new design has been introduced with the Wii-U. Either as part of the tablet, or as the Wii-U Pro Controller.
Wii-U-Style
Two little joysticks in the upper row, 4 buttons on the lower right side, an 8-way (4 button) rocker on the lower left and 3 buttons in the middle
There are already adaptors available to connect Wii-U-Pro Controllers to PCs. Searching Chineese manufacturers/sellers sites bring up some new PC/USB Controllers in Wii-U style, so we can expect so see more of them. Tink geek offers a nice SNES styled Wii-U Controller. Which brings us to ...

A group of gamepads are based on the classic Nintendo

SNES-Style
with a 8 way (4 button) rocker on the left, 2 buttons in the middle, 4 diamond placed buttons on the right, and two 'fire' buttons atop (shoulder).
They are available as rather close clones or pseudo-cool retro designs or even tiny foldable pads like the Buffalo Mini USB Pad. Ofc, the NES variation with (only) two right buttons is also available. More variations include modern designs like the Logitech Precision (with 4 fire buttons on top/shoulders). These Controllers are often named as n-Button-Controllers and available in lots of combinations and up to 14 additional buttons (I wouldn't be surprised to find even more :) placed around the SNES basic elements.

This Guy has a nice overview how buttons may be assigned from different devices. An interesting development seams to be the way rocker switches are offered. The classic variation is 8 way, like the old 2600. Newer Pads (most notably the latest xBox contoller) limit this to 4 way again.

Whats Missing: Joysticks (for now) and Wheels and more unusual controlls. Most of the later apear as Keyboard anyway - which brings up again one real issue I would love to see in the Gamepad API: Unified handling of Gamepads, Sticks, Presenters and Keyboard(alikes). Sigh. It's not cool to do all of this reassignment during runtime in JavaScript.

Well, curiosity killed the cat - or in this case my purse - I got me 3 more controllers - a (simple) digital gamepad, a PS3 Dance Map, and the eventually most featured contoller availabe, the Simraceway SRW-S1 Steering Wheel (1 axis, 2 sliders, one rocker and 17 Buttons) - 29,99 - resistance was not an option :). Controller Madness.

Data Collection

Tools

To collect Data and behaviour, various ways are used:

  1. USB VID/PID are (usually) taken from the Linux USB-ID List.
  2. Device Information from USB Device Tree Viewer
  3. Device Information from TDD
  4. Device Information from Windows7 control Panel > Devices and Printers > Generic USB Joystick > Properties Dialogue
  5. Device Interpretation from Windows7 control Panel > Devices and Printers > Generic USB Joystick > Game Controller Setings > Test Dialogue
  6. Behaviour from Windows7 control Panel > Devices and Printers > Generic USB Joystick > Game Controller Setings > Test screen
  7. Behaviour from Firefox using Ted Mielczares Gamepad API Test

Button Numbering

All button numbers try to follow whats written/engraved on the controller itself. Numbering usually starts with 1. In case of inconsistent numbering (like using the same numbere again), or missing numbering, a logical sequenced number (read what the USB Report returns) is used.

Control Elements

Further several types of input controls are used:

Button
General button reporting on/off. Offering a binary Value (0/1)
Axis
An analogue (well, digital sampled). Offering a signed Number, usually handled as a -1..0..+1 value
Rocker/Hat
A digital (button) based 2600 joystick like device. Represented as seperate entity of 4 switches, offering a series of 4 binary values (0/1). The switches are handled via a single hat pice, thus mechanical connected
Trigger/Slider
An analogue 'button', a slider. Offering a unsigned Number, usually handled as a 0..+1 value.
In technical Terms there is no difference between axis and sliders. Axis _schould_ be signed, sliders positive values, but thats not always true. More USB protocoll snpooping is needed here. Buttons and rockers are also based on the same priciple (on/off switches). Still, on API side they are not to be mixed. Same goes for buttons and triggers. While they may seam as exchangable due similar placements (on newer xBox style controllers triggers replaced Button 7/8), they are NO when looking at the API. When viewing triggers as buttons, a emulation may take place.

#1 Big Ben USB Controller

My first buy was a no name controller at Game Stop at Euro 9.99. It's a PS-Style variatoon and includes even a force feedback (dual motor rumble).

Rather average Controller. I couldn't find a way to make the rumble work.

Basic Data

Brandnamebigben play
ProductnamePCPADVIBASS
Product-IDBB5007Slv(Slv = Silver)
USB Product String"Generic USB Joystick "
USB-VID1345Sino Lite Technology Corp.
USB-PID1000
USB-REV0100
USB-Class(es)03/00/00
USB-Device (Windows)USBPDO-12
gamepad.id (Firefox)"1345-1000-Generic USB Joystick"
Style (Layout)PS
SwitchableYes: Default digital, switchable to Analogue
Detectd parts in FireFox12 Buttons
6 Axis
Detectd parts in Windows12 Buttons
4 Axis
1 8-Way Rocker/Hat

Detailed Information

See GP1-page.

#2 Speedlink Thunderstrike

Next one is a no name bought at Conrad (again Euro 9.99). It's a PS-Style variation, but this time silent.

Basic Data

BrandnameSpeedlink
ProductnameThunderstrike
Product-IDSL-6515-BK(BK = Black)
USB Product String"Generic USB Joystick "
USB-VID0079DragonRise Inc.
USB-PID0006Generic USB Joystick (!)
USB-REV0107
USB-Class(es)03/00/00
USB-Device (Windows)USBPDO-12
gamepad.id (Firefox)"79-6-Generic USB Joystick"
Style (Layout)PS
SwitchableYes: Default digital, switchable to Analogue
Detectd parts in FireFox12 Buttons
6 Axis
Detectd parts in Windows12 Buttons
4 Axis
1 8-Way Rocker/Hat

Guessing from a quick search, this controller (either just the chip or the whole device) is also sold as "SpeedLink Strike"

Except for a different asignment of the 4 top right buttons (diamond) it's virtually equal to the bigben gamepad. See there for comments regarding handling and FF-'features'.

Detailed Information

See GP2-page.

#3 Thrustmaster Dual Analog 4

This time a well known classic brand, Thrustmaster ... well, since been bought by french Guillemo, more like a hazbeen. It's a xBox-Style variation, bought at 14.99, again at Game Stop. I realy try hard to buy local, but somehow more and more shops drop game products, or PC products at all. Even Game Stop doesn't carry any (real) Joysticks (nowadays called Flightsticks) anymore :(

Basic Data

BrandnameThrustmaster
ProductnameDual Analog 4
Product-ID2960737
USB Product String"Thrustmaster dual analog 3.2"
USB Manufacturer String"Mega World"
USB-VID044FThrustMaster, Inc.
USB-PIDB315According to Linux USB-ID List: Firestorm Dual Analog 3
USB-REV0101
USB-Class(es)03/00/00
USB-Device (Windows)USBPDO-12
gamepad.id (Firefox)(not recognized)
Layout StylexBox
SwitchableNo (always analogue)
Detectd parts in FireFox12 Buttons
6 Axis
Detectd parts in Windows12 Buttons
4 Axis
1 8-Way Rocker/Hat

Detailed Information

See GP3-page.

#4 Thrustmaster Firestorm Digital 3

Again a Thrustmaster, bought at 7.99 at MediaMarkt.

Basic Data

BrandnameThrustmaster
ProductnameFirestorm Digital 3
Product-ID2960626 vs b
USB Product String"USB 2-Axis 8-Button Gamepad"
USB Manufacturer String"Mega World"
USB-VID07B5Mega World International, Ltd
USB-PID0213Thrustmaster Firestorm Digital 3 Gamepad
USB-REV0101
USB-Class(es)03/00/00
USB-Device (Windows)
gamepad.id (Firefox)"7b5-213-USB 2-Axis 8-Button Gamepad"
Layout StyleSNES
SwitchableNo (always digital)
Detected parts in FireFox8 Buttons
2 Axis
Detected parts in Windows8 Buttons
2 Axis

Detailed Information

See GP4-page.

#5 PS3 Dance Mat

Bargain at MediaMarkt at 19.99.

Basic Data

BrandnameKonami
ProductnameDDR/PS3 Tanzmatte
Product-ID2960737
USB Product String"DDR Mat for PlayStation(R)3"
USB Manufacturer String"Konami Digital Entertainment"
USB-VID1CCF(Not in List)
USB-PID1010
USB-REV0100
USB-Class(es)03/00/00
USB-Device (Windows)USBPDO-12
gamepad.id (Firefox)1ccf-1010-DDR Mat for PlayStation(R)3
Layout Stylenon-standard
SwitchableNo (always analogue)
Detected parts in FireFox13 Buttons
6 Axis
Detected parts in Windows13 Buttons
4 Axis
1 8-Way Rocker/Hat

Detailed Information

See GP5-page.

#6 Simraceway SRW-S1 Steering Wheel

I realy managed to leave the shop (again Game Stop, just different location), where I found this beauty, without buying, before returning again after New Year. After all, 29.99 for such an unusual device was too much to withstand.

Basic Data

BrandnameSteelseries (Simraceway)
ProductnameSRW-S1 Steering Wheel
Product-ID69005
USB Manufacturer String"SteelSeries"
USB Product String"SRWheel"
USB-VID1038Ideazon, Inc.
USB-PID1410
USB-REV0100
USB-Class(es)03/00/00
USB-Device (Windows)USBPDO-12
gamepad.id (Firefox)"1038-1410-SRWheel"
Layout StyleWheel - way sophisticated
SwitchableNo
Detected parts in FireFox17 Buttons
5 Axis
Detected parts in Windows17 Buttons
1 Axis
2 Slider
1 8-Way Rocker/Hat

Detailed Information

See GP6-page.

Conclusions

These are not the Contollers you look for

Or, regarding FireFox, at least not the gamepad API I would like to see. It's way too much tied to a certain type of controller. This might result in sever harm - read less than intended usage. With a multi polar ... err ... heterogenus gamepad world out there, only two strategies are usefull: Either just present the very basic switches and sliders, or offer as much structure as possible to be derivated from the HID descriptors. The third way, make everything look like PSx will result in another proof of the 2nd Hammer Theorem: If you treat all your tools like a hammer, expect them to break early and often.

Control Grouping

Most notable the Simraceway wheel proves that the 4 different ways of controlls (Axis, Trigger/Sliders, Buttons and Rocker/Hats) need to be implemented as distinct structures if you realy want to form amn interface capable to handling various controllers. Mixing them will result in quite implementation (read controller) specific structures, resulting in an unmaintainable nightmare.

Lessons learned

What I called 'Styles' should rather be named 'Layouts'. Also there is realy a basic difference of Analogue and Digital sticks. Partly rooted in history, but also in function. Like said before, it gets more and more like a field study in Entomology. The part about Styles may need rewriting.

Further research

It might be a good idea to see what kind of reports are _realy_ sent

Bugs: