So whole of my life I was using just a simple txt files and later JSON, and I love work with files when I make my games, but I was struggling a lot with a more complex data in my game, because JSON honesty can't handle it well. Someone told me that XML can be well for more complex games, but what is your opinion? What do you use and how GODOT handle XML or other in your opinion better data structures?

Currently I'm using ConfigFile for saving configuration data and saved games. It's simpler than JSON, if you don't need to access the files from other applications.

I think there's also an SQLite database module.

I would start by defining what operations you need for your data. Then decide on a data structure that makes those operations efficient.

File I/O is orders of magnitude slower than accessing RAM, so usage of that should be minimized.

I'm seriously curios what would be the data structure that json can't handle. It's designed to serialize complete javascript object model. That's quite a lot of versatility.

@xyz said: I'm seriously curios what would be the data structure that json can't handle. It's designed to serialize complete javascript object model. That's quite a lot of versatility.

In my opinion JSON can handle all structures but I will translate my question from another programming forum for you.

So question was I have a database of items for my game:

I create this item database in docs.google.com/spreadsheets and then I use plugin to change it to JSON file. That solution was very good until I didn't have a status effects, f.e. I want to add to items any effects like poison,healing... editable on the level of file, item X will have HEALING every 5 second 10HP and item Y POISON, this is an example:

{
    "10001": {
        "Name": "Small Health Potion",
        "Category": "Potion",
        "Type": "HealthPotion",
        "Texture": "SmallHealthPotion",
        "Stackable": true,
        "EquipmentSlot": null,
        "Attack": null,
        "Defense": null,
        "Max_health": null,
        "PotionHealth": 20,
        "PotionMana": null,
        "FoodSatiation": null,
        "Description": "Small health potion will give you an instant health.",
        "Poison": { "Damage" : 100, "Time" : 20, "Tick": 15 }
},

So I got the answer that JSON is good for hierarchical data structures but bad for Cartesian product and XML will be much better for more complex data structures. Actually I want to stick to JSON at least in my current project but I wanted to know for future games what data structures are used for more complex games.

I found a solution to manage my item database by JSONBuddy app:

I think virtually any database structure can be stored in json. Don't really see why xml would be any better. The only drawback of json imho is that it looks ugly when you read it. But xml is not much better in that department either. Did you perhaps get answered why precisely would json be bad for storing cartesian product like combinations?

No, XML is really bad for games and not a good way to store data (slower to parse and really difficult to edit manually). Both XML and JSON are hierarchical, so there is really no difference in structure. I would suggest never using XML in a game, especially in Godot. It won't give you much benefit but has a lot of downsides. Using an external app that supports JSON natively (not a spreadsheet editor) seems like a good solution. Game data is class based and hierarchical, so JSON actually makes a lot of sense here.

a year later