F.E.A.R. Designer Diary #1 - A Study of Smart AI, Part I
In this designer diary for the upcoming shooter F.E.A.R., the Monolith staff explains some of the features that make the enemies so formidable in battle.
We'll begin emailing you updates about %gameName%.
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 AIBy Monolith Staff
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.
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.
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.