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:
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.
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:
A group of gamepads are based on the classic Nintendo
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 futile :). Controller Madness.
To collect Data and behaviour, various ways are used:
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) a logical sequenced number (read what the USB Report returns) is used.
Further several types of input controls are used:
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.
Brandname | bigben play | |
Productname | PCPADVIBASS | |
Product-ID | BB5007Slv | (Slv = Silver) |
USB Product String | "Generic USB Joystick " | |
USB-VID | 1345 | Sino Lite Technology Corp. |
USB-PID | 1000 | |
USB-REV | 0100 | |
USB-Class(es) | 03/00/00 | |
USB-Device (Windows) | USBPDO-12 | |
gamepad.id (Firefox) | "1345-1000-Generic USB Joystick" | |
Style (Layout) | PS | |
Switchable | Yes: Default digital, switchable to Analogue |
See GP1-page.
Next one is a no name bought at Conrad (again Euro 9.99). It's a PS-Style variation, but this time silent.
Brandname | Speedlink | |
Productname | Thunderstrike | |
Product-ID | SL-6515-BK | (BK = Black) |
USB Product String | "Generic USB Joystick " | |
USB-VID | 0079 | DragonRise Inc. |
USB-PID | 0006 | Generic USB Joystick (!) |
USB-REV | 0107 | |
USB-Class(es) | 03/00/00 | |
USB-Device (Windows) | USBPDO-12 | |
gamepad.id (Firefox) | "79-6-Generic USB Joystick" | |
Style (Layout) | PS | |
Switchable | Yes: Default digital, switchable to Analogue |
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'.
See GP2-page.
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 :(
Brandname | Thrustmaster | |
Productname | Dual Analog 4 | |
Product-ID | 2960737 | |
USB Product String | "Thrustmaster dual analog 3.2" | |
USB Manufacturer String | "Mega World" | |
USB-VID | 044F | ThrustMaster, Inc. |
USB-PID | B315 | According to Linux USB-ID List: Firestorm Dual Analog 3 |
USB-REV | 0101 | |
USB-Class(es) | 03/00/00 | |
USB-Device (Windows) | USBPDO-12 | |
gamepad.id (Firefox) | (not recognized) | |
Layout Style | xBox | |
Switchable | No (always analogue) |
See GP3-page.
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.
It might be a good idea to see what kind of reports are _realy_ sent