Sunday, December 30, 2007

I'm still here

Three and a half months, eh? Blimey.

The reason for that unsightly delay is pretty much that I managed to land myself a job, and as such haven't quite had so much time to work on the game in recent times. Most of the work I have been doing is data entry, which isn't really that exciting.

I'm currently in the process of getting a match engine up and working, which is coming along reasonably well but without players it's all a bit pointless. I keep hitting a hump when I approach it and end up running off to fill in Korean football teams, but unfortunately no amount of teams are going to make an adequate substitute for the actual football so I've got to push through that.

When I get a match engine in, however basic, I can then get a working alpha ready. Pick a team, play games, have fun, and little else but it's a good platform to build upon.

Next update: March 2013. Well, hopefully not.

Thursday, September 13, 2007

Content!

Over the last few weeks I've started putting some real content into the game. With lots of the competition engine in place and working, the game can now support the leagues and cups that form the backbone of the entire football world, and it's actually quite exciting to see this take shape.


Wahey! Work in progress pyramids! Eat that, Pharoah!

Thus far, as I've decided to now indicate on the right hand side of the blog, the game contains the team data for three countries. Only England has competitions as yet, as the more I add at this point the slower the game gets to set up, but adding new ones can be done nice and quick these days. For England, I've got all the leagues down to Step 6 of the National League System, which is level 10 overall. 47 divisions in total, which took me bloody ages so people had better be grateful and start playing as Sport London e Benfica or something instead of Manchester United all the time.

Cup wise, it currently has the FA Cup, League Cup, League Trophy, FA Trophy, Conference Shield and FA Vase. The League Cup hasn't been fully modelled as the game still doesn't have the ability to reseed teams to keep everything neat, so the differing numbers of sides in European competition can't be done until then. In Scotland, I've got the teams for all senior and junior sides, so that's quite a few teams to choose from and was done purely to placate any Bankies fans. Wales is proving more difficult as club information is scarce. The Welsh Football League, which covers the south of the country below the Welsh Premiership, is pretty good on this front as their website gives me all the information I require, but the three leagues feeding the Cymru Alliance have only scattered information. I'm endeavouring to include them though, because last season Barry Town got relegated from the WFL Division One, and the ability to return them to their former glory would be nice.

For each league, I have a spreadsheet - we all love speadsheets. As well as the club name and some abbreviations, I have the year they were formed (adds a nice enyclopaedic feel, I think), their rough ability, their home kit, home town and stadium. When deciding whether or not a level will be included in the game, and assuming the level is strong enough to be worth while, I have a look to see what data I can collect. The absolute required info for every club is their name, strength and home town, and these are all fairly easy to come by. The strength is added so that when I generate fake players for the majority of clubs, the game will ensure that things feel right - no superstars plying their trade with Cefn United. The larger sides also get strengths but these will be altered later when more accurate player details are entered.

The real difficulty comes with finding kit details. When creating clubs, I'm only concerned with the home kits, and generally a great majority of accurate kits is required for any given level. Away kits are ignored mainly because they slow me down for detail that changes far too often anyway. Like players, I can go add accurate away kit data for the bigger clubs, and have the game generate suitable away colours for the other sides. It's really just a time issue.

So far there's over 1,250 teams in the game. Now if I can get them to play football, that would indeed be brilliant.

Thursday, August 16, 2007

Tiny little bug

It's always the little ones.

Today I was developing the league ranking system, essentially a way for the game to record the finishing positions of all the teams in a league, and also for the teams to be ordered correctly. This can then be used by competitions to determine seedings, or collecting only the top 8 teams to play.

While testing this out I was frustrated for several hours by a bizarre error. At the end of the season, all the teams' rank information are updated accordingly. This is then followed by promotions and relegations, which involves updating the current level each team are playing at. Irritatingly, doing so tended to set the "rank level" - the level the team were playing at last season - to 0, the highest level available. As far as the game was then concerned, if Cardiff City won the Championship, they're ranked as high as Manchester United.

