Home

Upgrade HTML5 Games with the Gamepad API

  • JavaScript
  • Tutorial
  • Gamepad
  • API

In my latest tutorial for Web Designer, I take you through all the ups and downs, left and rights, Bs, As and starts of the Gamepad API. It's all ready - plugin-free - in desktop and mobile browsers today.

While it's been present for many years now, uptake has been slow and inconsistent. By now, it's just about at a stable point to get using, even if it's supplimentary to the usual keyboard and mouse.

Sure, every browser has their own quirks (you would be amazed what confusion there is to be had between analogue sticks and trigger buttons) it's not impossible to detect and work around them.

In this tutorial, we make a little RC car game which can be controlled by either connected gamepads or by keyboard input. That's achieved by making a generic wrapper class around the controls.

But enough spoilers, grab the latest edition of Web Designer Magazine and give it a whirl yourself!