To start off, I need to say I am not an experienced game designer whatsoever. If there's some complex way to go about solving this that I don't know, it's probably because of my own ignorance of concepts of programming and math. I am really familiar with algebra, and I get all basic calculations with variables and such. Just not much more complex things beyond that.
Anyways, I want to try creating a randomized loot system, akin to Diablo or Borderlands. When the enemy dies, the player awarded with an item. That item will have possible types, like a weapon or armor. That weapon or armor will have its own qualities that are randomized, in the form of affixes. Affixes will be any sort of modifier, like a bonus to damage, or resistance, or some key stat.
My objectives are to:
A.Randomly generate items with varying values and stats
B.Allow for weapons and armor that can have a wide array of stats but only randomly selected stats will roll on that item (Limited # of affixes)
C.Create items that can be saved and loaded, without performance hits during creation and loading
D.Allow for unique items and affixes (I.E., named items with own personal trait unique solely to that specific item)
I've been spending a few days thinking of what ways to go about doing this, and I've been searching around the forums as well. I was thinking of making parent objects ("item_weapon," "item_armor," "item_consumable") and creating instances of those with instance variables to contain the affixes. I figured for each one of those items, I could have an instance variable for each possible affix, but I realized that each item would have tons of instance variables because of the sheer amount of possible affixes on them, and it would be difficult to display only the affixes that actually have values. I couldn't see way to (for example) loop through each instance variable for an item and see which ones actually rolled and have a value, and then display only those values in the item description. (if that could actually work somehow, please let me know)
So I'm little bit lost. I guessed another solution might lie in arrays but I'm unsure of how to use arrays for this. So my main questions are:
1.Could my old method work, using instance variables that are all present for that object but only some have value?
2.Could arrays be used in some way?
3.Do I need to learn to script in order to make this work?
(Thank you to anyone who replies, I will happily elaborate if I was too vague or missing any points or information)