Epic Partners With Mozilla To Port Unreal Engine 4 To The Web

Epic and Mozilla today announced that they are porting Unreal Engine 4 to the web.

At last year’s Game Developers Conference, Mozilla showed a port of Unreal Engine 3, the foundation for many AAA games, running in the browser. That was a bit of a wake-up call for many developers, given that this kind of plug-in-free gaming experience in the browser seemed impossible just a few years before.

The Mozilla tools that made this possible were asm.js, the organization’s high-performance subset of JavaScript, and the Emscripten compiler that can take C/C++ code and turn it into asm.js code that can run on any browser. None of this would work without WebGL either, of course. Firefox, which now features asm.js optimization in its stable version, can run this code at about 1.5x native speed (when compared to the compiled C++ code).

As Mozilla’s engineering director and inventor of WebGL Vladimir Vukicevic told me, a year ago the Unreal Engine 3 demo was just that – a tech demo. Now with Unreal Engine 4, Epic is going beyond the demo and is making the web a core platform for developers who use its engine for their games. While Epic and Mozilla are just showing a demo of the engine running in the browser right now, it will soon be available under Epic’s standard terms for developers.

“This technology has reached a point where games users can jump into via a Web link are now almost indistinguishable from ones they might have had to wait to download and install,” said Brendan Eich, CTO and SVP of Engineering at Mozilla in a statement today. “Using Emscripten to cross-compile C and C++ into asm.js, developers can run their games at near-native speeds, so they can approach the Web as they would any other platform.”

Here is video of Soul and Swing Ninja Epic, the two demos Epic is showing at this year’s Game Developers Conference:

When Mozilla first publicly showed asm.js, it was running at about 2x native speed (and it was only available in Firefox’s experimental nightly channel). Since then, Vukicevic noted, the team improved the compiler, but also added caching to ensure that startup times for large apps weren’t too long. These applications, after all, tend to rely on a large number of graphics and sound assets, and those have to be downloaded before the game can run.

soul_ninjaLooking ahead, Mozilla game platform strategist Martin Best told me, the team plans to focus on optimizing asm.js for mobile, too. Developers, he argues, want tools that can allow them to build cross-platform apps. “On mobile, we are in a similar place to where we were on the desktop a year ago,” he said. Support on Firefox OS, for example, is still somewhat lacking, he admitted. He believes that with the 1.4 release in the next few weeks, however, the team will have gotten asm.js and WebGL on Firefox OS to the point where it’s at least in a minimum viable state. Performance on mobile right now is also close to 1.5x native speeds, though the native speeds on mobile do tend to be a bit slower. All of the optimizations the team does for mobile, though, tend to flow back to the desktop, too.

One game developer who made an early bet on asm.js is Trendy Entertainment’s NomNom games, which showed a first web-based demo of its Monster Madness game back in December 2013. That made it the first company to release a commercial game based on asm.js and WebGL and since then, the company’s CTO Jeremy Stieglitz tells me, it has decided to make web versions a core part of its strategy going forward. Half of its users now play the web version of Monster Madness.

In porting the game from its C++ code base to asm.js, he told me, the problems the team encountered had less to do with the compiler as with porting the graphics to WebGL. Even so, it took just over a week to port the game over to the web.

He also noted that even though Firefox is currently the only browser to support asm.js, the team is seeing its game run at about 60 percent speed on Chrome. That’s enough to make it playable, and given that most casual games don’t use 100 percent of processor power and don’t always have to run at 60 frames per second, the team decided that the reach of the web platform is worth the performance tradeoffs.

With Native Client, Google is also working on a project that aims to bring high-end 3D graphics to the browser. Its approach is different, though. While Mozilla is betting on JavaScript, Google gives developers the ability to run their native code right in the browser. So far, however, other browser vendors haven’t implemented this technology and even in Chrome, it’s still off by default.