konstructs / client

A voxel based game client.
http://www.konstructs.org
MIT License
49 stars 8 forks source link

Port Konstructs to run as a web app using WebGL under Emscripten with asm.js/wasm? #237

Open satoshinm opened 7 years ago

satoshinm commented 7 years ago

Hello, curious if there is any interest in adding a "web browser platform" target to Konstructs (in addition to the current platforms of Linux, Windows, and Mac), taking advantage of WebGL and asm.js/wasm through emscripten? The end goal being to allow the Konstructs client to run directly in modern web browsers, and connect to servers with no need to download/install native software.

I found Konstructs after having gotten a basic port of Craft, Konstruct's predecessor, to function in the browser via Emscripten: https://github.com/fogleman/Craft/pull/175 - and began searching for more developed forks of Craft. There's a lot of advanced features in Konstructs and I understand it is now no longer a fork, so it could be a promising alternative for this purpose if there is interest.

Here's what I have so far:

The biggest hurdle I see is Konstructs heavily relies on #version 330 GLSL shaders, using features not available in WebGL 1's version of GLSL equivalent to #version 100. Maybe would be more feasible after WebGL 2 is widely available, based on OpenGL ES 3.0, supporting these new features. The Nanogui library should also be possible to port, though I haven't gotten that far yet, and have abandoned development for now.

Current status: some progress but nonfunctional, posting this in case anyone wants to pick it up and develop further.

nsg commented 7 years ago

This is interesting, we have considering adding a WebGL target earlier but dropped it to focus on the current client.

@petterarvidsson and me have actually discussed earlier about the possibility to use a lightweight 3d engine to replace some of the existing rendering code, and that includes nanogui. We have been looking at https://github.com/urho3d/Urho3D with also has has emscripten support.

We think that that WebGL 2 looks like a acceptable solution considering that Firefox, Opera and Chrome already support it, and I guess that the rest will soon catch up.

We have also been planing to replace the current TCP networking with WebSocket. This can also be helpful for a browser based game.