Wednesday, June 20, 2007

The circus that is the development of a unified competition system for the game continues unabated. The latest problem to rear its ugly head yet again is the concept of qualification.

Currently, competitions in the game are static structures - a set number of teams from each rigid stage progress to the next stage, and the parade continues until the competition ends. Such stoic behaviour won't work for qualification, unfortunately. The problem arises when a team achieves a qualification place that it is incapable of accepting because it does not meet the criteria (for example, a B team winning a place in a cup competition).

The qualification system in the game goes into specific detail about which positions qualify teams for other contests - instead of simply saying "the winners of the FA Cup will play in the Community Shield", it's "The team who win the final of the FA Cup". It's a subtle difference, the accuracy allowing for any position at any stage of the competition to have an associated qualification, one that can't be done by simply taking the "top six" teams.

If a B team, or another undesirable side finish in one of these positions, the system also can specify a number of backup positions to consider. For the most part, this should cover the loss.

However, I can't possibly guarantee that enough teams will qualify. It is possible that the backup list will be exhausted (perhaps they're all B teams?) before the places are filled. Rather than grudgingly accept the teams into the competition, the alternative solution is to allow the competition to continue with a dearth of teams.

So, the formerly rigid competitions need new functions and rules to ensure that they work adequately in any scenario. Knockouts are easiest, as the system reduces the number of teams in the early rounds and creates more byes in order to ensure the final rounds are fully populated. Leagues are fairly simple, requiring the game to work out how many rounds need to be played given the new number of teams. Group stages may prove more complex in the face of the varying ways of distributing the teams but I'm sure an adequate solution will be found.

All of which has been rather annoying for me, as I was hoping to start creating European leagues and cups starting tomorrow. That will have to wait until I'm happy the system can cope adequately with the changing data. It'll be worth it in the end.

Sunday, June 03, 2007

The hassle of Extra Tables

Some competitions, in the far flung corners of the world, aren't as straightforward as they bloody well ought to be.

In Belgian's Second Division, for example, the eighteen sides play each other twice in a regular round-robin format. The top team at the end of the season will get promoted, and there's a playoff to determine which team will follow them. All very good so far, it's something that anyone in the UK can instantly recognise.

Unfortunately for me, the Belgians didn't quite run with the same system that I'm used to. Instead of taking the teams who finish second through fourth and sending them into the playoff that also features a side from the top flight, they use a system of "periods". The 34 games are split into three periods of ten, twelve and twelve matches respectively, and the teams who "win" each of these periods will enter the playoffs. Only in the event of extra places needing to be filled, such as whenever a team wins more than one period, will the full league table be used.

Ok, I can do that. I have the fixtures, so surely I can just tell the game to create a table that consists only of fixtures played in rounds 1-10, then 11-22, then finally 23-34. Three additional tables that I can use to determine winners. Easy!

Belgium aren't alone. In the USA's Major League Soccer, the teams are split into two conferences and the top two sides in each conference advance to the playoffs, together with the next four teams with the best record. Again, this requires the creation of a table which effectively merges the two conferences together, producing a 13-team table from which the required sides can be plucked. I can do that too, right? Just collect all the fixtures and create a single table out of them.

It's all quite easy to create new tables whenever you're using all the teams and all the fixtures. Sadly, there are times when that won't be possible. UEFA's World Cup qualifiers involve a playoff featuring whichever sides finished second in their group, and to complicate matters, certain results against the lowest sides are discarded when creating the table.

Let me get this straight then. I need a system that will take a set of fixtures and create a new league table, discriminating against teams and results based on their position within a group, which round the match is a part of and who the opposition are? Bugger.

I didn't really want to do that. Damn you, UEFA! It caused me no end of headaches trying to come up with a system which I considered fast enough to be worthwhile, but in the end I think I got there and I now have a working Extra Table system that can conjure up a single league table of no more than 30 sides, based on whatever criteria I specify. It works perfectly well so far - the only remaining test is to see if it successfully merges data from matches played across multiple stages - rather than listing Germany twice in the table, all results should collected together. I'd have tested that by now but I'm far too lazy to create a new competition to do it. Something for later.

The next task is to create a working draw system for competitions, based on seedings, geography or downright prejudice. Well, maybe not that.