0
\$\begingroup\$

This is a question I've been meaning to ask. I have thought about it for a little bit and have a few ideas, but I'm not sure which is most secure, and will give me the most functionality with the most efficiency. For my game (being a story game) I have a plethora of strings that I'm going to need to display. I decided to split up the story into chapters, each chapter being a new scene(This way I could organize the content for the chapter). What I was thinking was that I could write regular text files with the chapter's content, while efficient and practical, this seems highly insecure. Then I thought, why not put it into large string arrays on a separate C# file. Well that's more secure, but it's not really practical and it has less efficiency. So I have found pretty much the two extremes here.

What would be the best way to deal with large amounts of strings in a secure, efficient, and functional way? Think about a happy medium compared to my two extremes.

\$\endgroup\$
  • \$\begingroup\$ What do you mean by "secure"? Do you fear somebody altering the files or stealing the content or something else ? \$\endgroup\$ – tigrou Feb 6 '17 at 22:23
  • \$\begingroup\$ In a way. I don't really want them to be able to alter the main files of the game(the text of the story that is). Oh, and yes I really don't want them stealing an original story of mine. I mean I'll have the game copyrighted but that's not gonna stop people. \$\endgroup\$ – Sora Feb 6 '17 at 22:27
  • 1
    \$\begingroup\$ I've never heard of a case of someone stealing the complete text of another creator's game and trying to pass it off as their own, so this might not be a problem you need to solve. A bit of basic encryption to keep players from inadvertently stumbling over spoilers in the game files or discovering secret scenes before you want them known might be all you really need. Players can always discover your whole story in the time it takes to play the game through (plus re-plays for branching) so you can never expect to keep it secret forever. ;) \$\endgroup\$ – DMGregory Feb 6 '17 at 23:15
1
\$\begingroup\$

The most secure method is to store them on a server, and transmit them to the client game only when absolutely required by that game.

If you store the text on the user's machine in any form, it can be retrieved and viewed (and modified, potentially) by that user. You can prevent casual inspection of the text data by storing it encrypted, and decrypting it at runtime. This will usually stop casual snoopers from poking around in the game's data files and finding the text. It will not stop anybody who can poke around in the game's memory at runtime, as you will eventually need to decrypt the strings and once you do the user has the decryption algorithm and keys and can decrypt the rest of the text whenever they want. Nothing on the end-user's machine can be trusted, from a security standpoint.

Notably, moving the text around into different C# source files has no impact on anything, security-wise. It is not more secure, it is not less secure, you've just moved the data a little.

\$\endgroup\$
  • \$\begingroup\$ So, I'm probably okay with just using regular text files to hold the chapter contents? \$\endgroup\$ – Sora Feb 6 '17 at 23:55
  • 1
    \$\begingroup\$ Yes, if someone wants to modify your game they will find a way. So it does not matter how you store something as long as it is easy and efficient for you the programmer to access it later. \$\endgroup\$ – rlam12 Feb 7 '17 at 0:59

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.