After a while I had traced it down to the exact function that sets the current level. A function that simply should not fail. I feared the worst - if a part of my database storage and retrieval code was broken, the entire database could be compromised. Sure, I have backups but I'd still need to find out the error, and if it's damaging I'd need to code an entire routine to reorganise the data and ensure it's fine.

Eventually, and naturally, I traced it to simply using the wrong variable at a crucial moment. My database works by only using the required storage for any given maximum data value in a field - if the field holds the numbers 0 to 15, it will use four bits. The next four bits in the byte will be used by something else. This enables me to store a great deal of data in a much smaller space. In order to store two values in a single byte, I need to be able to "mask out" the irrelevant data at any given point. This was the broken bit, with the code therefore ignoring the masking and wiping the entire bite before storing my data.

I think, but currently have no proof, that this error was the cause of a few other issues dotted here and there with some competitions "forgetting" what league they were part of if I edited them after setting the league up. All it would take is one editing of a preceding value and that data goes out the window.

Sunday, August 12, 2007

Ups and Downs

Individual competitions are almost complete. The engine is fully capable of coping with differing numbers of entrants, so there are only a few things left. Chief among these is the existence of what I've been terming the "half group" structures. The most prominent of these is the MLS - two groups, but with matches not restricted to those in your own group. Yesterday I discovered that it's not just the Americans using this system, and that any Englishmen still bitter at those "damn Yanks" for calling the sport soccer need to have a few words with some of the powers in their own garden. At the non-league level, at least

The Northern Premier League's first division was restructured this season in accordance with the FA's plans on sorting out a clear league pyramid. Unlike the other leagues at this level, the two created leagues (North and South) only have 18 teams, instead of 22. This caused a bit of a fuss among the clubs because 34 game seasons aren't really helpful, and the NPL duly responded not by increasing the league size or another cup competition to make up the deficit, but by splitting each league in two - sort of.

Each league is split into two groups of nine, on a regional basis. Each team will play those sides in their own group three times, and those in the other group once, thus giving an extra eight games each. Unlike the MLS, performance relative to the other teams in your group counts for nothing - it's the overall league table that matters. Whilst to the casual observer they don't seem to share structural DNA, the generation of fixtures and general workings are practically the same from my point of view.

The English league itself has been created in the game now, down to Step Four of the National League System, or the eighth level overall if you prefer. Whilst doing this, I helped myself out by introducing a few handy functions and changing the way clubs get added to the database. I can now duplicate an entire competition, which is handy given that most share similar characteristics with few changes. The club spreadsheets I'm using, one per division, contain club info as well as their city and stadium. I've ditched seating information, largely because the information simply isn't conveniently available and to use it would slow the input process down. I reckon now I can add an entire division in about a half hour, including creating the structure in the game and adding it to the league structure.

I make that about... oooh... 390 hours of work to get the world in there.

The regionalisation of lower levels is working brilliantly, although a few hiccups earlier did give me a bit of concern. The first was the bizarre omission of Newcastle Blue Star from the NPL First Division North in the second season. As the northenmost club at that level (by some distance), they definitely should have been there. They weren't in the First Division South either. Well, not the right one, they were in the Isthmian League First Division South. It turns out that I'd added the team with the city "Newcastle-upon-Tyne", and omitted the coordinates because I knew the city to be in the database. It was, sans hyphens, and the game thought that Newcastle Blue Star play in the heart of the world, in the Atlantic Ocean off the coast of Africa. I can't be arsed coding in severely flooded pitches, so I just set them to the right place.

I later got concerned that the game wasn't properly dividing teams up into Isthmian and Southern leagues, but I quickly discovered that I'd placed Bury St Edmunds in the West, not the East. Oh well. Everything else was positioned rather lovely, so I did a little dance.

Promotion and relegation isn't yet done. I've worked out the process and in theory it's fine. Promotion is dealt with first, with teams promoted provided they meet the criteria, and provision is there for other teams to take their place if necessary. Relegation is then dealt with, and repreives are available if the number of teams coming up isn't enough.

