To err is human...
Artificial Intelligence has come a long way from the days of sprites running back and forth on your screen spilling pixelated blood when shot to swarms of Helghast that move, take cover and make decisions in an intelligent manner that makes you swear they were controlled by real people. There is a lot to learn from the many games out today and how well the AI systems are being designed. We have talked a lot in class about what AI really is and how to simulate good AI versus bad AI. We've learned about pathing, programming enemies and steering behavior that adds realism to next-gen games. This blog is going to touch on some of these topics and perhaps delve deeper into how it's done and why it's done one way or another.
Think like a man
AI is a very important aspect of gameplay. The Artificial Intelligence of enemies and NPCs in most games is still flawed and for the most part AI is a problem that has yet to be solved. If you begin looking at where mistakes are made in AI patterns within games (even the more recent ones), you start to figure out what's gone wrong and how they simulate the behavior that keeps malfunctioning. AI is an effort to simulate human behavior as much as possible and as such is used to program enemies with the ability to make decisions for themselves. The trick here is that you want to do this artificially by defining a set of rules. Because it would be very difficult to do so, a game developers objective is essentially to get rid of the human element and emulate digital creature behavior instead. This would employ the use of tricks and hacks that elude the player and essentially trick the mind's eye into believing it's seeing something that might not necessarily be there.
"Artificial Intelligence is about making computers able to perform some thinking tasks that humans and animals are capable of"
- Ian Millington
We're not quite there yet because we don't exactly have a good grasp of what human behavior is as yet. Therefore, we want to create the illusion of characters being intelligent. Games can be either good or bad at creating this illusion. Three games that I feel do a fantastic job of simulating Artificial Intelligence are:
Batman: Arkham Asylum
Borderlands 2
Bioshock
These games are in no way perfect examples of AI, but they do a good job of simulating clever human behavior. From detecting the player well to ganging up and simultaneous attacking, Arkham Asylum has a well thought out combat system with AI that may look dumb, but are far from it. Borderlands 2 manages to create so many varying enemy types that chase you when you run, cover when you're firing and detect when they're in your crosshairs making sure they get clean out of the way before you put them in the ground. Splicers in Bioshock are excellent at running towards you, taking you by surprise, dodging attacks, climbing up walls, dropping down behind you and teaming up to take you down. Whether you argue that some or most of these events were scripted, the fact remains that the illusion was created and created well enough to have me fooled.
Let's also take a look at 3 games that don't do the best job of representing human behavior.
Unreal Torunament 2004
Tekken Tag Tournament
Ratchet and Clank
Unreal Tournament 2004 would often find bots simply standing around and waiting to be shot at or getting confused about where to go and what to do. Often this would take place in elevators and dynamic areas of the level. Tekken Tag saw very repetitive opponent action with button-mashing managing to successfully break the game on several occasions. Enemies in Ratchet and Clank tended to have very similar behavior which was simple and not very effective. For example, the robot frogs in the level above jump, bite and follow Ratchet. It is very simple to overcome enemies like this with regular strafe and shoot strategies. Understandably, these games are a lot older than the ones mentioned in my top 3 list, but that just goes to show how far we've come with Artificial Intelligence simulation.
It's not all black and white
A game that does a truly fantastic job in the field of AI is Black and White. As a God, you find yourself at a fork in the road with every major decision - you have two possible choices, which to take based on the situation? Each action taken will have weight to it which sums up to one. If both option are weighted at a half, then both are equally likely to occur. Re-enforced learning for your animal of choice will alter weights throughout gameplay as your progress within the game story. Weights are then essentially "learned" through your interactions and every decision you make. There are alternating consequences behind every action and based on these resulting possibilities, your community will either fear or love you. A few other games which have interesting AI patterns include S.T.A.L.K.E.R where enemies are tactically smart and Bioshock where splicers react to the environment around them. The cover system in F.E.A.R is also quite notable and seems to improve with every additional installation in the game series.
There are two types of AI in the gaming world - Traditional (academic) AI and Game (non-academic) AI. Game AI tries to solve problems within game environments with system-defined logic. Sensing, planning and acting are the three characteristics of traditional AI. Game AI, on the other hand, doesn't have a sophisticated method of planning. A* is the most commonly used algorithm in the industry. F.E.A.R uses records of what the player is doing to predict where he may go next or where he needs to be. This system is good at modifying AI plans with the use of strips, essentially turning the world into a series of boolean objects and finding the values that will detect the player.
History in the making
In the 1940s, Alan Turning, one of the world's first computer scientists, wanted to measure the development of good AI with something he called the Turing Test. The test begged to question, "What produces thought?". Turing's definition of good AI was the ability to trick someone into thinking that a person is responding to you instead of a computer. ELIZA was like this. Symbolic AI came about in the 1950s where expert systems would host a database of symbolic knowledge. This was a huge amount of data. In the 80s and 90s, we began using AI to solve problems. We were attempting to answer the question, "Can we be inspired by biology and use it to simulate AI?". Genetic algorithms were used to simulate evolution. They would take half the bits of one character and half the bits of another creating a result that exhibited characteristics of both parent characters. None of this really worked well though.
Chess games may be considered intelligent, but they can only play chess. Here we get into the true definition of intelligence which can't be simply defined further proving that there is no such thing as an artificially intelligent being. In Pacman, the ghosts (AI) move around till Pacman collects an item which then reverses the mechanic. Different colored ghosts were programmed with varying behavior sets. They even choose different behavior sets when Pacman picks up a pellet. There were many theories behind the manner in which the AI in Pacman works, but the truth is that even this was far from good AI.
Closing Thoughts
AI and animation (locomotion) are very closely linked together. Game developers often use a simple state machine to trick people into thinking that the enemies are exhibiting human behavior. Goldeneye added sensing to enemies so that they could "see" the character. Many games still use the same basic principles exhibited in Pacman. What usually happens is the system is split up into group AI (strategy) and character AI. In Half-Life, enemies would would try to come around and flank you. If the player is subscribed to a particular group then the group can commit to a different strategy depending on the situation. The enemy group will choose which one to use based on the state of the world and what's happening in the game. Character AI takes a look at decision-making and movement strategies. This is usually done through scripting. Both group and character AI are given access to the game world. They execute their actions based on animation and physics. Their decisions trigger particular animations which are then played to represent these decisions.
Strategy itself is a higher-level idea. In an FPS game, it's all about harnessing the environment (picking up items, covering and shooting, flanking, etc.). Here, there needs to be a plan of what action need to be performed and at what time. A* search is a really simple way of planning efficiently and appropriately. It's not just about movement, it's about getting to a goal whatever that might be. But once the character gets there, then where does he go? To solve this problem, we break it up into sub-strategies. A* find the most optimal path in static game environment and once you get to goal one, you move to goal two then goal three, so on and so forth. Then the question becomes do we navigate one-two-three or three-one-two, etc. This is entirely dependent on the other characters in the environment, specifically where they are and what skill level the player is at. This means that planning is essentially about choosing your goal or choosing which goal to navigate to first.
The trick to making people believe in your AI is in manipulating the animation well. The Assassin's Creed series has a lot of A* searching in their games. The character's internal state has a big influence on the AI in-game. Reactive control is defined by a player being in an environment and the game choosing the right animation to play based on what he needs to do and where he needs to go. Often the player will animate around obstacles to get to a particular node - this movement is defined purely by the animation system. There will either be a straight or avoidance path along which the player will have to animate making reactive control primarily animation-driven. You can take most games today and split them up into a series of path-planning, waypoint navigation and reactive control sequences with truly great animation. The game developer will have the AI choose a path and then have it figure out what it needs to access (goal nodes) and a way to access it. A good example of this is racing games where opponents (NPCs) employ plenty of splines to get from one goal node to the next.
This all that AI is in a really small nutshell. The details an procedures involved are robust and very descriptive with plenty of documentation about how to implement such systems within your own games. AI has a lot of space to grow in the gamin industry, all it has to do to fly is aim at the ground and miss.
No comments:
Post a Comment