FEAR AI

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
SithMaster
Posts: 306
Joined: Mon Jul 04, 2005 11:45 pm
Contact:

FEAR AI

Post by SithMaster » Sat Sep 24, 2005 3:02 am

The upcoming PC first-person shooter F.E.A.R. is one of this year's most highly anticipated games. Not only does the game take the unusual step of basing the action and story on a cross between the highly kinetic battles of The Matrix and the Asian horror of The Ring, but also it has what appears to be excellent artificial intelligence. In the single-player game, you'll play as a top secret operative pitted against a highly trained battalion of soldiers, whose members are much smarter and more aggressive than any enemies you'd ever expect to see in a shooter. These enemies will tear down the environment to give themselves cover, they'll leap over barriers (or crawl under them), and they'll flank and pin you while their buddies hunt you down. For more information on the game's remarkable AI, the Monolith staff has graciously provided this new designer diary story, complete with exclusive trailer.
F.E.A.R. the AI
By Monolith Staff

F.E.A.R. will offer some of the most dangerous enemies you've ever encountered.
It's quite common for new games to claim they feature "groundbreaking artificial intelligence." Unfortunately, most games support this claim by scripting gameplay or defining intelligence as opponents that are either more numerous or more heavily armed. Scripting is a design process whereby gameplay events are programmed to happen in a specific order based on the player doing the "right" thing at the right place and at the right time. The scripting process hard-codes gameplay experiences into the game but limits replay value...which can change the game from a unique, dynamic experience into a puzzle-solving exercise. Creating opponents that react intelligently to the environment and to players, without scripting, has long been the holy grail for first-person shooters. After several years of effort, the F.E.A.R. team is anxious to present your new opponents--a culmination of the latest academic AI research and the practical experience of creating past "Game of the Year" shooters (No One Lives Forever and its sequel, No One Lives Forever 2).
Gone are the days of mowing down the line of non-player characters as it danced its way into your stream of lead. Instead, your opponents in F.E.A.R. are imbued with a sense of self-preservation. They will take cover when shot at, and they will run or call for reinforcements if they feel overwhelmed. Once they know where you are, they will formulate a group or individual plan in real time to accomplish their goal of eliminating you. This dynamic reaction will become immediately apparent when you replay any segment of the game, because the AI tailors its behavior to both the environment and your play. In order to achieve this level of dynamic and autonomous response, the F.E.A.R. team employed several tools, including the "NavMesh" (navigational system), an understanding of spatial relationships, GOAP, or "goal-oriented action planning," and NPC communication.
This first article will cover and explain how F.E.A.R.'s AI is grounded in the environment through the NavMesh, as well as provide an understanding of both spatial relationships and the squad members' ability to communicate. We will detail the systems and showcase gameplay elements that you will experience in F.E.A.R. Goal-oriented action planning and further details of the intricacies of squad behavior will be covered in the second article on F.E.A.R.'s AI systems.

The enemies you'll fight in the game will get past catwalks, ladders, and drop-offs with ease.
F.E.A.R.'s NavMesh system lets the NPCs move around the world anywhere players can move. Many games use a system of waypoints to move NPCs around a map (a series of points they must reach in their navigation), but this limits the NPCs' freedom and fails to provide any information about spatial relationships. The NavMesh breaks the map into groups of polygons that are effectively aggregated into triangular paths of possible movement. This allows for greater flexibility in moving around objects, because the NPCs direct their movement to an area--and not to a point on the map. In addition, the NPCs can leverage their understanding of the spatial relationships between these areas to determine how to flank and flush out threats or how to systematically divide the space for an organized search.
Reacting to the environment is another key "intelligence" for NPCs in F.E.A.R.. The NavMesh polygons can be flagged with special link properties that represent areas that require special movements through doors, stairs, and ladders, or that require NPCs to jump over chasms, jump down from catwalks, or duck under low obstacles.
The net technological advances of the navigational and environment systems are manifested in many distinct and unique AI behaviors in the game. The AI in F.E.A.R. can jump through a window, crawl under a pipe, or jump off a balcony, depending on what is required of it in a given situation to accomplish its goal. (The overall goal is, of course, to eliminate you.) These actions will change depending on where the NPC is on its patrol route, where the player enters a room, and where and how the player engages the NPC. In most other games these behaviors would be scripted, and thus are oftentimes inappropriate or repetitive. In F.E.A.R., your opponents will confront you in a live, dynamic way according to your gameplay style.
The NPCs' understanding of their surroundings also allows for strategic interactions with the environment. One example is that NPCs have the ability to create cover by utilizing dynamic objects in the environment. In F.E.A.R., the AI will flip over tables, knock over shelves, and manipulate furniture to create more cover for itself. That's right, the squad members will dynamically communicate to create cover for one another to improve their area defenses against you as you attack.

