Hey everyone. Long time no post. Sorry about that. I landed my dream job over a year ago and have been pretty busy since then. I'm working at Harebrained Schemes on the new turn-based Battletech game. The last turn-based version was released over 20 years ago! Come check it out at: http://battletechgame.com/
Today I'm going to talk a little bit about a metadata database (That's really fun to say btw) and how you might use it in your projects.
What is a metadata database?
Let's start with a couple of definitions. Metadata is just data about other data .And a database is just a structured way of storing and accessing data. So... a metadata database is a structured way of storing and accessing data about other data... Is your mind blown yet?
For example... Unit metadata might include things like the filename, and tags that describe the type of unit that it is: medium, sniper, jump_capable. Map metadata might include the filename, and a bit to say whether or not to include it in the release build.
Why use a metadata database?
If every unit is its own separate file, you'd have to load every single file into memory in order to query that data. That might be okay, but file access is slow, and there's lots of data in our unit files that we don't care about until we actually spawn it: how many heatsinks does this mech have, what's the internal structure is in the left leg, there's a large laser in the right arm, etc. For a given spawn point, we might want to say I'd like a random light mech that's jump capable to spawn here. Without the MDDB, we'd have to load EVERY unit file and look at each one. Instead, we can write a query that returns a list of units, pick one, and then load just that file.
Databases are fast at querying data... It's what they were built to do. For smaller projects, it's probably fine to just load up all the data and iterate through all the data you care about. But eventually, you might want to consider using something like this.