ai solutions for games

5
8/8/2019 AI Solutions for Games http://slidepdf.com/reader/full/ai-solutions-for-games 1/5 Bartosz Plichta AI solutions for Games Nowadays AI is a very popular topic. It has been popularized by movies such as Matrix, Blade Runner or Terminator. But how does this impression of AI correspond to real situation. In movies we can see AI that is extremely intelligent, cunning and most often want to destroy humanity. Of course this is very far from what we can observe in real life. As we can see it AI is not very much developed. Most of AI applications in real life come to data mining, some algorithms used to solve computational problems etc. One of earliest applications of AI which is still very valid and probably the most similar to the AI we see in science-fiction culture is AI used in computer games. Most of the similarity can be observed in the fact that AI in games as in these movies most often wants to kill human player. To be able to describe this issue in most appropriate way we first should define what AI is. Shortcut comes from ‘Artificial Intelligence’. In many textbooks the field is defined as “the study and design of intelligent agents”. An intelligent agent may be described as a system which can perceive its environment and maximize its chance to success in given task. This may be the most simplistic definition of AI. However to be able to accommodate real intelligence we would have to take such traits as reasoning, ability to plan, learn, communicate etc. These are the fields where AI isn’t very well developed and probably won’t be in the nearest future.  AI in games has some different purposes than AI in general. We don’t want g ames AI to solve difficult computational problems or answer questions that humans might find to difficult. The main goal of games is to entertain and games AI is created solely for this purpose. In most cases AI in games is created to be intelligent only in some situations. For

Upload: bartek-plichta

Post on 09-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AI Solutions for Games

8/8/2019 AI Solutions for Games

http://slidepdf.com/reader/full/ai-solutions-for-games 1/5

Bartosz Plichta

AI solutions for Games

Nowadays AI is a very popular topic. It has been popularized by movies such as

Matrix, Blade Runner or Terminator. But how does this impression of AI correspond to real

situation. In movies we can see AI that is extremely intelligent, cunning and most often want

to destroy humanity. Of course this is very far from what we can observe in real life. As we

can see it AI is not very much developed. Most of AI applications in real life come to data

mining, some algorithms used to solve computational problems etc. One of earliest

applications of AI which is still very valid and probably the most similar to the AI we see in

science-fiction culture is AI used in computer games. Most of the similarity can be observedin the fact that AI in games as in these movies most often wants to kill human player.

To be able to describe this issue in most appropriate way we first should define what

AI is. Shortcut comes from ‘Artificial Intelligence’. In many textbooks the field is defined as

“the study and design of intelligent  agents”. An intelligent agent may be described as a

system which can perceive its environment and maximize its chance to success in given task.

This may be the most simplistic definition of AI. However to be able to accommodate real

intelligence we would have to take such traits as reasoning, ability to plan, learn,

communicate etc. These are the fields where AI isn’t very well developed and probably

won’t be in the nearest future. 

AI in games has some different purposes than AI in general. We don’t want g ames AI

to solve difficult computational problems or answer questions that humans might find to

difficult. The main goal of games is to entertain and games AI is created solely for this

purpose. In most cases AI in games is created to be intelligent only in some situations. For

Page 2: AI Solutions for Games

8/8/2019 AI Solutions for Games

http://slidepdf.com/reader/full/ai-solutions-for-games 2/5

example in shooter games we want AI to be able to hide under cover, call for backup etc, in

sports games we want AI to be able to compete in given sport, e.g. football or racing.

Furthermore AI used in games must be often tuned down to be able to present an enemy

possible to defeat. In shooter games AI which has 100% accuracy would be unbeatable;

drivers that would always drive using perfect driving line would win every race. This tuning is

called difficulty level, most games have many difficulty levels present to allow them to

entertain many people with different skills. Of course in some cases tuning up is also used to

increase difficulty, sometimes even cheating by applying some handicaps for AI ‘player’. 

To be able to see the full scope of AI solutions in computer games we have to go

back to year 1958 when the first game ‘Tennis for two’ was created. This game was

multiplayer only, meaning it had no AI and two players were needed to play. This was the

trend for many years. With the growing popularity of games people wanted to make games

that can be played by one person. One of the first examples can be ‘Breakout’ created by

Steve Wozniak future founder of Apple. It was a simple evolution from ‘Pong’ where two

paddles were controlled by two players and a ball was moving between them. Breakout

changed one of the paddles to a wall of bricks which had to be destroyed by player using the

moving ball. ‘Pong’ had one more very crucial impact on AI but well get to that in a while.‘Breakout’ was static, meaning the blocks that player had to destroy haven’t been doing

anything, so the game had no AI whatsoever. Another milestone in gaming history was

‘Space Invaders’ here player had to fire at aliens that were moving on the screen. While one

may think that some AI was implemented here, that wasn’t yet the case. The movement of 

aliens was hard-coded in the game, so every time one would play the movement would be

exactly the same. First example of something that we could call intelligence is again ‘Pong’ in

its single –player version. The program calculated the movement of the ball and moved its

paddle to the place where it can strike the ball. Here also a difficulty setting was

implemented namely the speed with which the computer’s paddle was moving.

