Help understanding save slots in relation to database information

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Help understanding save slots in relation to database information

Post by annathehank »

Hi Tony!

I am mainly working on trying to create an 'achievements' page on the title screen of my game that would save certain information across all playthroughs so players can try to collect everything in the game (such as finding all the different endings). I thought to myself, well I can create a series of bool variables that would turn on when certain things are activated, and then on the page just have things display if those bools are true.

But then that got me thinking about how the variables save across playthroughs. Mainly I'm thinking if the dialogue manager has the 'do not destroy on load' aspect, and a player finished a game and then went back to the menu to start again, without closing the software and starting it back up, wouldn't the database knowledge from the first playthrough carry over into the new game? Do I need to do something with my 'new game' button that explicitly creates a new save slot that somehow 'wipes' the data and then have a second database that's just to store the achievements that doesn't get wiped?

I am using the dialogue system saver as described in the set-up manual if that helps.

Thank you!
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help understanding save slots in relation to database information

Post by Tony Li »

Hi,

Dialogue System variables are saved within individual saved games (save slots), so they're not a good fit to record achievements across playthroughs.

You could script your own achievement system that stores achievement information locally into PlayerPrefs on the player's machine.

If you'd prefer not to script your own achievement solution, the Asset Store has several achievement systems. I haven't used any, but the user ratings and reviews will probably be a good guide to help you find one that will meet your needs.
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Help understanding save slots in relation to database information

Post by annathehank »

Thank you! I'll look into those more.

But I'm still curious how the starting of a new game would work.

If the player ends one game, the system will take them back to the menu screen. How do I get the game/system to clear the data from the other playthrough and reset things for a new game if the player immediately hits 'play new game'? (I.E. doesn't close the game, resetting the system manager). From what I understand, the data is saved per slot and that slot won't reset until the player hits save in the new game, but then the new game will save the database data from the old one since it didn't destroy/reset. Is there a code/Lua condition that will reset the data once the game is over?
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help understanding save slots in relation to database information

Post by Tony Li »

Hi,

If you're using the save system (slots, etc.), call PixelCrushers.SaveSystem.ResetGameState() to just reset the data, or SaveSystem.RestartGame("sceneName") to do the same plus load a starting scene.
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: Help understanding save slots in relation to database information

Post by annathehank »

Ahhh I see! Can't believe I didn't see those :lol:

Thank you!
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help understanding save slots in relation to database information

Post by Tony Li »

Happy to help!
Post Reply