Unreal gaming from within the browser
Having recently introduced asm.js as a way of running C/C++ applications using a highly optimisable subset of JavaScript, Mozilla has joined Epic Games to present the technology being applied to a well-known platform at the Games Developer Conference in San Francisco. A port of the Unreal Engine 3 game engine to JavaScript allows games to be played in the browser without a Flash plug-in. The port only uses HTML5, WebGL and JavaScript technologies, and asm.js ensures that the games are almost fast enough to meet the performance levels of native implementations.
The developers say that porting the code with Emscripten only took them four days, which is rather impressive considering the approximately one million lines of code. Mozilla says that with this technology it is also opening up the path for web-based 3D games on mobile devices that can compete with native games. Mozilla's own developers have already demonstrated the web's potential in this field with a demo of BananaBread that is available as source code.
An asm.js optimiser can currently be found in the form of OdinMonkey in the nightly builds of Firefox; it is due to become a mainstream Firefox component with release of Firefox 22 in June. Emscripten takes LLVM bitcode, created by compiling C and C++ code with the gcc-llvm or clang compilers, and recompiles the bitcode into JavaScript; recent work on Emscripten has enabled it to produce code which uses only the asm.js subset of JavaScript.
(djwm)