macroquad icon indicating copy to clipboard operation
macroquad copied to clipboard

WASM basic setup: Version mismatch console error

Open GRASBOCK opened this issue 3 years ago • 11 comments

First off, I am glad, that all the examples I have tried so far work locally out of the box. Thanks for working on such a library!

Now I want to run it in the browser. I set up the project as described on https://crates.io/crates/macroquad. Compiled to WASM (issue appears in both debug and release) and used the same index.html. Running it on Firefox the canvas looks just like it should, but the console is outputting an error: version_mismatch I downloaded the other version (as specified in the comment) and put it next to the index.html version_mismatch2 This bumped up the version from 0.3.11 to 0.3.13. It won't affect the program, but I would like to know to which extend it is a problem and if it can be fixed.

Aside from the console error I also want to ask, what exactly the .js script does.

GRASBOCK avatar Feb 24 '23 22:02 GRASBOCK

if thats the only error - its a known problem, will fix soon!

not-fl3 avatar Feb 25 '23 03:02 not-fl3

Hmm, it's a bit strange. Maybe you can help me out here. When I use the generated wasm file on my local machine with a basic-http-server it works fine (aside from the error message described above). However when I put the whole thing on a remote host it fails (canvas remains empty) with two error messages. Screenshot_2023-02-28_19-07-48 WASM failed to load, probably incompatible gl.js version The first error message stems from the mq_js_bundle.js and is probably the cause of the second.

I tried this with both the sample file in the Readme as well as my own. It's strange that hosting remotely apparently has an impact on whether the program can run. Do you have any clues as to what might cause that?

I looked into the gl.js file and was able to determine that it fails for the if (typeof WebAssembly.compileStreaming === 'function') part of the if statement. I wasn't able to narrow it down further.

GRASBOCK avatar Feb 28 '23 18:02 GRASBOCK

However when I put the whole thing on a remote host it fails (canvas remains empty) with two error messages.

double check that remote server support application/wasm MIME type

not-fl3 avatar Feb 28 '23 18:02 not-fl3

Oh wow, that actually worked faster than expected. I am using nginx as a http server. So all I had to do was give it

include mime.types;
types {
    application/wasm wasm;
}

like described here Thanks so much for the quick reply :)

GRASBOCK avatar Feb 28 '23 18:02 GRASBOCK

This error is still happening, although the sapp-wasm version is now 0.4.0:

Version mismatch: gl.js version is: 0.3.13, rust sapp-wasm crate version is: 0.4.0

for macroquad = "0.4.2"

emoritzx avatar Aug 26 '23 13:08 emoritzx

This error is still happening, although the sapp-wasm version is now 0.4.0:

Version mismatch: gl.js version is: 0.3.13, rust sapp-wasm crate version is: 0.4.0

for macroquad = "0.4.2"

yes, the error is still there, it should be fixed. but if thats the only error - everything should still work just fine!

not-fl3 avatar Aug 26 '23 17:08 not-fl3

can confirm :+1: thanks!

emoritzx avatar Aug 29 '23 00:08 emoritzx

yes, the error is still there, it should be fixed. but if thats the only error - everything should still work just fine!

@not-fl3 Do you mean that this error should not prevent the game from running?

I don't get any other error, but the game works on Windows but not in WASM.

a-n-d-a-i avatar Sep 10 '23 06:09 a-n-d-a-i

yes, the error is still there, it should be fixed. but if thats the only error - everything should still work just fine!

@not-fl3 Do you mean that this error should not prevent the game from running?

I don't get any other error, but the game works on Windows but not in WASM.

yes, if its the only error - everything should be fine!

You can check some miniquad demos, like https://not-fl3.github.io/miniquad-samples/helmet.html (takes some time to load) to see if its a browser/OS problem and some sort of a macroquad bug or the problem is in the build setup.

not-fl3 avatar Sep 10 '23 08:09 not-fl3

The other examples run fine! Might be an issue with my game, this is basically my first Rust program. It does run on Windows, though there are some graphical glitches (the original game used a different rendering system, I need to rewrite some of the math to account for the differences.) https://andai.tv/games/pong-goof/ https://github.com/avelican/pong-rs

a-n-d-a-i avatar Sep 10 '23 21:09 a-n-d-a-i

I would recommend trying to build smaller examples to make sure that your build setup is correct, to have a point of reference with something that works

not-fl3 avatar Sep 11 '23 00:09 not-fl3