XML

I’ve taken a break from the UI, so the news for today is I’ve stopped using:
stardata.txt
planetdata.txt
wormholes.txt
and replaced them all with a single universe.xml.  XML, if you’re not familiar with it, is a way of representing arbitrary data in a tree, where each nested relationship is represented by putting the child “inside” the parent’s node.  There are other features like validation schema, which I won’t be using.
It makes a lot more sense now from the data’s point of view- you used to have to give the ID number of which star each planet orbits when declaring the planet in planet.txt, now you just have the planet be a child of that star’s node, and it is visually pretty obvious what is going on.  The same goes for which galaxy/world each star is in.  It’s also now impossible to have a planet orbit a non-existent star, or a star in a non-existent galaxy.
I used rapidxml to make it happen without having to write my own xml parsing tools, so I was able to make the switch in a day, which is better than I really expected.

This entry was posted in Design. Bookmark the permalink.

Comments are closed.