Tuesday, August 26, 2014

Quake 3 in Javascript

This is pretty impressive. Even more impressive is the technology behind it.

Apparently, Quake 3 strictly separates game engine from game content. The latter are packaged as platform-independent bytecode and run in a virtual machine. That is, either interpreted, or, for more common platforms, compiled to machine code. The advantages are, among others, platform independence and sandboxing potentially unsafe game content.

The Javascript port includes a Javascript backend for that virtual machine: the bytecode is translated to Javascript, and the resulting Javascript source string is fed into eval, and run by the Javascript virtual machine inside the browser.

The performance is not bad, considering that we have a double-nested virtualization. The game runs very smoothly on my Chromebook Pixel.

No comments:

Post a Comment