-
Notifications
You must be signed in to change notification settings - Fork 65
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
Added Initial (experimental) web support. #902
base: master
Are you sure you want to change the base?
Conversation
I appreciate the work you've put in here, but just so there's no misunderstanding, my stance on supporting this hasn't changed much since my original reply in #477. If anything, I have much less time to dedicate to this extension these days, so I have even less bandwidth to spare for this, especially when considering whatever bug reports or CI issues that might arise from this down the road. It already costs me a full day to cut a release for this extension, due to smoke testing all the various platforms and architectures and their respective deployment methods. I'm not super excited about adding more permutations to that list. I'm not averse to merging this (when it's done) but there needs to be some sort of commitment from somebody with regards to taking on the above mentioned extra work. If everything goes as planned that commitment shouldn't have to extend much further than Q1-ish 2025, at which point this extension will ideally have been merged into Godot as an official module and released as part of Godot 4.4, shortly after which I will likely archive this repository. Don't quote me on that timeline though. I'm sure something will delay it. |
Totally understandable. I really appreciate all the work you've put into this extension, especially all the documentation and infrastructure. It was a pleasure to work on, in no small part to the hacking document and the overall structure and build process.
I'm happy to commit to this. I'm working on a project that relies heavily on Joints, and have found GodotPhysics sufficiently unpredictable and incomplete that I need another option. So I need to see this through one way or another, and I'd love it to be in a form that can benefit others. Here is what I propose: Emscripten 3.1.62 will likely drop soon, and Godot 4.3 final too. I'm hoping the combination of those two (or a followup 4.3.x) will eliminate the need to custom build the export templates in the medium term, but in the mean time I can produce those semi-automatically and host them. With the final release of 4.3 (or soon thereafter), we can add web support under an unsupported "experimental" tag to gather feedback, etc. I will handle the web-related bug reports (though I will be of limited help with any physics/math stuff, alas) and CI setup for this and any subsequent releases until Godot 4.x takes it in. I can start getting the various CI stuff going now in a separate MR? Thanks again for your help getting this going and for your stewardship of this extension! |
b9aed22
to
10cf9d5
Compare
I guess we'll have to see how these things develop, but I'm not super keen on relying on third-party export templates. I would probably prefer to see that this PR remains unmerged until Godot's official export templates are fixed.
Any reason why you couldn't do it in this PR? |
Totally fine with me. I'm hopeful this will happen with the 4.3 release.
Nope; happy to. Wasn't sure you'd want both things in one. :) |
Not a problem at all. I'll turn on the CI stuff for you in this PR. Note that there are quite a few CI jobs, due to the combinatory explosion of platforms and architectures, so it takes roughly an hour for each CI run to complete fully, and much longer than that if there are others queued up obviously. |
Oh, and I don't run the packaging job as part of the regular CI, so you'll have to run that manually on your own fork to test that, which you should be able to do by pressing the "Run workflow" button here. EDIT: You'll probably want to comment out (or just remove) the macOS part of the packaging though, found here, since it will try to sign the builds, which will fail if you don't have all the credentials set up as secrets in your own fork. |
Also, I realize this deviates from the Godot conventions, but for what could end up being a long-running PR like this one, I would appreciate if you could refrain from force-pushing and instead commit/merge like normal. It makes incremental reviews easier. |
307c9d3
to
e902070
Compare
949e0e2
to
680e5d1
Compare
I've successfully tested this on single threaded builds from the latest godot master. I've also also created a patch(*) to add a separate profile for threaded builds (the two binaries are not compatible sadly), which can works with emscripten 3.1.61+git (see godotengine/godot#93143 ). The patch also assumes godotengine/godot#93556 to allow the two binaries to co-exists and be exported according to the chosen variant. (*) threads.diff.txt (NOTE: In the patch, I'm abusing the |
Awesome! Thanks very much, @Faless! Do you happen to know if 4.3 final's export templates will be built with Emscripten 3.1.62 (or +git)? OR if the output of 3.1.61+git works with the existing export templates (single threaded)? I will pull this patch into the PR, unless @mihe would prefer it split into a new PR? I'm hopeful the export template issues can be ironed out before 4.3 so we can merge and release (at least with an experimental flag or something) near final 4.3-time. |
No, by all means, I'd prefer to see the web support finished as much as it can be in this PR. We'll iron out whatever kinks there might be after it's been pulled in. |
Looks like you'll likely need to add |
Do not use MEMORY_GROWTH with threads.
I tested the joins.tscn example scene on Windows and an M1 Mac on the following browsers:
And it worked flawlessly! Really impressed. Amazing thanks to tetious and the godot-jolt contributors. I will be using jolt in game jams from now on. |
Good news! The combination of 4.3b3's (default) export templates and godot-jolt built with Emscripten 3.1.62 works perfectly in my tests, both threaded and not threaded. Bad news! I merged master and that broke the build. Something to do with adding I'll have an updated zip posted for folks to try once I get the build sorted. I think we're getting close, though! EDIT: |
I've been meaning to try out this PR for myself, as I was planning on moving some things around, but time has been scarce. What I'd like to see changed is (and I'm happy to do this myself when I have time):
I'm also curious whether the amount of threads reported by Godot is correct for |
About this, we shouldn't need to specify the |
@mihe I'm happy to tackle at least some of these, and I think @Faless is probably right that we can just omit all the memory related flags as a "side_module" "DLL" or whatever. I don't know enough about the low level details to really wrap my brain around how wasm dlink works and how it differs from other platforms.
Possibly not, through if you pass any sorta SIMD, you also have to pass If anyone has the time and inclination, two items I could use help on:
|
@mihe When you get a sec, would you mind updating the jolt fork, please? The fix is in for excluding Thanks! |
@mihe It actually is, if you compile with the emscripten flags |
Sorry, I ended up replying in that Jolt issue before I saw your reply here. My poorly phrased comment was meant as a continuation of this review comment. My concern was more about why it's SSE 4.2 specifically and not SSE2, and why Jolt requires passing it through I somehow missed that WebAssembly had its own set of SIMD instructions though. Is that somehow influencing the reasoning behind passing the x86 flags manually? |
I'll reply in the other ticket. |
Rip out threads preset. Rename web threads option and wasm -> wasm32. Add nothreads feature flag.
This adds web support, lightly tested on with a medium sized project on:
A caveat:
Please try it out!
Option A
addons/godot-jolt
folder.Option B
You can build everything yourself following the build instructions in this PR (see building.md). Note that you will need to build the web export templates using Emscripten v3.1.39 otherwise godot-jolt will crash at load.
Please report back!
Either option you pick, please let us know how it works for your project.
TODO
"RuntimeError: memory access out of bounds" when using a RayCast3d.