How to store text in a game?

Godot Version



Hello, community

Non relevant context: I’m doing my first 2D-Game just for testing, so I don’t know if it will end up releasing, but anyways I’d like to make it as real as possible to a finished game. I’ve already implemented movement, some NPCs, Finished State Machines, tilemaps and I’m using Nathan Hoad’s Dialogue Manager to handle dialogue. So far, I’m really enjoying the process of learning Godot, GDScript and game design and programming in general.

Going to the point, my question is how do you store the text data of the game? If I have to put the text of the menu buttons it’s very straight forward. I just write the text on the Control Nodes. But what about all the dialogue lines if they’re too many?

I’d like to add quite some dialogue to my game and…

  • I’ve thought about writing all the text in Godot scripts, but I feel like that’s not the best way.
  • I’ve also thought about writing the text in a .txt document and retrieving the data when needed. I know very little and I wonder if that’s bad because of having the data in plain text (perhaps when compiling the game, the data gets encrypted?).
  • Another option would be writing the text on the plugin’s specific type of document (document.dialogue).

I’m not searching for a definitive solution, but for opinions and ideas on how you do it or how would you do it, so I might learn about you and game structure in general :face_with_monocle:

Thank you a lot for your time :smile:

1 Like

Depending on your needs, any of those seem fine. It’s up to your preference really.

In case you ever wanted to support translation, you might keep your text in a .csv file. Other than that, I would probably lean towards the .dialogue files, if it’s the dialogue system that willl be using it anyways. I haven’t tested Dialogue Manager’s compatability with translation files, but I expect it would work fine.


Those options should all work.
If you wish to encrypt the text, there’s an option in the editor to turn text strings into binary (Under Project → Project Settings → Editor), and of course you can use an encrypted pak file.

In our game, we have a ton of dialog, and to keep my writer from having to learn Godot it’s all stored in plain text (using the Clyde dialog plugin). I break it up by map for convience, so the vast majority of the dialog is stored in one dialog file per map. No sense loading irrelevant dialog into memory, right?

1 Like