Shortening the Saving time?

Announcements, support questions, and discussion for the Dialogue System.
danthepob
Posts: 10
Joined: Mon Sep 07, 2015 8:39 am

Shortening the Saving time?

Post 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!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Shortening the Saving time?

Post 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.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Shortening the Saving time?

Post 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()?
danthepob
Posts: 10
Joined: Mon Sep 07, 2015 8:39 am

Re: Shortening the Saving time?

Post 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.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Shortening the Saving time?

Post 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.
danthepob
Posts: 10
Joined: Mon Sep 07, 2015 8:39 am

Re: Shortening the Saving time?

Post by danthepob »

Thanks for the information, look forward to your patch!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Shortening the Saving time?

Post 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.
danthepob
Posts: 10
Joined: Mon Sep 07, 2015 8:39 am

Re: Shortening the Saving time?

Post 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.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Shortening the Saving time?

Post 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.
danthepob
Posts: 10
Joined: Mon Sep 07, 2015 8:39 am

Re: Shortening the Saving time?

Post 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.
Post Reply