Monday, July 31, 2006

Morose what now?

Ok. Been a bit long. I blame.... cabbage.

I've been doing plenty of work on the data editor, and now it's almost refurbished. Well, it looks identical to the old one but uses the new database code, and as such it's infinitely better and using it is like breathing a whole new type of air, with 55% less fart.

I've also fixed a fairly major bug in the database code, so that's equally excellent.

But apart from that lot, I'm getting a bit annoyed that I'm retreading old ground. I expected this to happen, of course, and I'm still not doing too badly with regards to my targets. However, it does sap the energy to spend each night in front of the computer doing repetitive tasks.

So in addition, I'll also fiddle about a bit with random graphical jiggery-pokery (the best kind of pokery) to keep that little spark alive that says "have a bit of fun, you morose fuck!"

Although if it's going to be rude...

Sunday, July 23, 2006

Wahey for Backups

So, there I was, about 90% of the way towards changing the way the system stores the group sizes. I had updated the database structure and found that I made a wonderful saving of 8MB.

Then it hit me - the major memory hits come from any tables that have a lot of records. The biggest table is the People table - 575,000 records. The next biggest weighs in at a mere 16,000, which is section data (each competition being split up into sections, such as a group phase or knockout stage).

Other than the People table, I wasn't losing much memory. And although on an individual basis the speed hit wasn't that big, there's no point in sacrificing speed for 8MB of RAM. Speed lets me do more.

So the backup was useful, to stop me having to spend time changing everything back. I've got to do that more often.

In other areas, I started playing Brothers in Arms: Earned in Blood. The series is easily the best WWII shooter out there. It's atmospheric, looks great, and best of all doesn't treat your character as John Matrix. Invincible supermen don't work for me in a historic setting, so to see myself get ripped apart when in the open is joyous indeed.

Or not, as I'd rather kill them.

The sequel looks ace.

Wednesday, July 19, 2006

Insight into My World

I can use the database code to solve a problem with the database code. Now that's just genius on a par with folk like the guy who invented marmalade, and stuff.

Actually, I hate marmalade. Tangy bunch of crap.

See, my problem is that I'm often forced into using too much memory to store small numbers. I wrote the database code as a means of allowing me to store small numbers in just the right amount of memory. So what I've decided to do is have the system automatically create fields for every "group" in a table, telling you how many entries are in that group.

I had held off this idea in the past because I thought it would be too slow. That's a load of poo, it's perfect. The player table alone shaves nearly 10MB from the file size. Ten arse megabytes that weren't being used at all.

In other news, I purchased a copy of Kudos, obviously on the basis that my own life's down the pan so I may as well lead an alternate one. That went well. Within a year I had lost all my friends, been robbed three times and learned the ancient art of Kung Fu in retaliation. One of the chaps that burgled my home decided that instead of taking the cable telly, he'd swipe my self help book. Such a blow to my confidence, but at least I could still watch the Comedy Channel. Alone.

Hey, it beats staring at the walls with the lights off.

That's an option in the game, by the way. Where I live, I have no walls.


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...

Sunday, July 16, 2006

Ahhh!

I sat down yesterday to start creating the database structure (a delightfully easy task now). I perched my laptop on my lap, which no doubt made the guy who invented it let out a sigh of satisfaction at another accomplishment, and got to work. A few tables later, black.

The screen went black. The laptop had shut off. It had overheated.

No worries, I thought. This has been known to happen - the fan's a bit clogged with dirt and dust and so if the laptop isn't on a cool surface, it'll overheat. I sat the machine on the little table in front of me and got back to work. A while later, black.

In fury, I leapt up and unleashed a stream of urine towards the toilet. I must point out that I actually went into the bathroom first, as I'm not blessed with such fantastic aim. I let my anger subside, picked up my small plastic guitar and thrashed out a few Guitar Hero tracks, failing miserably at No One Knows and Crossroads yet again. I had decided to let the laptop cool and also let any capacitors (which there probably is inside these things) discharge properly.

Then I would open it up, clean the fan, and everything would be good. Alas, I couldn't open the fucker. Every screw known to man was removed but the thing wouldn't open. Instead, I fixed a room fan and set it beside the machine. Success! The fan's cold air kept the laptop cool, and I worked away. As the day turned into night and other cliches, I turned the fan down a little to keep myself from freezing, and continued working.

Black.

Oh for fuck sake. Four times in one day is not fucking good. I unleashed my fury upon Crossroads but once again failed miserably at Queens of the Stone Age's efforts.

If this laptop's buggered I'll be most upset.

Sunday, July 09, 2006

Swift? Ha ha!

In my last post, I mentioned the links system and how it would swiftly clean things up to avoid horrible crashes.

Swift is not the word. Slow is.

Actually, it's reasonably quick but it can't be used in the game at all because it all adds up - delete one player and it might take a second to ensure all traces are removed. Delete the 20,000 people who might retire at the end of the season and I suspect that nobody's going to be happy waiting for five and a half hours while the game makes sure everything's ok.

Instead of automating it, it'll have to be cleaned up in code. It's not a major problem - it had to be done anyhow in places - and still doesn't necessitate too many code changes if I rearrange the tables. I've still got some headaches related to the whole speed thing but not as much as before.

And of course, I don't have to worry about the imminent destruction of the universe.

Friday, July 07, 2006

A whoo-hoo. Yes.

The database has been recoded. And works great, it's clean, and it'll be much easier to use. I've still got to tackle the rather large and annoying problem that is rewriting the data editor in order to use the new code, but it won't take as long as it did to write it in the first place.

At the moment, I'm still adding a system of relationship links to the database. Essentially, these will allow you to link the field of one record to another table or group, the purpose of this being to get the database code to automatically clean things up when you make a big stink. For example, if I delete a player from the database, it will swiftly search through all the teams in the game to make sure that the player is removed from his club, through all the competitions to tell his disciplinary record to sod off and so on, thus avoiding horrible crashes that might have plagued the original system.

It's a wonderful theory, but it also threatens to undo the very universe with its irritating recursiveness. Remove a player and you remove his entry in a club. Remove that... and you might end up deleting something else, like an existing loan arrangement. Delete that, and it might go and mess up something else, which will screw up the upstairs landing and result in a cacophony of squirrels attempting to assault a banjo with creme de menthe. I've confused you, I know, but that's basically how I'm suffering just trying to sort out this ridiculous yet entirely necessary system.

It could, in theory, end up trying to delete the very thing you've deleted in the first place, setting off the entire chain reaction. If that's a record, that's no problem - the system doesn't shift records around when you delete one, so deleting record two won't move record three down. However it does shift entries in a dynamic group. If I remove Player 13 from a club, Player 14 will shift down to save memory. I don't particular want to delete that and end up destroying the universe, particularly as I've yet to visit some nice places in that universe.

It'll be done tomorrow if I don't gibber.