save/load/reset nightmare
Fal01
Member Posts: 460
Hi all,
I am making a point and click adventure and have discovered a strange quirk in my game.
I have a play button on the splash screen (which is replaced by a continue button once you start to play) and a reset button.
When you play the first time everything works as it should and when you exit the game and press 'continue' you go to exactly where you were, with all the things you collected which is fine.
Then when you press the reset button everything is back where it started like it's a new game, which is also fine.
But if you exit the game on this second go and subsequent goes and press continue, it loads the first game again as if you had never reset it.
You are on the last scene where you were but all the doors are unlocked and items missing from the first go.
It's like the reset didn't overwrite the initial game and it's driving me crazy trying to figure it out.
Any ideas will be greatly appreciated.
I am making a point and click adventure and have discovered a strange quirk in my game.
I have a play button on the splash screen (which is replaced by a continue button once you start to play) and a reset button.
When you play the first time everything works as it should and when you exit the game and press 'continue' you go to exactly where you were, with all the things you collected which is fine.
Then when you press the reset button everything is back where it started like it's a new game, which is also fine.
But if you exit the game on this second go and subsequent goes and press continue, it loads the first game again as if you had never reset it.
You are on the last scene where you were but all the doors are unlocked and items missing from the first go.
It's like the reset didn't overwrite the initial game and it's driving me crazy trying to figure it out.
Any ideas will be greatly appreciated.
It’s not a bug – it’s an undocumented feature
Comments
Thanks for your reply,
That is what is confusing me because the first time you play it you can quit at any time and it has saved properly when you continue.
So it is obviously constantly saving the attributes etc.
You could play the whole game through quitting when you want and it works perfectly.
It would be when you've finished the game and want to reset it that there is the problem.
Because you would probably play a few scenes and collect a few things and then if you quit and press continue you would find that the whole game is unlocked and all the items are collected.
It’s not a bug – it’s an undocumented feature
Hi @Fal01 I'm guessing you're using game attributes, these are "remembered" as they are updated/changed, even when going back to the menu and pressing the Continue button, all while the game is open… as you know…
But, presuming you're using the Save & Load Attribute behaviours to save the attributes, there does seem to be a bug crept in whereby game attributes don't save (self and scene attributes seem OK).
I've reported this to GS HQ (as has several other people, I think) although there hasn't been any definitive answer back as to whether or not this is an actual bug… although I can't think it's not….
So the workaround would be to use a Table for saving your attributes, using Save Table behaviour…
Important though: if you do, and you want the ability for a user to refresh and start a new game all over again (even after the game has been completed) then you need to use the Save Table behaviour on a copied Table, otherwise you'll overwrite the table permanently without any way of getting back the original values.
On a side note, some people would insist you use Tables always for saving attributes… (personally, I think it depends on any one individual project).
Hope that helps.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thanks for your reply, all the game attributes save and load fine the first time you play the game.
It's the second time you play after a reset that it loads your progress from the first game when you quit and continue.
I have tables for some of the attributes but I am not too sure how to save booleans on tables, ie if I pick up a screwdriver I can change a table value to reflect that, but you need a hideous workaround to make the table value effect the game without direct table expressions. I know they are on the nightly builds but it is such an enormous amount of work has gone into the game that I can't trust the nightlies.
I probably wouldn't bother about this quirk if the game didn't have dual ending and therefore replay value.
Anyway i'll persevere (
It’s not a bug – it’s an undocumented feature
In other words, no mention of any Load Attribute behaviours in your new game button (with normal attributes kept outside of Tables), and all of the Load Attribute behaviours in your continue button it should work fine. THe only thing you would have to change in your new game button is those attributes saved in tables That could be where your problem lies, I'm thinking… … you'll have to reset them with Change Attribute behaviours; that should solve your problem there.
Btw, strange that you've got game attributes being loaded OK… what version of GSC are you using, for interest? For booleans, set up either a Text column or an integer column… (probably easier with an integer column). For text, put true or false depending, but for the integer version, put 0 for false and 1 for true, then something like: Change Attribute YourBool to tableCellValue(YourT, 1, 7) will work fine for retrieving - I guess you know that bit, and a Change Table Value behaviour to change it; no enormous amount of work at all.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
The reset button resets all the game attributes back to their original values, and copies blank tables onto the used tables.
The continue button has all the load keys in it and scene number rules.
I'm using version 0.10.4.1
It’s not a bug – it’s an undocumented feature
@Fal01 OK, in that case, surely we've come full circle back to my original suggestion of your problem, that the game attributes aren't being saved, or if they are, aren't being loaded with Load Attribute behaviours.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
But if they are not being saved/loaded how come I can play through the whole game without a problem no matter how many times I turn the device off and on?
It's a mystery!
It’s not a bug – it’s an undocumented feature
Perhaps sometimes it seems everything's OK because you're saving and loading self and scene attributes which work fine, but when a game attribute is involved, it doesn't work, as previously described…. or the table isn't being reset properly (i.e copying a fresh one from the master) for a new game… or… no, that's it, can't think of anything else here at the moment… ;-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Yes it is quite confusing.
Let me try and explain.
If I start the game and I collect some wire and open a gate and then collect a crowbar and then I exit the game, when I turn the game back on and press continue the wire and the crowbar will still be in the inventory and the gate will still be open as you would expect.
Then if you go to the menu screen and press reset, the game will be reset with the wire, crowbar uncollected and the gate shut as you would expect.
But then if you go to the menu screen and press continue, the wire will be collected, the gate will be open and the crowbar will be collected as if the reset had never occurred.
Like it is remembering the game before the reset
It’s not a bug – it’s an undocumented feature
In the reset button I overwrite the tables with blank copies and reset all the attributes to their original values.
It’s not a bug – it’s an undocumented feature
Just tried it, no difference
It’s not a bug – it’s an undocumented feature
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Yeah that's exactly how I copy the tables
It’s not a bug – it’s an undocumented feature
@Fal01 Let's see if we can't knock this one on the head… so first to ask, presumably you're testing your game with an ad-hoc on your device?
Either way, put a temporary actor with a Display Text in it to show one of your problem attributes, play your game til it changes, reset it by pressing the new game button, then immediately go back to the menu, look at the attribute again, then press your continue button, then the same but close the app in between times. Just note down what's going on.
Btw, when you close the app, are you just pressing the bottom button on an iPad, then immediately pressing your game icon after? Don't know if you know or not, this doesn't actually take your game out of memory, which could skew results…. just open any other app, close that and reopen yours as newly opened again.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Just a couple of questions.
Would you put the load attributes in an actor on the splash scene that loads when the scene starts, or in the continue button that loads when it is pressed?
How would you set up your load/save attributes in a game like this?
I have the Table and 'scene number' saves in the Round Rules on each scene.
I just have a feeling that it's the order that it's doing things in that is messing it up.
Thanks for any help!
It’s not a bug – it’s an undocumented feature
Ah, you could be onto it here, @Fal01 !
You definitely don't put your Load Attribute behaviours in your splash screen or even at the side of the menu, i.e to load as the menu card is opening… otherwise you'll have the users loading somewhere in the game even if the New Game button is pressed. (Although Save Attribute behaviours can be anywhere, on any level, simply just when and where you want them to save something).
So, if you've your Load Attribute behaviours in one of these places, move them to your Continue Game button, with Rules in that with something like if you haven't already):
When touch is pressed
Load Attribute Att1 key:att1
Load Attribute Att2 key:att2
etc, etc…
Load Attribute WhichLevel key: 9
When game.WhichLevel = 1
Change Scene Level1
When game.WhichLevel = 2
Change Scene Level2
etc, etc…
When game.WhichLevel = 9
Change Scene Level9
---------
OK, that should work fine except to say there seems to be a problem with loading game attributes at the moment, as I mentioned….
So if still not loading properly, your only workarounds would be to either change all your game attributes to scene ones, which is not only impractical and a lot of work, but as you're making an adventure game, wrong to do in most places, I'm certain - you need those attributes as game ones… or put your saved values via a copy of a table into your attributes, and use a whole bunch of Change Attribute behaviours picking the cell values out, in place of the Load Attribute behaviours in your Continue Game button.
And then, I'm sure you know, in your New Game Button, in it's Rules is just basically Change Scene to scene 1/first level.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Halleluja! <:-P ) ) ^:)^ \m/ :-O :O) #:-S
It's working!!
I had a couple of load attributes in a separate actor on the splash screen 8-X
Thanks for everyones help!
It’s not a bug – it’s an undocumented feature