Frequent saving issues in Idle game
Frequent saving issues in Idle game
So long story short, I'm making an idle game and want to save the progress.
Money are changing very frequently also the user can upgrade and buy stuff frequently too.
I looked up: https://docs.moodkie.com/easy-save-3/es ... -the-cache
But I'm not sure if this is going to fix the performance since as I understand the file saving will be with some timer
for example every 10 seconds. But what if the user closes the game?
Should I go and add OnApplicationQuit() in all the spots where is saving or should i just have a single OnApplicationQuit which
should right the cache to a file?
Is there any good practices or common user expectation for saving in Idle games?
Money are changing very frequently also the user can upgrade and buy stuff frequently too.
I looked up: https://docs.moodkie.com/easy-save-3/es ... -the-cache
But I'm not sure if this is going to fix the performance since as I understand the file saving will be with some timer
for example every 10 seconds. But what if the user closes the game?
Should I go and add OnApplicationQuit() in all the spots where is saving or should i just have a single OnApplicationQuit which
should right the cache to a file?
Is there any good practices or common user expectation for saving in Idle games?
Re: Frequent saving issues in Idle game
Hi there,
If you're saving every 10 seconds there will still be a significant performance advantage to using caching, even if you're then storing this data to file every 10 seconds. In most cases this will be sufficient to improve performance.
If it's not, storing the cached data in OnApplicationQuit rather than after every 10 seconds will improve performance further.
All the best,
Joel
If you're saving every 10 seconds there will still be a significant performance advantage to using caching, even if you're then storing this data to file every 10 seconds. In most cases this will be sufficient to improve performance.
If it's not, storing the cached data in OnApplicationQuit rather than after every 10 seconds will improve performance further.
All the best,
Joel
Re: Frequent saving issues in Idle game
Thanks for the quick reply and confirming my approach.
I really like the plugin so far and I was impressed about the code generation for custom classes.
It was really easy adding saving support for some custom models with bunch of properties.
That really helped me saving an inventory of items as Dictionary once I've generated the Item model ES3_Type.
One of the next steps I'm looking is a test integration and sync of the ES3 save file in the cloud with Playfab.
If all goes fine I'll share my little case study.
I really like the plugin so far and I was impressed about the code generation for custom classes.
It was really easy adding saving support for some custom models with bunch of properties.
That really helped me saving an inventory of items as Dictionary once I've generated the Item model ES3_Type.
One of the next steps I'm looking is a test integration and sync of the ES3 save file in the cloud with Playfab.
If all goes fine I'll share my little case study.
Re: Frequent saving issues in Idle game
Glad you're finding it useful
All the best,
Joel
All the best,
Joel
Re: Frequent saving issues in Idle game
Hi Joel,
I've found this thread: Work with Coroutines
Also I researched a bit more and saving on different thread and across several frames looks like the best way to handle the frequent saving.
Does EasySave3 have something integrated or is the approach the same as the one in the ES2 topic?
Also is there a difference if I save the different keys in the save file or a 1 key?
Do ES3 loads the whole file in memory and than write out all of the content or is there some smart optimizations?
I've found this thread: Work with Coroutines
Also I researched a bit more and saving on different thread and across several frames looks like the best way to handle the frequent saving.
Does EasySave3 have something integrated or is the approach the same as the one in the ES2 topic?
Also is there a difference if I save the different keys in the save file or a 1 key?
Do ES3 loads the whole file in memory and than write out all of the content or is there some smart optimizations?
Re: Frequent saving issues in Idle game
Hi there,
All the best,
Joel
There would be little benefit in saving over multiple frames vs saving using caching.Also I researched a bit more and saving on different thread and across several frames looks like the best way to handle the frequent saving.
For your use case there wouldn't be much benefit of using threading over using caching as described in the Improving Performance guide. However, if you do decided to use threading, you would need to create your own thread to do this.Does EasySave3 have something integrated or is the approach the same as the one in the ES2 topic?
I'm afraid I don't understand your question. Please could you clarify?Also is there a difference if I save the different keys in the save file or a 1 key?
If you use caching then it will load the entire file in memory and load from this. Otherwise, it will load directly from the file. Generally there are no 'smarter' optimisations when it comes to File I/O.Do ES3 loads the whole file in memory and than write out all of the content or is there some smart optimizations?
All the best,
Joel
Re: Frequent saving issues in Idle game
Ok thanks for the answers.
About this one:
Or if I do only one of them?
At the moment I have a method that call Save on each of the objects/managers that need to be saved.
If I separate the calls to save only coins, and later on only gems should it be better in term of performance?
All of the above data is saved in a single save file - since the game autosaves and player doesn't have a choice when and where to save.
About this one:
Is there difference if I do a method which calls:Also is there a difference if I save the different keys in the save file or a 1 key?
Code: Select all
ES3.Save("coins", _coins);
ES3.Save("gems", _gems);
ES3.Save("inventory", _inventory);
Code: Select all
ES3.Save("coins", _coins);
If I separate the calls to save only coins, and later on only gems should it be better in term of performance?
All of the above data is saved in a single save file - since the game autosaves and player doesn't have a choice when and where to save.
Re: Frequent saving issues in Idle game
Hi there,
Splitting it across frames is unlikely to make any noticeable difference if you're using caching.
All the best,
Joel
Splitting it across frames is unlikely to make any noticeable difference if you're using caching.
All the best,
Joel
Re: Frequent saving issues in Idle game
Ok I've set it up with Caching and it works ok for now
The only strange thing was that even thou I've set the default path in the Unity UI in the ES3 panel
I still needed to call:
With the full path otherwise the Loading from the persistent file to the cache did not happen.
The only strange thing was that even thou I've set the default path in the Unity UI in the ES3 panel
I still needed to call:
Code: Select all
ES3.CacheFile("Saves/IAF_Save.es3", Settings);