WASM basic setup: Version mismatch console error
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:
I downloaded the other version (as specified in the comment) and put it next to the index.html
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.
if thats the only error - its a known problem, will fix soon!
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.
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.
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
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 :)
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"
This error is still happening, although the
sapp-wasmversion is now0.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!
can confirm :+1: thanks!
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, 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.
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
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