Page 1 of 1

[SOLVED] Android - loading a save file does not always work

Posted: Tue Jul 06, 2021 7:39 pm
by Bren
Hi guys,

I just encountered a new yet very unexpected issue with Android!

In a nutshell, I asked my code to save the game everytime a new dialogue is displayed - no autosave, no quicksave, only one save file called "1-1" (i.e. appears on first page & first slot of the save menu). And on the launch screen, I only have a "Start" button that checks the existence of the save file "1-1" and loads it (if it doesn't exist, it starts a new game).

When I test the game on Bluestack / Renpy, no problem => the "Start" button on launch screen does launch the save file "1-1" and I start exactly where I left the game ==> all good
But when I test the game on my Android device (with SD card), I sometimes encounter a weird issue when I start the app:
  1. 50% of times, the game directly loads the latest (and theoretically only) save file "1-1" without showing the launch screen - the screen just says "auto-reloading" and then directly displays the loaded file (a bit weird, but at least I start exactly where I left the game)
  2. The other 50% of times, the game properly start and I get to the launch screen (no direct loading of saved file); but when I click on "Start" button, the save file it loads is not the latest one=> it's an "old" "1-1" file that does not get me exactly where I left the game
So when I'm unlucky, I can get 3 times in a row the "old" "1-1" file when I start the app, i.e. the game would just not save the latest progression and just send me back to an old save => this doesn't make sense to me as there is supposedly only one save file called "1-1" that is replaced everytime I display a new dialogue...

My only guess would be that there are actually two different "1-1" files somehow, one on the device and one on the SD card:
  • The "proper" latest one would take me to case 1. (game automatically loads the latest file, no launch screen)
  • The "old" file would take me to case 2. (game shows launch screen, but I only get access to a weird old "1-1" file)
Just FYI, I have disactivated all automatic saves, including the ones from Android (in script.rpy):

Code: Select all

define config.save_on_mobile_background = False
define config.has_quicksave = False
define config.has_autosave = False
define config.autosave_on_choice = False
define config.autosave_on_quit = False
define config.autoreload = False
Has anyone encountered the same issue? Any advice would be a massive help, I'm completely stuck on this!

Many thanks!

Re: Android - loading a save file does not always work

Posted: Tue Jul 06, 2021 8:05 pm
by Imperf3kt
Have you tried setting quit_on_mobile_background True?
https://www.renpy.org/doc/html/config.h ... background

This will force the game to fully restart each time you close it and relaunch it, so you won't see the soft launch (auto-restarting), which should force the game to go to the main menu, triggering your load.


Just something to think about though, saving in every line of dialogue is not a good habit as you're hammering I/O, which will wear the users device out fast as well as slow your game down.

Re: Android - loading a save file does not always work

Posted: Wed Jul 07, 2021 5:21 am
by Bren
Hi Imperf3kt, thanks for your help! Will definitely try this tonight - hopefully the hard launch will make the game load the latest "1-1" save file (and not some old version that somehow exists).

About your side note, I understand your point - what would be the best practice here to make sure there's only one save file always up-to-date?

Re: Android - loading a save file does not always work

Posted: Wed Jul 07, 2021 7:19 am
by Lochana
Why not have the game save at sections instead of every line. Auto saving at every line is way too excessive.

Re: Android - loading a save file does not always work

Posted: Thu Jul 08, 2021 7:27 am
by Bren
Hi guys,

Thank you so much for all your help - tried Imperf3kt's solution, it works perfectly (I don't have any "soft launch", and the app properly loads the latest save file).
Here is the final code FYI:

Code: Select all

define config.save_on_mobile_background = False
define config.quit_on_mobile_background = True
define config.has_quicksave = False
define config.has_autosave = False
define config.autosave_on_choice = False
define config.autosave_on_quit = False
define config.autoreload = False

Regarding the saving frequency, I will try to set up frequent checkpoints as you guys suggested to make things smoother.

Thanks so much!