I then read about the Italian Coppa Dilettanti, a competition played in Italy between sides in the Eccellenza and Promozione, the sixth and seventh levels of the Italian league system. The quirk of this competition is that the winners are promoted to Serie D. I like quirks, so I instantly wanted to make the Eccellenza available, and thus this cup competition playable.

Unfortunately, my league system doesn't cope with teams potentially being promoted more than one level. In fact, it freaks out completely and doesn't know what's going on, leading usually to the level in between the two having far too many teams. I could spend time devising a new system, but I've decided that for now it just isn't worth devoting time to a non-essential. Not when there's so much else to do.

At the moment I'm looking at ways to make inputting the promotion data as stress free as possible. Currently I have to set up the data in the competition itself, and then let the league know where to expect the promotions/relegations to come from and what priorities to assign to them. I should be able to get some of that done quicker. Once that's done, I'll get the English system finished up and tested, and use that as a basis for working on the focus system and other details.

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.

Thursday, May 17, 2007

I'm not dead. Physically.

It's been a month. Probably a good idea to update, although I'm not entirely sure what to write. I'll have to actually go and read previous posts so I don't repeat myself, and so I can see how much I've failed. In the meantime, have a picture of a beard:



I hope you've enjoyed that as much as I have. Perhaps more! Now then. Back at the start of the year I was working on competitions, and everything was going quite well. Then I shifted focus to the data editor, changed an awful lot, and had to redo most of the competition work.

Thankfully, that has taken about two days (the rest of the time may have been spent scratching various parts of my body). Things are working again and are much tidier than before, so I feel a tad more confident that it will all hang together well enough to fool people into thinking I know what I'm doing. I've still got to add a bit of code that will sort a league table for me. The existing routine just assumes that you're using the same system as the Premiership - Points, Goal Difference, Goals Scored. That's fine but other leagues aren't quite so simple, with the number of flying mice having an affect on whether or not throw ins are worth an extra place or two in the table and all sorts of nonsense. I have a vague idea of how I intend to do that, but actually doing it is another thing.


Thursday, April 19, 2007

Viva Ecuador!

Viva indeed, as they've finally seen sense over there and stopped their habit of promoting teams halfway through the season. Now, whilst that made things very interesting, especially from a gamer point of view, it was always going to be difficult to cater for.

Thankfully, that's no longer the case and as I'm not presently aware of any other nations doing the same, I can ignore it happily.

Whoo!

Friday, April 06, 2007

Focus

Most of the time spent in the last few days has concerned teams. I've got a simple import function in the editor that will read data from a csv file, so I've filled it out with 189 clubs from the UK and Ireland. Not much in the way of data, just names, formation years and club colours, but also a team rating.

One thing that irritates me about some games is that if the developers can't get the player data, they leave the team out altogether. Sometimes the team exists but cannot be controlled, they're there in order that certain competitions work accurately (for example, having a number of Andorran clubs in the game so that they compete in UEFA competitions), but in more extreme cases they just cease to exist.

This strikes me as a mistake. Surely, when it comes to accuracy, the hierarchy is Real Players -> Fake Players -> Non Existence?

I'm a one-man band at the moment. I may well be able to draft in some volunteers to help me out with player data, but there's no chance whatsoever of every team in the game having real players. Restricting the number of playable teams has a greater negative impact than having having them slightly inaccurate.

Clubs in the game have ratings for more than just random player generation in the event of missing data. For a start, in testing the game I need as many players in there as possible, and working on real data just isn't quick enough. A quick routine in the code to flesh out every side and I'm ready to test.

The second reason is due to the game's focus system. The less important the competition from your perspective, the less time you want the game to spend on it. By giving each club a rating that changes as players move and develop, I can generate reasonably accurate results for distant leagues based on club ratings instead of calculating individually. Speed is vitally important, it is a game after all. More playing, less waiting.

