[Solved] Problem with resetting the game
Hey everyone,
I'm having a problem resetting the game lately (or maybe it always had this issue).
I am doing this manually and everything gets overwritten, tables, values zeroed (which are then saved) etc.
So if you were to complete the game (it will automatically reset) and then you are presented with the first screen.
If you are to start a new game, then it starts it without issues, a clean slate.
If you are to X however the game (as most would do) and then you open the game and try to start a new game, it starts some messed up version which means it's not really reset. What is going on? It's almost as if there's a cache that isn't getting cleared out and then it overwrites everything and causes this problem.
Any advice would be much appreciated as I need to submit the game to the App store.
Thanks!
Comments
My guess without seeing any of your logic:
either you are missing to reset some attribute or you are saving or loading very many attributes in one go and you have a change scene behavior just after the saving/loading (in the latter case you could wrapping the change scene in a 0.2 sec timer)
I can't be missing any resets because like I said, if I start the game immediately before closing then it starts perfectly. It's if I haven't started the new game and just exited the app that there's some phantom memory creeping back.
Yes, I thought about the change scene affecting the process so I have booleans preventing that happening. But like I said:
Go to options, click reset, go to main menu click New game. Starts clean new game.
Go to options, click reset, X the app right there. Open game again. Will start a glitched game.
I even have the Start Game button changing to Continue if you started a game, and it's obvious something is going wrong because if you reset and go to main page it's New Game. If I X the game without starting a New Game and come back, it's Continue and then it loads the glitched game. How can it both reset and then not reset?!
"I can't be missing any resets.. "
Not quite the right mindset for debugging I would say
You need to look over your logic and break it down and follow the logical steps that should occur. Use display text or log debugging state.
How can I be missing resets if it resets the game and works. The problem appears if you didn't immediately start a new game.
I looked at the logic a ton of times, that's the first thing I did. I just came here to try and find any possible ideas on why it doesn't actually save the reset. The reset like I said works. It just doesn't save.
Anyhow I found another thread with similar issues. I'm going to try those things.
In most cases, GameSalad does what it's been told to do. That is, if you set up your rules correctly, it won't do anything unexpected. If you feel you've done everything correctly then you have one of two possibilities:
If I was a betting man I'd happily bet you a large sum of money that you've missed something in your logic, that something isn't being reset or is being reset at the wrong time or under the wrong conditions. So if you want to post some screenshots of your rules or the project file itself, someone can probably figure out why it's not working.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang thanks for posting!
I found another thread (http://forums.gamesalad.com/discussion/61786/save-load-reset-nightmare) speaking about loading attributes on the 'splash' page and moving them instead inside of the Start button. Also can you please clarify, when you do Copy Table, you then need to also Save that table? That's my two possible ideas on what is happening. If that doesn't work I'm all out of ideas on what's going on and will report back!
Copy Table copies the data from one table to another but doesn't save anything. Save Table saves the table data to the device. Table data automatically loads when the app starts so there's no need for a Load Table behavior (which doesn't exist because of that!).
If you use any Save Attribute behaviors, then you need matching Load Attribute behaviors with the same key names.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
All right!
I've tested in the GameSalad Viewer so far but I think it'll stick this time.
Double error on my part:
Thinking that overwriting tables was permanent, need that Save Table at the end. Just to be safe I added the saving part of the logic in a timer at the very end.
Loading the Saved attribute was good. My error there was that I had the saved key within an expression for some reason. So I removed the key from there and retyped it and now it saves it fine!
Hope my headache helps someone in the future! Thanks for the clarifications @tatiang!