Loading the game fails

0 favourites
  • 15 posts
From the Asset Store
Is a circular loading screen with code ready to use. No Animation.
  • Hello,

    in my game I use the basic save and load feature provided by the System object.

    Saving the game works fine, "on save complete" triggers. But when I exit the game and start it again, "on load failed" triggers immediately.

    I've tested it as a signed APK on two different devices.

    What can cause the game to fail loading?

  • You need to post a screenshot of your code.

    Where did you put "Load" action? Is it in the Loader layout?

  • It used to be in my loader layout but I removed it. Now I don't have a loader layout. I save and load from my "Start Layout", which is the first layout that loads. Here's what it looks like:

  • Did you set "Use loader layout=No" in project properties?

    Does this problem happen in preview, or only in apk? If you can reproduce it in preview, press F12 to see if there are any error messages in console.

    If this only happens on mobile, try adding a small wait before "Load" action. Or add a "Continue" button to the layout and request players to press it.

  • Yes, "Use loader layout" says no. On the preview everything works fine.

    I tried to let the game load by pressing a "Continue" button but it still fails when testing with an APK.

    Also when the load fails, I can no more watch Ads or buy In-App purchases, seems like the plugins crash on loading the save file.

    Sometimes the load actually works, but it's not loading everything, for example some global variables didn't have the same value when I saved the game and the whole game behaves very weirdly.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm sorry, I don't know. Maybe the ads are somehow corrupting the save. Or the amount of saved data is too big. If you run the game in preview and open console, you should be able to see the size of save file. I would also try saving after a small delay, or try disabling/removing ads and videos and see if this helps.

  • But still thanks for trying to help me!

    This is what the console prints after the first save "Saved state to storage (77522 chars)". I don't know if that's too big.

    What else can I do if the save function is not working? Should I switch to local storage or use something else to save?

  • 77 kilobytes is nothing. You can also try to get a log from Android phone, maybe you'll see the error message there. Google "android logcat".

  • I ran Logcat, here's what it says while saving:

    SystemWebChromeClient: file:///android_asset/www/scripts/c3runtime.js: Line 2 : [Construct 3] Saved state to storage (63675 chars) chromium: [INFO:CONSOLE(2)] "[Construct 3] Saved state to storage (63675 chars)", source: file:///android_asset/www/scripts/c3runtime.js (2)

    Looks fine to me but the load is a bit weirder:

    04-11 17:25:33.009 32717 32717 D SystemWebChromeClient: file:///android_asset/www/scripts/c3runtime.js: Line 2 : [Construct 3] Loaded state from storage (63675 chars) 04-11 17:25:33.009 32717 32717 I chromium: [INFO:CONSOLE(2)] "[Construct 3] Loaded state from storage (63675 chars)", source: file:///android_asset/www/scripts/c3runtime.js (2) 04-11 17:25:33.024 32717 32717 D SystemWebChromeClient: file:///android_asset/www/scripts/c3runtime.js: Line 2 : [Construct 3] Failed to load state from storage: 04-11 17:25:33.024 32717 32717 I chromium: [INFO:CONSOLE(2)] "[Construct 3] Failed to load state from storage: ", source: file:///android_asset/www/scripts/c3runtime.js (2)

    Is the game trying to load two times in a row? First loading succeeded and then it fails? I pressed the load button only once.

  • It could be.. Seems like the error is happening on the next tick.

    Are you sure you don't have another "Load" action elsewhere in the events? Also, make sure to use "On tap" event and not "Is touching" condition for the button.

  • I now used the official example from Scirra for saving and loading on my android device which worked, this was the logcat output

    04-11 18:28:37.899 7686 7686 D SystemWebChromeClient: file:///android_asset/www/scripts/c3runtime.js: Line 2 : [Construct 3] Loaded state from storage (6493 chars) 04-11 18:28:37.899 7686 7686 I chromium: [INFO:CONSOLE(2)] "[Construct 3] Loaded state from storage (6493 chars)", source: file:///android_asset/www/scripts/c3runtime.js (2)

    I'm using the "on tap object" trigger and it's the only place where the game is trying to load.

    I tried to change my event a bit but it's still not loading correctly:

  • I still think the problem may actually be with the saving step. Have you tried to add a "Save" button (just for testing), instead of automatically saving after the video has finished? I would also try to test without the MobileAdvert plugin. Also, add "No save" behavior to everything you don't need to save.

    I'm out of ideas. If you manage to reproduce this problem in a small demo project, you can submit it as a bug:


  • I'm back from testing.

    I removed the automatic save feature and added a save button instead. Sadly it didn't work.

    After that I deleted the MobileAdvert plugin and removed the corresponding events and now the manual saving and loading is actually working!

    Sadly I definitely need ads so hopefully I can get it to work somehow.

  • It's working perfectly now. Manual saving and loading works fine with the MobileAdvert plugin. I checked some more sprites and objects and set them all to no save. Probably there was still some sprite interfering with the save file.

    So thanks again for your help!

  • Based on your earlier log it looks like it's actually loading a savegame twice - the first one succeeds and then the second one fails. Since it appears you load a savegame in 'On start of layout', and loading a savegame also triggers 'On start of layout', I would guess you accidentally made events that constantly recursively load the savegame, but (luckily I might argue) it failed preventing it getting stuck in a loop.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)