I've also tweaked FryGUI some more, and now it's possible to add new gadgets to the system without altering the module itself. This is perfect for game-specific features such as a league table in a football game - why do I need that in a graphic adventure? Gadgets are easily added, and the XML system has been revamped to allow for the new gadgets to be added so that the parser can recognise them.

Tuesday, April 03, 2007

The match engine has been put on hold for now, every time I approached it I just got some sort of block. I think the problem is that the animation is utterly woeful, yet in order for the game to feel right it needs to have these frames of animation in place. Things like dragging the ball when turning, swinging to connect with shots and so forth. Given that the rest of the game still has plenty of work to do, it makes no sense to keep running up against a brick wall and I certainly can't afford to draft in someone else to get those animation frames done for me. I'll focus efforts elsewhere and return later with a clearer head.

The first thing I've done is refactor the game's interface to an effective resolution of 800x600. As mentioned in earlier posts, I went with a larger resolution so that I had more room, more detail, and so that in windowed mode it didn't look like playing on a postage stamp. However, a few things since then have made me rethink the decision. The main one is my laptop, which has an SiS graphics card that has caused me a few headaches. Higher resolutions put more strain on the damn thing, producing frame rates that were satisfactory today but not something I could guarantee would be the case further down the line. For as long as these things exist, it makes sense to cater for them.

But why do I need more room in the first place? I'm not looking to create a stat-heavy game on the outside, I want things to be clean and attractive without looking like a spreadsheet. 800x600 gives more than enough space to produce the game - in the past I developed a management title on a 320x200 resolution CPC6128 and it still included everything I needed. By restricting the space I just need to come up with better ways of conveying the data than throwing text around the screen, which is precisely what I want to do anyway.

Leading me to the second problem - detail. I'm no artist, and with the match engine I already made the decision that higher resolutions will simply show more of the pitch rather than the existing viewpoint with more clarity. The same principles can largely be applied here - less resolution means a greater margin of error. That's not to say I'll be making a half-hearted effort or even relying on my own dodgy art if I can't get it up to scratch - absolutely not. I'll be striving to make the game look good. Lower resolutions keep the download size down as well, which might be nice given the database size.

As for the windowed mode, well, my GUI is fairly powerful as it is, but more tweaking should allow me to display it in any screen resolution simply by adjusting the OpenGL or DirectX properties accordingly. As a result, you could play in a 1024x768 window if you like. It won't even have to be all scaled if I've got my numbers right, as it should be possible to get the GUI system to adjust the locations of gadgets if you choose any other resolution. All the different resolutions will be supported in order to get the game looking right on LCD monitors, but the only difference will be some things look sharper.


In slightly related news I've spent a lot of time in the last week (when I wasn't lying around in frustration with the match engine) playing LMA Manager 2006 for the Xbox, which I managed to get for about six quid. I'd be lying if I didn't say that the game's attractive appearance on my telly wasn't a major motivating factor in the switch down to 800x600, they've done a wonderful job there. But there are other aspects which, whilst traditionalists may scorn upon them, have an awful lot to say in how much I'm enjoying the game. The stadium building aspect is like toying with Lego, and that's always fun. You can browse every team in the game and have a look at their stadium, most of which appear to be reasonably authentic. Sure, they're not the incredibly detailed representations that surround the pitches of FIFA 07, but where EA's effort has 51, LMA's number in the thousands, especially when you include your own concoctions.

It adds nothing whatsoever to the management aspect itself (where the game does reveal itself to be very shallow in comparison to the main PC efforts), but does an awful lot for atmosphere, and personally I find it a motivator. I'm managing East Stirlingshire, there's no North Stand, just a brick wall behind the goal and every match day I can plainly see that there aren't many fans there. We averaged about 430 in our first season where we nabbed promotion against all the odds but with a capacity of 1,880 there's no need to take any of the investors up on their offer, we're good for another while. Eventually though, we'll need to expand. When Firs Park has a 60,000 capacity stadium and every game it's packed to its fullest with drunken Falkirkians, I'll know we've made the big time. As big as time gets in Scotland anyway.

Stuff like that interests me in a game, because it stops your mind from wandering. There's no questioning the accuracy and depth of Football Manager's simulation but text screen after text screen can grind a man down, and blobs engaging in an entertaining game of football makes it all feel somewhat sterile. It's a game that needs a technological advance or two to really start getting the blood pumping from day one, rather than requiring several game-seasons of play to really sink in. Playability is most certainly everything, but every now and then you need the visuals. You need to treat yourself.

Friday, March 23, 2007

Dribbling

Things have been going in a certain way that immediately brings such non-words as "poocrapular" to mind. The last three weeks have been focused on getting some people playing football, and this has revolved around several areas of frustration.

The first is the fact that I can't have little people playing football until I have little people. I'm not a terrible artist but nor am I particularly adept with the human form, so after much frustration I finally got this lot done.

As you can see, they aren't the best looking animation frames in the world. For a start, they're far too exaggerated so I've got some freakish loon waving his arms all over the place when he so much as attempts a light jog. And I'm pretty sure he'd actually break his legs if he ever tried to run with that. But still, they're functional so it gives me something half decent to work from.

Once I got the little chaps done, my next task was to get him running about. I've created a rather simplistic animation system, which I'll no doubt build upon as I go along (the same can also be said for the tilemap system, which will be updated with animation and transparency features as time goes on). I did a little bit of research and found that professional runners tend to run at about 180 steps per minute, essentially meaning three steps per second. So each frame lasts for a ninth of a second, and this was pretty easy to do. The game's physics engine (rudimentary though it may be) already had code to ensure it updates every 60th of a second, so the same code was used in the animation system to keep things ticking along.

A running man, and not an Austrian in sight. Now what he needs is a football, and the ability to run with it.

I've played a fair amount of football games in my time, and having recently upgraded my PSP to a PS1-emulation supporting firmware, I indulged in yet more online spending to grab myself another six. Across all the games, it seems that the representation of dribbling ability falls into one of four camps.

  1. The ball sticks to the player's feet. All the time. In other words, I can't actually see what the difference is between a good dribbler and a bad dribbler. Sample games: Actua Soccer, FIFA 98, Viva Football
  2. The ball sticks to the player's feet for a period of time. During this period the player has full control over movement, however when the time elapses he can no longer change the ball's direction. Thus, a better dribbler can keep control for longer. Sample game: Sensible World of Soccer
  3. The ball sticks to the player's feet, but he moves much slower than his normal running rate. The better his dribbling ability, the faster he can move whilst maintaining this level of control. Sample game: New Star Soccer 3
  4. The player nudges the ball along as he moves, just as you would in real life. The player can therefore only change direction when he's close enough to the ball to alter its direction accordingly. Better dribblers don't knock the ball as far as the poorer ones. Sample games: FIFA 07, Kick Off, Pro Evolution Soccer 6
I've never seen anything different. Seeing as this game is supposed put a lot of weight on the player's abilities, the first one can't be considered. A shame, as it's by far the easiest to actually do, but frankly I'm not sure I'd want a game where something as vital as a dribbling ability is entirely irrelevant. The second system, used by the official Best Football Game Of All Time as voted by me, just now, places a large importance on ability but at the expense of realism - I dunno about you, but when I run the length of a pitch I'm still able to change direction and take the ball with me.

The last two have their good and bad points, and it's hard to split them. It can be argued that they're both differing implementations of the same basic idea - where Pro Evolution Soccer's players knock the ball further so that they don't trip over their own feet, NSS3's little guys just take their time to achieve the same thing. Of course, if you delve deeper into Pro Evo's control system you'll find that you can slow yourself right down and maintain tighter control of the ball, while with NSS3 you can nudge the ball out from under your own feet to run at a quicker pace.

