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

Add missing rustflags for exporting to web #63

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

scroggo
Copy link
Contributor

@scroggo scroggo commented Nov 29, 2024

According to a message in the Discord server, you probably need some more flags in order to properly export to the web. In my experience, these flags make it work! I have not tested to verify whether this is the exact set needed or a superset.

According to [a message in the Discord server](https://discord.com/channels/723850269347283004/1311869218572210207/1312024661860683847), you probably need some [more flags](https://discord.com/channels/723850269347283004/1274080437198651546/1275336695264575542) in order to properly export to the web. In my experience, this makes it work! I have not tested to verify whether this is the exact set needed, or a superset.
@PgBiel
Copy link

PgBiel commented Nov 29, 2024

I believe the flag suggested in the existing PR should be enough, can you confirm? #56

@scroggo
Copy link
Contributor Author

scroggo commented Nov 29, 2024

I believe the flag suggested in the existing PR should be enough, can you confirm? #56

@PgBiel , I'll list my steps here in case I did something wrong, but that flag by itself seemed to be insufficient for some features.

Steps:

  • remove the new flags I added, except for "-Cllvm-args=-enable-emscripten-cxx-exceptions=0"
  • run cargo +nightly build -Zbuild-std --target wasm32-unknown-emscripten
  • From the Godot editor, click Remote Debug > Run in Browser 1

When the browser window opened, my game did work, BUT the sound did not2. I don't know which of the other flags might be required to make sound work.

Footnotes

  1. Sometimes Remote Debug also includes options to Re-export Project and Stop HTTPS Server. I suspect that if they were showing I may have needed to click one or both of them in order to see the updated version?

  2. I restored the flags used here, rebuilt, stopped the server, and ran again, and the sound works again.

@PgBiel
Copy link

PgBiel commented Nov 29, 2024

When the browser window opened, my game did work, BUT the sound did not

That's new. The singular flag in the existing PR should be enough to make it work with Godot 4.3+, but I hadn't heard about problems regarding sound. Would be nice if others could confirm that they can reproduce this problem first. (Maybe also post this information in godot-rust/gdext#438 - that just that flag works but no sound, and the flags you list here work with sound as well - so others can see and try to reproduce)

@scroggo
Copy link
Contributor Author

scroggo commented Dec 6, 2024

In this comment, @milesdesiran suggested

If @scroggo wants to add the book documentation like in godot-rust/book#56 , that would be helpful - that PR has similar changes, but has been left unattended by the creator for a few months.

We can pull more from that PR into this one, though it looks like there's still some discussion about some of the particulars and I'm not sure what best to recommend. I think adding this line (now that I have removed some lines that turned out to not be necessary) would be beneficial by itself.

@PgBiel
Copy link

PgBiel commented Dec 6, 2024

I think adding this line (now that I have removed some lines that turned out to not be necessary) would be beneficial by itself.

I tend to agree, even though further improvements to this docs page are planned, I think there isn't harm in just adding this flag for now and potentially helping out some users.

cc @Bromeon for further thoughts - if you agree, I think this PR could be merged as is.

@Bromeon Bromeon added the error Mistake in the book label Dec 6, 2024
@Bromeon Bromeon merged commit a295ce8 into godot-rust:master Dec 6, 2024
4 checks passed
@Bromeon
Copy link
Member

Bromeon commented Dec 6, 2024

Thanks a lot! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error Mistake in the book
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants