Hi all,
Mozilla and Google are working on gamepad input for their browsers. It's very much experimental, but is basically the coolest thing ever. I've been playing around with it and have got some simple input being detected.
Unfortunately, the input is a mess. For one controller, the list of buttons and joystick axes can come back in completely different orders (sometimes even buttons counted as axes and vice versa) depending on the browser, the controller and the operating system! For example my XBox 360 controller has the buttons in a different order between Firefox and Chrome, and apparently (although I haven't tried yet) it changes again if you go to Mac, and so on and on.
However if we do a lot of testing with different controllers, browsers and OS's, I can build mappings in to the gamepad object that makes it consistent everywhere. For example, regardless of whether you've got a Playstation 3 controller or XBox 360, Firefox or Chrome, or Mac or Windows, it should consistently work with "left analog", "d-pad", "face button 1" and so on. I need help testing this though! It would be very nice if this was working smoothly with all common setups when support arrives in the mainstream browsers.
<font size="5">How to help</font>
You can help by digging out any old controllers you have that plug in to your PC. Then, you need to install special versions of Firefox or Chrome which support Gamepad - it's not in the mainstream releases yet.
Firefox 11 nightly with Gamepad support:
http://people.mozilla.com/~tmielczarek/mouselock+gamepad/firefox-11.0a1.en-US.win32.zip
Chrome 18 beta:
https://www.google.com/landing/chrome/beta/
Once installed, you need to go to chrome://flags and click 'Enable' for 'Enable Gamepads' to turn on support.
Warning: installing beta versions of Chrome can sometimes overwrite your user profile. e.g. in the past I've had trouble going from a beta version of Chrome back to the stable one. Back up your profile first if you can, or just skip testing. The Firefox install is just a zip with the EXE inside it so it should run totally standalone.
<font size="5">Run the test</font>
It's here:
http://www.scirra.com/labs/gamepadtest/
Nothing will happen until you press a button on the gamepad. Then, if you're properly set up, a list of buttons and axes should appear, with the name of the gamepad at the bottom.
One by one you can then test each axis and button, and see what order they are listed in and write down the results.
<font size="5">Results for Windows/XBox 360 controller on Firefox & Chrome</font>
Here are my results to show the idea - listing the OS, browser, controller name as it appears in the test, and button and axis mappings.
Windows - Firefox
"45e-28e-Controller (XBOX 360 For Windows)"
Button 0: A
Button 1: B
Button 2: X
Button 3: Y
Button 4: Left shoulder button
Button 5: Right shoulder button
Button 6: Back
Button 7: Start
Button 8: Left analog button
Button 9: Right analog button
Axis 0: Left analog stick X axis
Axis 1: Left analog stick Y axis
Axis 2: Shoulder triggers (left up to 100, right down to -100)
Axis 3: Right analog stick X axis
Axis 4: Right analog stick Y axis
Axis 5: D-pad left and right
Axis 6: D-pad up and down
======================
Windows - Chrome
"Xbox 360 Controller (XInput STANDARD GAMEPAD)"
Button 0: A
Button 1: B
Button 2: X
Button 3: Y
Button 4: Left shoulder button
Button 5: Right shoulder button
Button 6: Left shoulder trigger (up to 100)
Button 7: Right shoulder trigger (up to 100)
Button 8: Back
Button 9: Start
Button 10: Left analog button
Button 11: Right analog button
Button 12: D-pad up
Button 13: D-pad down
Button 14: D-pad left
Button 15: D-pad right
Axis 0: Left analog X axis
Axis 1: Left analog Y axis
Axis 2: Right analog X axis
Axis 3: Right analog Y axis
<font size="5">Please note...</font>
We only need each combo of OS-browser-controller tested once. If your combo is already tested in this thread, in order to keep the thread straightforward, please don't post it again. However, it's worth noting if yours is different to anyone else's test, just in case there's something funny going on.
Thanks everyone and hopefully when Gamepad support comes it will be awesome :D
Edit: if you want a quick test, try Space Blaster with Gamepad support:
http://www.scirra.com/labs/spaceblaster-gamepad/
Probably only supports XBox 360 controller at the moment.