External Data Files

I’m back with the strategy game again, and another question that’s been bugging me for a while.

I want to represent the raw data of maps and units in external datafiles, possibly XML. The trouble is, I dunno if it’s possible to encript stuff like that, is there a way? I suppose in this precise situation I’d be better off not encrypting but for the sake of my long-term curiosity and if I ever want to make save files, I’d like to know the answer anyways. I’ve been curious about external files ever since I first tried to hack a game’s save. Are they encrypted? Do they use special characters that look like garbage to text editors and not to the game? How do they communicate anything whatsoever to the game? These things puzzle me to no end.

Also, just so it’s clear, I realise that the save files of my past were not written in XML, lol.

Check out java.util.Properties, it has a method which stores in XML through an OutputStream. Perhaps you can use that with a javax.crypto.CipherOutputStream. I haven’t used that stuff yet, but it seems pretty straight forward.

[quote=“Black_Drazon,post:1,topic:27013”]
No they are generally just binary data files. Ther eason they look like garbage to you in your text editor is becasue they are binaries, not text.

Binary data is much faster and easier for the computer to read and write but is not human redable.

See DataInputStream and DataOutputStream in the Javadoc. Basically, the game knwos the order in which the data was written into the file and reads it out in the same order.

So, the save files are just binary versions of “HP = 45 [divider] Loc=23,45,64” or something?

Actually the data file is usually the binary form of “45,23,45,64…”

You know the meaning by the position in the file.

All these tags are one of the reasons XMl bloats data files. (The other reason is that “255” takes 1 byte in binary but 3 bytes in ascii, or 6 bytes in unicode.)