This article will explore the concept of artificial intelligence; how and why it’s used and the AI tools used within in a games development process.
What is Artificial Intelligence?
Artificial Intelligence (AI) is used in computer games to make the non-player characters (NPC) appear real to the person playing the game. The difference between other systems and computer games is that in a lot of cases the illusion of intelligence within an NPC is all that is necessary for the player to feel engaged when interacting with the NPC.
In certain games an advanced level of AI would be necessary to make the game challenging to the gamer. For example, in chess games you can play against very smart computers that will use algorithms to interpret the moves you make and decide the best moves to make in return. It can plan many moves in advance and make changes to the way it plays dynamically as the player makes additional moves to counter. A high level of AI is important in this case because the player needs to feel challenged when playing against the computer; as if they are playing another human being, otherwise what would be the point of playing the computer.
AI essentially attempts to mimic human behaviour. But it does not require advanced algorithms to give the impression of intelligence in certain games and in others it is essential.
For example in a Role playing game (RPG) NPC’s will be present at various stages through the game. Generally as merchants or as entities to push the story along the right path. In these cases it is only the illusion of the intelligence in these NPCs that is the important factor. By using basic response algorithms along with realistic graphics, good voice acting and sound effects the player can be immersed enough into the game to believe in the character they are interacting with.
The image to the right shows our trusty friend Garran from the game Rage. He is a very realistic looking NPC that is used in the game to perform two main functions. Firstly, he helps to drive the storyline along as when you first encounter him he explains what has happened to the small town he and a few other bandits occupy and secondly, he acts as a merchant who you can sell and buy necessary goods throughout the game.
In terms of AI, there has been very little used in the development of Garran, but in this case it isn’t necessary because he looks and acts real enough and is only required to perform basic functions in the game.
In some cases the AI of NPCs can be an essential factor to the gaming experience the player has. A good example of this is a game called Call of Duty (COD). COD is a game that involves the player in a lot of military style combat with multiple enemies across large map locations. The enemy AI will incorporate advanced algorithms to respond to a multitude of different actions, reactions and scenarios.
The NPC will need to be able to take cover from the player, position itself correctly depending on where the player is, and take immediate action when the player decides to rush or to throw a grenade. It needs to act and behave like a real enemy would that a) doesn’t want to be killed by the player, and b) wants to do it’s best to be able to kill the player without being shot itself. Taking this into account it will also need to decide what it is going to do in cases where the player is taking cover, if the player decides to run away, and have an awareness of how much damage it has inflicted on the player and what actions to take if the player is almost dead. If it knows the player is on less that 10% health and is on the floor dyeing with no gun in his/her hand does it stay in its position, running around in circles or does it make the intelligent decision to scan the area and then advance on the player to kill them.
In many modern shooter games the enemy will generally be accompanied by other NPC’s. The NPC’s will have to have an awareness of each other and work together as a team (or at least give that impression). COD incorporates this group AI very well with enemies working together to clear the room that the player is in or to flank the player.
AI middleware tools; how they are used in the game development process and how they benefit the development team
When developing a game that the developers have decided will require certain amounts of AI. Depending on their specific needs they will usually not have to design and code the AI from the ground up for the game they are developing. In many instances the use of middleware AI tools and software packages (incorporating AI) can be used and included into the development of a game with the ability to manipulate the tools to make changes to the available AI so it behaves more appropriately for the specific game.
The availability of third party middleware AI solutions is a crucial aspect for developers as it frees them up to focus on the core aspects of the features that make the game unique. All the complex algorithms are already coded and available in the API. The development team only needs to call the functions and define how they want the AI to behave.
A good example of an AI middleware software solution is DI-guy. DI-guy provides the tools and API for the inclusion in C++ and can be run on both Windows and Linux. It enables the developers of a game to populate the game world with as many NPC’s as they want, each NPC will behave as a normal human being would and will react to triggers in an intelligent way, for example if an explosion was to happen nearby they would disperse realistically and take cover, when crossing roads they will avoid traffic, they will find the shortest route to pre-defined destinations and avoid pre-defined hazardous areas. They will also interact and co-operate in groups of NPC’s and against other NPC’s in a humanistic way. For example, in a battlefield environment they will work together in combatting the enemy; covering each other while each moves into a strategic position with the map, clearing buildings together, checking each person is okay in terms of needing first aid, more ammo etc.
Because the tools are provided in an easily accessible API it makes it very easy for the development team to make changes or additions to the AI for unique characters. They simply need to add in their own functions and algorithms to the library. This is especially useful if the development team realises late on in the development process that they want to include an additional unique character. They can quickly associate the standard generic AI available from the existing API and add in any other AI to the library for that specific character. This is also useful in games that have frequent expansions where more content and characters are added later after the game has been released to the public.
These tools provide a huge library of algorithms, path planning via a user-interface making it extremely easy to plan where NPC’s will go in the game environment and does this is a highly productive way. This in turn enables the development team to be far more productive in the overall project, helping to shorten the development time and shifting majority focus to core features of the game.
What is the point in re-inventing the wheel? It would be unproductive for a development company to create AI tools from scratch when there are companies that specialise specifically on providing these tools for the specific purpose of aiding games companies in the development of games. For this reason it is likely that these middleware tools are far more sophisticated than those that a development company could produce with the limited time span and budget that they have available in a single game development cycle and in the case of modern game development; all aspects of the game have become so complicated that it requires a vast domain of expertise from all the different areas of the development process that if they were to development everything from scratch it would turn a potential 3-5 year development lifespan in to a 7-10 year one unnecessarily.