0 Favourites

Help test the new Gamepad object!

  • 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.

  • Confirming "45e-28e-Controller (XBOX 360 For Windows)" in firefox.

    Also tested in FF: Noname PS2 pad (plugged 'n play through convertor MaDrics Superbox 3 Pro)

    Pad got installed as USB gamepad in win7

    In the test app, stays blocked on "GamePad Connected" and doesn't go further.

    The pad has been tested in Derek Yu's Spelunky and is recognized.

    Probably doesn't help much, but that's all I can test for now.

  • I was excited but now I'm let down, as it only seems to work with the popular but low quality d-pads controllers like the Xbox 360 one. I hope that it'll allow for more inputs later.

    I wonder if once these gamepad API things are in the "normal" browsers we'll see some more consistency between them, but that doesn't really seem likely considering other browser differences at the moment.

    Same results as you for Xbox controller on Chrome/Firefox on Windows 7.

    Buffalo SNES USB gamepad: in Firefox it said "Gamepad connected" but then no other text appeared. On Chrome, I get no response at all.

    My PS3/PC arcade stick works well in Firefox (ID:e8f-310d-GAMEPAD 3 TURBO) but like the SNES one it gets no response in Chrome. Don't feel there's much point in listing the inputs, as there's a lot of arcade sticks and many of them are custom built.

  • This is awesome guys, and that could be super usefull for prototyping as well!

    Keep it up!

  • alspal: you should list it nevertheless.

    The gamepad support is at its very beginning. Meaning that today basic USB pad doesn't get well recognized, but the API will evolve in a matter of months.

    Let's Ashley have the most complete database of mappings possible as of now, this is listing we won't have to do again later.

    Also it's not a surprise that it works better in FF than in Chrome for now, the gamepad API has been pushed by mozilla for a few months now.

    Like HTML5 this is all very new.

    Even worse it is in experimental stage. Meaning it will only improve.

    Help the experimentation today <img src="smileys/smiley2.gif" border="0" align="middle" />

    Tommorow will come sooner.

  • 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.

  • How cool!

    I got a generic USB gamepad and it worked fine.

    Windows 7 32bits

    Firefox Nightly 11.0a1 (2011-12-12)

    Detected as "Gamepad 0 ID 810-3-USB Gamepad"

    Analog mode ON

    Buttons in the following (correct) order:

    B1, B2, B3, B4,

    Left shoulder button, Right shoulder button,

    Left shoulder trigger, Right shoulder trigger,

    back, Start, Left stick, Right stick.

    Axis maps as follows:

    Left Stick left/right (X) = Axis 0, -100..100

    Left Stick up/down (Y) = Axis 1, -100..100

    Right Stick left/right (Z axis) = Axis 5, -100..100

    Right Stick up/down (Z rotation) = Axis 2, -100..100

    D-pad left/right = Axis 5, -100/100

    D-pad up/down = Axis 6, -100/100

    Analog mode OFF

    Buttons in same order, but stick ones don't work.

    Axis 0 and 1 read -1 when idle.

    Axis maps as follows:

    Left Stick left/right (X) = Axis 0, -100/100

    Left Stick up/down (Y) = Axis 1, -100/100

    Right Stick left/right (Z axis) = buttons 3, 1

    Right Stick up/down (Z rotation) = buttons 0, 2

    D-pad left/right = Axis 0, -100/100

    D-pad up/down = Axis 1, -100/100

    I have the right stick swapped like this, what may interfere in the readings.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • nornberg I don't think it's useful to run the test if you've done hacks to change the input. It should be the stock install. Otherwise any mappings I add will be wrong for everyone else. Could you run it again with a default setup? And maybe check Chrome 18 too? :)

  • Ashley

    Marvellous to see you getting on to this! Running late for a job, but couldn't resist doing a quick test:

    Windows 7 - Firefox Nightly

    Gamepad 0 ID: 46d-c216-Logitech Dual Action

    Button 0: 1 (right button pad)

    Button 1: 2 (right button pad)

    Button 2: 3 (right button pad)

    Button 3: 4 (right button pad)

    Button 4: 5 (back left top)

    Button 5: 6 (back left bottom)

    Button 6: 7 (back right top)

    Button 7: 8 (back right bottom)

    Button 8: - (should be 9, but no reaction)

    Button 9: 10

    Axis 0: Left analog stick X axis

    Axis 1: Left analog stick Y axis

    Axis 2: Right analog stick X axis

    Axis 3: -

    Axis 4: D-pad left and right

    Axis 5: D-pad up and down / Right analog stick X axis

    More later ...

  • If you want a quick test, try Space Blaster with Gamepad support ...

    I have seen the future of browser-based gaming and it works! <font size="1">(apologies to Lincoln Steffens)

    </font>

    This is absolutely fantastic, guys! Being able move around and fire in a browser-based game with a gamepad is a real blast!

    (For the record, with my Logitech Dual Action/Win7/FF Nightly, I press 1 to start and to fire laser cannons, 2 to fire rockets, and use the left joystick to move around).

    It was smitchell who put me onto the Gamepad API in this thread. I went on to hunt out Benjamin Read's excellent intro and downloaded his demo code.

    His PS3 mappings didn't work with my Logitech gamepad, but with a bit of experimenting they were easy to change in the code. I had dreams (just dreams!) of trying to make a gamepad C2 plugin, but I could see that allowing for myriads of different mappings was going to be a real hassle - so I'm mightily impressed that Ashley has taken up the challenge and has already succeeded brilliantly!

  • Awesome guys !!

    I will try to contribute with my wiimote and nunchuck

    but how can i connect it to my pc ?

  • Wii Remotes actually use bluetooth, so if you have a bluetooth adapter for your pc then you should just be able to add it to your bluetooth devices.

    Can't remember if you need more software or not though, I have only done it with an emulator that recognised the wii remote.

  • Wii Remotes actually use bluetooth, so if you have a bluetooth adapter for your pc then you should just be able to add it to your bluetooth devices.

    Can't remember if you need more software or not though, I have only done it with an emulator that recognised the wii remote.

    Getting a Wiimote to work as a controller is a somewhat convoluted process requiring two pieces of software. First is GlovePIE, which interfaces with the Wiimote and allows you to map Wiimote/Nunchuk/Classic Controller button presses to a PPJoy controller. This leads into the second required piece of software, which is PPJoy. PPJoy takes virtual controller input and maps it to a virtual controller recognized by Windows.

    Overall, it's not terribly difficult, but it can take some finagling to get it working just right - and if you're running on a 64-bit version of Windows, there are additional hoops to jump through with the installation of PPJoy.

  • Anyone have a PS3 controller? That's an important one we're still missing I think.

  • Oh and thanks Velojet, any chance you could test Chrome 18 too?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Your C2 tests
566 243,739
thisisblogs's avatar
thisisblogs
Unread hot topic
0 Favourites
New Android Export Experiences
494 67,273
jabk's avatar
jabk
Unread hot topic
410 84,615
MrMegawatts's avatar
MrMegawatts