GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Fix the export of game using Box2d WASM library

Open D8H opened this issue 2 years ago • 3 comments

Fix the export, but the preview no longer work.

D8H avatar Aug 09 '22 16:08 D8H

I wonder what's making the preview to behave differently 🤔

4ian avatar Aug 09 '22 21:08 4ian

A network preview works: image

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: image

Sadly, it seems it changes the way the file is resolved.

4ian avatar Aug 10 '22 08:08 4ian

@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).

4ian avatar Aug 10 '22 08:08 4ian

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!

4ian avatar Aug 11 '22 11:08 4ian

Tested on:

  • Preview
  • Liluo.io
  • Windows
  • Android

D8H avatar Aug 11 '22 12:08 D8H

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)

D8H avatar Aug 11 '22 12:08 D8H

Thank you! I've relaunched the CI to be sure.

4ian avatar Aug 11 '22 13:08 4ian