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.