Ren'Py How can I delete persistent data on Android?

Mastur Bar

Member
Game Developer
Oct 7, 2021
232
165
Hello everyone!

I'm testing my project on Android and eventually I install a more up-to-date version on the phone to see if everything is working correctly, but I'm running into an annoying problem.

When I try to run the new version, the phone loads the previous version.
Then I erase the application data and finally the new version is loaded (with this I also lose the saves and all the permanent data).
After some time of playing, the application crashes and everything goes back to the beginning, losing everything that had been done so far.

Because of that, I plugged my phone into the PC and deleted all the saves contained in the game folder, hoping that would solve the problem.
After all, now that there were no more save files, I would play from the beginning and possibly no more crashes.
To my surprise, when I tried to open the game again on my phone, I had a save from a VERY old version, which came from nowhere, since I deleted all the saves from the phone.

Somehow, it seems that Android keeps saves and persistent data in some inaccessible place on the device, and with that, I can't get a totally clean install to see if it would solve the problem with the crashes.

I know that on Windows, Ren'py keeps saves and persistent data in 2 folders:
1) The game folder
2) Roaming/AppData/Renpy

Apparently something similar happens on mobile, but I can't find this AppData folder on Android anywhere.
How can I completely delete these saves and persistent data on Android? (Without having a hidden backup coming from nowhere.)

Thanks in advance!
 

MissFortune

I Was Once, Possibly, Maybe, Perhaps… A Harem King
Respected User
Game Developer
Aug 17, 2019
4,914
8,026
Are you using a decent file explorer? Something like Cx Explorer should be good enough. Even Samsung's One UI has a decent one.

Android/Data/com.devname.gamename/files (for example mine would look like Android/Data/com.missfortune.wewerejustkids/files) is where you'll find the saves (at least on my phone, non-rooted Note 10+). Not sure about persistent data, though.
 
  • Like
Reactions: Mastur Bar

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,369
15,285
Apparently something similar happens on mobile, but I can't find this AppData folder on Android anywhere.
Ask Ren'Py.

renpy.loadsave.location.locations is the list with all the path used to save the data. Each entry is a Location object, so to know where the files are saved you need this:
Python:
init python:
   def listSavesDir():
       tmp = []
       for l in renpy.loadsave.location.locations:
           tmp.append( l.directory )
       return tmp
There's perhaps a function that already do this for you, but I don't remember it right now.
 
  • Like
Reactions: Mastur Bar

Mastur Bar

Member
Game Developer
Oct 7, 2021
232
165
Are you using a decent file explorer? Something like Cx Explorer should be good enough. Even Samsung's One UI has a decent one.

Android/Data/com.devname.gamename/files (for example mine would look like Android/Data/com.missfortune.wewerejustkids/files) is where you'll find the saves (at least on my phone, non-rooted Note 10+). Not sure about persistent data, though.
I used Windows Explorer, as I accessed the phone files from the PC.
This folder I managed to find and deleted all the saves contained there.
That's why I thought it's weird, the mobile loaded a save from apparently nowhere.


Ask Ren'Py.

renpy.loadsave.location.locations is the list with all the path used to save the data. Each entry is a Location object, so to know where the files are saved you need this:
Python:
init python:
   def listSavesDir():
       tmp = []
       for l in renpy.loadsave.location.locations:
           tmp.append( l.directory )
       return tmp
There's perhaps a function that already do this for you, but I don't remember it right now.
Thanks, I'll give it a try. ;)


I was able to figure out the cause of the Android crashes by myself.
Ren'py comes with Model-Based Renderers enabled by default, as the Ren'py developers intend to ditch the classic Renderers, but this causes issues on older devices.
The crashes solution was given by the following line of code:
Python:
# Turn Off Model-Based Renderers
define config.gl2 = False
I put this below the others define commands on options.rpy and played for a long time on mobile (approximately 1 hour) without crashes.
Make sure your game doesn't use any features that rely on Model-Based Renderers before disabling them, of course.

I'm leaving this here to help others who may be experiencing a similar problem, as I haven't found this on the forum anywhere.
 
Last edited: