1
\$\begingroup\$

I'm developing a 2D "small" offline rpg game, and to this point I have many actors (mobs, heroes, NPCs) and what I did, is created a class named "Actor" and each time I have a new actor I create a whole new class extending it.

I was thinking if I could limit it and go with a single class (prototype pattern?) were each instance of it gets its info and properties from stored files (name, weight, HP, attack, playable, ...)

I thought first to use xml to store every actor I have in the game, so it would be a lot easier to modify or add new actors, and this goes for also weapons, gear, potions, etc.

I'm afraid to use XML or JSON, because this would make the game content open and then anyone can modify it.

So, any thoughts on how to implement that, because i'm totally new to game dev?

\$\endgroup\$
  • 5
    \$\begingroup\$ If you're making an offline game, why is modding an issue? \$\endgroup\$ – Tyyppi_77 Nov 19 '16 at 15:14
  • \$\begingroup\$ "I'm afraid to use XML or JSON, because this would make the game content open and then anyone can modify it." You'll get more players if modders know they can mod your game. Specially if your game is offline, as pointed out by Tyyppi. \$\endgroup\$ – Vaillancourt Nov 23 '16 at 11:53
2
\$\begingroup\$

You could use JSON and zip it with a password (encrypt), then use a runtime zip library like DotNetZip to extract it for inspection by the game only, no-one else.

Or you could access it on a secured server that requires login to get the file.

The question boils down to, How do I secure plain text? - perhaps this form of the question will help you find the best answer.

\$\endgroup\$
  • 1
    \$\begingroup\$ i think compressing it with a password will do the trick, it's just a small offline game, thank you again \$\endgroup\$ – AminePaleo Nov 19 '16 at 15:11
  • 2
    \$\begingroup\$ Note that as long as the password to decrypt the file lives in the game client, your data isn't completely protected, it's just a bit harder to get at. If someone's eager to modify the data, they'll do it, because they have both the lock and the key in their possession. Fortunately since it's an offline/singleplayer game, they can't impact anyone's experience but their own, so players changing the data might not necessarily be such a bad thing. \$\endgroup\$ – DMGregory Nov 19 '16 at 15:34
0
\$\begingroup\$

Also think about how you will be parsing the data, does your language have easy methods to parse JSON for example? Not all languages do.

Also you are probably aware but you will also only want to send diffs of your data rather than the whole data each time.

But as the other answer states, if you are sending sensitive data, encryption is a must regardless of how you send it.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.