Friday, April 02, 2010

A Lack of Control

The past month has been spent building up the moveset of players, and then tearing the whole thing down again. That was intentional though, I swear.

Having earlier given players a physical presence, the next task was to get them to interact with the ball. I stuck with a sticky ball system, as it's easiest to get up and running in game-form, so when a player is in possession the ball is pretty much locked to his feet until he releases it, or he's tackled. Passes were added, with some nifty code that allowed a player to weight a pass just perfectly, and then I topped it off with shots capable of breaking the net.

Well, ignoring the net. One of the things I had yet to do with the collision detection system is deal with objects that move faster in one frame than their own size, allowing them to easily pass through thin objects like goal nets. Oh well, that was fairly easy to solve, simply splitting the motion in a single frame into several smaller chunks to ensure everything's caught.

That left first-touch football as the only thing that still needed doing, and thanks to the aforementioned tearing down, that's still largely the case.

The game deals with everything using an Action system. Everything a player can do is ultimately an action. Some are continuous, like running, where as along as the action is set the player will run in the given direction. Others are timed, and an example of that might be a volley - it takes time to swing your leg, with only the point where the swing connects with the ball being of any concern.

Naturally, because of this the game needs to work out exactly where and when you should start swinging, which depends on the ball's trajectory, your position, and so on. Unfortunately, what I've managed so far is first to have the player move to position then stand like a goober because he can't work out the timing, presumably because of the archaic intercept timing system I have which wasn't designed for this purpose. I've also managed to tweak a few values and have a player run to the ball and then encircle it forever, which I think might be a good model for some footballers, but doesn't exactly lead to a fun game.

Looks to me like I'll have to tackle the interception system. Which sounds obvious, and that's probably because it is and I didn't think of it until now.

I tell you, this blog's like a Mac. Pays for itself.


Thursday, February 25, 2010

Year 2010 of development

Oh, how I do love my big long gaps between posts.

Picking up where I left off, I expanded the match engine to include some rudimentary set pieces, then trotted off to work on FryGUI2 for some time, even though I said I wouldn't. Eventually though I was lured back to the match engine.

My next task was to inject a bit of physical presence. Players were ghosts at this point, freely floating through one another in their pursuit of the ball. Of course, some existing games work like that, even the mighty Sensi, but there's a lack of satisfaction when you can't use your ample frame to block an opponent's attempts to dispossess you, and the likes of NSS3 show it can even be done in the classic top-down viewpoint.

Added to that, I wanted some momentum. I had players reaching top speed instantly, and equally quickly they'd grind to a halt when the stick was released - good enough to get things moving, but again it just wasn't satisfying. Players need to feel weighty.

After some experimentation, I quickly decided in that familar way of mine to start writing another engine, this time featuring the basic physics and collision detection along with the graphics display. Using the old graphics engine as a base, I added some bounding volumes for collision detection, got immensely frustrated a number of times that possibly entered three figures, got drunk a lot, and eventually landed with a working system. Again, it was one of those things that was quite pleasing to finally have working, and again it was one of those things that didn't really bring me any closer to having an actual game.

No matter! Back to the match engine, rebuilt now using the newly named FryWorld, back to largely working order but with the added bonus of collision detection. It only took about six months. I'm so proud.

In the coming weeks I'll be building up the move set and expanding on the basic AI, hopefully getting myself a playable match for the first time ever.

Then, I think, I might just get drunk.

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.