Article:A True Gaming Experience with the Gamepad API

Extract form Sitepoint article “A True Gaming Experience with the Gamepad API” by Robby Ingebretsen

Published June 30, 2015</small.

This article is part of a web dev series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

Gaming on the Web has come a long way with HTML5 technologies like Canvas, WebGL, and WebAudio. It’s now possible to produce high-fidelity graphics and sound within the browser. However, to provide a true gaming experience, you need input devices designed for gaming. The Gamepad API is a proposed standard of the W3C, and is designed to provide a consistent API across browsers.

The Gamepad API allows users to connect devices like an Xbox Controller to a computer and use them for browser-based experiences! If you have a gamepad, try plugging it into your computer and then press a button. You’ll see the Xbox controller below light up to mirror each movement you make!


Try it out interactively here.

This tutorial is the third in a series on Flight Arcade – built to demonstrate what’s possible on the web platform and in the new Microsoft Edge browser and EdgeHTML rendering engine. You can find the first two articles on WebGL and Web API, plus interactive code and examples for this article at flightarcade.com

Flexible API

The Gamepad API is intelligently designed with flexibility in mind. At a basic level, it provides access to buttons and axes. Button values range from [0 … 1] while axes range from [-1 … 1]. All values are normalized to these ranges so developers can expect consistent behavior between devices.

Continue reading article on SitePoint …

HTML5 is the future of web and web apps which makes it huge. It is exciting and can change the web. It is the next generation of web technology. It supports both mobiles and desktop dynamically. HTML5, together with CSS3 and JavaScript, is the foundation of cross platform web application development.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.