I am a novice C coder who would like to write a role playing game resolution library. What I mean by this is that this program would only deal with resolving those conflicts which is piped into it. For example, when informed that Captain Amazing uses his Blasto eye beams at medium distance with his d8 Shooting Skill costing 3 Power Points, and his Wild Die, against Commandant Nefarious who is behind Medium Cover, it determines the result. It will not deal with either character, per se, only their relevant statistics, who the attacker and defender are and any modifiers relevant to this particular action of which it is informed.
The thing is that it will not have a built-in set of rules. Instead, it will be fed the rule set from a configuration file. This way, the same core engine could be used for a Savage Worlds virtual tabletop game, a turn based rogue-like or a real time D&D 3rd Edition 3d game. Different sets of rules for different types of CRPGs all using the same RPG library. My question is with regards to how best to do this.
For the last couple of days, I've been looking at using XML as a possible way to store the game data which would be needed. At first appearance, it looks like a good way to go since does not appear to be terribly difficult. On the other hand, since it would load the rules at run time, I cannot do XML data binding as that would convert it to C code, which would of course need to be compiled. That is how I understand it, at least.
To build on the example in the first paragraph, this is what the library would and would not need after the rules have been read in:
Library knows through the read in rules: How to resolve a Ranged Attack. What Skill is needed for a Ranged Attack (Shooting). What the base Target Number is. What the penalty to hit at Medium distance is. What the penalty to hit for the Defender being behind Medium Cover. How to deal with the Wild Die (if it is higher than another rolled die, it is used instead.) Aceing. (On most, but not all rolls, if the die hits its maximum score, it is rolled again, adding to the total. This continues until the die does not hit the maximum score.) What the values for the dice are.
What the library will need to be informed of: What the Attacker's Shooting Skill is. Distance. What the relevant situational modifiers are (Medium Distance, behind Medium Cover) Any character modifiers relevant to resolving the Shooting attack.
What the library does not care about in performing its task: Character names. Character skill levels in subjects not pertaining to resolving the current question. Which character is the player and which the non-player character.
Would XML be fine or should I approach this in a different way?