One of the first and most basic, albeit difficult, forms of Artificial Intelligence can be seen in Pong |
THE HISTORY OF AI
Before we get into the bulk of the blog about AI, I felt that it would benefit you the reader to know some of the history behind AI and why it was developed in the first place. Although the idea of artificial intelligence has been around for thousands of years, it was not until the 1940's that mechanical AI was truly taken on as a study by mathematicians and philosophers. One of the key contributors to the field of artificial intelligence was Alan Turing, whose theory of computation stated that a machine that shuffles symbols such as "0" and "1", could come up with any conceivable act of deduction. This theory eventually led to the creation of the first programmable digital electronic computer. Form this point the study of AI flourished, leaving many people amazed at the way computers could now solve word problems and prove logical theorems. Many believe that the 1990's and early 2000's saw the greatest success in the study of AI, as the technology was implemented into the fields of logistics, data mining, and medical diagnosis. Although it has been over 50 years since the first steps were taken in artificial intelligence, we still have so much to discover in this ever growing field.
Alan Turing, considered by many to be the father of Artificial Intelligence. |
When it comes to artificial intelligence in games, this technology plays a very significant role in how the game will play. In our current state of games, AI is still in what I like to call the childhood stage, as we really haven't achieved full human like behavior. In games, AI is generally used on Non-Player Characters (or NPCs). When creating these NPCs, the designers try to create a set of patterns that the entity will follow, that seems very natural and human like to the player. Since AI is an effort to try and simulate the realistic behavior of a human in a non human entity, the programmers want to try and remove the human designed element from the NPCs in the game and instead make the NPC feel like a real individual. When this is done successfully, the NPC will have very natural movements through the game space and will react to situations in a similar way the you or I might. This creates a great sense of immersion for the player and can lead to some pretty phenomenal games.
GREAT AI IN GAMES
As I stated above, the AI in a character can be the difference between a hit game release and a complete flop. Here are a few games that I feel really integrated AI into their game successfully.
F.E.A.R. SERIES
THE SIMS
HALO
Now I know that in any game there are examples of how the AI is flawed, however I feel that the games listed above are great demonstrators of how AI can be successfully implemented into a game. F.E.A.R. earns a spot on my list not only because of how the AI work in the game, but the technology that was implemented to allow these behaviors. Having designed their AI system from scratch for the game, meant that they were able to implement their new planning system that had the enemies generate context-sensitive behaviors and actions that were all decided in a single frame of the game. This meant that enemies not only reacted in human like ways, but it was also a fast and realistic process. Some examples of these in game behaviors are enemies using set cover points, as well as tipping objects and opening doors to gain access to more advantageous cover points. The enemies in game also work in tandem with other NPCs to perform various military maneuvers such as flanking and suppressing fire.
The Sims is a personal favourite of mine from back when I was a kid. Now that I am starting to learn more about how games function, I never realized all of the AI elements that were present in these games. The main game I will focus on is the Sims 3, as it is one of the most current titles and features the most elements. Why I believe the AI works so well in this title, is because of the sense of life the game gives to each character (including NPCs.) Characters will go about living their lives in the town regardless if the player interacts with them or not. Each character has a set list of basic desires and needs that are used to determine NPC activity and what task they will perform next. To help with the implementation of these behaviors the designers created each object as a smart object. What this meant was that all of the data that pertains to an object is stored together to allow easier accessibility from the AI standpoint.
Finally on my list of great AI examples is the Halo series. Having spent many hours investing my time into beating the main campaign of the game, I can say with confidence that Bungie did an excellent job when it came to AI in Halo. This is evident in the way that enemies work together to employ suppressive fire for enemy teammates, while simultaneously searching for a new area to give themselves cover. The team at Bungie also put a lot of detail into showing when enemies react to your attacks by taking cover and performing actions like throwing your own grenade back at you. Situational AI is also implemented in Halo and can be seen when a higher ranking enemy is killed during combat. In most situations the smaller grunt soldiers will lose morality and begin to flee from the player. This tactic really adds to the immersion the player feels in the game, by giving the enemies their own personalities. Since Halo Combat Evolved, many games have implemented the "behavior tree" (trees of tasks are combined together to create AI) form of AI implementation that we can see throughout the game.
THE NOT SO GREAT AI EXAMPLES
Now that I have touched on the good, I need to touch on the bad. These games portray some of the worst AI I have come across in my life of gaming.
CRYSIS 2
JUST CAUSE 2
DEAD RISING 2
Although I loved playing the three games listed above, the one thing that kept me from logging some serious hours into them, was the terrible AI. In Crysis 2, the character has the choice to use many different abilities to dispatch the enemy. Although one of these options is stealth, I found that at times the enemy would detect me while I am behind a wall on the other side of a house. Other times, I could be standing directly in front of an enemy and my character would stay hidden from view. Although the game looked great and the gun-play was fun, I still feel as though the game was missing an element that could have been greatly improved on. In Just Cause 2, the enemies are the polar opposite. At every turn they seem to detect the player and will immediately engage him. The problem with this however is that the enemy seems like they are a commando on a suicide mission. Rarely does the AI script force the enemy to find cover, and it is not uncommon to see an enemy jump right in front of a car while chasing after the player. Although this can lead to some hilarious results, it really broke the immersion of the game and took away the humanity of the NPCs. Finally, we have Dead Rising 2. In all my years of gaming, I think that this game has some of the worst character AI I have come across. Since a fair chunk of the game is derived of escorting survivors, you would think that the AI would be a well oiled machine. While playing however, characters will become stuck in groups of zombies, will rarely use the weapon given to them, and at times will stop dead in there tracks and quit following the player. This made for a very frustrating experience as the whole game has a set time limit and every second is precious. Although I did enjoy them at times, these game just reinforced the fact that artificial intelligence can either make or break a game.
And at times beat you at your own game. |
I now understand why we were enrolled in an animation class before we tried our hands at engines and how AI works within them. This is because for AI to function properly in a game the animations must be generated in tandem with the AI behaviors. However, these animations cannot be done correctly if they do not inherit a path behavior, and for these paths to be determined, many games look the A* algorithm. The A* algorithm is the perfect option for this, as it does not necessarily find the shortest path (a very expensive thing to do in a large world), but it instead finds a path for the AI to use. This is very evident during certain chase sequences during games such as Assassins Creed. While the player is outrunning the enemy, the AI has to be constantly creating new paths for the pursuers to be using, otherwise they would not be able to catch the player. This means that the A* has to be constantly checking for objects the guards will have to run around, or tables that they may be able to vault. Once these paths are locked in, the game will play out the appropriate animation, creating these grand chase sequences. To make sure it is fair for the player however, the AI must always reference back to the behaviors and states of the NPCs to ensure basic principles like "Is the character in view" and "Am I still with my allys" is being checked. Otherwise, the player may be stuck in an endless chase or battle that they cannot win.
Scripted sequences in game can also be related in a way to how the player perceives the artificial intelligence in a game. An example of this can be the random encounters that players interact with in games such as Grand Theft Auto V. During these scripted sequences, the player gets to choose how they want to interact with different scenarios, such as a store being robbed. Although the scene is scripted into the code, it gives the player a feeling as though the NPC made the decision to rob the store via there own decision. This helps to give the game world a feeling of life, making NPCs seem as though they make their own choices, with no influence from the game itself.
One of the higher end ideas that are implemented into the AI of games is strategy. What strategy means to me is how the enemy I am facing is going to interact and use the world around them to work against me. In the games this can be something like running to get a new gun when out of ammo, or using player suppressing fire to move to a new position. This form of strategy can be seen in the Half-Life games, when enemies will work together to move into different positions and attempt to flank the player from the sides and back. Most of these actions however complex they seem, usually can be traced back to using the A* search methods to effectively plan these routes for the AI. To handle most of these complex actions like suppressing fire in tandem with movement, we break up the actions into smaller categories such as behavior trees or state machines. When the enemy teammate is firing, this enemy will use A* to find a path from position one to two and so on. Once there the behavior will switch from movement, to firing upon the enemy. Although to the player it seems like a complex system of interaction, in actuality its just a series of linking behaviors between the enemy units.
What I have mainly taken away from these teachings of artificial intelligence is how simplistic some of the more complex sequences can be. I cannot wait to see where the future takes us with AI, not only in the game industry, but in our human lives as well.
Robot Butlers perhaps? |
No comments:
Post a Comment