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

Further fixes and improvements related to WebAssembly #9444

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

oleg-derevenetz
Copy link
Collaborator

@oleg-derevenetz oleg-derevenetz commented Jan 11, 2025

  • Allow to build the Wasm version with or without multithreading support, as desired. The advantages of the non-multithreaded version are that it does not require a web server to return the special set of HTTP headers.
  • Enable LTO for the Emscripten builds.
  • Build the Emscripten version in the strict mode.
  • Improve the mechanics of music feeding during playback, fix the deadlock (see the comments in the corresponding source files).

I'm currently running Wasm build of fheroes2 (with threads) in the browser (Chromium-based) in the AI auto control mode for a few hours, and I should say that the situation with playing background music has improved significantly. The only strange thing is that immediately after starting the game and when loading the first map, the memory consumption of the corresponding browser tab increases sharply from ~500Mb to 5-6Gb for several seconds ( and during this time music is played intermittently). After a few seconds, the memory consumption drops back to ~500Mb, and loading of other maps (or the same map) no longer causes such an effect, memory consumption is not growing anymore. This is very similar to the GC behavior, which means that some JavaScript code is most likely eating up memory (not the fheroes2 itself).

P.S. What's interesting, there is no such an effect in the Firefox.

@oleg-derevenetz oleg-derevenetz added improvement New feature, request or improvement Wasm WebAssembly version of the engine labels Jan 11, 2025
@oleg-derevenetz oleg-derevenetz added this to the 1.1.6 milestone Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement Wasm WebAssembly version of the engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant