Friday, June 30, 2006

Retreading old ground

I've made the decision to go back and redo the database code. Since writing it in the first place I've got, well, a little better at coding. At the moment, the main problem is that in order to access, say, the date of birth of a player, I've got to read in all of that player's data into a Player type, and then have a gander at his birthday.

Hey, it made sense at the time - by reading and writing whole records, I saved myself a few headaches. But it came at a price - every time I wanted to change the database I had to make numerous changes to the game's code as well, and over the last week it all came to a head when I realised I was putting off work on the next issue because it involved this utterly soul destroying task.

I had had enough. I decided that I needed a way of telling the database system that I just want to look at the "Year Founded" field in "Club" without also getting the youth coach's weekly wage. It does mean a few extra problems need solved but I'm up to that task now. The new system when implemented ought to save me plenty of time, and it also keeps the game easily expandable.

The larger problem with this decision is that the Data Editor pretty much needs rewritten as it is based almost entirely on the old database code. Arse. But it can't be helped, it's going to have to be done.

Keeping this database clean is useful because it means I can create the basic game and then spend most of my time adding leagues and making improvements, rather than fighting with hideous code and ending up churning out crap.

Nobody wants crap.

Not even flies. But flies can't be choosers. Or I shall kill them.

Tuesday, June 27, 2006

It's big...

So I've been doing what I said I would - splitting the code into far more manageable chunks spread across many files. I'm not quite finished yet. Initially there were about 10 files at most, covering the data editor, the competition engine, the game database and so forth. All of them pretty large to the point where they got difficult to manage.

I'm not quite done yet but currently the total stands at 109 files, each one typically containing a single function and a few of the files have more, smaller functions that splitting seems a bit silly.

It's a ridiculously big game that doesn't even have some very important bits. Tsk.

That's my excuse for all this time. It's fucking huge. Live with it.

Saturday, June 24, 2006

Late night problems go away

Frame rate problem solved. Not that there ever was a problem.

Turns out, the IGlass frame rate function was returning the actual frame rate - i.e. how often the screen was being refreshed every second. Whereas I wanted to know how often the screen is capable of being updated every second. End result is that it's actually been running ten times faster than I thought it was, which means there's plenty of time for processing between frames.

Part of the plan for the game is to have it multitask, of sorts. So when you're playing, the game should be working in the background. After all, clicking on an interface is not a particularly intensive piece of work so there's no point forcing the player to wait at the end of every day while petty tasks are carried out.

I plan to implement this multitasking by having the game work out when it should refresh the GUI. It's easy to work out how long it takes to render a single screen. Say it takes 5 milliseconds on a bad day. That still leaves about 15 ms of time if you want the game to run at 50 frames per second, so the little background worker guy can just keep checking his watch to see when he should be showing you an update, or when he can do another quick job. Even if he's getting one job done every frame, that's still 50 every second. Those will add up.

It'll get complex when it comes to larger jobs such as calculating an entire match. I'm aiming for a single match to take about an eighth of a second, based on Football Manager's time of 1 second for an exceedingly complex ninety minute match compared to my game's 8 minute fixture. If I could get it in that time on the same computer, I'd be very happy indeed. But that means a single job would take much longer than one frame, so I'd have to be able to chop it up into little pieces.

Ah, design problems. Much more fun than making an editor anyway.

Thursday, June 22, 2006

I haven't done any work since I've come home. Whilst reading Masters of Doom I decided I really needed to create some sort of work area for myself - for the most part the game coding has been done in the living room. This isn't too bad and has yielded plenty of progress, but it's all to easy to get interrupted by marauding girlfriends and televisions.

So I've to clean up the spare room a bit better. Pity it's tiny and has little room for a desk, but I've got some rather sturdy shelving which will probably be fine to sit the laptop on. It's peaceful, that's a good thing. And I might want to move that laundry basket, but then I luckily can't smell.

Elsewhere, I've got to tidy things up a bit. The living room is a bit shambolic anyway because I bought a 14" telly to sit beside the computer whilst the World Cup is on, so right across from me there's a row of crazy electronic shit of varying ages. I can't work in mess very well, so that has to be sorted.

Speaking of mess, my code is a mess. It's not terribly structured (in my opinion) but it's nowhere near perfect. The problem is many of the files are getting rather large and need splitting up into more manageable chunks, so that's my target for the meantime. That, and see what I can do to sort out the rather jarring problem with the laptop (a 2.2GHz machine that's well above the target spec) running the existing code about 20% of the speed of the PC (an Athlon 3500). That can't be good. Not when it ends up rendering the screen at 60fps before I have it do anything complex. Considering my target spec is probably around the 1GHz range, I have to let out the occasional primal yell.

Hence the need for sanctuary.

Wednesday, June 21, 2006

Return to the blog

I haven't posted because I haven't done any work. I haven't done any work because I haven't been in the country, and because the country I was in was far too hot to do any work. Also, there was a small matter of football.

I did get to see Australia lose to Brazil in a rather indifferent game, but the atmosphere was amazing. I was Jakob Moertl for the day, whoever he is. Good old Jakob.

In other places, I did exciting things like climb an alp, or... no, that's it.

I also read Masters of Doom, by David Kushner. The story of id software, particularly focussing on John's Carmack and Romero, it's inspiring stuff for a guy like me. I even have long hair! Future Rich Person in the making, methinks. Now, if only I had their talent. Oh, and their Ferraris. No, there's plenty in that book that made me want to rush off and get coding long into the night.

There's also this quote from John Carmack I picked up earlier today:

The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.

He speaks a lot of sense. There's a place for patents but it is not in software. By all means make money from your creation but don't try to kid yourself. That pathway was forged with the architecture you're working on - you're just the first to walk down the road. Hilary doesn't claim rent on Everest.

Friday, June 09, 2006


World Cup time again! Happy days!

Although Ireland didn't qualify, thanks in the main to Israel's ability at coming back from defeat, I'll still be enjoying it. And I'm not just saying that because it's about 95% certain I'll be at one of the games.

No, it's a football fest. The good kind of fest.

A month of fun. Can't beat it. Although people organising weddings during the thing need a stern talking to.

Tuesday, June 06, 2006


That's what I did today. Or yesterday if you want to get technical. Monday. I did nothing. Well, I went to work (and did nothing there), and when I came home I was in no mood to do work of an interesting variety. So I had a long overdue day off.

A day off where I completed Simpsons Hit & Run (not a bad game), and then beat the Water Temple in Ocarina of Time. Well done me.

I did have a moment of clarity during the day regarding the best way to deal with all the data that a competition is going to require to get running (you know, storing all the results and league tables), which is a bonus. And last night whilst lying in bed in a frustrated heap (the Sunday Demon struck, you see) I had a nice little breakthrough with regards to those item templates that nagged me during the weekend.

It's good to get away from it all for a day. I'll come back tomorrow refreshed and eager and should hopefully make decent progress. By next Monday I'd like to have competitions basically working - that is to say that any one competition will work perfectly fine regardless of its structure, but all the fancy stuff like qualification will have to wait until a week later or so. If the football doesn't intefere. Pesky real world.

Sunday, June 04, 2006


So, we all have a new nation. Now, I'm sure that's wonderful for 55% of the Montengrins, but I'm not here to discuss politics and stuff. Football is at hand! With a new nation invariably comes a new national side, a new FA and new widdly things to worry about. I've structured the game so all that's fairly easy to enter, but when will it all occur?

We'll no doubt see Serbia & Montenegro at the World Cup as a unified team, and I wouldn't be surprised to see the two nations compete as one in the European Championship qualifiers, for which the fixtures have all been decided amongst the usual quarrelling. Assuming the game is actually finally released by that point then there might just be a problem. We'd see Serbia and Montenegro compete as separate nations at a future date.

That's not easy. I could hard code it but I'm loathe to do that, it's ugly and doesn't help for any future developments. So I'd like to do it in the editor. Some way of unifying two nations as one team for a period of time seems to be the answer, and also seems to be a lot of work.

Pesky politics. Think of the hardworking game developers!

Saturday, June 03, 2006

Revelation #239

I'm shit at graphic design. Really fucking shit.

Modern PCs give you massive resolutions and 32-bit colour. That's far too much for a guy like me to deal with. I used to be ace at creating interface mockups on my Amstrad CPC, with its 400x250, 2-bit colour screen. Four whole colours! Man, I had a screen with black, red, a darker red and white. It looked ace.

And that's it there in those little pictures, that I just took with a crappy camera. It suited the machine perfectly, it was nice, and I never got further than this. It would clearly have been the best game ever. Alas, it wasn't to be because it was 1999 and I finally got myself a PC, and thus all the requirments got expanded into areas that I alone can't possibly meet.

Which is why I'm quite grateful for my XML GUI system. Without that, I'd be stuck right now having to design (or get someone to design) an interface before I could proceed with the guts of the system. That'd be frustrating, and I wouldn't be able to make any changes later without a heck of a lot of work.

But right now, my interface looks like someone's crapped it out after eating fifteen curries laced with laxative, yet it's not holding me back in the slightest. Yes!