Saving in Games

For questions about using Classic.

Post » Wed Feb 24, 2010 5:23 pm

I searched through the wiki and through tutorials, nothing found.
I know I can make this with the INI Object. But I don't like it, that it saves at the Windows Folder and also, it's not encrypted. That means, those people that find out, could easily just cheat the game. Also, I didn't found out how to work with the Array Object.

Any suggestions, pwease? :3
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Wed Feb 24, 2010 5:49 pm

The system object has a couple of save actions built in: "Quicksave/quickload" and "Save/load to disk". These basically save a perfect state of the game, and they're not just plain text so cheating isn't as easy.

I will mention, however, that some plugins(mostly third-party plugins) don't work properly with these actions.
Moderator
B
99
S
37
G
19
Posts: 1,584
Reputation: 17,842

Post » Wed Feb 24, 2010 6:09 pm

Hmm, this wouldn't really work with saving settings, like language setting, full screen/windowed, etc.. If there are no other possible ways, is there any way to save the ini to a different place instead of .../Windows? And maybe some other plugin that encrypts this file (Like Blowfish).
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Wed Feb 24, 2010 6:50 pm

The INI object isn't made so much for making INI files as it is for reading them.

If you're just looking to save things like configurations, you could use the HashTable for that, which allows you to assign values to 'keys' and then access the values through these 'keys'. The files it saves are also not plain text, making it harder to crack.

One thing I'll point out, in case you don't know this yet, is that if you want to save your file to the same path as your game, you can use the apppath expression. For example, to save your file "blah.yes" to the same folder as your game, you would put:

[code:31ngp681]apppath & "blah.yes"[/code:31ngp681]
Moderator
B
99
S
37
G
19
Posts: 1,584
Reputation: 17,842

Post » Wed Feb 24, 2010 6:54 pm

[quote="Neo1000":kgb4ve0p]That means, those people that find out, could easily just cheat the game. [/quote:kgb4ve0p]

[quote="Neo1000":kgb4ve0p]Hmm, this wouldn't really work with saving settings, like language setting, full screen/windowed, etc..[/quote:kgb4ve0p]

So you're afraid people will cheat your game using language and screen settings? :P

Anyway.. you use both then don't you, like other games. One method for saving the game. One (the ini) for saving your game settings. That way you get the best of both worlds.

Also along with Linkman's third party plugin warning. You also need to ensure things have loaded back in correctly. Some stuff set at start of layout, doesn't save and needs to be done on load. Also you can limit what is and isn't saved on a per object basis.

The quicksave/load is just into memory btw (handy for temp level progress perhaps, or for time traveling items). The Save/Load one is for saving the actual files, which you can name whatever you like, including extension, and they'll still work.

And it saves the ini wherever you want it to. Don't know of any game saving it in the windows directory, but if you wanted to you could. Though remember the whole security thing. Generally makes more sense to save it there in the Apppath along with the rest of the game.

Edit: Curses Linkman for posting just before me! :P
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Wed Feb 24, 2010 7:23 pm

[quote="Lost my Keys":20bndv3y]So you're afraid people will cheat your game using language and screen settings? :P[/quote:20bndv3y]
Nah, I wanted to save the level progress too. But now after reading your text, I got an idea.
I use Save Game for levels and use ini for settings. I'm such a Genious! :lol:

But for some reason, after it loads the file, ZOMG, the enemy disappears into nothingness. Is this because of "For Each [Sprite]"?

CAP File with the problem
Put this in a folder, then go to Arcade. Then press 1 to save a file (should come level.sav). Then close the app, open it again, go to settings and then press exit. It will load the file and the enemy is gone.
B
7
S
1
G
2
Posts: 87
Reputation: 1,099


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests