Over the weekend we published a post which detailed Javascript advancements to position the web browser as a respectable replacement for native code. Asm.js allows for C-like languages to be compiled into easily optimized script executed at near native performance on asm.js-aware browsers, but are still functional as plain Javascript otherwise. If you wish to see a presentation about asm.js and compiling native code into web code, check out an online slideshow from Alon Zakai of Mozilla.
If, on the other hand, you wish to see an example of a large application compiled for the browser: would Unreal Engine 3 suffice?
Clearly a computer hardware website would take the effort required to run a few benchmarks, and we do not disappoint. Epic Citadel was run in its benchmark mode in Firefox 20.0.1, Firefox 22.0a2, and Google Chrome; true, it was not run for long on Chrome before the tab crashed, but you cannot blame me for trying.
Each benchmark was run at full-screen 1080p "High Performance" settings on a PC with a Core i7 3770, a GeForce GTX 670, and more available RAM than the browser could possibly even allocate. The usual Firefox framerate limit was removed; they were the only tab open on the same fresh profile; the setting layout.frame_rate.precise was tested in both positions because I cannot keep up what the state of requestAnimationFrame callback delay is; and each scenario was performed twice and averaged.
Firefox 20.0.1
- layout.frame_rate.precise true: 54.7 FPS
- layout.frame_rate.precise false: 53.2 FPS
Firefox 22.0a2 (asm.js)
- layout.frame_rate.precise true: 147.05 FPS
- layout.frame_rate.precise false: 144.8 FPS
Google Chrome 26.0.1410.64
- Crashy-crashy
For Unreal Engine 3 compiled into Javascript we notice an almost 3-fold improvement in average framerate with asm.js and the few other tweaks to rendering, Javascript, and WebGL performance between Firefox 20 and 22. I would say that is pretty enticing for developers who are considering compiling into web standards.
It is also very enticing for Epic as well. A little over a month ago, Mark Rein and Tim Sweeney of Epic were interviewed by Gamasutra about HTML5 support for Unreal Engine. Due in part to the removal of UnrealScript in favor of game code being scripted in C++, Unreal Engine 4 will support HTML5. They are working with Mozilla to make the browser a reasonable competitor to consoles; write once, run on Mac, Windows, Linux, or anywhere compatible browsers can be found. Those familiar with my past editorials know this excites me greatly.
So what do our readers think? Comment away!
This is really interesting
This is really interesting and could mean alot for PC game development. Just out of curiosity though, what kind of framerates would we expect to see from this demo while not in a browser? Is there a large or negligible difference?
Id like to see performance
Id like to see performance results from the demo running natively. Do they evenhave a citadel demo out?
Not really. Loading the map
Not really. Loading the map through UDK I tend to get about 240-270 FPS. So this HTML5 implementation is about ~45% slower if you go by that metric (which is flawed on so many levels such as different quality settings, different benchmark path, etc… heh but it's the best I can do)
Benchmarks published by Mozilla show a performance hit of roughly 50% when compared to native… but Epic Citadel is not one of their benchmarks.
And that does not even mention all the optimizations which can go into both the browser and the application going forward. Point is, the gap is getting narrow enough for some applications to make the leap.