GDevelop
GDevelop copied to clipboard
Fix the export of game using Box2d WASM library
Fix the export, but the preview no longer work.
I wonder what's making the preview to behave differently 🤔
A network preview works:
So the issue is because of the preview done locally, which does not use a web server. We run directly the index.html of the game as a local file, thanks to Electron access to the file system:
Sadly, it seems it changes the way the file is resolved.
@D8H This is what we can do:
- Pass locateFile when you initialise the library.
- If location.protocol === 'file', locateFile should return
Extensions/Physics2Behavior/Box2D_v2.3.1_min.wasm.wasm
. - Otherwise, locateFile should return
Box2D_v2.3.1_min.wasm.wasm
.
Check that:
- it works in preview and when the game is exported on desktop (i.e: the game runs in Electron)
- it works in network preview, Liluo.io and HTML5 exported on a webserver (i.e: the game runs on any webserver)
- it works when exported to an Android apk (i.e: the game runs on Cordova, which should run the game on a webserver, so this should be equivalent to the previous case... but let's be sure).
LGTM, at least in theory that's all I think is needed! Should work in preview, desktop export (electron), cordova, liluo.io and classic HTML5!
Tested on:
- Preview
- Liluo.io
- Windows
- Android
The test failure seems unrelated and pass on Travis.
e 104.0.5112 (Linux 0.0.0): Executed 30 of 890 SUCCESS (0 secs / 3.433 secs) 00:11
e 104.0.5112 (Linux 0.0.0) Firebase extension end-to-end tests Cloud Firestore Base read/write operations should delete and detect presence of a field from Firestore FAILED 00:11
Error: timeout of 5000ms exceeded 00:11
HeadlessChrome 104.0.5112 (Linux 0.0.0): Executed 31 of 890 (1 FAILED) (0 secs / 8.434 secs) 00:12
e 104.0.5112 (Linux 0.0.0): Executed 32 of 890 (1 FAILED) (0 secs / 8.688 secs)
...
e 104.0.5112 (Linux 0.0.0): Executed 879 of 890 (1 FAILED) (skipped 9) (0 secs / 35.427 secs)
Thank you! I've relaunched the CI to be sure.