Kinda funny how you completely and utterly failed to answer the question he asked. What he's talking about is Serialization, how you take an in-game data structure and put it in a file. The answer is that you have a lot of different choices, mainly depending on what the data itself is. Just look up some info on serialization, google is your friendN64vSNES wrote:Obviously the only way to get data static from a program executing and terminating would be to save it to a file.dnxviral wrote:Not what we save but how we save it.
Saving and loading game data
Moderator: PC Supremacists
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Saving and loading game data
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- thejahooli
- Chaos Rift Junior
- Posts: 265
- Joined: Fri Feb 20, 2009 7:45 pm
- Location: London, England
Re: Saving and loading game data
Most of the time you wouldn't want this in games though. Object serialisation is not normally necessary. If this is what he meant and he has a good reason for saving an entire object, then it would be useful and a good way of doing it. However in most situations whole objects are not needed to be saved, only parts of it, and saving the whole object would potentially increase file size and loading times.ginto8 wrote:Kinda funny how you completely and utterly failed to answer the question he asked. What he's talking about is Serialization, how you take an in-game data structure and put it in a file. The answer is that you have a lot of different choices, mainly depending on what the data itself is. Just look up some info on serialization, google is your friend
I'll make your software hardware.
Re: Saving and loading game data
Oh my bad XDGinto8 wrote:Kinda funny how you completely and utterly failed to answer the question he asked. What he's talking about is Serialization, how you take an in-game data structure and put it in a file. The answer is that you have a lot of different choices, mainly depending on what the data itself is. Just look up some info on serialization, google is your friendN64vSNES wrote:Obviously the only way to get data static from a program executing and terminating would be to save it to a file.dnxviral wrote:Not what we save but how we save it.
Supposing you had a inventory containing 3 potions and 2 cookies ( why? I dunno cookies rock ).
Your inventory actully probably looks like this:
Code: Select all
1 1 1 2 2
Code: Select all
1 1 1 2 2 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Your save file could look like this:
Code: Select all
Noob -- Name
22 -- Up to level 22
75 -- You had 25 HP before you quit the game
2054 1023 666 -- X, Y and Z coords you were at when you saved
1 1 1 2 2 0 0 -- Your items
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
Code: Select all
shit = LoadShit()
for i = 0 20 do this
if shit.Items(i) not = 0 then
Player.GiveItem(shit.Items(i));
end
end
Player.SetName(shit.Name)
Player.SetHealth(shit.health)
Player.SetCoords(shit.x,shit.y,shit.z)
Level.LoadLevel("Level" + shit.levelnum + ".level")
But this could do well for somthing like a linear level 1, level 2, level 3 type game. ( Or at least thats how I would go about it )
-
- Chaos Rift Cool Newbie
- Posts: 51
- Joined: Tue Dec 14, 2010 6:49 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: Everything... and C#
- Location: dnXstudios
- Contact:
Re: Saving and loading game data
Haha Yea I know what your trying to get at. Cookies ftw.
I have map xml files and later items that would be defined through xml files, but these will be stored remotely and the player has no influence over them.
I'm not sure how to save my player's profile securely so it can't be, in a way influenced.
Yes and No. I'm trying to secure data to make it virtually impossible for somebody to change their stats, game position, items, etc.Ginto8 wrote:Kinda funny how you completely and utterly failed to answer the question he asked. What he's talking about is Serialization, how you take an in-game data structure and put it in a file. The answer is that you have a lot of different choices, mainly depending on what the data itself is. Just look up some info on serialization, google is your friendN64vSNES wrote:Obviously the only way to get data static from a program executing and terminating would be to save it to a file.dnxviral wrote:Not what we save but how we save it.
I have map xml files and later items that would be defined through xml files, but these will be stored remotely and the player has no influence over them.
I'm not sure how to save my player's profile securely so it can't be, in a way influenced.
- thejahooli
- Chaos Rift Junior
- Posts: 265
- Joined: Fri Feb 20, 2009 7:45 pm
- Location: London, England
Re: Saving and loading game data
You could encode the data in the file, I've never really had experiance with this but I'm sure something will come up if you google it.
To be fair you are never going to have a completely secure save data, because after all it is only data, which can be modified in some way regardless of your best efforts.
To be fair you are never going to have a completely secure save data, because after all it is only data, which can be modified in some way regardless of your best efforts.
I'll make your software hardware.
Re: Saving and loading game data
The is no such thing as "secure" data since anything can be decoded.
The simplest way I'd suggest would be to encode the file like thejahooli said, the advantages to this being unreadable is that the file size will be very small and loading shouldn't take too much time.
The simplest way I'd suggest would be to encode the file like thejahooli said, the advantages to this being unreadable is that the file size will be very small and loading shouldn't take too much time.
-
- Chaos Rift Cool Newbie
- Posts: 51
- Joined: Tue Dec 14, 2010 6:49 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: Everything... and C#
- Location: dnXstudios
- Contact:
Re: Saving and loading game data
Encoding sounds.... fun. And I wouldn't mind if somebody edited the file and have their game file be corrupt eitherthejahooli wrote:You could encode the data in the file, I've never really had experiance with this but I'm sure something will come up if you google it.
To be fair you are never going to have a completely secure save data, because after all it is only data, which can be modified in some way regardless of your best efforts.
Would be smaller?N64vSNES wrote:The is no such thing as "secure" data since anything can be decoded.
The simplest way I'd suggest would be to encode the file like thejahooli said, the advantages to this being unreadable is that the file size will be very small and loading shouldn't take too much time.
How would you do the encoding?/What would you use for the encoding?
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: Saving and loading game data
The only secure way is to store data on a server where they can't directly edit a file.
For your purposes saving the file as binary ought to deter cheaters without completely disallowing hardcore modders having fun.
For your purposes saving the file as binary ought to deter cheaters without completely disallowing hardcore modders having fun.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: Saving and loading game data
Yes the file size will be much smaller.dnxviral wrote:Encoding sounds.... fun. And I wouldn't mind if somebody edited the file and have their game file be corrupt eitherthejahooli wrote:You could encode the data in the file, I've never really had experiance with this but I'm sure something will come up if you google it.
To be fair you are never going to have a completely secure save data, because after all it is only data, which can be modified in some way regardless of your best efforts.
Would be smaller?N64vSNES wrote:The is no such thing as "secure" data since anything can be decoded.
The simplest way I'd suggest would be to encode the file like thejahooli said, the advantages to this being unreadable is that the file size will be very small and loading shouldn't take too much time.
How would you do the encoding?/What would you use for the encoding?
Depends on what launguage you are using for encoding the file.
Its basically just working with bytes rather than numbers.
1 byte = 1 byte
1 integer = 4 bytes
-
- Chaos Rift Cool Newbie
- Posts: 51
- Joined: Tue Dec 14, 2010 6:49 pm
- Favorite Gaming Platforms: PC
- Programming Language of Choice: Everything... and C#
- Location: dnXstudios
- Contact:
Re: Saving and loading game data
Haha nicedandymcgee wrote:The only secure way is to store data on a server where they can't directly edit a file.
For your purposes saving the file as binary ought to deter cheaters without completely disallowing hardcore modders having fun.
ahh ok. I'll look into both approaches. Server side, and files. Thanks!N64vSNES wrote:Yes the file size will be much smaller.dnxviral wrote:Encoding sounds.... fun. And I wouldn't mind if somebody edited the file and have their game file be corrupt eitherthejahooli wrote:You could encode the data in the file, I've never really had experiance with this but I'm sure something will come up if you google it.
To be fair you are never going to have a completely secure save data, because after all it is only data, which can be modified in some way regardless of your best efforts.
Would be smaller?N64vSNES wrote:The is no such thing as "secure" data since anything can be decoded.
The simplest way I'd suggest would be to encode the file like thejahooli said, the advantages to this being unreadable is that the file size will be very small and loading shouldn't take too much time.
How would you do the encoding?/What would you use for the encoding?
Depends on what launguage you are using for encoding the file.
Its basically just working with bytes rather than numbers.
1 byte = 1 byte
1 integer = 4 bytes