Game developers employ AI for more adaptive play
- 27 March, 2013 00:58
Instead of charging directly at the player in the craggy martian landscape, as they might do normally, the aliens zigzag to take cover behind boulders and outcrops of rock, adjusting their approach as the hero opts for a less conspicuous route to his destination. The player changes his route again, and the aliens adapt their movements accordingly.Situations like this are becoming more common in video games as the product of a technique known as situational, or tactical, awareness. The concept is rooted in military tactics, but programmers schooled in artificial intelligence (AI) have started incorporating it into games to make enemies and other characters seem smarter. Situational awareness can play a big role in games that take place in immersive, "sandbox" environments, in which the objectives and challenges are not pre-set but rather determined by the player as he or she moves through the game. But situational awareness can be useful in any game that seeks to include intelligent beings in its cast of characters.
Advances in processing power mean the approach can allow for more realistic experiences in games such as first-person shooters and role-playing games, or RPGs. Essentially it allows characters to adapt more intelligently to moves made by the protagonist.Traditionally, the movements and behaviors of characters have been less flexible. "Where people often start with this kind of system is hard-coding some specific functions for specific kinds of cover," said Matthew Jack, founder and AI consultant at Moon Collider, an AI development company that worked on the "Crysis" series of first-person shooter games. But Jack's work, and that of his peers, is focused on a more organic, adaptive type of intelligence. One programming technique, for instance, is to build measurement systems into a game so that distances between the protagonist and other characters are constantly recalculated and analyzed, allowing characters to make a variety of decisions based on those distances. One key application of this technique is "directness." Directness is a ratio that developers can employ to control an enemy character's movement toward the protagonist, for example. The calculation looks at the distances between the enemy character and an intermediary object, such as a rocky outcrop, and the protagonist. Using those relative distances, programmers control how the enemy characters advance toward the protagonist, Jack said. Setting the directness just barely above zero, for instance, could trigger flanking behavior by a group of enemies, since they would be moving closer to the protagonist via certain intermediary points but not close enough yet to attack, Jack told an audience of gamers and programmers at the Game Developers Conference (GDC) in San Francisco. Negative directness, on the other hand, can be used for retreating or fleeing, while zigzagging could be the result of establishing a directness of 0.5, which yields the least direct points of advancing upon a target. Another AI technique based on the same ideas as directness is the "golden path" method of measuring different location points between the gamer and some end goal or destination. Enemies might traditionally be scripted to appear along the most direct route to the player's goal, since that would be the most likely path for the gamer to take. But with the golden path technique, enemies could appear on the spur of the moment if the player takes a more circuitous route. A somewhat different type of tactical awareness was discussed by Mika Vehkala, senior AI programmer at IO Interactive, developer of the first-person shooter "Hitman: Absolution." Vehkala described a programming approach that determines the best location for enemies by looking at how "visible" any given location, or node, is to their target. As the player moves around, "it's constantly re-evaluating and seeing if there's a node with a better rating," he said. This sort of AI, however, works best in games built on static environments that do not change as much, Vehkala said. The techniques Jack described, on the other hand, are based on performing calculations and measurements as the game's obstacles and characters change. "My takeaway would be to build a language so you can iterate on your queries most rapidly and get the best results," he said.