Jan 27, 2011 11:38 GMT  ·  By

The web has a bright future as an app platform, thanks to HTML5 and related technologies, but there are still plenty of things to be done. One area where it's still lacking is gaming. HTML5, via the <canvas> tag, provides the basis for 2D web-based games and most modern browsers support the feature. Performance though is another issue, one that Facebook is trying to solve, or rather encourages browser makers to solve.

"With wide adoption and industry support, HTML5 will transform desktop and mobile gaming, creating amazing user experiences that are only a link away," Facebook's Cory Ondrejka writes.

"Less clear are the capabilities of HTML5 as a high performance gaming platform today. New HTML5 games regularly appear, they often exhibit quirks and low frame rates," he continues.

"So we spent the last few weeks -- and one hackathon -- building JSGameBench and we think version 0.1 is ready for release," he added.

"JSGameBench exists to explore HTML5’s game performance limits. For version 0.1, the focus is sprite performance a player is likely to see. Scoring is how many sprites are drawn, so large scores are better," he explained.

In the lengthy post, Facebook goes on to explain why there is a need for a game specific browser benchmark and what it's done to create it.

JSGameBench is a very early release and Ondrejka points out several times that there are likely to be errors or problems with the benchmark and with the way the tests were done.

HTML5 will usher a new generation of web apps, which will compete in performance and features with native desktop or mobile apps. However, browser support is crucial in this. In fact, it's not enough to support a HTML5 feature, the browser has to ensure that the performance is on par with people's expectations.

HTML5 gaming in particular holds a lot of promise. At the moment, Flash is the only viable way of building a game for the web. But Flash comes with plenty of its own problems and leaves many mobile devices out.

Leveraging HTML5's Canvas will enable developers to create games that work on any platform or even on any device, while using standard, open technologies.

But this is not going to happen until browsers can provide the kind of performance needed for games.

Facebook's JSGameBench aims to see how suited are browsers today for games. It focuses on canvas and 2D content since WebGL is still in the early stages, despite rapid development.

Further, the benchmark, for now, focuses on sprite performance. Sprites are the 2D elements, images or animations, that make up the graphics part of a 2D game.

"For each render path, JSGameBench draws as many moving, animating sprites as possible at 30fps against a background with both axis-aligned and rotated sprites. We try both because significant performance differences between the two indicate flaws or oversights in current rendering techniques," Ondrejka explains the choice.

"More importantly, while animation can be used instead of sprite rotations, it is often an unacceptable tradeoff that game developers should not be forced to make," he added.

Facebook also provides test results for a combination of browsers and operating systems. Unfortunately, the results are not that relevant at this point, since they are skewed by several factors, some inherent since it is only the first release of the benchmark, some methodological.

The browsers were run in Windows under a virtualized environment that doesn't really guarantee accuracy, especially since the test is so dependent on hardware acceleration and therefore driver support.

What's more, since hardware acceleration support is very much in active development and is at various stages in different browsers, this makes a bigger difference in the benchmark results than any other optimizations or technologies used by the browser makers.

Still, there is clearly a desire to push HTML5 game development forward. Mozilla has been encouraging the very same thing and has held a competition to distinguish the best games built with standard web technologies.

Social games are a big part of Facebook so there is a clear motivation to provide developers with the tools they need to create HTML5 games that will work on any device.

Facebook itself is focusing on web apps and HTML5 as a way of ensuring that it only has to develop a feature once and have it work on desktop and mobile platforms. However, Facebook insists that all of this does not mean that it plans to create its own games any time soon.