Unreal JavaScript
blog.bitops.com
blog.bitops.com
That game blew me away when I was younger—the graphics were truly stellar, better than Quake 2 and Half-Life, games released at the same time—and for a moment I thought someone had managed to port it to JavaScript.
I would pay good money to play it in my browser.
If that's not proof that asm.js is a cool concept, then I don't know what is.
I don't understand how they're making this so freaking fast; they've done some special work to get it running with WebGL.
> We’ve had success in running it in other browsers, but it’s somewhat hit and miss – it heavily depends on the quality of the WebGL implementation, memory management, and JavaScript engine
Anyway, Firefox does a great job with it. I'm impressed.
Next thing you know, antivirus software for web browsers (sic) will become the norm.
I'm sort of skeptical when they say they ported "Unreal" though. What I see there is an Unreal map viewer. I don't see any physics or AI or sound going on. The thing is about doing a map viewer, pretty much all the work is going to the graphics card, so it really doesn't matter what language you use. I think I'll be more excited when I see a demo that actually plays like a full game.
[15:16:42.533] TypeError: asm.js type error: Internal codegen failure (probably out of memory) @ http://www.unrealengine.com/html5/UDKGame-Browser-Shipping.js:9649
[15:16:50.798] out of memoryI tried downloading the entire page (html,css,js) and increasing TOTAL_MEMORY (et al) in the js, but with the same result.
Nightly-23 from 07 May (firefox-20.1, same result). It did work on ubuntu-amd64 though.
Details:
Windows 7 (latest Intel GPU drivers), Firefox 23 nightly
Ubuntu 13.04 with custom Mesa git (Mesa 9.1 also works, but a bit slower), Firefox 23 nightly
I had to set layers.acceleration.force-enabled variable to true in Firefox (in about:config) because it is blacklisted for some reason on Linux/Intel (probably some previously resolved bug).
The browser Window was maximized in 1920x1080, and game view was not full-screened.
Cpu is i5-3320M on Thinkpad X230
Windows: 40.5 FPS Linux: 43.6 FPS
Did you mean with emscripten to asm.js
They compiled C/C++-code using Clang (or possible gcc w/dragonegg, but my guess is Clang 3.2 as that's the supported compiler for emscripten) to LLVM bytecode and then to JS/HTML5 using emscripten, which is aware of asm.js and optimizes for it.
Mozilla (which Kripken is also highly involved with) are behind asm.js and is supported in the latest nightly of firefox (supposedly giving speeds to within 2x of native code, which is damn impressive), and the guy behind emscripten (again, Kripken) works for Mozilla.
I'm don't know to what extend emscripten is part of Mozilla or his own personal project.
---- Slides by Kripken on emscripten (http://kripken.github.io/mloc_emscripten_talk)
Download them with: 1) curl "http://cdn.unrealengine.com/html5-4c0913f/UDKGame-Browser-Sh... -H "Referer: http://www.unrealengine.com/html5/ > UDKGame-Browser-Shipping.js
2) curl "http://cdn.unrealengine.com/html5-4c0913f/UDKGame_Data.js -H "Referer: http://www.unrealengine.com/html5/ > UDKGame_Data.js
And all you get is 5.4M / 4K of unreadable bytecode.
It's just gzipped. ungzip the files (turns 5 MB into 50 MB) and you can read them as plain text javascript.
curl --compressed "http://cdn.unrealengine.com/html5-4c0913f/UDKGame_Data.js" -H "Referer: http://www.unrealengine.com/html5/" -O // EMSCRIPTEN_START_ASM
it becomes if((d|0)!=36620|(d|0)!=0&(c[b+4>>2]|0)!=0)
{c[1779323]=6}b=c[1312365]|0;d=7084512;
c[d>>2]=c[1312364]|0;c[d+4>>2]=b;b=7084520;
d=c[b>>2]|0;if((d|0)!=36620|(d|0)!=0&(c[b+4>>2]|0)!=0)
{c[1779323]=7}b=c[1312363]|0;d=7084520;
c[d>>2]=c[1312362]|0;
all on one line for nearly the rest of the file. It might as well be bytecode. Actually many bytecodes are more understandable.asm.js isn't just an evocative name, it's a reasonable description... it's assembly in Javascript.
A solution is missing that fits between C++ and Javascript.
Now, of course, there are a lot of advantages to having things really working in a browser - less sensitivity to latency sometimes being a critical one. But there are a lot of enterprises using remote access to thick client applications, even some specialised SaaS vendors.
But the performance will always behind a native application.
Since you mentioned Java, note that in some cases JavaScript with asm.js can be faster, for example http://j15r.com/blog/2013/04/25/Box2d_Revisited
Will it be much jobb to make this work in all browsers?