The Epic Citadel demo of Unreal Engine 3 running in a browser using high-speed JavaScript and WebGL.
Chrome and Opera have become the first browsers to match Mozilla Firefox's support for Epic Games' Unreal Engine 3 and the Web-based Epic Citadel demo
that's built on the 3D graphics technology. The demo's computing
challenges include 3D graphics covered with 2D textures, rustling
leaves, flowing water, reflective stone floors, lens flare, and shadows
and other lighting effects.
Mozilla and Epic Games demonstrated the advanced Web programming
in March using a combination of Mozilla technologies: Emscripten that
converts C or C++ software into JavaScript, and asm.js that can run a
specialized subset of JavaScript much faster.
Mozilla has been trying to drum up support for asm.js, but Chrome and
Opera used their own JavaScript technology. (Opera Software, earlier
this year, shifted away from its browser engine, adopting Chrome's and
benefiting from Google's investment in the software.) The Epic Games
demo also uses the WebGL standard for 3D graphics, which Chrome,
Mozilla, and Opera all support.
Epic Games added Chrome 31 and Opera 18 to its Unreal Engine 3 supported browsers list. Martin Best, the product manager of games at Mozilla, noted the rival browsers' achievement in a blog post Tuesday.
The new browser support is notable, given the push toward Web programs
that run on any machine with a browser -- cross-platform flexibility
that has big advantages over writing native code that only works on iOS,
Windows, or some other specific operating system. But the maturity and
consistency of Web programming still leave a lot to be desired,
especially for complicated, performance-intensive Web apps.
Mozilla and Google got their Unreal performance with significantly
different approaches. Asm.js uses a technology called ahead-of-time
(AOT) compilation for its performance boost, with the Web app sending a
"use asm" hint to the browser to trigger the technology. Compilation is
the process of converting human-written source code into machine
language that a computer can execute. AOT compilation means the browser
can build an optimized version of the software in advance.
The Epic Citadel demo of Unreal Engine 3 running in a browser using high-speed JavaScript and WebGL.
But Chrome uses a different approach with its V8 JavaScript engine
called just-in-time (JIT) compilation that's standard nowadays for most
Web sites and Web apps. The JIT approach means the browser compiles the
JavaScript, monitors how it runs, and optimizes with new compilation as
it goes.
Google likes its approach because improvements to the JIT can mean all
JavaScript across the Web gets faster, not just what's specifically
created to take advantage of asm.js.
Google's "V8 people seem to want to JIT-optimize harder, not process
'use asm,'" said Mozilla Chief Technology Officer Brendan Eich, but he's
not convinced the performance will catch up to AOT compilation. In his
experience, Unreal Engine 3 on Chrome shows more "jank" from pauses
triggered by recompilation and
Firefox is faster to start running the software.
"Yet they do well," Eich said, praising Chrome's virtual machine that
runs the JavaScript programs. "V8 is a formidable JIT'ing virtual
machine."
In my tests of the two, Chrome showed a higher frame rate on a 2012 Retina-equipped
MacBook Pro. Firefox Nightly version 28.0a1 (2013-11-26) showed 52.4fps, but Chrome 33.0.1712.4-dev ran at 59.8fps.
Both versions sent the CPU fan whirring, though, so there's still work to be done.
Update, 11:24 a.m. PT:
Adds comment from Google.
The Epic Citadel demo of Unreal Engine 3 running in a browser using high-speed JavaScript and WebGL.