Save/load function

Get help using Construct 2

Post » Wed Nov 13, 2013 9:21 pm

@Ashley Thank you! That's what I was looking for. Is there a way to tell a Global variable not to be saved ?
B
72
S
21
G
12
Posts: 314
Reputation: 12,121

Post » Wed Nov 13, 2013 9:25 pm

@KaMiZoTo

you have to redesign your savegame option because the save/load is like a "save state" similar to emulators (i know, and i dont like it too)

so check points is not a good thing to do for save, thats why some games like castlevania and super metroid have save rooms without music playing

what you can do is make a save room without music and make a simple menu with a event to prevent the player from moving; you can still have check points but try not to use then as save/load options, use just to keep a location for 1 section of play.

now for the bonus, you have to make a check if the player already have it and destroy the one showing on the background/map
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Wed Nov 13, 2013 9:35 pm

Currently everything is saved except things with the 'no save' behavior. It's not elegant, but a workaround is to back up any global variables to instance variables in a 'no save' object, load, then restore the globals from the instance variables afterwards.
Scirra Founder
B
399
S
236
G
89
Posts: 24,523
Reputation: 195,378

Post » Wed Nov 13, 2013 9:39 pm

@Valdarko I already have a saveroom. The music issue is solved thanx to the audio plugin options. So it works.
But I'm still wondering how we can have game options with that 'save stat' system. If the player decided to change an option on the title screen menu, it will be overwritten by the load state. It seems to be a deadend.

I have a webstorage classic savegame. But if I want to deal with 500 bonus and check their stat, I have to deal with 500 global variables. (Am I wrong?)
B
72
S
21
G
12
Posts: 314
Reputation: 12,121

Post » Wed Nov 13, 2013 9:53 pm

@KaMiZoTo

maybe you can use the dictionary to handle this number of bonuses and check then
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Fri Nov 15, 2013 7:42 pm

@valdarko Mmmm yes perhaps dictionary can be a solution. But I never used one and don't know how it works. How would you proceed to check the stats of instance objects with a dictionary ? (If you don't mind of course!)
B
72
S
21
G
12
Posts: 314
Reputation: 12,121

Post » Fri Nov 15, 2013 9:08 pm

@KaMiZoTo

of course i dont mind man :]

i still figuring out how dictionaries work but they pretty much do the same thing as variables, but you actually can organize it better because as a separated file you can download it as you load the game

so what you have to do is put a dictionary on the bonus or in the character and give it a default key value, lets say if the player have the bonus then the value is 1, if dont then is 0.

you can make the same thing with a global var to check if the player have or not the bonus so you can make the bonus desappear in the game map, but probrably you have to make a event to store the data and call it on load; i think with a dictionay you can do that

maybe the manual explain it better than me, my engrish is terrible:

https://www.scirra.com/manual/140/dictionary
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Post » Fri Nov 15, 2013 9:43 pm

@valdarko Well I can't add a dictionary to an object. It's not a behavior, it's a project object. I don't know how to use the dictionary to say something like :"Hey, you see that instance bonus I've just collide with? Please remember it to destroy it next time.".
I can do it with a global but I will have to do so many events for that. :(
The Save/load feature is interesting for that work. BUT as it remembers quite everything, I discovered very strange ingame behaviors when I update my level design or include new objetcs. That can be a real issue for patching the game. And I still havedifficulties to autorize a modification in the main title options without overwriting it because of the state load on another layout.

So I'm a little scared about that state save and if there's a alternative other than globals, that could be cool. :)
B
72
S
21
G
12
Posts: 314
Reputation: 12,121

Post » Fri Nov 15, 2013 11:41 pm

@KaMiZoTo

to add a dictionary to a object you have to make that object a container

i dont know really if this gonna work since i have not tested, but i think the issue is to make the information be saved and load properly. maybe some one more experienced can answer this one, i want to know how to make a good save/load too
B
48
S
5
G
6
Posts: 210
Reputation: 6,297

Previous

Return to How do I....?

Who is online

Users browsing this forum: ALLMarkMade and 20 guests