5 Replies - 4240 Views - Last Post: 21 November 2011 - 02:15 PM

#1 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Discussion: Saving Data

Post icon  Posted 19 November 2011 - 04:10 PM

A common thing that people want to do in their XNA games is to store data like high scores, game options, or even game states. There are a number of ways of accomplishing this. I have used many myself but my favorite is now to use XML serialization and XNA's Storage. The problem with straight XML serialization though is that it isn't secure. It is easy for the player to edit an XML file. There are ways to encrypt/decrypt the data to make it more secure. The discussion I want to start is how do my fellow XNAer's save data related to games?

Is This A Good Question/Topic? 1
  • +

Replies To: Discussion: Saving Data

#2 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: Discussion: Saving Data

Posted 19 November 2011 - 04:20 PM

I've used XNA storage with a serialized structure in my first Blockable game attempt and that is mostly for setting up the level data, but the only problem I've found is the lack of changing the storage location as it wants to use the default system for a Windows Storage Container which is in the Game Saves in My Games.

So being able to store serialized data in the content project would be my preference.
Was This Post Helpful? 0
  • +
  • -

#3 bonyjoe  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 175
  • View blog
  • Posts: 548
  • Joined: 08-September 10

Re: Discussion: Saving Data

Posted 20 November 2011 - 06:26 AM

If you want it to look more secure you can change the extension of the xml files after they are written, just change them to any extension. They will still open as xml files without trouble. The only trouble is someone with a bit of knowledge could just think to change it to xml, edit it and change the extension back.
Was This Post Helpful? 0
  • +
  • -

#4 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Discussion: Saving Data

Posted 20 November 2011 - 04:02 PM

That is an idea but like you said it is easy to get around. Anybody serious about cracking your game would be using hex editors and such and would see the XML file for what it is right away. I've considered encoding/decoding strings using simple Boolean logic like XORing with a specific mask. It is very simple to implement but also easy to crack. Securing game data, in XNA or any platform, can be a challenge to overcome.
Was This Post Helpful? 0
  • +
  • -

#5 lesPaul456  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 173
  • View blog
  • Posts: 729
  • Joined: 16-April 09

Re: Discussion: Saving Data

Posted 21 November 2011 - 12:29 PM

I prefer to serialize my save data as well. However, rather than serialize the data to an xml file, I like to use a binary file, using the BinaryFormatter class found in the System.Runtime.Serialization.Formatters.Binary namespace.

The process is very similar to xml serialization, but since the file isn't human readable, it's a bit more difficult to edit (not impossible, though).
Was This Post Helpful? 1
  • +
  • -

#6 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Discussion: Saving Data

Posted 21 November 2011 - 02:15 PM

That is also a good alternative when it comes to saving data. Combined with some sort of encryption scheme it would definitely make things more secure. Thanks for adding that to this conversation. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1