Could native games be compiled into HTML5 using asm.js?

Think about it. If you could compile SFML game into html5 using asm.js or other similar solution, you’d only need to write sfml extension and no porting would be needed.

asm.js is not sufficient itself, you must use a compiler like Emscripten, which is already what I do to get GDevApp running using the code of GDevelop. :slight_smile:

The main issue is that SFML is using OpenGL intensively and is not made for running with Emscripten. There is a limited support of OpenGL done by Emscripten but could be a lot of work to do for mediocre performance at the end.

This could be interesting to test though. :slight_smile: I was also thinking of merging both platforms, investigating solutions right now to do this.

I have already mentioned before but how about Chrome Native Client?

I think at the moment only Google Chrome has the support but seems the most efficient way to run C++ inside browser.

NaCl is nice, but unfortunately we need something that will work in most browsers. Hence asm.js and maybe in future WebAssembly.

NaCl would need heavy changes just to run in Chome. Not a good solution for me.

asm.js (or WebAssembly in the future) is easier to begin with, as it is generated by emscripten compiler, which is already able to compile GDevelop codebase.
Native games still heavily rely on SFML which can’t be used directly in the browser even when compiled with asm.js

By the way, if you are interested in Javascript, take a look here: (For now you have to build the library by yourself, but later I’ll add prebuilt js files).