For now, I've gone with the fourth system. In addition to being a fairly fine representation of how dribbling is, it also plays a part in goalkeeping - my own position in the field. When an opponent is bearing down on your goal and you feel like rushing off your line to smother at his feet, you need to time your advance with his own dribbling. When he nudges the ball further still, you need to be quick off the blocks to close down the angle before he can do anything else. This also applies to defenders, who will be looking to nick the ball away from a player when it's vulnerable. When the ball is stuck to a dribbler's foot, you lose these facets of the game.

Whether or not this lasts depends on how it holds up in gameplay. There's no swanky 3D engine to get a closer look, and the players are sprite based which greatly limits the animations available. Yesterday I finally got a player to run with the ball in a manner that satisfies me, but until opposition stand in the way it'll be impossible to know for sure. One irksome problem is the game's perspective - when you're running towards the goal at the top of the screen, the ball is often obscured by your player. If you can't see the ball too well, how will it affect gameplay?

Friday, March 02, 2007

Deceptive

The central midfielder picks the ball up just inside his own half. He rolls a simple ball out to the wing where it's picked up and dribbled, unchallenged, towards the corner flag. Cutting onto his left foot, the winger lays the ball off to the unmarked and now arriving central midfielder who meets the ball beautifully and deftly slots it home through the obvious gap. All so simple.

It's not fucking simple! It's fucking terrifying! There's nothing fucking simple about getting any of that to work, not without tearing huge chunks of your own brain out and devouring them in the process in the hope that you might get taken away and never have to do any of this cunting shite ever again!

As you can tell, I'm not particularly happy at the moment. The little things that, when you're out on the pitch playing with even the more clueless folk out there, are so easy to do, become cunting tough whenever you actually need to put it into code. Let's take an example - there's a ball rolling in a direction, and you want it. So what do you do? You take note of where it's going and you get in the way of it. Easy.

I spent the best part of a week trying to come up with the quickest possible way of getting my tiny little blobs to do that. I have pages and pages of worthless trigonometry, now. Worthless because those theories never panned out. Maybe I never coded them correctly, maybe they were wrong in the first place, none of that matters because it's a heck of a lot of wasted time - in thirty minutes I coded in what was initially a temporary fix that actually does a better job than any of my mathematical tricknickery.

With that done, I turned my head to the rest of the physics. Balls should bounce off players, right? This would be easy if it wasn't for two things - first, I can't rely on the actual graphics engine for collision detection because I want the game to be able to process more than just the match you're viewing. The second irritance is that I never know what the hell a player is doing. Is he running? Where are his arms?

"Where are my arms" is a question I may well have found myself asking random people if this had frustrated me any more, as I can think of little more immediately satisfying than blowing away the object of your anger whilst cackling like a 1920's Chicago mob boss. I would even have bought a cigar for the occasion, it would be that important.

