Browser platform support#848
Conversation
it'd probably also need porting to 64-bit wasm before merging as was mentioned in the forum thread, but really, amazing work on this 🎉 |
| #ifdef __EMSCRIPTEN__ | ||
| SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); | ||
| SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); | ||
| SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); | ||
| #else |
There was a problem hiding this comment.
this should probably be done by forcing gles2 on browser, rather than #ifdef-ing the version, that way if GLES3 support is ever added to the opengl3 backend (as a delta touch backport possibly?), webgl2 can be used with full user shader support
There was a problem hiding this comment.
GL context creation is deep in js module guts generated by emscripten. So it's better to set it from "native" code.
There was a problem hiding this comment.
GL context creation is deep in js module guts generated by emscripten. So it's better to set it from "native" code.
yeah, but the ifdef'd out code already sets 2.0.0 for GLES in the very same function, that's what i'm confused about
There was a problem hiding this comment.
To be honest I just didn't want to search SDL_GL_* attribute which is not supported and ruins context creation, later I will try hunt it.
|
|
||
| # Non-Windows version also needs SDL except native OS X backend | ||
| if( NOT APPLE OR NOT OSX_COCOA_BACKEND ) | ||
| if( NOT APPLE OR NOT OSX_COCOA_BACKEND AND NOT EMSCRIPTEN ) |
There was a problem hiding this comment.
the logic itself might not need it, but it'd be good for parenthesis to be used (since mixing OR and AND)
|
also this: https://github.com/UZDoom/UZDoom/blob/trunk/src/common/audio/sound/oalsound.cpp#L639-L643 probably needs an ifdef to check for the emscripten version of openalsoft, or else a bogus warning will be printed |
It's better to check if AL_VENDOR == "Emscripten" |
a91d00d to
3e8c7f2
Compare
yeah, just something so that this warning doesn't print |
Certain things won't work without OpenAL Soft features, like sounds that use loop points (which don't cover the whole sound) or use stereo sound for 3D/world sounds, and "area sounds" may not sound correct. Some warning that the audio may sound wrong may be appropriate. |
…dd flto optimisation
afaik emscripten supports a ton of openal features |
|
yep, loop points, spatial sounds, hrtf, etc |
Thanks for opening this PR! We'll review it soon.I'm a bot that checks for some common problems. I'll update this comment with anything I find. Looks like it's your first time contributing!
Here are some minor issues, that might need fixing:
|
|
not sure if its just me but i get a lot of weird mouse snapping with this, would be cool if it was fixed before merging. 2026-01-03.23-09-44.9MB.mp4 |
|
Absolutely unbelievable. It works so damn well!!! Congratulations, this is absolutely legendary. Just tested and its working like a charm. What is preventing this to be merged officially? Are you working on in something specific at the moment? About networking, do you have a plan to approach it? Thanks!! |
|
|
Thanks @RicardoLuis0 for the kind response. Perhaps I can try helping making sense of stuff. Honestly this is the only gzdoom/uzdoom wasm implementation working on the internet at the moment, and it works very well. Legendary works. Will be amazing to make all that ztuff run in the browser, open many possibilities for the future of videogames lol @ololoken what are you working on at the moment? |
|
@babycommando I'm working on Serios Sam. @RicardoLuis0 totally agree I will continue wasm fork support. Another demo: |
|
Hey @ololoken, woah Voxel Doom <3 I just cloned your branch at https://github.com/ololoken/UZDoom/tree/emscripten-trunk and tried building locally, but got stuck around Currently trying to wrap my brain around how you made a couple things there.
Could you share how you usually build it? Perhaps you have the exact emcmake cmake commands or a rough script, if you could share the sequence it would be helpful. The demos work beautifully, so I'm clearly missing something in the build setup. Thanks again, this fork is seriously amazing!! |
|
@babycommando it's supposed that you have to build 3rd party libraries using emscripten toolchain. Just |
|
@ololoken Got it, that makes sense now. So for your local build, do you just build/install libvpx and glib with emconfigure/emmake into the Emscripten environment, then rerun UZDoom cmake? Or do you avoid glib by patching bundled fluidsynth to use the glib stubs for EMSCRIPTEN? Also, for VPX, are you using upstream libvpx with emconfigure ./configure && emmake make install? update: managed to compile libvpx locally so the project dont cry more about it, but glib-2.0 used by ZMusic still a problem, when trying to build it I'm getting: update 2: finally got to build glib-2.0 manually, I ended up indeed replacing libffi with that emscripten version and it worked. Also later on when compiling it, it also asked about building zlib manually. After that, I finally got glib-2.0 far enough to stop failing at configure. update 3: got past the huge C/Cpp error wave! The mistake was building it with vulkan not disabled. Now I'm passing the flag -DHAVE_VULKAN=OFF and it seems to be building. update 4: Phew, after a long time it finally compiled, I put it over some dumb html file to see what happens, initially it was only throwing a cpp pointer errors 🤣 but it was just me not mounting the wad correctly. It worked!!! Music, performance, everything working just so well. It is lovely to finally see this running. Also could you provide the html and js files you are hosting the wasm into? Perhaps it would be way more helpful if you could just share an installation instruction of what to do from the moment I clone the repo to build and run it so we don't fall on those traps anymore. Also did everything on windows powershell which might have been an extra problem. Anyway this is legendary ::) Thanks! |
|
@ololoken let me know if you read my previous message up there. If you could provide installation instructions that you are doing in your environment, as well as the html/js if possible for the demo page it would be very, very nice. Thanks. It was super cool to make it run but I lost some time on it building random stuff as mentioned previously, probably did something wrong. Also nice that you got lemon, re2c and zipdir as the node wasm modules now. thanks! |
There was a problem hiding this comment.
This is indeed solving the problem of having to do the hackish workaround for lemon, re2c and zipdir. Gracefully fixes that part, thanks. Perhaps we can make libvpx and FluidSynth (glib-2.0 -> libffi/zlib) build automatically as well as part of the next commits
Description
Adds wasm32 platform support. By default works in 32-bit mode with single thread.
Demo: https://turch.in/uzdoom+ashes2063/index.html?lang=en
Right now it's more PoC for discussion than PR ready to merge.
TODOs:
Checklist