[SIZE=3]What this is:[/SIZE]
Using the GamepadAPI that has been tentatively adopted by the Mozilla and Chrome browsers, and the Gamepad.js library, I’ve developed a flash application that supports input from a controller, in-browser.
It is currently only working in the Chrome and Mozilla browsers, and only with developer flags, but it is working. Seeing as how the GamepadAPI is a W3C-considered specification, I think this is a safe avenue to begin development for.
This application owes quite a bit to the Gamepad.js library, as it collects the gamepad inputs in a easily navigable array. Without it, this would have been a MUCH larger undertaking.
[SIZE=2]Anyway, I’m posting this here for two reasons: [/SIZE]
I’ve been looking for a way to use gamepad input in a browser-based flash application since…well, as long as I can remember. There may be other ways to do this, but everything I’ve found requires separate applications on the user’s side, which I don’t think is best practices.
This application, as of now, will still require some work on the user’s side, but it has two distinct advantages, in my opinion. First, it can be used with the consumer version of the Chrome browser that is currently released. And Second, if the GamepadAPI specification becomes more widely adopted, it may not require anything of the end user, in the future.
[SIZE=3]**Getting started: **[/SIZE]
So, there are a number of ways to get the demo underway, but I’m just going to tell you the quickest:
- Get an Xbox360 gamepad and plug it in. Once it has installed its drivers successfully, you can proceed.
- Download the newest release of Google Chrome. If you already have Chrome, the version you have should be fine. (Assuming you haven’t turned off automatic updating)
- In chrome, open a new tab and type in
- In the list of flags, find the GamepadAPI flag, and select “Enabled”. (it’s near the bottom.) This will prompt you to restart. Do so.
- Navigate to the demo page. You should be able to use your xbox game pad to control the application!
Like I said, this is also available in Mozilla’s nightly builds, and with controllers that aren’t the Xbox controller, but this is just the fastest way to get it up and running. Visit the Gamepad.js site for more information on how to get this working in other browsers.
If you’d like to download the source code, you can find it here.
Please poke around in there and let me know what you think. If you have an optimization or a better method for something, just let me know. I’d love to see some native-gamepad apps being developed to test functionality on this.
I can’t stress enough how important the Gamepad.js library is for this application. Please check it out and get to know how it works. And a big thanks to Scott for creating it!
This is just the specification information for the GamepadAPI. It’s not directly important, but any changes made to it will trickle down to the flash applications, so it’s a good idea to keep an eye on it.
That’s pretty much it. If you have some questions, I will try to answer them as best I can. Just let me know what you think.