I want to create an XML format in which I will define data objects for a game I am currently working on.
The base idea is that I will have Elements
which can be combined in other Elements
, Items
or Spells
.
A primal element
is an element which is directly available.
If an element is not primal then in order to create it, it must be combined from other elements so it will have a recipe definition (list of components required to combine in order to create the specific entity).
Items
and Spells
also need to have a recipe.
As of now I created the sample XML:
<TechTree>
<ElementDefinitions>
<Element name="Fire" primal="true"/>
<Element name="Earth" primal="true"/>
<Element name="Nature" primal="true"/>
<Element name="Mana" primal="true"/>
<Element name="Lava">
<Component>Fire</Component>
<Component>Fire</Component>
<Component>Earth</Component>
</Element>
<Element name="Grass">
<Component>Nature</Component>
<Component>Mana</Component>
<Component>Earth</Component>
</Element>
</ElementDefinitions>
<ItemDefinitions>
<Item name="ManaPotion">
<Component>Mana</Component>
<Component>Grass</Component>
<Component>Nature</Component>
</Item>
</ItemDefinitions>
<SpellDefinitions>
<Spell name="FireSpell">
<Component>Fire</Component>
<Component>Fire</Component>
<Component>Mana</Component>
</Spell>
<Spell name="HealingSpell">
<Component>Nature</Component>
<Component>Nature</Component>
<Component>Mana</Component>
</Spell>
<Spell name="MoltenArmor" selection="ordered">
<Component>Lava</Component>
<Component>Nature</Component>
<Component>Mana</Component>
</Spell>
<Spell name="RestoreMana">
<Component>Mana</Component>
<Component>Mana</Component>
<Component>Mana</Component>
</Spell>
</SpellDefinitions>
</TechTree>
As of now there aren't too many attributes, but in the future the entities will have all kind of attributes (damage, effect, usable conditions etc) so I need to have a format that would allow me to extend, for instance, all items but not spells or elements.
I will enforce with an XML schema that components used in the recipe must be already defined. So writing Air
as a component without firstly defining it will yield an error.
Although as of now all recipes have 3 elements in the future I might decide to create some with a different number.
I would greatly appreciate feedback or tips on how can I improve the format.