Error running game on mobile with ammo

Hello i have a game i am working on that working fine in browser but when i try to run it on mobile i get

Uncaught Error: failed to load api/assets/files/Ammo/ammo.wasm.js

Any ideas?

1 Like

Hi @kdarius and welcome,

On which browser and device does the demo fail on mobile?

Are you able to share a url to try out?

galaxy s9 and tried both chrome and that samsung browser.

i just tried it with the build ur and it seems to work

But what can i do while editing

It should work while editing as well, I don’t have any problem with edit urls on mobile, running Ammo enabled projects.

Can you check if you have all the required Ammo files in your project added?

image

If not, head to your project settings and on Physics -> Import Ammo.

yeah i have those three files.

Does the same happen if you create a new empty project and enable physics?

well now it is working… no idea what that was

Thank you very much for your help

1 Like

It’s happening randomly to me as well @Leonidas

1 Like

Invoking @will and @vaios!

What do you think @slimbuck?

This happened to me as well with web download version, @will

Before this issue, the config.json had a part saying

..."useLegacyAmmoPhysics":true,"useKeyboard":true,"useMouse":true,"useTouch":true,"useGamepads":false,"i18nAssets":[],"externalScripts":[],"useModelV2":true,"libraries":["ammo.dcab07b.js"]}...

You can see that ammo.dcab07b.js is linked and a file with this name was on the top level of the exported ZIP (next to config.json).

Now, the “libraries” array is empty and the ammo.dcab07.js is not present anymore.

Hope this helps finding the error :slight_smile:

Note: copying the ammo.dcab07b.js manually from an older export and linking it in the “libraries” array manually makes it work again!

Edit: I can consistently reproduce this issue with “Download for web” export, with and without concatenating scripts. Could be related to the build process somewhere? :slight_smile:

1 Like

Hi @FreddyMac,

ammo.dcab07b.js is the legacy asm.js-only version of ammo. (This was replaced with the wasm module version which you import into your project).

It might be that project flags are getting confused between the old way and the new.

Are you able to give me access to a project that is failing so I can take a look?

Thanks!

1 Like

Hi @slimbuck,

Alright, I just realized that it’s not working in my Firefox because I disabled WASM for some other testing purposes. If I download the project as ZIP and launch it from FTP in Chrome, WASM version kicks in and works fine!

At first I thought the error was with the ammo.dcab07b.js because I saw it was missing, but obviously it does work without - I just have to re-enable WASM in my Firefox :slight_smile:

PS: can’t share a link because it’s a customer project we cannot show externally. But the issue is pretty much resolved for me now.

Thanks and have a nice day!

Hi @FreddyMac,

Thanks for letting me know. With WASM disabled, the module loader should have reverted to the fallback script (which is just an asm.js script). I will try reproduce this issue myself and see what’s up.

Thanks!

1 Like

Hi @slimbuck,

welp, now it does work in Firefox as well. Does indeed fall back to asm.js!

The problem seems to be on our side, our building pipeline seems to be omitting the fallbacks or something like that. When I launch it as standalone from the downloaded ZIP it works fine, just when I embed it into our React framework it seems to fail (it did work while the ammo.dcab07b.js was present, but that’s probably just a build configuration thing).

The issue is therefore probably 100% on our side. D’oh!

Sorry for wasting your time.

Cheers!

Hey @FreddyMac, no worries thats great news! :slight_smile:

1 Like