Which text format would you recommend me?

Godot Version

<v4.1.1>

Question

Hello,
I work on game for quite some time now. The game is like a bureaucracy simulator (sounds like fun, I know, I’m German). Anyways know it’s time to decide how to store the text.
I created custom resources to store the right texts together. My example texts are very short and in String. But for the real texts I need to use BBCode to make the long texts more readable in RichTextLabels.
I have heard of TNT or Json as format. I don’t know what are the differents and therefore what fits my needs the best, bc it feels weird to copy the BBCode directly in the custom resources.
Would be cool, if you could recommend me a data format.
Thanks in advance.

If you want to know the difference between resources saving and json saving, so resources saving is saved inside the project (after export) but json saves inside the user computer

I have absolutely no idea what TNT is…

JSON (JavaScript Object Notation):

JSON is a widely used, human-readable, and editable format that can easily store both short strings and BBCode within an object structure.

You can create a JSON file with an appropriate structure. Here’s an example:

{
    "text_id_1": "This is a short string.",
    "text_id_2": "This is a longer text with BBCode formatting. You can use [b]bold[/b] and [i]italic[/i] tags here."
}

When Loading:

Use Godot’s built-in JSON parsing functions like JSON.parse() to load the data into your game scripts.

var bb_codes = JSON.parse(json_data)

print(bb_codes["text_id_1"])

I have some following questions:

  1. Your first example code is what I would write into the Json file, right?
  2. Do I need to use the “JSON.parse()” thing? Bc my whole game structure is basicaly in custom resources. How am I supposed to do this with resources?
    “JSON.parse(resource_name.variable_name)[“text_id_1”]”

If you’re wondering about which text format to go with, I’d recommend giving Markdown a try. It’s user-friendly and helps you concentrate on writing without any fuss. Markdown is great because it’s versatile—you can use it for jotting down quick notes or drafting more detailed documents. One cool thing is you can pair it up with tools like Notes Online you can find it here: https://notesonline.com/ for an even smoother writing experience. It’s straightforward to learn too, so you’ll be up and running in no time. Give it a whirl and see if it clicks with your style!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.