Page 1 of 2
Shortening the Saving time?
Posted: Mon Sep 14, 2015 7:41 am
by danthepob
I have everything running smoothly in my game, but the only thing that bothers me a bit is that it actually takes a lot of time to Save the game, especially on mobile. To Save my game, I call PersistentDataManager.GetSaveData() and during the time I call that, the game freezes temporarily. I added a static saving screen before that, so it's Ok, but I would like to explore new ways to speed up the saving process? Or make it such that it doesn't freeze the game whenever the method is called. I included SimStatus which I know would lengthen the time to save, but my conversations require that. Any help would be great. Thanks!
Re: Shortening the Saving time?
Posted: Mon Sep 14, 2015 8:58 am
by Tony Li
Hi,
Have you written any custom persistent data components? If so, make sure they do the minimum amount of processing required.
Unfortunately, though, it's probably SimStatus. If you're only using SimStatus in a few places, you might consider using variables instead and turning off SimStatus.
I'll also examine the save code for any optimization opportunities and get back to you today.
Would an async version of GetSaveData() help? It would work like Unity's WWW class, where you'd have to check an isDone property or rely on a callback.
Re: Shortening the Saving time?
Posted: Mon Sep 14, 2015 10:32 pm
by Tony Li
It's possible to optimize the saving of SimStatus. It still won't be instantaneous, but it should be about 4-5 times faster according to some brief tests.
Do you think that will be fast enough, or will you also need an async version of GetSaveData()?
Re: Shortening the Saving time?
Posted: Mon Sep 14, 2015 11:09 pm
by danthepob
4 - 5 times faster does seem pretty good, that would be awesome. I was going to explore not using SimStatus and define my own Variables, but that seems like a huge amount of work, so I'll leave that as a last resort.
Oh and regarding SimStatus, if I select "Do Not Use Sim Status", does that mean I can not use it at all? Or just that during Saving it won't log the SimStatus into the database? Like, during the game's current instance, the checks for SimStatus still works, but when you reload, it'll disappear.
Re: Shortening the Saving time?
Posted: Mon Sep 14, 2015 11:35 pm
by Tony Li
So I can get you a patch sooner, I'll finish testing the optimization without adding an async version of GetSaveData(). I'll try to get it to you tomorrow.
There are two places you can specify "Use Sim Status".
1. If you untick this on the Dialogue Manager, SimStatus is not available at all.
2. If you untick it on the GameSaver component or set PersistentDataManager.includeSimStatus=false, then it will not be included in saved games -- but you can still use SimStatus during the current play session if it's still ticked on the Dialogue Manager.
Re: Shortening the Saving time?
Posted: Tue Sep 15, 2015 2:55 am
by danthepob
Thanks for the information, look forward to your patch!
Re: Shortening the Saving time?
Posted: Wed Sep 16, 2015 12:16 am
by Tony Li
The patch is now available on the Pixel Crushers customer download site. I PM'ed you your access info.
The time to record SimStatus dropped from 1.25 seconds to 0.25 seconds on a desktop PC. You should hopefully see a similar speed-up in your mobile build. If not, or if you need something more such as an asynchronous call to GetSaveData(), let me know.
Re: Shortening the Saving time?
Posted: Wed Sep 16, 2015 4:01 am
by danthepob
Hi Tony,
Thanks for the patch. I notice that it's a lot faster when I test it on my laptop (Mac) but remains somewhat the same on mobile. (I could be wrong, but it did seem a bit slower). I'll try experimenting with it a bit more.
Re: Shortening the Saving time?
Posted: Wed Sep 16, 2015 10:06 am
by Tony Li
Hi,
Sorry, I expected that to be the magic bullet. There are still things we can do.
What mobile device are you testing on? I'll test on a similar platform.
If you temporarily turn off SimStatus, does it dramatically speed up saves? I want to make sure I'm optimizing the right part.
Re: Shortening the Saving time?
Posted: Wed Sep 16, 2015 12:26 pm
by danthepob
Ok, so I disabled simstatus by including the code:
PersistentDataManager.includeSimStatus = false;
I tried saving a few times and from my brief test I can see that it's around 40% - 50% faster (which is good, not as jarring as before).
I'm testing on an iPhone 6.