Mozilla wants you to get your game on -- in your browser

Mozilla goes gunning for native code speed with a plan to "supercharge" JavaScript, and it wants to use games to spread the word.

Seth Rosenblatt Former Senior Writer / News
Senior writer Seth Rosenblatt covered Google and security for CNET News, with occasional forays into tech and pop culture. Formerly a CNET Reviews senior editor for software, he has written about nearly every category of software and app available.
Seth Rosenblatt
3 min read

SAN FRANCISCO--If you could play high-end, 3D games in your browser at the same speed as on a console, would you? Here at the annual Game Developers Conference, the maker of Firefox revealed a plan to get you to do just that.

Mozilla's current holy grail is getting the mix of HTML5, JavaScript, and CSS that powers the modern Web to run apps at speeds that rival native code, the operating system-dependent languages underpinning apps on iOS, Android, Windows 8, and other proprietary systems.

The not-so-secret weapon in Mozilla's plan is something called ASM.js, said Director of Engineering Vladimir Vukicevic. "It's a dialect of JavaScript that can optimize [code] much better. It's around two times as fast," he said.

Mozilla announced here today that through a partnership with Epic Games, it's ported Epic's Unreal Engine 3 to the Web using ASM.js and the JavaScript compiler Emscripten. Mozilla said that it's working with other big-name gaming companies including Disney, Electronic Arts, and ZeptoLab.

Brendan Eich, the creator of JavaScript and Mozilla's chief technical officer, said that the Web is ripe for improvement when it comes to games. Developers "look at the web and they see the need for a plugin, [which means] you have to get users who don't have them to get them." Along with restrictions in Safari on iOS and Internet Explorer 10 on Windows 8 Metro that prevent people from installing plug-ins, such as Flash, Silverlight, and QuickTime, the process is becoming "harsher," he said.

Basically, Mozilla is building a way for people to run browsers with all the powers of current plug-ins, but without the plug-ins themselves.

Martin Best, the product manager of games at Mozilla, said he expects game developers to be interested in creating browser-based games because it will cut down on a problem that he called "code fracturing." Developers "only have to support HTML5, instead of many different kinds of native code," he explained.

A demo game from Epic called Citadel (embedded at the top of this story) shows off what the ported Unreal Engine 3 can do. When combined with the in-development Web Real-Time Communication protocol, game developers will be able to make games that incorporate high-resolution 3D graphics and the social interactive aspects in browser-based games.

There's another reason besides gaming for Mozilla to support native code speed in the browser: Firefox OS. The company has spent the better part of the past 18 months, at least, developing Firefox into a mobile operating system.

"It really unlocks the ability for people to take advantage of the hardware on Firefox OS," Vukicevic said.

Of course, developing games for multiple platforms isn't the only arena where "fracturing" is a problem. Browsers suffer from it as well, and while Eich said that ASM.js will work in other browsers now, it's only been optimized for Firefox so far. ASM.js is currently optimized in the Firefox Nightly builds, and is expected to arrive in the Firefox stable in June.

Eich is hopeful that the other browser vendors, including Google, Apple, and Microsoft, will make the effort to optimize ASM.js performance. "This is the modern 'harmony' era," he said with a slight wry tone to his voice. "I can't speak for the other vendors, but they like that it's all JavaScript. You have predictable performance, and our friends find this compiler back end appealing to write for."

Mozilla's hope is that ASM.js optimization will get into other engines. Without support from its competitors, high-speed, high-resolution games will have to find another way into your browser.

Corrections at 6 p.m. PST on March 27, 2013: The game demo that shows off the ported Unreal Engine is called Citadel, and Brendan Eich described the performance of ASM.js as "predictable."