I don't know if OP is still with us at this point anyway...
Basically I just need a way to describe an item. Give it a name, what type of clothing it is(head piece, gloves, etc.), and what stat changes it provides. Then in the game be able to grab the information and use it to alter the player's stats.
If someone can point me in the right direction I'm sure I can figure out some way to implement this properly.
There are two problems.
1st: a data structure must hold this data.
2nd: the data must get there.
While some people wrote about RDBMS (what?) an other about writing yet another domain specific language (c'mon), I'd rather consider the design problem first.
From your message, I have the impression you're considering examples... as a problem X instead of a problem Y. In generic terms. That's not the case. The first thing you must do is to sit down, and figure out what the game needs.
So, you have RPG elements. At the basic level say we deal about characters, stats and stat-boosting equipment.
An initial design might be (some fat trimmed and shortcuts taken)
struct Stat {
String name;
uint value;
std::vector<StatModifier> effects;
uint GetCurrentValue() const {
uint ret = value;
foreach(e : effects) ret += e.GetModifiers();
return ret;
}
};
class Character {
std::vector<Stat> stat;
Character() {
stat.push_back(Stat(L"Strength", 10));
stat.push_back(Stat(L"Hit points", 6));
}
}
So, when equipping a pair of gloves giving STR+4 we look up for a "Strength" attrib and add a modifier.
Notice that an armor giving COS+20 would be wasted on a vampire as it has no "Constitution" attribute (not in D&D rule set at least).
You must resolve all the features you need to make your game work before starting to write. You don't need to figure them out in detail, but at least know in what direction you need to go.
For example, being copy-driven, the above method has an issue. If a specific object is disabled (say by enemy magic), what modifier do we need to change?
Notice at this point however, getting data there is rather straightforward. I suggest JSON to do that (it will take you a day). A JSON representation of the two objects above might be
gloves {
"name" : "Empowering gloves"
"attribEffects" : [
{ "str" : "4" }
]
}
armor {
"name" : "Golem skin"
"attribEffects" : [
{ "cos" : "20" }
]
}
I'm making this up right away so I cannot guarantee it will go through a proper JSON parser. But I'm confident it will, as JSON is so easy it will make you sick.
Now the problem is:
- data to json: just iterate the various properties
- json to data: more involved, must figure out the data structure to use, multiple data paths required.
I guess it's better to stop there now. This is a really open and complex problem, we could go on for ages.