Wednesday, July 19, 2006

It's getting big

I've slowly been building the database structure. It's all much easier now, as I had hoped. However, it's a little shocking to find the entire database weighs in at 100MB at the moment and has the potential to grow further.

I'm not entirely pleased with that, so I need to get it down. I know where the problem is, and it's best illustrated with a lovely example. The game has room for five World Organisations, such as FIFA or the Island Games Association. You know them well, of course. Now, each organisation has a list of affiliate nations, and it takes two bytes to store how many are in this list.

Which is a tad ridiculous and ought to be avoided if possible. I'd use one byte, except certain lists of this kind use up more than that. Now, if I could get it so that the game used the appropriate storage, I'd save an awful lot of memory.

Six organisations aren't using much. But consider that the same applies to a player's history, and there are 570,000 people in the game. That's over one megabyte, and I'm using two bytes to store a number between 0 and 20. That's just not right. And there are about 15 such lists for each person. 7.5MB at least is just wasted space.

As it is, these values are using up 40% of the total size. Arse.

Of course, if you're running a good computer this is never an issue. And the database has been designed to hold more data than is really necessary so the size will get reduced over time. Yet even so...

No comments: