2
\$\begingroup\$

I want to make an item database in xml for my game.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

I want my database to be moddable, but hard to screw up for average users.

(~I don't want kids to make the game unplayable, then unable to fix it)

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

TL;DR How hard is it to get a raw xml file from a standalone build?

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

I want to make an item database in xml for my game.

Good idea.

I was thinking about encrypting it, but I don't know how hard is it to edit the database.

Encryption is an advanced topic. And it can be really easy to screw things up.

I want my database to be moddable, but hard to screw up for average users.

Moddable = Editable = Not secure. You choose.

(~I don't want kids to make the game unplayable, then unable to fix it)

Instead of preventing the edit, offer an option in-game to fix the xml file (Rebuild, load from backup, etc.). This would be easier for you and modders. And players can safely mess around without fearing to break the game.

Should I encrypt the database? Or will it just annoy the "modders", while the average players wouldn't find the database even when it isn't encrypted?

It will just annoy the modders. Most of your players won't even open the folder the xml file is stored.

TL;DR How hard is it to get a raw xml file from a standalone build?

It is not hard, but it takes some time to implement and polish the code. Take a look at this unify wiki article about serializing to XML file and deserializing back.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for the fast reply! :) 1 last question: If there is a test.xml file in the Assets folder, how can I find it in a Windows standalone build? \$\endgroup\$
    – Tudvari
    Aug 27, 2016 at 22:27
  • \$\begingroup\$ @Tudvari Here is a tutorial video about that: unity3d.com/learn/tutorials/topics/scripting/… \$\endgroup\$ Aug 27, 2016 at 22:28
  • 1
    \$\begingroup\$ From my tests it looks like the xml plaintext gets included in one of the .assets files Unity assembles in the _Data folder next to your game executable. You wouldn't want players to edit this file directly, but you can use the methods @S.TarıkÇetin linked to clone the contents of this asset into its own file in Application.persistentDataPath on startup if it doesn't already exist, or load data from the existing file if it does. This helps offer the backup feature described - if a player messes up the file, they can delete it & it will be regenerated with default values on the next run. \$\endgroup\$
    – DMGregory
    Aug 28, 2016 at 0:17
  • \$\begingroup\$ Thanks, and how can I open those .assets files? \$\endgroup\$
    – Tudvari
    Aug 28, 2016 at 7:25

You must log in to answer this question.

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