Coding a Football Computer Game

Coding sports games is not as simple as it sounds at least not to produce a really professional product. The easiest tasks involve management games like Football Manager which although complex are often just a matter of number crunching and analysing statistics. However games like FIFA 18 produced by Electronic Arts are arguably some of the most complex games in existence.

The issues are not what you would imagine, controlling things like how the ball moves are well understood with simple physics models. The difficulties as I’m sure the programmers would attest to are related to how the players react when not being controlled by the human themselves. Imagine the game and how complex an actual game of football is (I’m talking soccer here for our US readers). You have 22 players on an electronic pitch at one time and realistically only one can be properly controlled by the human at any point.

That means that the computer has to run some sort of artificial intelligence routines to determine how all the other players react to the online game. If anyone has ever tried to code this, the usual first attempt involves focusing directly on the ball which works to a certain extent. The problem is that game ends up looking like an under 9’s kick about with most of the players all being drawn magnetically to the ball. Any code like this will have the majority of the pitch empty while every computer controlled player homes in on the ball.

Of course, this is not entirely accurate if you sit and watch professional football then you’ll see it’s more complex than this. Just watch a single programme of Match of the Day on your computer and you’ll see that a professional game is much more like a game of chess. Each team has a strategy and a tactical layout that has to adapt during the game. Any formation will be flexible of course but the players will have exact instructions on their positions and how to react to events during the game.

In essence the greatest difficulty in coding a football game is to create the positional sense for the computer controlled players. For someone like the goalkeeper it’s relatively straight forward as he can usually be coded to react to the ball and any attacking player who has the ball. After all the goalkeeper’s role can be defined in some ways a little more easily than some other players.

However imagine what a second striker should do in a 4-4-2 formation when the opposing team has the ball. Should he run back and defend? Should he stay up and wait for the ball to come back? Should he stay put, follow the balls trajectory or just wander around up field. What’s more there are literally thousands of combinations of formation and individual roles will effectively change for every one.

Much of this can be of course passed to the human, who can specify some of this behaviour. You could allow attacking or defensive options to control the behaviour of the computer controlled players. This takes some of the requirements away from the artificial intelligence but certainly not all of it. Coding how the non active players move and react is still going to be largely the responsibility of the computer code not the human being. Without this the game is likely to be completely unplayable at least by only one player who has two hands that is!!

It just shows you how complex sometimes the simplest programming task can be when you start analysing it. The FIFA football franchise has been developing for years now and has had literally hundreds of millions of dollar spent on it’s development. Every year the code is refined and improved yet even now anyone who watches football will be able to spot poor positional senses from the computer controlled players.

John Hamilton
Euro VPN Service

Leave a Reply