Keep to the shadows, avoid using your flashlight, and stay frosty. Or else.
The AI's movement through and awareness of the world it inhabits is punctuated by audible communication between enemy soldiers as they react to you. When AI enemies recognize a player location, they will verbally call it out to their fellow soldiers to announce the threat is "behind the boxes" or "in the ceiling." When they see a flashlight they will scream "flashlight" and will close in on your position. The enemy soldier will even recognize your efforts to flank and will alert the squad to your method of attack. In working together, the lone AI-controlled soldier will recognize the death of a teammate and will call for backup if pinned down.
The AI in F.E.A.R. creates a sense of immersion and replay value that is unique among shooters. As the goal of F.E.A.R. is to maximize fun, a great deal of design effort is being taken to effectively match the NPC intelligence with the player's skill level. Our goal is not to have the players dominated by the AI, but we want them to learn to respect the AI so much that even the easy kills provide a sense of accomplishment.
Gamers are still buzzing about the incredible artificial intelligence demonstrated by the enemy soldiers in the recent demo of F.E.A.R., the upcoming first-person shooter that's also one of the most anticipated games of the year. By now you've probably come to expect that the enemies in most first-person shooters are there to serve as cannon fodder. However, the elite soldiers in F.E.A.R. actually play like human beings who want to win and survive. Soldiers will literally jump over barriers, flip tables over for cover, crawl beneath obstacles to get to you, and scream commands to one another as they hunt you down. It's a pretty amazing technical achievement. Thankfully, the team at Monolith was kind enough to give us a glimpse into how the AI in F.E.A.R. is so lifelike.

You'd better bring your "A" game, because these guys are tough.
F.E.A.R. the AI, Part II
By Monolith Staff
The goal of artificial intelligence in video games is to create opponents that challenge you with realistic competence and provide you with a rich and varied game experience. Recent games have employed scripted behaviors with a certain degree of success, but a careful scrutiny of enemy behavior quickly exposes the limitations of that technology. Scripted behavior leads to repetitive and often inappropriate reactions that break the immersive feel of a game. As the game experience of F.E.A.R. is based on confronting a highly intelligent, highly trained combat force that quickly adapts its tactics in response to the player's actions, a new AI paradigm had to be created. Fortunately, the F.E.A.R. development team possessed the unique combination of proven experience and a thirst for applying the latest academic advances in AI research.
The results of the team's hard work are some of the most startlingly intelligent enemies you have ever seen. Gone are the days of replaying a segment of a level with the confidence of knowing your enemies' paths and reactions. In F.E.A.R., your enemies formulate real-time plans based on environmental circumstances and your actions within that environment. Your opponents will move and react to you with the familiarity and tactical awareness of a seasoned multiplayer veteran. You will witness AI opponents change their courses to avoid danger, manipulate the environment to create cover, flank you, and dynamically support squadmates with cover fire and verbal warnings. Your opponents in F.E.A.R. work together in such a realistic way that you may compare the single-player combat to the tactics and strategy of a quality multiplayer match.
Recent advances in AI have allowed game designers to give their non-player characters basic decision-making capabilities with predefined finite state machines (aka FSM). This standard FSM technology allows for goal-directed characters that are able to activate a goal in response to a situation. However, as Jeff Orkin, the game's AI architect, notes, "Once a goal is activated, the character runs through a predetermined sequence of steps, hard-coded into the goal. The embedded plan can contain conditional branches, but these branches are predetermined at the time the goal is authored." While this can sometimes give the impression of a "thinking" NPC, this is essentially a mildly more versatile form of scripting. The characters have limited and predetermined behavior patterns, and the rigidity of the "sequence of steps" often forces recognizable "dumb" behavior that breaks the immersion of the game.

