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 build (WASM) #14

Open
7 of 9 tasks
nathanleiby opened this issue Nov 7, 2024 · 2 comments
Open
7 of 9 tasks

Web build (WASM) #14

nathanleiby opened this issue Nov 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@nathanleiby
Copy link
Owner

nathanleiby commented Nov 7, 2024

Why?

Way easier to share and ship iterative improvements.

How?

@nathanleiby nathanleiby added the enhancement New feature or request label Nov 7, 2024
@nathanleiby
Copy link
Owner Author

nathanleiby commented Nov 8, 2024

Good progress on WASM build today: https://github.com/nathanleiby/drum-break/compare/4c9c9fa9b8288da73a8d4ce7d382851b33cf822a..66bff4c5c09eb538acbf986744526477392169c4

Got a build working that lets me keep Macroquad with its special wasm build toolchain, but include other wasm-bindgen deps! Much thanks to https://gist.github.com/tgolsson/d78f7887a8542f3fd6f125070e5e22d6?permalink_comment_id=4901010#gistcomment-4901010

One obvious issue has cropped up. The screen is flashing sometimes in WASM build. This is a reported issue for Macroquad web builds: not-fl3/macroquad#471 (comment)

In that case, it was due to loading a resource during the loop in a way that's expensive. Could that be my issue? It seems to flash just before a sound is played

  • ... is that when audio is being scheduled?
    • Interestingly, if there are multiple sounds in close succession it seems NOT to flash for each
  • .. does it have to do with fetching the data?
    • revisit idea of loading sound 1x and then cloning each instance for performance

Whatever my fix is, I should chime in on the Macroquad issue and share context. Maybe they can close the issue out if it doesn't seem to be a Macroquad isue. Contributing in some way to macroquad is one of my RC goals for the upcoming weeks!

nathanleiby added a commit that referenced this issue Nov 9, 2024
This resolves the 'blinking screen' issue seen in WASM in #14

The approach is to not do repeated reloading of expensive assets.

I'm following Kira advice here
https://tesselode.github.io/kira/playing-sounds.html

> If you want to play a sound multiple times, keep a copy of the StaticSoundData around and clone it each time you pass it to AudioManager::play
@nathanleiby
Copy link
Owner Author

Fixed the blinking screen issue ^ f4999f1

nathanleiby added a commit that referenced this issue Nov 19, 2024
relates to #14 WASM perf issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

No branches or pull requests

1 participant