Tuesday, April 9, 2013

This was also an awesome idea  video game developing here I come lol.



 3D games controlled with your gamepad

Have you ever tried to play a non-Flash browser game nowadays? The graphic capabilities are amazing, especially when you see game clones like Quake.
But when playing this stuff you're always tied to your keyboard and the (mostly) clunky mouse. This is a major disadvantage, in particular for action games, it really holds them back from the browser.
Wouldn't it be cool if you just could plug your Xbox controller into your PC and start playing your favourite browser game? This is not a future vision anymore, say hello to the Gamepad API!

If you are having a gamepad around your desk, plug it in right now and enjoy some games, that already are using the Gamepad API. Programming the input controls also is a piece of cake, check out this code snippet or even better, run it yourself:
  1. <div id="gamepads"></div>
  2. <script>
  3. function gamepadConnected(event) {
  4.   var gamepads = document.getElementById("gamepads"),
  5.     gamepadId = event.gamepad.id;
  6.  
  7.   gamepads.innerHTML += " Gamepad Connected (id=" + gamepadId + ")";
  8. }
  9.  
  10. window.addEventListener("MozGamepadConnected", gamepadConnected, false);
  11. </script>
If you would like to know more about browsers' 3D capabilities check out Three.js and Jens Arps' open source 3D simulator engine Ascent built on top of it. Mark Hammil watch out, we might need you for another Wing Commander sequel!

7 comments:

  1. That's cool, I have my wired xbox360 controller sitting next to me, I will have to try it out!

    Check out my blog if you have not already: http://pmickplace.blogspot.com

    ReplyDelete
  2. Good post/blog
    Nice to see
    http://webappspr.blogspot.com/

    ReplyDelete
  3. I can't say that I play anything more sophisticated than Minecraft, but this is cool.

    http://42lampshades.blogspot.com/

    ReplyDelete
  4. Nice, I'd be interesting to implement this in future projects

    ReplyDelete
  5. Sweet! That'd be fun to play with.

    ReplyDelete