But it never came to that. I decided that as much fun as playing with little circles is, there's no real match for getting proper visual feedback. Instead of working with an abstract engine and Football Manager style blobs on a single-screen, overhead pitch before introducing the snazzier display, I've decided to go the other way. A pitch, a ball, a man (although I'm not fussy, so as long as it's bipedal I couldn't give a shit), and they'll fucking stay there until they've worked out how they're supposed to interact. Actually, I did get the ball interacting with the pitch correctly, but with an overhead view it's harder to see the bounce.

So, over the last two days I've created a basic tiling system for the game. Tiling, if you don't already know, is simply the way the background graphics of the game get built - the pitch consists of several tiles which are laid together, and that's about it. In order to do this I knocked together a half-decent TileMap editor, and I made sure the drawing code could cope with flipping the tiles on the horizontal and vertical axes, to save me having to have four versions of similar tiles. It all seems to be working well, and about a half hour ago I managed to have a scrolling football pitch. Couldn't even get jumpers for goalposts though, I'm very poor.

I've set myself a little personal goal for the end of March. If I can get something that resembles a playable football match done, I'm going to treat myself. As I have no money, it will have to be something small.

And with Sensible World of Soccer on the way for the Xbox 360, I think I also need to have a major goal for around June 2007, get that done, and treat myself to one of those.

Thursday, February 15, 2007

Ok, a little later than I had hoped but today I started working on match engine elements. More specifically, the problem of devising the basic formations, and with that the positions a player will take up depending on the situation.



I built this editor today. The basic system is the same as that of Sensible Soccer, Championship Manager, New Star Soccer 3, Football Manager, and probably countless other management games out there. The pitch is split into twelve segments in a 3x4 grid, and players are given rough positions on the pitch for when the ball is in each grid. This is duplicated for possession (the Wibble in the combo box above referring to "With Ball", which any CM players might be familiar with).

It's a starting point, and nothing more. The first big hurdle of football AI is getting a player to have an idea of where he's supposed to be, and you've basically got two choices. You can build a hugely complex module which factors in every known factor, from the number of players on either team to the length of every blade of grass, and results in a perfect position for the given situation at the cost of several billion clock cycles... or you can just use your intuition and do it manually, once. (Don't take the screenshot as an example of my intuition.... those are woeful positions for a left wing ball)

Then you tweak. You tweak for all the little things - where's the ball, exactly? Is it safe to move? Will I have an advantage if I go over here? Why can't I get enough alcohol home from the shop in one trip?

Tweaking, when we're worried about clock cycles because you want to process as many matches as possible, is cheap. Stick a bag of grass in front of a sniffer dog and he's going to find it much quicker than when you shove it up your... chimney. Mainly because a dog isn't a burrowing animal. No, not burrowing.... chimney sweep. Yes... that will do.

I've decided upon 38 unique positions a player could possibly have, and they're on the right. The guys who play in the centre each have five different values because there are always differences depending on how many are playing at the back. A flat back four doesn't want to have any of its players assuming the same role as a the middle guy in a back five, so I've tweaked accordingly. I've also thrown in three sweeper positions just so you can too.

What I haven't done is take into account how positions change depending on the other guys on the pitch - having a central defender might well change where the "ideal" positions are for your centre backs. But to throw that into the mix would mean my list of positions would be a lot greater, and worse it would be more complex to actually devise the individual formations.

The theory, at present, is that these are created simply by using the defaults. Two strikers in a 4-4-2 will always begin their position-finding routine at the same place as two strikers in a 4-2-4, where the other guys are the "advanced wingers" as I've put it. The routine ought to change those positions accordingly to best use the space available.

If this theory falls down, then I'll run with the ability to change the positions for all the formations, but these defaults created will serve as a simple method for giving me a base from which to build each formation.

Elsewhere, I've been working on player generation, which I'm mostly happy with but clearly there are a few things that need ironed out.


The first, most obvious one if you check that screenshot is that player names are a little on the poor side. These guys were all randomly generated (and I've added a flag to them so I can remove them with ease), but the existence of chaps like Sabatino Greenwood means I need to work on a much better method for creating player names. At the minute, all the English names are kept together, which is lovely when you get William Carr, but not so nice when Ciaran El-Salahi rears his ugly head (he's not there on the screen before you look for him, but he did come up once).

The flaws don't end there - the physical characteristics haven't panned out too well yet either but then I knew they would be borked from day one. It's entirely random at the moment so when you get several seven-footers with light blue dreadlocks and bum-fluff moustaches roaming the midfield, you can't really say you're surprised. I'll work in a normal distribution there to the generator to ensure more normal people.

What are working well are the routines that deal with player attributes. Positions are linked, so if the game sees fit to throw up a centre back, there's a chance he could work well in a defensive midfield role, or even as a full back. Attributes are then linked to positions, depending on competence in that role - a natural striker is throwing up strong finishing and movement, whilst a reasonable defender might not be a great tackler, but he won't be shit at it either.

