Large sets of data and how to organize them

Godot Version

4.4.1

Question

This is a bit more of an esoteric question than I normally ask here. I’m largely self-taught as a programmer and game designer, so I don’t have a formal education and my knowledge base has many holes, I’m sure.
Lately I’ve been working on a web-hosted application in godot that exists in order to facilitate character creation and play for a TTRPG I designed. It’s actually going pretty well, but while creating it I’ve started to wonder if there’s a better way to do a lot of the things I’ve been doing.
For example, each character has 8 attributes. In addition, each attribute basically has 8 modifiers that add together to give you your total.
So the way I thought to implement this, since my attributes are static and never change, was just an array of 8 integers (one for each attribute) and to keep that order the exact same for 9 total arrays representing the modifiers and one for the total, then using a for loop to basically just go through each index and combine all key values of the same index for the last one.
The problem though obviously is I now have 9 arrays, and it’s not exactly super clean looking.

Later when doing skills, which are far worse (28 skills with 9 modifiers), I had the idea of putting arrays in arrays and this sort of worked but also introduced various complications.

Is there some method for managing large groups of numbers like I have that is more simple or obvious? How would you manage it? I’m not asking for a 100% concrete solution but rather I want to hear ideas and learn from you.

I’m also mostly self-taught and have no experience with web hosted application so take my advice with a grain of salt.

I’ve been working on a spell creation system where the player can make their own spells. A spell in this case is basically just a long list of values that is passed from the spell creation scene to the spell scene. In this case a spell is a dictionary and could look like this

equip slot 1 button was pressed, Selected item is: {
 "damage": 93.0, 
"mana": 39.89, 
"speed": 200.0, 
"lifetime": 14.0, 
"bounce": 4.0, 
"bounce_targeting": true, 
"element": "arcane", 
"size": 6.5, 
"pierce": true, 
"cooldown": 0.5,
"AOE": false, 
"AOE_size": 0.0, 
"crit_chance": 0.614, 
"spell_type": "orb", 
"multishot": true,
 "multishot_count": 2.0,
 "multishot_spread": 16.0, 
"knockback": true, 
"knockback_power": 66.0, 
... and so on
}

I plan to add more attributes in the future. If your code structure is good and the arrays in arrays work but is hard to read then i think this could easily be implemented with no major code changes.

In programming theres a term called “magic numbers” which is a numeric literal that is used in the code without any explanation of its meaning. If I were to change my spell list to an array it would look like a long list of floats and bools and i would have to comment what every number is on every line of code they were used.

But now instead of accessing the index spell_array[12] # crit_chance
I can instead get the dictionary key “crit_chance” and then get the value from there.

Hope this helps :slight_smile:

Custom resource classes.