Emscripten allows applications and libraries written in C or C++ to be compiled ahead of time and run efficiently in web browsers, typically at speeds comparable to or faster than interpreted or dynamically compiled JavaScript. It even emulates an entire POSIX operating system, enabling programmers to use functions from the C standard library (libc).[5]
The Unity, Defold, and Godot game engines provide an export option to HTML5, utilizing Emscripten.[14][15][16]Unreal Engine had this export option but it has been migrated out of the engine to a community member plug in.[17] The Source Engine, has a community developed port for Emscripten dubbed "HalfLife2JS"[18]
In December 2014, the Internet Archive launched a DOSBox emulator compiled in Emscripten to provide browser-based access to thousands of archived MS-DOS and PC programs.[20][21][22]
Creation
Emscripten was created by Alon Zakai in 2010, motivated by his desire to port his fork of the open source first-person shooter game Sauerbraten, known as Syntensity[23], to the web. Sauerbraten (also known as Cube 2) is an open source FPS game[24], and Syntensity was Zakai’s project that extended the Cube 2 Engine for greater flexibility. Observing the increasing shift of applications to web browsers, Zakai began developing Emscripten as an LLVM-to-JavaScript compiler, aiming to make it possible to run existing C and C++ code, such as game engines, directly in the browser. In early blog posts, Zakai explained that his long-term goal was “to run Syntensity, or a smaller version of it, on the web”[25], and Emscripten was released as open source shortly after its initial development, making it available for the broader community to experiment with and contribute to.[26][27]