This early random generation means I can knock up a number of teams for use during the development for the match engine, which should hopefully prove invaluable. Better still (can something be better than invaluable?), when the match engine has reached a solid, playable point, I can swiftly create and populate enough teams to turn a collection of reasonable looking screens with no real purpose into an actual working game. At this point I will stroke my beard and proclaim victory over the elements, chiefly boron. I have issues with boron. Don't ask.

Finally in a lengthy blog post, work continues on FryGUI and I'm hoping to get the latest release out this weekend. A lot has been added since the last version, the most spiffing of which being the inclusion of a canvas gadget, but there's also a few image buttons (of the rectangular and circular kind, too) and some other smaller stuff. Oh, and I wrote a new data editor for the game (that'll be it there in the second screenshot), which started off annoying because I think it's the fifteenth so far, but it works cross platform and is significantly more attractive than the drab, grey look. One problem with it is that I can't cut and paste, and more annoyingly I don't think I will be able to on anything other than Windows, but I'll see if I can build a character map or some other form of adding the rarer characters
into FryGUI.

Thursday, January 25, 2007

A big empty box

I can't say that this week has any better than the last in terms of hauling my arse out of bed at a reasonable time, but at least things are still going smoothly with the game. I've just managed to complete the basic competition engine, which will give me some room now to go off and work on other aspects of the game knowing I've got a bare bones machine to work with.

I haven't bothered to speed up any of the fixture-checking routines as yet, there's not much point when the database only has one or two competitions in place at any one time. I'll wait until I've populated the game world enough to actually see any major slowdown during the checking process, and by extension any speed gains from new routines.

Hopefully by the end of the month I'll have implemented a decent front end to the system, and a module to manage all the human players in the game, a save and load system, the basic shell of the game. That'll leave things nicely poised for February so I can start fleshing out the world, building little people and commanding them to their doom.

Friday, January 19, 2007

One Week Gone

I've got some mixed feelings. It's very clear that I work a hell of a lot better now, and get more done, but somehow I feel I haven't really achieved enough to give me an entirely positive outlook on the whole "never wanting to have another job again, ever" plan.

Then again, a string of 11.30am starts and one day that waited until after noon to begin probably played as much of a part in that as anything. Today was a bit of a lazy day, accomplishing much less than the others, which I'd put down to being Friday except weekends are a meaningless concept now.

So, what did I do? Well, I've been spending the time working on testing the storage and updating of league and knockout data, and they're working well. Knockouts still need work, I've cheated a bit thus far, but I'll focus on that later. On top of those I've then implemented a main engine which "controls" the game time, so to speak - it takes care of the in-game clock, advancing it forward in real time or faster, better speed settings, and carrying out necessary tasks. One such task is to collect all the fixtures that are played on this game day, for which it has to get out of bed at 2am. It does it by brute force at the moment, running through every fixture in every competition in the game (i.e. none at this point), so that'll need hugely optimised in order to keep the game running at high speed.

I don't really want to spend any time sitting about waiting, and if there are to be competitions in over 250 nations I'll need a nicer routine.

Hopefully next week I can drag myself out of bed at 9am, and with the extra time I might be able to make huge strides on bringing all the competitions together and interacting properly.

Saturday, January 13, 2007

It Begins

It's been a month, for various reasons. I'd like to blame Christmas, Half Life 2, Far Cry Instincts Evolution and even alcohol, but that would all be lies. The real truth is I ended up taking a mini-holiday for the hell of it.

I did so because as of Monday, I'm going to be working on the game full time. Obviously this means I'll run out of money eventually and you will be able to find me and a dodgy laptop coding away in an overflowing gutter whilst I fend off tramps using a bit of an old bone, but such sacrifices need to be made for the hell of it.


This is possibly a good thing. Also, potential goodness stems from the fact that the blog is an entire year old. That warm, fuzzy feeling then gets smattered (it's a real verb!) into oblivion as I tell you that it's been a bit of a shit year, in fairness. Aw, fuck. Have I really not done much? Well, apart from the nice interface.

Poo.