Why F.E.A.R.'s AI is still the best in first-person shooters
Flank, cover and run away
The shadows on the wall tell me they’re coming. Two of them, both with assault rifles swinging idly at their hips. If I’m quick enough, I’m sure I can take them both out in one go. I peek out of cover as they round the corner, and let my stake gun sing, pinning the first enemy to the wall with 10mm steel projectiles. But at the sound of gunfire the other one legs it back the way he came, hunkers down in cover, and yells for reinforcements down his radio.
This five-second episode tells you a lot about the attention to detail in F.E.A.R., a 12-year-old game with AI that puts many modern-day shooters to shame. Its army of clone soldiers feel smarter than any enemy I’ve faced in an FPS since, and remain razor-sharp to this day.
The clones will shout “covering fire” as they spray bullets at your position at the same time as their squad mates move to safer spots. They’ll hide in dark corners to try and get the drop on you, and fall back to more solid cover if you’re getting the better of them. In the clip below, the enemy on the left peeks out of cover (at the start of the gif) to get a look at my location. In most other games, he’d poke his head back out at the same spot, so I’m ready and waiting to splatter his brains on the wall. But instead, unseen to me, he crouch walks behind cover and emerges somewhere else, making me re-adjust my aim.
Grenades are a big part of the AI’s arsenal, thrown both to cause damage and to flush you out of cover. In the clip below, I’ve taken refuge behind a pillar, but an incoming grenade from the right (the enemies actually shouted “flush him out” before they threw it), forces me to the left and into their line of fire.
This is all smart stuff, but it’s the kind of thing most FPSs should be able to get right. However, if there's one thing that sets FEAR's AI apart from the crowd, it's movement. Enemies are constantly shifting from cover to cover, retreating around corners, changing spots to get a new angle on you. They're looping back on themselves and diving through windows, crashing through doors to open up new parts of the battlefield, and they’re never in one spot long enough for you to get comfortable. It means that crouching behind cover can be disorientating, because when you lean out again the enemies won't be in the place they were when you were last firing.
And this movement isn't just random, either. Enemies are aggressive, and will actively hunt you down in packs. More than once I've died because an enemy simply ran over to my cover position and shot me mid-reload, before I even knew they were there.
What’s most remarkable is the simplicity of the system behind the AI, as revealed by Jeff Orkin, senior engineer at Monolith productions, way back in a 2006 GDC presentation. The team had just one AI programmer, and so designed a ‘planning’-based system that lets the AI soldiers think for themselves.
Instead of telling an AI exactly how to behave in every situation, F.E.A.R gives the soldiers a set of goals and a set of possible actions, and then lets them figure it out for themselves. Essentially, the AI reacts dynamically to what’s going on in the environment – for example, if they’re in danger they will look to retreat, but only if they can identify a safe path to follow. If not, they will hunker down, and perhaps blind fire from cover to try and slow your progress.
Where it gets really impressive is where AI soldiers work together. They can form impromptu squads based on proximity to each other, and then act as a unit to kill you, each aware of the other’s actions. In practice, this means that while they normally start together in any gunfight – coming through the same door, for example – they quickly fan out, and before you know it you're twisting your head this way and that, falling back to try and keep them all in your field of vision. It almost feels like they’re being controlled by single unseen player on high whose one objective is to see you dead.
None of it is dictated. There’s no direct command to flank, for example – but complex behaviours emerge from the soldiers analysing and reacting to their environments, which are built to showcase the AI at its best.
In the clip below I’m in a strong position, firing my shotgun down a narrow corridor, with all my enemies in front of me. At least I think they are, until one enemy flanks into a small room on my right, chipping away my health and forcing me to retreat to where I can engage him one on one.
The cherry on top is communication. As the soldiers fight they provide a narrative for the chaos in the form of orders and updates barked down their radios. “He’s flanking us”, one will call out, as his squad reacts to my movement. “I’ve got nowhere to go!” another will call, aware that he’s trapped but unable to identify another safe spot.
As Orkin explained, “Having A.I. speak to each other allows us to cue the player in to the fact that the coordination is intentional. Of course the reality is that it’s all smoke and mirrors, and really all decisions about what to say are made after the fact, once the squad behaviour has decided what the AI are going to do.” Smoke and mirrors it may be, but it really makes you feel like you’re facing an intelligent force.
In his presentation, he observed that the AI reminded players of the first Half Life game, which came out seven years earlier. “It seems that we haven’t made much progress in seven years. There has to be more we can do with game AI.”
Unfortunately, what F.E.A.R demonstrates is how little AI has progressed since 2006. There’s no one aspect to it that's unique – no one individual behaviour I can pick out and say that I haven’t seen in other games since. But it nails the simple things, and brings them together into something that's greater than the sum of its parts. 12 years on, it’s still the pinnacle of shooter AI.