For some time we haven’t seen much improvement from ‘Pong’ AI. Games were

simple and the most of the computational power of the machines went into improvement of 

the graphics, sound etc. Some interesting examples of ‘AI’ used that time can be ‘Snake’

where the movement of enemies was calculated using player movement. This movement

was used as input to some simple functions which calculated the movement of enemies.

Page 3: AI Solutions for Games

8/8/2019 AI Solutions for Games

http://slidepdf.com/reader/full/ai-solutions-for-games 3/5

The next very important step in AI development was introduction of conditional

actions. This type of AI has been doing different things depending on many conditions, for

example in fighting games like “Mortal Kombat” the movement of computer controlled

character was dependant on actions taken by player, position on the screen etc. This

approach can be treated as fulfilling one of AI traits namely perception. AI was checking

player actions and other elements and taking appropriate actions. Of course these actions

were programmed before and launched after analyzing the data.

Another interesting idea in AI development in games was sports games. AI not only

was able to play for example soccer but also some major teams had their play style

implemented. I still remember playing some old version of FIFA soccer simulator where

when playing against for example Real Madrid you had to face dozens of passes and many

technical tricks. Just as in real life.

With growing power of computers and introduction of high-performance graphic

cards and sound processors which has taken most of the difficult computational tasks from

the CPU we have observed rapid development of AI solutions. From very simple intelligence

agents we have come to usage of decision trees, neural networks etc. Now let’s take a closer

look on some of the most significant cases of modern AI in games.

Probably the most advanced and amazing example of advanced AI in computer

games is a Lionhead Studios game called ‘Black and White’. In this game player takes the role

of a god, while the intelligence of his subordinates and enemies isn’t too amazing there is

one thing, the creature that player can indirectly control. It’s an animal like huge beast that

is a kind of  player’s avatar. It cannot be controlled directly, player can only make it learn

what is right to do and the creature will do it on its own.

Creature AI is created using three methods. First of all there is a symbolic attribute-

value pairs which for example represent the difficulty rating of passing a certain terrain type.

This approach joined with some situational calculus is very widely used in many games, for

example in first person shooters this approach is used to determine whether an AI should

look for cover, call for backup etc. However while in many games this is the most important

AI implementation, in ‘Black and White’ is the most basic of AI solutions used for the

Creature.

Page 4: AI Solutions for Games

8/8/2019 AI Solutions for Games

http://slidepdf.com/reader/full/ai-solutions-for-games 4/5

One of most important features of ‘Black and White’ AI is its ability to learn. Creature

can learn from anything, for example if player often brings food to village granary then the

Creature will learn that this is a desirable action and will start doing it by itself. Also Creature

learns from its own experiences. It has the need of food implemented from birth but it

doesn’t know what will satisfy its hunger. Creature will try eating rocks and will learn that it

doesn’t satisfy hunger and won’t try eating it again unless there are no more feasible items

around. All these information are stored in a table of attribute-values described in earlier

paragraph. From these tables decision trees for given needs are created. All these actions

are taken by the Creature are taken to fulfill current desire or need. These needs are stored

in neural networks.

In this game many modern advanced AI solutions have been used. However power of 

computers at the time of game release wasn’t as big as today and because of that some

omissions had to be made to allow owners of weaker machines to play the game. Because of 

that one of the most important traits of AI in general, planning has not been implemented.

The Creature took actions basing on only current biggest desire and checked for it after

every action made.

Among first games to implement planning feature was F.E.A.R. In this first person

shooter enemies didn’t work on a condition->action basis. Instead enemies were given a

goal, in most cases kill player and the way it would take to achieve it wasn’t straightforward.

The difference from earlier AI which could be presented in a form of State machine with

specific conditions is that now computer starts calculating actions in a regressive way from

the back. For example AI is given a goal to kill the target, of course at the beginning this

condition is not met, so AI adds attack action to the plan, but it can only attack if the weapon

is loaded so it adds load weapon action to plan etc. Of course this is a very basic and

straightforward example and between any actions there may be more checks than only one

with different priorities changing dynamically which creates an illusion of intelligent

behavior.

This dynamic priority change is a very important feature, let’s continue with our

soldier from F.E.A.R. example. A soldier who would only be standing and shooting is a very

easy target for the player, he should look for cover. But is it always a task of the same

Page 5: AI Solutions for Games

8/8/2019 AI Solutions for Games

http://slidepdf.com/reader/full/ai-solutions-for-games 5/5

importance? Of course not. It can have different priority basing on many variables, for

example if a soldier has full health one shot won’t kill him so looking for cover is less

important, also looking for a place to hide on a desert where he is perfectly visible is more

important than looking for cover in a jungle where trees provide natural cover and hide him

from players eyes.

These were some examples of AI techniques used in modern gaming. We can see that

with growing power of computers the complexity of AI had also grown. This will most

probably also the case in future. AI in games has to work in real time so the time window

that the computer has to calculate what action is very short. Growing power and new data

analysis techniques will allow for computer games AI to simulate human even better.

However gaming is best when we can play with other humans as we can see from sales

results of best multiplayer games. And this won’t change even in nearest future.