Best way to port c++ game to web

DavidColson picture DavidColson · Jul 27, 2012 · Viewed 8.1k times · Source

I realize the above question is rather broad so I will narrow it down. I have a simple opengl c++ game engine that lives in a static library (could be converted to a dynamic lib).

I have been thinking of ways of getting it to run in web. From what I can see I could use ActiveX or Google NaCl to run the c++ code in browser. But these technologies do not seem easily cross platform? Or maybe I have misunderstood.

Another option I have seen is converting the engine to javascript and WebGL and running in an HTML5 canvas. Would this be slower than c++? It would be very cross platform though.

What do you think is the best option, or better yet is there any other option I have missed?

EDIT: what about a custom plugin similar to the unity webplayer?

Answer

Endre Simo picture Endre Simo · Jul 27, 2012

There is a library created by @kripken which is still under development. It takes LLVM bitcode and convert into Javascript.

You can see the project page here, with working examples. https://github.com/kripken/emscripten/