Of course things are not quite this simple as the code has to be modified to change the way that resources and frameworks are used, e.g. draw to canvas rather than a bitmap.
To prove that it can be done, Mozilla and Epic games ported the Unreal 3 game engine in just 4 days. Given that Unreal 3 has over 1 million lines of code, we have to assume that most of it went across unmodified. The code runs at near native speed and is said to give a native feel to games running in the browser.
Mozilla is suggesting that this points the way for porting and implementing games from scratch, but there are some problems. In particular, there is the download time for the extensive resources that a 3D realistic game needs - textures, sounds, maps, models and so on.
There are some interesting things to consider about where we find ourselves. Google is forging ahead with NaCL and an extended version PNaCL, which also uses the LLVM intermediate language to allow code to run in the browser at native speeds. The only difference between this and the Mozilla approach is that in Google's case the LLVM is JIT compiled to native code rather than asm.js.
Both Chrome and Firefox support enough modern HTML5 infrastructure to be compatible enough to expect that an LLVM program might run under both after suitable compilation.
It might just be that LLVM is the language that will be the common target for high performance web apps.
This of course leaves IE out in the cold, but as it doesn't support OpenGL it has no 3D graphics and so is looking increasingly pointless as a platform for this sort of web app. There are rumors that IE11 might support OpenGL, but these have not been confirmed
Mozilla promises that you can examine the code of Unreal 3 and run the demo. Details are to be found on hacks.mozilla.org but there is nothing available at the current time.
Jay Forrester. the computer pioneer who invented core memory while working on Project Whirlwind at MIT in the 1940s, and is even better known as the founder of the field of system dynamics modeling, d [ ... ]