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

WASM version improvements #9411

Open
2 of 12 tasks
ihhub opened this issue Jan 5, 2025 · 15 comments
Open
2 of 12 tasks

WASM version improvements #9411

ihhub opened this issue Jan 5, 2025 · 15 comments
Labels
improvement New feature, request or improvement low priority Low priority item which could be addressed in the future Wasm WebAssembly version of the engine
Milestone

Comments

@ihhub
Copy link
Owner

ihhub commented Jan 5, 2025

Preliminary checks

Describe the problem requiring a solution

We've recently added WASM version of the engine in #9406. However, there are many things we need to do to make this version up to our standards.

Describe the possible solution

This is a list of tasks which we will need to do:

  • add documentation as we've done for other platforms
  • provide all JS files as a part of the package: no files should be downloaded from the Internet
  • explicitly state in the page Heroes of Might and Magic II, not Heroes 2
  • add a description at the bottom of the page explaining what this page is for and also why this version might crash/doesn't work/be slow. Important: state that all uploaded files are actually being uploaded on the same machine and being stored in a cache
  • wait till Add multi-threading variants to sdl2_mixer emscripten-core/emscripten#23094 is merged
  • deploy this version as a part of GitHub Actions to https://ihhub.github.io/fheroes2/
  • change the main readme file to link the deployed version of the engine
  • verify the WASM version on different browsers (possibly limit access only for desktop versions as we don't know at the moment how to handle file loading on mobile devices)
  • add an option to download the demo version of game via a separate button as we did for Android
  • add copyright info for index.html page
  • once a player exits the game we should show the initial index.html page

Additional info

No response

@ihhub ihhub added improvement New feature, request or improvement Wasm WebAssembly version of the engine labels Jan 5, 2025
@ihhub ihhub added this to the 1.1.6 milestone Jan 5, 2025
@ihhub
Copy link
Owner Author

ihhub commented Jan 5, 2025

Hi @oleg-derevenetz , could you please look through the proposed list and comment if anything doesn't not make sense or I missed something?

Hi @zenseii , would you mind to take a look at possible changes in the documentation?

Hi @ololoken , could you please check if any of these tasks can be handled by you?

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Jan 5, 2025

deploy this version as a part of GitHub Actions to https://ihhub.github.io/fheroes2/

I think we need to solve the issue with pthreads first. There is an unmerged (yet) PR to the upstream emscripten repo that should allow us to build fheroes2 with pthreads and throw away all these Emscripten-related crutches for our AsyncManager (and probably should resolve the issue with the background music chokes).

add an option to download the demo version of game via a separate button as we did for Android

I think we can try to do it another way - we can bundle the demo version by default (this way, the user can immediately start playing the demo version), but allow users to use their own game assets. To do this, we will need to refine the UI, but it needs to be refined in any case. Any objections or maybe other suggestions?

@ihhub
Copy link
Owner Author

ihhub commented Jan 5, 2025

Hi @oleg-derevenetz ,

While we discussed similar topic regarding usage of demo version in the past and concluded that it should not violate copyright according to its licence file, by shipping the engine with the files from the demo version we might be entering the gray area of law. The license allows to redistribute the demo version but we aren't going to distribute it but our own engine which might be considered as a derived work according to Ubisoft's EULA file.

Also, to be consistent with other platforms we should allow to download the demo version but not to ship with it.

@zenseii , what is your opinion about this?

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Jan 5, 2025

The license allows to redistribute the demo version but we aren't going to distribute it but our own engine which might be considered as a derived work according to Ubisoft's EULA file.

As far as I understand, the demo version that is freely available everywhere has only original 3DO license, which doesn't impose any restrictions related to "creation of derivative work" and other additional restrictions from Ubisoft, and Ubisoft cannot retroactively impose additional restrictions on something that was already shipped on a certain terms by 3DO. It can only impose restrictions on something that it ships now on its own. But I'm not a lawyer and you are right, this looks like a gray area.

@zenseii
Copy link
Collaborator

zenseii commented Jan 5, 2025

@oleg-derevenetz and @ihhub. As pointed out, the license of the demo doesn't really prevent shipping the demo files, but this might still be enough to provoke Ubisoft to make some sort of action to shut it down or cause trouble.

Therefore I think if we can avoid taking one step into the gray area/provoking them, which we have made efforts to avoid up until now, then that is best.

It's a risk vs reward situation: will the user experience be so much worse by not shipping the demo files that it makes it worth the risk?

@ololoken
Copy link
Contributor

ololoken commented Jan 5, 2025

Slightly updated module launcher https://turch.in/fheroes2/
I will add link to the repo after some code cleanups

@ololoken
Copy link
Contributor

ololoken commented Jan 5, 2025

It's better to build launcher as standalone project: no issues with shipping of 3rd party data, I mean wasm build should not contain anything related to licensed materials, even links

@ololoken
Copy link
Contributor

ololoken commented Jan 6, 2025

Here is repo with wasm module launcher https://github.com/ololoken/fh2-ems
Added support of zip archives

@ololoken
Copy link
Contributor

ololoken commented Jan 7, 2025

Fill free to use https://github.com/ololoken/fh2-ems in any way you want.
Deployed version: https://ololoken.github.io/fh2-ems/
Current implementation supports following features:

  1. download demo version
  2. init game data from directory or from zip(I'm considering to add fetch data by url)
  3. en/ru languages(en by default)
  4. full screen toggle

Quick test results: in all major desktop browsers ff, chrome and safari build works stable (sometimes pages crashes in chrome, at least I saw it once on XL map day ~40-45); on mobile devices: iphones, ipad, galaxy tab, and some chinese android build stable crashes page in one-two turns on any map, I guess oom.

@zenseii
Copy link
Collaborator

zenseii commented Jan 8, 2025

Hi @zenseii , would you mind to take a look at possible changes in the documentation?

@ihhub,

I can change the documentation, but since I'm not following every step of the port development, I'm not sure exactly what the final state of the port and its implementation will be like. Is it already good enough for the documentation to be written?

@ihhub
Copy link
Owner Author

ihhub commented Jan 8, 2025

Hi @zenseii , at the moment WASM version is very unstable and it's not ready for the public. Therefore, we don't need to change documentation as of now.

@ihhub ihhub added the low priority Low priority item which could be addressed in the future label Jan 8, 2025
@ihhub
Copy link
Owner Author

ihhub commented Jan 8, 2025

I am marking this issue as low priority as we don't want to spend many resources to support an unstable version.

@polybluez
Copy link

polybluez commented Jan 10, 2025

Btw I've also done a web version in the past (the build is very old at this point). Open the console, click "download demo version" and wait til it is successful :)
https://webheroes2.pages.dev/

@ihhub
Copy link
Owner Author

ihhub commented Jan 10, 2025

@polybluez , are you offering help in this?

@polybluez
Copy link

@polybluez , are you offering help in this?

I guess, if you don't mind. It will take me some time to catch up with what happened since the last time I've worked with fheroes2, though

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 low priority Low priority item which could be addressed in the future Wasm WebAssembly version of the engine
Projects
None yet
Development

No branches or pull requests

5 participants