So how worth is using xml for game data ?
I would say it would be pretty good for many things such as level data and entity data. Both of which can be read prior to starting the game/level. So performance won’t be an issue.
The nice thing about using XML would be having all the parsing API’s done. One less thing to code.
XML is good for level data - clear organization, and most browsers color-code and outline XML pages, so readability is a plus.
however, on the negative side, XML levels will be significantly larger in bytes than a custom file format or something. So if you’re not worried about size or users trying to edit your levels, XML is the way to go.
Vorax is definitely right about the parsing thing- that’s a big roadblock that’s already cleared for you 
I just started using XML the other day to specify object setups and animation ranges and so on for my objects. I started writing my own parser for the data then threw my hands up into the air and converted it all over to XML instead. Takes the gruntwork out 
I’m just using the Javax DOM implementations which I suspect is a bit heavyweight for what I’m using it for. Anyone using any Lightweight XML libs they’d recommend ?
D.
[quote]XML is good for level data - clear organization, and most browsers color-code and outline XML pages, so readability is a plus.
however, on the negative side, XML levels will be significantly larger in bytes than a custom file format or something. So if you’re not worried about size or users trying to edit your levels, XML is the way to go.
Vorax is definitely right about the parsing thing- that’s a big roadblock that’s already cleared for you 
[/quote]
That’s not a problem. You can just compress the XML file. Or compress your distributino jar.
This was also discuessed here:
Might have been better placed in that forum also.
Depends on the game data and the game. XML is a tool, you choose whether its applicable to your task.
Kev
There are JDOM and Xerces but since i never made a game using XML data i don’t how much is parsing speed a problem in a game application context. Ziping the data will solve the size problem.
There are other alternatives like using JAXB to marshal objects directly from xml files. Don’t know anything about how eficient this is.
What i really would like to know is, from the experience of guys who already used this in a functional game, what are the bottlenecks and where they are most critical when using xml and with what tools.
For example a rough estimate of the order of magnitude of difference between the startup time of a game using binary files (for game databases) and the same game using the java xml to load that data in a xml format. Would it be about 2 times, 10 times, 100 times ?
well, I only use XML quite sparingly. Firstly for configuration files that are parsed on game start and maybe written to once or twice if the user changes any options. Secondly for Object definition files. My object data is a large binary, MD2 style keyframed animation, then the XML file just contains information such as the filename of the binary data, what shader class used to texture the object, What animation sequences (if any) there are in the file etc etc. Loaded up when the object is first requested and then all the objects are cached and instances used for rendering, so obviously any performance hit I’d get would be negligble, and more than offset by the convenience factor.
D.
I use XML to store Odejava physics data - http://tanksoftware.com/xode/
Nice and easy to read, easy to parse too.
Will.