-
Notifications
You must be signed in to change notification settings - Fork 83
🚧 [WIP] FMOD web support (HTML5) #210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Firefix also doesnt work for my SQLite plugin so I assume the issue with Firefox not working is on the side of godot-cpp itself. |
|
Hey I've been trying to take a stab at this recently to see if I can help and learn a bit more about C++. What version of emscripten and FMOD are you compiling with? From what I understand, w32 is the recommended format to work with now, why are you using the bitcode binaries instead? EDIT: This thread on the FMOD forums seems to indicate that statically linking to the wasm binary like the build currently does will cause linking errors, I'm seeing the same ones right now. We may need to include the binaries instead like we do for the other platforms. |
|
Hello ! I worked on a little game project using FMOD with Godot using utopia's addon. If you need a tester for this PR with a small game using fmod to make a web export don't hesitate reaching out ! |
|
Hey! wanted to checkup on progress of this/if it's still being worked on. If not, I'd be glad to pick up the torch and get this finished up at least on the code side of things. |
|
Feel free to try your hands on it. It hasn't been touched in months. |
|
I originally raised the PR for this but have not worked on it ever since due to hitting blockers. If anyhbody can figure out how to make it work that would be brilliant. |
Could I ask what issues you ran into other than the Memory stuff listed above? I'm going to take a crack at it soon. |
|
I use GoDot and FMOD and I would pay someone to finish this |
|
I would also pay for this to be completed. xD Someone, anyone take my money. |
|
Opened a new thread on the forums, maybe this will help us get somewhere https://qa.fmod.com/t/emscripten-linking-errors/22429 EDIT: One of the FMOD devs said they are going to look into the situation, hopefully they will come up with some sort of solution for us Just to add some extra info, this solution where we statically build the FMOD GDextension against the shared object library is actually against FMOD's EULA since we would technically be distributing a "tool for an end-user application". It seems a bit unfair that way, the only allowed option would be to compile FMOD into Godot, and all of that effort would be just for distributing Godot FMOD HTML5 games. I'm hoping we can dynamically link it like we do on the other platforms or (long shot but fingers crossed) they make some kind of exception in the EULA for us and other 3rd party engines. |
|
Update, as of 2.02.27, FMOD has started compiling the HTML5 build with position independent code However, FMOD still doesn't work on the web due to some runtime errors and I'm struggling to get a readable traceback from it. I don't have much experience in C++/emscripten to begin with so if anyone is interested in helping, please let me know! |
hey, any updates on this? ❤️ they say Godot officially supports version 3.1.62 of emscripten, maybe worth a shot to try that one? |
|
Sorry to "any updates?" this, but wanted to check and see if this was something that is potentially possible, or if it's a lost cause. I wish I knew anything about how it all worked to pitch in, but unfortunately I don't have the skillset. Happy to pitch in some funds if somebody is available to head it up. |
|
Sorry for the delay, I got sort of discouraged at the time and just haven't circled back to yet in my side project rotation. As far as the linked Godot issue, that was not an issue for me as I was building with Emscrypten 3.1 and (as far as I remember) I believe I was successful in building the web build for Godot, which I was attempting to do to enable extra debugging info. When the build fails to launch in the browser, Godot suggests I compile with debug mode on, but I think after compiling both Godot and FMOD with debug enabled, I was still getting the exact same suggestion and the error message was no more usable. I'll try to take another crack at it soon. |
|
@pmdevita amazing, could you perhaps also share a branch of your progress? More eyes could then also take a look at it and we can figure this out together. |
|
This branch https://github.com/pmdevita/fmod-gdextension/tree/web-support is the closest thing online to what I have right now, you want to build against a recent FMOD >2.02.27, <2.03 and you compile against the w32 binaries. I think it should no longer require messing with the LINKFLAGS. I'll try to update my branch sometime soon with my local changes |
|
Branch is now updated to master https://github.com/pmdevita/fmod-gdextension/tree/web-support-4.4 Rough instructions
scons target=template_debug platform=web fmod_lib_dir=path/to/fmod threads=no verbose=yesPath to FMOD is the path to the root directory of the unpacked HTML5 SDK. FMOD does not support threads in HTML5 (yet, hopefully). If all goes well, it should build without error or warning, whereas previously it would complain a lot about -fPIC. Exporting from Godot and running it in the browser will give you this error
This is around where I got stumped, if I did somehow make it past this error (and I'm not sure I did) I was met with an equally as useless error about enabling verbose debugging or something. Does anyone know how to compile with I think we should be building with FMOD has some docs on HTML5 here but they are inconsistent with what the SDK presents and are not very clear otherwise. |
|
Hello, I am investigating fmod with godot on the web, and naturally reached this pr. So if I understand, @pmdevita has the most progress, but work is generally stale. What is the feasibility of reaching something working? How much work would be needed? Is it just about figuring out the SConstruct? Would modification to source be required? |
|
@sphynx-owner I have attempted continuing the work myself but hit a brickwall again. Fixing the SConstruct is not a big deal, I am even able to run the game in the web. The only issue is that no audio plays because banks cannot be loaded. This is due to the custom bank loading logic this extension has: in order to load banks properly, we are running our own custom bank loader but that one won't work in the web. I had the idea to use preprocessor directives to do a cheeky if-else and disable any code that would be incompatible when building for web and using the native behaviour instead. |
|
@bitbrain I appreciate your resopnse. In fact, this sounds very promising. I have a few questions then:
Also, perhaps unrelated, but I came across a quote from the FMod documentation:
Is this related to bank loading logic? does that mean that every game using fmod on the web will need a dedicated server for content streaming? |
|
Where can I find your latest progress? |
|
@bitbrain Did you continue it from my work? How did you get it to not crash at launch? I figured we'd have to revisit the bank loading, I think your idea with the preprocessors makes sense. We're gonna need a web specific loader. For @sphynx-owner I believe we have custom bank loading logic so that we can store banks in the Godot game bundle file. |
|
@sphynx-owner let me dig out the changes and push them here.
@pmdevita yes :)
This is as far as I got: the demo project runs in the browser, but with no sound and a ton of console errors. |
|
I see. Thank you for digging this out for me. |
|
I don't mean to rush, but do you have a PR that I can clone and have a look at myself @bitbrain? You might have pushed already and I just don't know where to look |
|
I believe I got pretty close to having a compiled web bulid, but yet so far away. I got @pmdevita's branch, and followed his instructions, however I am getting this error when trying to compile. I am on windows so I am already shooting in the dark here: |
|
Update: I got the latest fmod gdextension, and applied the same changes that @pmdevita had done in his fork |
|
@sphynx-owner I pushed changes to this branch so it is up to date with The required structure in My toolchain: |
|
@bitbrain thanks for the update. What FMOD version do I get? because 2.03.06 does not have the |
|
I would also like to clarify, you were able to run the game in the browser (albeit without sound banks loading). Were you doing that from the editor with the "run-in-browser" button? |
|
My main concern right now is that I am not seeing any significant difference in your changes to those that @pmdevita did, yet you were able to enter the game without an -sAssertion error. This leads me to believe your success is due to toolchain specific setup. |
|
@sphynx-owner I had to tweak it slightly, as without it, I got the same error as @pmdevita. Can you join the Discord server? We can debug the issues you are facing together in the #gdextension channel: https://discord.gg/nS34H6fY |
|
Bank loading seems to work fine now. However, still no sound. The main issue right now is that gdextension |
|
I found a dirty workaround to get this working on @sphynx-owner 's branch here Here's a copy-paste from the message I left on the Godot Fmod Discord: Maybe this will shed some light onto whats going on with the banks, but I managed to get the HTML5 build to run by doing this:
This made the banks available to the game and it seems to function as intended |





Closes #50
This PR aims to add support for web support via
wasm.Todo
SConstructto considerwebas a platformscons platform=webpass & buildlibGodotFmod.web.template_debug.wasm32.wasmcorrectlyEmscripten)Uncaught TypeError: Module.FMOD_JS_MixerFastpathFunction is not a function onmessagewhen trying to play soundsKnown issues