Sunday, August 02, 2009

Playing in a box

Well, two weeks later and that's what I've got. 22 poorly drawn and animated men running around playing something approaching football in a big enclosed space. There are no set pieces (not even kick off), the defenders don't do anything and every player is exceedingly single minded when he finally gets on the ball, but at least it's all a start.

There's no kick off - the ball just floats in from the sideline and all 22 men start right on the centre spot, inhabiting each others bodies in ways that I didn't intend. There are no goals to be scored, not just because there are no goalposts but because there's an invisible forcefield surrounding the entire pitch that's deflecting the ball should it dare venture in that direction. Even if there were goals, there's no ref to allow them.

So there's still a lot to be done on this basic version before I can start building upon things. I'd have liked at this point to say "well, I've got a start, let's go tackle the GUI" but that's the sort of lazy thinking that got me here in the first place - several years on without a football match.

Saturday, July 18, 2009

Football, football, football.

About two years ago I posted about my frustrations with creating a good match engine. I got severely pissed off about it all and went off to do other parts of the game. Those done, I recently went back to the match and am feeling no different, unfortunately.

I spent a short while mucking about with 3D engines and in the end decided that it would probably be too much effort right now fretting about that. I created a 2D engine based on the same principles as Blitz3D's system (a world full of entities, basically) as a kind of stepping stone, and also so it's easy enough to update and draw each frame. That's working brilliantly, so as you can guess, it isn't the problem.

Getting the perspective right is the issue. I'm wondering if it's worth pushing on until I've got it sorted. Now, the right attitude should be to press on - I'm using placeholder art anyway - and then correct things when the basic game is up and running and tweaks can be made. The match engine's inner workings are separate from the graphics, so it should be pretty simple to do so. I'll just have to ignore some graphical quirks - currently the actual pitch is being viewed from directly overhead, whilst the players are from an angle, lending the whole thing a rather odd feel.

Still, pushing ahead I did manage to create a control abstraction system. This lets me poll what I call a virtual joypad for input. The actual input could come from key, joypad or even the mouse, but as far as the game's concerned it all comes from this one joypad. It works quite well, though it still needs a few things tidied up.

I'm going to make a big push over the next few weeks to get somewhere with the match engine and see if I can have it play an utterly terrible, but thankfully complete game of football. From there, I can start tweaking the perspective, improving the AI and expanding the controls and options.

Saturday, March 07, 2009

Platini said my game rocks. Allegedly.

Today, I started work on a new GUI system. As much as I like the original FryGUI, there are a few features that I'd like to support that, whilst possible to implement in the existing code, would require enough rewrites and redesigns that I'd be as well starting afresh.

I'm sticking with the Screens and Panels system which works well, and adding support for things that I think really ought to be there. Chief among these is multiple resolution support. Instead of sticking rigidly to an intial res, the interface will scale appropriately when altered by resizing the panels and gadgets appropriately. Fonts might get bigger, tables might get more info visible on-screen at once, and so forth.

The other major inclusion is joypad control. I'm making a football game, the joypad will be the primary method of control during a match, so it's pretty important that I can navigate screens using it rather than have to reach for the mouse every time I fancy making a substitution. Navigation using Tab or the cursor keys will also be supported.

Other additions include allowing individual screens to reposition panels, more flexibility regarding skins (previously, skin border details etc. were hard coded, I never did get around to making them editable), positioning gadgets using reference points rather than hard coordinates (e.g. BOTTOM_RIGHT for the bottom right of a panel, regardless of size), animated gadgets, improved tables and better text input (with clipboard support, or at least that's the plan).

Meanwhile, Michel Platini was in the stands as Newry City (my home town team) lost to Portadown last weekend. The footballing world is certainly a strange place.

Sunday, February 22, 2009

Leagues forever

Leagues have taken up a fair bit of my time recently. More specifically, promotions and relegations.

I didn't want to have a simple system where teams go up and down willy nilly, I wanted to match some of the complexity of the various leagues from around the world. There should be restrictions on teams climbing the leagues, ground requirements to be met and limits on the progress of B teams, blocking promotions or even forcibly relegating them to accomodate relegated first squads. It was tough, but I've a working system.

I've had one of my frequent worries recently about whether or not things would hold together. Individual competitions and leagues are working, as are the connections between them, but I've never been able to test it properly over a long period of time, to see how the game copes with the data being thrown around, to make sure little oversights here or there don't conspire to bring things crumbling down ten or twenty seasons later.

That's what I've just been doing today. There's only a small selection of competitions forming a league system and a cup, but it's a good test for now.

Happily, 32 seasons later the game's still blasting away. That's about half of what I really need, as careers can start with the player as young as 14, so we really need to keep him going until he's about 70. 55 seasons at the very least. Looking at the test competitions I've been using, they've been working every season, no crashes, and the league is still structured as expected.

And happily, something that's difficult to fully test for but brilliantly came out anyhow - a team won the second division of the league in 2036, and their B team won the same division in 2037, showing that B teams will still be promoted if their A team is promoted ahead of them. Sweet!

Wednesday, January 28, 2009

Round and Round

Knockout competitions are fun things, aren't they? Full of excitement and drama, and because they're so simple, you'd think they'd be easier than a league to put into a game. And in thinking that, you'd be wrong - at least as far as this game goes.

The biggest concern is in coping whenever you've got fewer entrants than you expected. A league can simply adjust the number of fixtures everyone plays in order to compensate but in a knockout, playing fewer games in one round will affect those that come later. This is worth considering, because with so many competitions and possibilities, it's next to impossible to guarantee that something won't go wrong somewhere and render a knockout short on teams. It won't necessarily be a bug or an oversight either - the Europa League has differing numbers of entrants depending on whether or not the holders are participating in this season's Champions League, whilst in the English League Cup, teams playing in Europe get byes to later in the competition.

The game needs to be able to react to this. One possible solution would be to cater for every possibility by creating several formats and choosing the one that works, but that's awfully wasteful. Instead, I decided that knockout stages should be able to take control of their own destiny.

By telling the game how many teams are supposed to reach the final, the rounds that some teams get seeded into automatically, and how many teams are expected to join midway (think the CL failures dropping into the Europa League), any knockout competition can adjust its format. All I need to do is tell the game what rounds might possibly be played - the League Cup actually has a preliminary round that has only been played once, but if nine English sides are in Europe in a given season, it'll turn up.

Seeing this work has been hugely satisfying because it was a major cause of headaches over the last while. Knowing that a competition will be react to changes takes a lot of pressure off, as the whole thing is less likely to break down because things didn't work out entirely as expected, and in football, you just can't expect anything.