What is the difference between read/load in storage and read/load from .json file

what is the difference between load in storage and load from .json file
Is .json better for desktop games ?

There are two different type of save/datastorage events

Filesystem (text/file/etc) and Storage.

There are differences for each of them, which you can read on the wiki here

https://wiki.gdevelop.io/gdevelop5/all-features/filesystem

https://wiki.gdevelop.io/gdevelop5/tutorials/storage-action-explained

At a high level, the file system actions cannot be used on mobile, but let you create actual save files which can work with cloud storage systems like Steam’s save cloud.

Storage works on both mobile and desktop devices. But the data is stored in an exe cache which isn’t compatible with cloud dave syncing.

I’m pretty sure that’s not how it works :thinking: Storage does save to a file, though it’s a leveldb file so it is not cleartext nor really readable without extra tools.

I guess though that Steam cloud save might not auto detect it as a save file by default, since it is a binary file that could be just a game file, not plain text?

IIRC you can find that file at appdata/Roaming/<You game name or "GDevelop" if you are in a preview>/Local Storage/leveldb on windows

Thanks Arthuro! I definitely could be going off bad info as I’m just going off memory here. Quick tests don’t show it at those locations for me, but it is late and I am probably not setting up storage correct in the test.

I do remember there being something about not being able to sync storage with Steam, but it may also just be that it is a DB file? Having never tried that, it could be old info too.

Edit: Okay, to close the loop on this, I definitely had my local storage events set wrong.
During preview, local storage events save to %appdata%\GDevelop 5\Local Storage\leveldb\randomnumbershere.ldb (%appdata% ends up pointing to your local AppData\Roaming folder)
This appears to be shared across all game previews.

Once you build your game to an EXE, it stores it at %appdata%\YourGameNameHere\LocalStorage\LevelDB\ into a set of multiple files, it appears to be some sort of combination of the .log file and the .ldb file depending on how much data you have.

If you use an HTML5 export/hosted game, it will be stored into your browser’s local storage. I’ve added this information to the Wiki here: Storage [GDevelop wiki]

With the above in mind, Saves using Storage events (instead of Filesystem events) will not likely automatically be picked up due to their structure (multi-file rather than single file) and location, but you could probably manually point them there.

With this new information, I’d say the biggest benefits for Filesystem is that you as the dev have more control around how/where the save files are stored, and you could split out save files (One for main settings, one for each save slot, etc). While you can still split out where the data is stored within the local storage system via Storage events, they’ll be retained in the same files.

Thanks again Arthuro for the clarification!

Generally i believe the filesystem is good if you want the user to mess with the games as you can provide them an easy to read and access file, for example if you want to make modifying/swapping saves trivial, or want to make some level builder that saves a file the user can share, etc. Otherwise storage probably does the same but better (fast, reliable, compressed, etc since it’s not inefficient cleartext JSON) and makes porting the game later easier since it’s cross platform.

1 Like