Bithack / principia

Open source physics-based sandbox game.
https://principia-web.se
Other
260 stars 25 forks source link

WASM port using Emscripten #154

Open rollerozxa opened 5 months ago

rollerozxa commented 5 months ago

Porting Principia to run in the browser with WASM and WebGL using Emscripten would be awesome.

Initially, the goal of the port could be to only allow playing community levels inside of the browser. This would make the lack of GTK3 dialogs less of an issue (and the small amount of dialogs you come across when playing levels could be provided by the WIP Imgui dialog backend).

I do know that cURL, Freetype, libpng, libjpeg and zlib work to build for Emscripten (see https://github.com/paradust7/minetest-wasm for some build scripts for those dependencies). SDL2 obviously supports Emscripten and they have a page with notes on porting an SDL2 app to Emscripten: https://wiki.libsdl.org/SDL2/README/emscripten.

From what I've read WebGL appears to be compatible with OpenGLES 2.0 (WebGL 1.0) or 3.0 (WebGL 2.0). Unsure what GLES version the Android version uses, but doing what the Android version does to display graphics sounds like a good start for the port.