These soldiers actually have goals...like killing you.
The AI takes the next leap in the evolution of AI decision making with goal-oriented action planning (aka GOAP). In addition to deciding to activate goals, the AI also plans how to accomplish these goals in real time. "A character that formulates his own plan to satisfy his goals exhibits less repetitive, predictable behavior and can adapt his actions to custom-fit his current situation," says Jeff. Goals in GOAP are not created with a hard-coded plan. Instead, GOAP simply defines the conditions necessary to satisfy a goal, and the character determines the steps to satisfy this goal in real time. With this structure, the AI is able to dynamically replan to react to environmental factors. If a situation changes, the NPC recognizes this because the steps planned to accomplish his goal are no longer valid. When a plan becomes invalid, the NPC reassesses the situation and either finds alternate means for accomplishing the goal or activates a different goal. For example, if the player slams the door on a pursuing NPC, the NPC replans and decides to kick the door in. If the player physically blocks the door with his body, the NPC replans again and decides to dive through the window. Creating individuals that act intelligently is only half the battle. The next step was to make them act as an intelligent team.
There's No "I" in F.E.A.R.
F.E.A.R.'s enemies predominantly patrol and defend locations as a group. The difficulty in creating a believably intelligent squad was to get each NPC to have good reaction times as an individual, within the context of the squad. In some games, all squad behavior means is that there are multiple individual NPCs in an area. But this is not the case in F.E.A.R. The squad mechanics in F.E.A.R. enable the NPCs to work in a sophisticated and coordinated effort to take you down. Squad behavior supersedes and directs the individual's movement to improve the tactical advantage of the group as a whole. Your opponents in F.E.A.R. will use verbal communication, squad maneuvers, and situational awareness to exploit the advantages of numerical superiority.

Imagine lots of gunfire and yelling. That's what this scene sounds like.
The most immediately apparent manifestation of F.E.A.R.'s squad intelligence is in communication. NPCs will scream warnings of your actions and location as you engage them. The verbal feedback from enemy NPCs is extremely accurate. If you rush a squad, you will hear, "He's rushing!" And if you are caught trying to flank a squad, an NPC will yell, "He's trying to flank!" The NPCs' awareness of one another also takes verbal form, as they account for squadmates down. "We've got two men down!" for example. The AI communication is impressive and enriches the gaming experience, but F.E.A.R.'s AI does not simply talk the talk.
Groups of enemy soldiers in F.E.A.R. behave like the highly trained military collectives that they are. When NPCs patrol as squads, they will cover one another and move logically through the spaces they are patrolling. If you run from an engagement, the AI will form two-person search teams from the fragmented group to systematically move throughout the area.
If you plan to charge into a room full of NPCs, you should think again. Your opponents will not stand around and get shot; they will move into covered firing positions, and you will quickly find yourself taking fire from several directions. The AI will maneuver to the most strategic positions to cover their squadmates and will lay down suppression fire for teammates moving into position to flank or charge you. Enemy soldiers will even advance and flip a table to create more cover for a squadmate to advance. They are not unbeatable, but squads of enemies demand a great deal of respect and will surprise you with their intelligence--and will perhaps educate you about the effectiveness of your decision making.
One of the coolest behaviors of the enemy soldiers is that they recognize dangerous areas. If a squadmate is killed in a position, an NPC will flag it as unsafe and avoid taking cover there. If you pin an opponent down behind his cover, he will not continually stick his head out in the same place for you to shoot at. Once pinned, he will either call for backup, blind fire over or around their cover, retreat, or attempt to move to different cover. NPCs will even wildly fire their guns with one hand in desperate attempts to cover themselves as they retreat. This dynamic reaction to adverse situations will keep you on your toes and make you constantly reassess your battle strategy on the fly.

F.E.A.R. ships in October, just in time for Halloween.
The ability of the AI to dynamically react to you as a group and as an individual creates a rewarding atmosphere of tense uncertainty, and it keeps enemy engagements fresh and exciting throughout the game. You will never take the enemy for granted. The incredible immersiveness of this AI system is aptly demonstrated by a final quote from Jeff Orkin. "They take me by surprise... I can lose myself in the game and forget that it is my code working here."


Got this from the gamespot.com site and hope this provides some ideas.
The brightest light casts the darkest shadow.
Burn the heretic. Kill the mutant. Purge the unclean.

User avatar
ZenBudha
Posts: 285
Joined: Wed Aug 17, 2005 6:06 am
Contact:

Post by ZenBudha » Sat Sep 24, 2005 5:29 am

Some piece of code has to tell the pawn to do XYZ. They can call it a "Navmesh" a "Scriptpoint" a "Ai guidance system" or whatever but it doesn't chnge what it does. Just makes it sound spiffy.

So basically they've got this spiffy AI program that does what a bunch of pre-scripted AI's do. Challenge the player. Whether they are actually communicating or just scripted to seem like they're communicating doesn't really matter to the player.

Although it might be cool to turn 2 AI squads loose on each other and see who wins. lol
Fear not the textures for the almighty stylus is with thee - Book of Zen

User avatar
SithMaster
Posts: 306
Joined: Mon Jul 04, 2005 11:45 pm
Contact:

Post by SithMaster » Sat Sep 24, 2005 2:52 pm

One would think having every surface have an attribute that is checked by every object would drain resources. So everything they claim to exclusively do we can do in rf. Though i wonder about the npcs knocking over stuff for cover.
The brightest light casts the darkest shadow.
Burn the heretic. Kill the mutant. Purge the unclean.

Post Reply