Jump to content
  • Advertisement
Sign in to follow this  
d1sc0rd

Database design : xml or relational

This topic is 4953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a project in C++ that uses more complicated data than I have ever used before. I am looking for some helping in chosing the right type of database. I am mostly looking into XML and relational databases (or some kind of hybrid). The data is stored locally. It doesn't need to be modified (at least not by the user). However, I will be updating the data for everyone on a regular basis. The first problem I am having with it is that it is semi-structured. For instance, in a database of spells (i'm not working on a game, but a program about a game), each spell will have some structed elements, such as the name of the skill and its casting cost, but each skill will a varied number and type of effects.
<Spells>
 <Spell>
  <SkillName>Flame</SkillName>
  <CastingCost>10 Energy</CastingCost>
  <Effect>
   <EffectType>Direct Dmg</EffectType>
     ... other aspects of Effect1...
  </Effect>
  <Effect>
   <EffectType>Incendiary</EffectType>
     ... other aspects of Effect2...
  </Effect>
 </Spell>
 
 <Spell>
  <SpellName>Heal</SpellName>
  <Effect>
   <EffectType>Heal Self</EffectType>
     ... other aspects of Effect1...
  </Effect>
 </Spell>
</Spells>


Each skill has a varied number of effects. The number and type of elements characteristic of each effect type vary widely. I am new to relational modeling, but I can not see how this can be effeciently modeled in a relational database. So, I have been inteding to use XML. However, the second problem is that the data will need to be queryed and resorted in many different ways. SQL would do the job very well. I have thought about using sqlite for a relational database, or DBXML for an xml database. Anybody have any suggestions about how to best store and access the data?

Share this post


Link to post
Share on other sites
Advertisement
For a relational db design you'll end up having several tables with only a couple of fields each. Something like this:

SpellTypesTable
---------------
ID : autoincr
Name : string

EffectTypesTable
----------------
ID : autoincr
Type : string

AspectsTable
------------
ID : autoincr
Name : string
Value : number

EffectAspectsTable
------------------
Effect_ID : number
Aspect_ID : number

SpellEffectsTable
-----------------
Spell_ID : number
Effect_ID : number


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!