Skip to content
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

Web/HTML5 export #18

Open
ashtonmeuser opened this issue Apr 22, 2023 · 3 comments
Open

Web/HTML5 export #18

ashtonmeuser opened this issue Apr 22, 2023 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@ashtonmeuser
Copy link
Owner

Just allowing Godot Wasm to be used as a module is not enough to export for web/HTML5. This is because Wasmer (the Wasm runtime used by this project) is not able to be comiled to Wasm by Emscripten which is what is happening internally when compiling the web/HTML5 Godot export templates. The following error is presented.

[bin/godot.javascript.opt.js] Implicit dependency `modules/wasm/libwasmer.javascript.opt.a' not found, needed by target `bin/godot.javascript.opt.js'.

I see a few solutions to this but none that are a simple addition to this project.

  1. Use a Wasm runtime that is able to be compiled to Wasm such as Wasm3. This library is should be able to be compiled by Emscripten. Unfourtunately, it does not seem to adhere to the Wasm C API and would therefore require a significant rework of this project or a shim to add API equivalence.
  2. Create a small shim library that exposes the Wasm C API (which is used by this project) and translates the relevant Wasm interactions to JavaScript. Because the browser has a Wasm runtime, including another runtime e.g. Wasmer or Wasm3 seems superfluous. This seems like the more sensible option.
This was referenced Apr 22, 2023
@fire
Copy link

fire commented May 2, 2023

Can you provide a design for the option exposes the Wasm C API?

@fire
Copy link

fire commented May 2, 2023

In https://github.com/ashtonmeuser/godot-wasm/blob/master/config.py I would return False if the platform is web for now.

@ashtonmeuser
Copy link
Owner Author

ashtonmeuser commented May 3, 2023

Can you provide a design for the option exposes the Wasm C API?

I'll play around with this to see how feasible it is and update this issue. In short, we'd need to override parts of the Wasmer implementation of the Wasm C API to be a bridge to JS. Wasmer cannot be compiled to Wasm but that's okay because there is obviously already a Wasm runtime exposed to web exports that is accessible by JS.

In https://github.com/ashtonmeuser/godot-wasm/blob/master/config.py I would return False if the platform is web for now.

Done. Only supporting Linux, macOS, and Windows.

@ashtonmeuser ashtonmeuser added the help wanted Extra attention is needed label May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants