I’m getting ready to start creating some of the basic data for my game - enemies, items the player can use/equip etc. and I’m trying to decide on the best format for this data.
I know that JSON is really popular these days and it has clear advantages:
- Fast processing
- decent out of the box support in libGDX
but there are also things I don’t like about it. Despite what everyone on the internet seems to think, I don’t find it as easy to read as XML - or, at least, well-designed XML. XML also seems to have much better support for metadata than JSON does. I know XML is verbose, but I genuinely don’t care (I’ve never really understood the strong aversion to verbosity in XML or in Java) - unless someone knows of a really good technical reason to go with a less verbose format.
XML also has XPath. The ability to perform a query on the data is important to me and I know that XPath is good for this and, I believe, can be done reasonably quickly via a cheeky SAX parse. There is, of course, JSONPath - is that any good?
The other option is to use SQLite, which has all of the above advantages (clean structure, metadata support and queryable), but the downside of a performance and memory overhead. It’s a nice technology, though, but I suspect that either XML or JSON would perform better.
Anyway, I’m interested in the thoughts of the internet - so please weigh in. I’m expecting a lot of support for JSON, which is fine - it may well be the best solution, although please don’t just recommend it because it’s the most popular. I’ve found a number of discussions online about this where that seems to be the main argument for JSON - just that it’s the latest and greatest thing.
Obviously, if you’re aware of yet another solution I’d be really interested to hear about it.