For large, complex games, I imagine that text descriptions, dialogue lines, etc, are organized in some sort of database, and not actually hardcoded into the source.

Are there any conventions on how such textual data is organized and inserted/loaded into the game? And how does this "database" get "compiled" into the executable along with the source code? (Because for most AAA games there aren't additional files containing said database, etc).

In particular, I'd like to know how to load text into a game, without opening some external client-side file (so the client can't just browse the file and read the ending!). I don't see how an external file/database could be bundled into the compiled source executable (for example, how would you do this in C)?

  • \$\begingroup\$ FWIW I think Skyrim uses some kind of custom database file but where it is located I have no idea. \$\endgroup\$ – lozzajp Nov 23 '16 at 8:24

Use an external file but obscure/encrypt it

One good solution (and what I am currently doing in my project) is to write the text in a source file in your game project (if using say Visual Studio, make sure not to copy content) written in your choice of XML/JSON or custom format.

This makes it easy for you to read and edit and in particular easy for any other designers or script writers to read and edit.

When it comes to building your project, you have two options, the first is to convert the text into binary and save the binary file. This would prevent most people being able to read it, you could read it easily back into your project and use the text as you wish in the game.

With just a binary file any slightly technical person could quite easily open and read it as they wish, so you may want to go for a second option. This would be to encrypt the text before saving it as a file. Depending on the method or encryption used only the most hardy hackers can get into and read the file.

The above methods have many benefits, it is readable and editable by non technical people on your team yet on release it is unreadable by the game players. It can be scalable and expandable to add more text to your game without the need to recompile your game (depending how this is done!).

| improve this answer | |
  • \$\begingroup\$ @Philipp I believe the OP wanted to prevent looking at content not the actual files. Having your entire textual script of a story for someone to just read is probably not ideal. \$\endgroup\$ – lozzajp Nov 23 '16 at 9:42

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.