I’m planning how to save progress in my new game. There might be a large number of levels. Each level will store a few integers like score, time, star rating etc.
Is there a limit on how many files can be saved with sys.save()?
I’m tossing up having a small number of files with a lot of data, or one file per level. I like the idea of using many files, because the save time would be constant irrespective of which level the player has reached.
This is probably an OS/platform thing, so limits would be based on whatever resources the user has available in general. Probably not a big enough limit for you to worry about, but keep in mind OS operations add up in time.
Yeah, that makes sense. It would be interesting to hear people’s experience with this on various platforms, which approach Defold devs tend to take.
Until now I haven’t had to deal with more than a handful levels, and then it doesn’t really matter too much. With this game, which if proven popular, could easily have hundreds, maybe even thousands of levels. I’m trying to avoid having to change structure once it becomes big and plan for this now.
I suppose the next step is to test on device to see which becomes a problem first; many files or large files. In the meantime, if anyone has any experience to share I’d be delighted to hear it!
Our games have a ton of game related data files but most of them are in the bundle.
For saves in appdata we don’t use a ton of files, maybe 10 per profile and just whatever the user is at is saved so not many files are necessary.
You can optimize the size of your save data by not saving raw tables and instead using a custom binary data format. You could serialize then zip your save data on saving/loading too. If you give more specifics on what you are considering using / how big you expect your save files to be we can give better suggestions.
I would use a single file for saving the progress. Of course, the configuration settings are in a separate file. At least this is my approach, still not tested with Defold but tested in previous games (on Nintendo DS).
Probably there is something I am missing… Why are you worried about a table with 1K entries? Could there be any problem with lua or Defold I am not aware?
All progress in my game is a unique table with a lot of subtables… For a hundred of levels with these data for each levels: