2
\$\begingroup\$

For a game I am working on, one of the build targets is the Unity Webplayer, which does not support saving file I/O at all. However, as it's an action/adventure game based on Zelda 2: The Adventure of Link, I would like to provide my players the capability to save their game somehow.

In light of the webplayer limitations, I was going to circumvent it by creating a password system that the user could simply enter to resume where they left off. Said password would convey various things about game state, such as event flags, and picked up item flags (true to the game this is based off of, loading a game restarts the player in a pre-determined location.) This is also convenient for other modes, because the save system would be merely responsible for storing this password, as the password is a compressed version of the game's state.

My understanding is ideally, said setup would just entail creating a series of bits, represented by a complex character (such as, a digit or hexadecimal character) which could be stored in some larger value, then unpacked when entered by the user.

Of course, there's a problem, and that's security. I have to assume some less-honest player knows the sequence of flags and how to recreate them. From what I understand, a way to get around that is to append some sort of checksum to the bit sequence. If that checksum fails, then the system knows that the code is bogus, and to do nothing at all. Of course, I would also assume that the attacker would be aware of said checksum's existence.

Question: what are some good ways I would go about securing a save-state password as described above to make it less-able to be gamed by cheaters?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ You could use a Web service to store data instead of trying to do local I/O. Also, you can totally store data in the Unity web player using some inventive means (PlayerPrefs rather than a File). \$\endgroup\$ Commented Nov 15, 2013 at 21:12
  • \$\begingroup\$ In single-player games, cheating is almost irrelevant, see @MarcksThomas's answer. As long as you implement some very basic security (if you can easily edit a simple text file, it might be much less fun), anything extra is just wrong. \$\endgroup\$
    – o0'.
    Commented Nov 16, 2013 at 9:59

3 Answers 3

3
\$\begingroup\$

first get the bitstring for the standard way you described then just encrypt it with some symmetric cypher and chosen key

then you pack that into the password string into something the user can enter

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Being an encryption novice, what would you suggest is a good symmetric cypher to start off with? \$\endgroup\$ Commented Nov 15, 2013 at 18:56
3
\$\begingroup\$

In a little game I'm making using Unity, one of my build targets is the Web Player. I had the situation where I wanted to remember the configuration of the last launched ship, and allow the player to save various configurations by name.

As you say, standard file I/O isn't supported. However, Unity provides the Player Prefs class for storing data in both Web and native environments. This is a form of restricted file I/O as it writes to a file saved the in the users local appdata. The size of the file is limited to 1mb, but that's more than enough for the data I needed and likely plenty for the data you need too.

I think that having the user remember a complex string of random characters to access their save data is a bad idea. (Especially since it's likely that many of the characters are non-standard and not easily typed).

Security is still a concern, and, in this case, it's not possible to completely prevent the cheaters from modifying their data to suit. You'll always be unable to trust the client.

Further steps to secure these "save games" is to move them to a database. Users would access their saved progress with a username and password.

\$\endgroup\$
3
\$\begingroup\$

You can invent your own algorithm, as simple or fancy as you like. It'll be horribly broken, but it will have to suffice. You're asking for good ways to secure save-state passwords. There are none. At best, you can try to frustrate the player until he gives up.

The reason these methods don't work is that they fundamentally try to do something out of their control. Assume I'm a dishonest player. If you tell the game not to do something (e.g. start in a different state) and I say otherwise, I win. My pc does what I tell it to do. To put it a different way, you can't trust the client.

Perhaps more importantly, as long as my cheats don't harm the experience for other players, any effort you put into securing your password system goes straight to making the game less enjoyable. After all, if I didn't want to manipulate my saves, I wouldn't do it. In conclusion, unless you have a multiplayer mode to protect, this is a lost battle for a bad cause; I advise you not to fight it.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I'm relieved someone gave THE RIGHT ANSWER™, I don't have to write it myself then :) I'm a bit worried it got just one vote, though :/ \$\endgroup\$
    – o0'.
    Commented Nov 16, 2013 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .