Of course there are a few restrictions, and in our cases we had to make some changes to the code before we could have it running properly on a browser:
Emscripten has no support for client side arrays in OpenGL. Even though it has a pretty good support for OpenGL ES2 via webgl, using client side arrays is not supported. This is not really a problem: we just used array buffer everywhere we had client side arrays.
Some standard C functions are missing. The one that really hit me was
strsepthat we used in the levels parsing code. In that case I just modified the code to use
strtok_rinstead. As a bonus, it turns out the code using
strtok_rwas actually cleaner than the original one.
Sound. When doing a portable game, sound is probably the most complicated part. For the graphics, using Opengl ES2 pretty much works on every possible platforms, but for the sounds, there is still no clear standard library that can be used everywhere. So, as we already had an openAL and an OpenSL ES backends for the desktop and android versions, we created an other sound backend using