Sunday, May 27, 2007

Action man

Since we last spoke I have mainly been working on 3D aspects of the game. Initially I improved the appearance of the globe that will spin in the background and highlight the location of the stadium for the next fixture. Pinpointing the right spot on the surface of the earth proved very tricky, partly because I'm useless at maths and partly because I'm still getting to grips with the 3D module, but after a couple of days I was very pleased with the results. This screenshot doesn't highlight a stadium but you can see the atmospheric haze and the cloud layers. There are actually two layers of cloud which rotate at slightly different speeds and directions to the earth itself whichs give the affect of random cloud formations shifting over the earth.

After a brief spell fixing some issues with the database editor I felt like getting stuck into the match engine again. You may remember from a previous blog that the 3D blocks which temporarily represent the players were sliding around the pitch in the desired formation and they could chase the ball from one end to the other, but there wasn't any passing going on. Well the past week has been all about replicating the control scheme from NSS3 in the new engine. Despite using the same basic principles for kicking the ball (a tap of the button will perform a quick pass or quick shot, whilst holding the button will bring up a power bar so you can measure long passes) when combined with 360 degree control and a new dribbling method the game feels a whole lot different to NSS3.

Players now knock the ball in front of them when they are dribbling - the distance of the knock being determined by the running speed and dribbling skill of the player. In between knocks your player will automatically chase the ball so you can concentrate on holding the joystick in the direction you want to turn when he next connects with the ball. I feel that this is a much more realistic method than in NSS3 and after a while becomes second nature.

I've also included a sprint button which when held makes your player run faster but can also be used for advanced dribbling. By tapping the sprint button before touching the ball you can knock it a few yards in the direction of your joystick (this is more pronounced than the normal dribbling). With a little practice this is great when taking on defenders because you can see where a his momentum will take him and you can flick the ball in the opposite direction and go past him. Seeing it in action I am minded of Didier Zokora going on a driving run through the midfield, similar to this clip in Spurs versus Arsenal...

Also included is the "call" button which allows you to receive the ball from team mates. Getting the auto-pass to play the ball quickly and accurately to a player is one of the biggest challenges in the match engine as often the receiving player will change his direction just as the ball is kicked towards him. Using a bit of clever programming though it's possible to roughly predict where he will be in a moments time and play the ball to that area. The computer players are also able to detect where the ball is heading and move into that position rather than just expecting it to land at their feet.

So despite the fact that the players are just coloured blocks, it's actually starting to feel like a real game of football. Well, almost. I need to work some more on the artificial intelligence so that the computer players don't stick so rigidly to their formation and actively seek out good positions, and they also need to learn when to dribble and when to pass. Once those things are in place I can start working on the set-pieces and various game rules. There's still so much to do that I don't like thinking about it too much, but looking at how far the game has come I can't help but get excited about how great it will be in the end.

Friday, May 04, 2007

Doodle-flaps and dinkle flips

It's been a long three weeks since I last posted and it has been tough spell. After converting the Database Editor so that we can use International alphabets for player and team names, which was a chore in itself, I then spent 3 or 4 days changing the Blitzmax module which handles the database in the main game. I changed it because the new one was more user friendly and flexible but then I found that it simply wasn't fast enough for my needs and I had to revert back to the original database module which took another couple of days. Stuff like that can really put a dampner on your weekend.

Anyway, I feel like I'm moving forward again now and I've been putting some thoughts down as to how the non-human controlled players should develop in NSS4. In other words, the players in the database that are controlled by the game need to progress through their careers in a realistic manner, building their skills, moving from club to club, getting old and eventually losing their skills and retiring. I call the whole process 'player progression'.

Below are my initial plans. No doubt they will be tweaked and refined, especially once the game starts being tested, but I'm throwing them out there so some bright spark can say "hey, you forgot to increase the player's doodle-flap based on his dinkle flip!"

These are the player attributes that will fluctuate over time:

SKILLS
Tackling, Shooting, Passing, Dribbling, Heading, Crossing, Setpiece, Control, Weakfoot, Vision, Flair, Positioning

PHYSICAL ATTRIBUTES
Pace, Acceleration, Strength, Stamina

Every player will be required to do a minimum amount of training every day. Thus skills will gradually increase. However, if that player is suffering from alcohol in their system the following stats are affected:
' Flair increases more easily
' Vision decreases slowly
' Energy recovery is slower

The pitfalls of performance enhancing drugs are not listed here, but players that take drugs will find that physical arributes are easier to progress:
' Pace, Acceleration and Strength are easier to increase, though Stamina is not affected (this can only be increased through sheer hard work.)

So then, every day a players ability will increase very slightly through their training regime. The amount it increases will be based on 3 main factors. Potential, determination and the his manager's coaching skills. Determination signifies how hard a player trains, whilst the rating of his manager in the various abilities will help the player develop those skills. A player's "potential" stat is perhaps his most relevant during his early years. The potential stat is assigned at the start of his career and will decrease slightly every day. A 15 year old player with 100% potential will have lost it all by the age of 27 years. Players that starts with less than 100% potential will naturally lose it before they reach 27. So...

27 - 15 (years old) = 12 years
12 years * 356 days = 4272 days
100% potential / 4272 days = 0.023408239700374531835205992509363

Therefore the potential stat needs to decrease by 0.0234 per day. That way it will reach zero when a player reaches the age of 27.

I estimate that the maximum amount that a player's ability may increase by in 1 day is 0.02 points. That 0.02 is split 3 ways between the potential, determination and manager coaching skills, each contributing a maximum of 0.0066. Therefore a player with 100% potential, 100% determination and being coached by a manager with 100% coaching skills will see his abilities increase by 1 point every 50 days. In addition to this daily progression there will be slight bonuses for the following stats depending on the player's position:

Defenders
Heading
Tackling

Midfielders
Tackling
Passing

Forwards
Shooting
Heading

Specifically Left or Right sided players
Dribbling
Crossing

When a player's potential finally hits 0% he will not benefit from his potential stat anymore. However he will still increase stats through determination and manager coaching skills.

At 27 years old (and not before) the potential stat should start to move into negative figures, which will mean abilities naturally start to decrease, particularly the physical stats which will decrease at a faster rate. Determination and coaching will continue to slow a player's degeneration, but as his potential decreases further into negativity eventually it will outweigh determination and manager coaching. By the time a player is in his mid thirties his abilities (particulary his physical abilities) will be falling at an alarming rate. Certain skills may remain unaffected due to being more mental than physical, such as Vision and Positioning.

So, these are my initial ideas for the 'player progression'. The figures may need a few tweaks (feel free to help me out there) but ideally I think it should take a 15 year old lad with 100% potential, 100% determination and an excellent manager about 10 years to increase an ability from 50% to 100%. That way his abilties will be peaking between 25 and 27.

Other factors will influence a player's progression, such as clashes of personality with the manager or team mates and they may receive occasional bonuses now and then depending on positive moments in their career. Another thing I will introduce is a cap for certain abilities depending on a player's position; defenders won't generally be able to reach 100% in shooting for instance, whilst height and weight will also be a factor so that we don't see 90kg dribbling wizards, but the details I've presented above will form the basis of their progression.

As I've said, please feel free to point out any flaws or tweaks, or alternative suggestions. :)