The Perfect Organism: The AI of Alien: Isolation
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.
This article is an edited transcript of the AI and Games YouTube video linked to above. AI and Games is a crowdfunded series on Patreon.
One of the biggest AI-driven titles of modern times, Alien: Isolation brings the terror of the xenomorph to video games. While the alien, LV-426 and many other key elements of the franchise have previously been explored, Alien: Isolation takes a different route. A horror game steeped in the aesthetic and style of Ridley Scott’s classic 1979 movie: in which the player is trapped on the Sevastopol space station with a single, intelligent, near-invincible alien. For this experience to play out as expected, the alien itself has to carry a large amount of the experience: a demanding feat for any AI in an industry in which non-player characters are either heavily scripted or suffer really short life spans.
So how did developers Creative Assembly pull it off? The short answer is through tried and tested AI techniques, designed in a manner that breaks from many traditional game-design concepts.
The Design of the Xenomorph
The team behind Alien: Isolation built the game around a simple premise: to survive an encounter with Ridley Scott’s original alien. Such a feat is pretty difficult to balance, given that you need a strong story to carry the player through, but also to establish pacing such that the tension varies throughout your gameplay. Neither of these are easy when you introduce a systemic AI into play: a collection of decision-making systems that react to what is happening in the game. It needs to know when it can participate in the experience and it what level it should do so. In order to do this, it required a unique design perspective.
‘Psychopathic serendipity’: the alien always find itself in the right place at the right time.
As explained by Andy Bray in his talk at the 2016 nucl.ai conference, the player can’t be scared senseless all the time, otherwise they’ll just give up. The tension had to vary but also maintain an air of unpredictability in the xenomorph itself. This led to the developers seeking inspiration naturally from horror movies such as Ridley Scott’s Alien, but also adventure movies such as Jurassic Park. The resulting philosophy: ‘psychopathic serendipity’ is where the alien always find itself in the right place at the right time. Even if you’re in hiding and the monster can’t see you, and it doesn’t know your ultimate objective, it will still find a way to mess with your plans. However, the key to pulling this off was to ensure it wasn’t scripted. Co-ordinated jump scares while fruitful the first time are cheap; they won’t yield further reward in subsequent playthroughs. Instead, the player should have a sense of powerlessness, but still know that while the alien is smart, they are smarter.
But all of this goes against the grain of a lot of AAA games development: a world in which player empowerment is key. This means challenging a lot of design tenets that have held in pretty much every Alien game — from Alien 3 and Alien: Trilogy to Aliens: Colonial Marines. The biggest departure is that you cannot kill the alien. You can distract it and in time find ways to hurt it and scare it off, but you can’t kill it. But in another significant departure, a role reversal between antagonist and player: the alien will not only kill you frequently, but it does so with one hit.
Building the Alien AI System
In order for this alien to work, Creative Assembly fell back on reliable and trusted AI techniques. Building systems that ensure the alien serves its purpose, but interestingly, also ensures it plays according to expectations.
To achieve this, the game requires two distinct behaviour management systems: the ‘macro’ or director-AI and the ‘micro’ or alien-AI. The director observes the player throughout the game, always knowing your location. Meanwhile the alien-AI is driven by a series of sensors and behaviours that allow it to hunt the player down. The director’s job is to point the alien in the direction of the player periodically, to give it a hint as to where it should be looking. Despite this, the alien is never allowed to cheat: while the director always knows where you are, the alien has to figure it out for itself. You can fool it, you can surprise it and you can escape it.
The director is responsible for managing what is known as the ‘menace gauge’: a metric that allowed the system to understand how much it was pressuring the player. This is rather similar to an approach made in Left 4 Dead in which a stress gauge was used to prioritise enemy attacks. However in this case, menace would come not from attacking the player, but being in their proximity and the perceived increase in tension.
As such, the system would periodically wish to invoke menace upon the player and tell the alien to head to a particular location. While the alien is near the player, the menace gauge would increase depending on specific factors:
- Whether the creature is within a short walking distance of the player.
- Whether the player has actual line of sight on the alien.
- Whether the alien was close on the motion tracker, but could also reach the player quickly.
The last item is particularly important, as the alien could technically be close on the motion tracker but in another room. As such, the menace won’t increase at the same rate given the threat is minimal.
‘Menace’ comes not from attacking the player, but being in their proximity and the perceived increase in tension.
Naturally once this menace metric has peak level, the director backs off and sends the alien elsewhere: either into neighbouring areas or up into the air vents. The general principle being that when the alien is closer, the game is scarier, but we need to give players a break after a while. Not only to ensure they stop freaking out, but to enable them to achieve some progress in the game.
This whole process is managed via a Utility AI or job system — previously used in the likes of BioShock: Infinite for the companion character Elizabeth — which dictates the task to complete, the location the alien should visit and the priority with which it should do so. The priority dictates to the alien whether it should finish what it is doing now, immediately move towards doing this action (and blend the required animations) or just outright interrupt everything and execute right now!
The job system allows the alien to operate in two main states of active and passive. The active state or 'front stage' mode, is when the alien is told to sweep areas of the map or search specific locations after a certain noise or trigger occurred. Meanwhile the passive or backstage mode occurs once menace levels peak for too long and it falls back into the air vents. But of course, it would then head for air vents up ahead it thinks you’re going to move towards.
The Alien Itself
The aliens behaviour is reliant upon behaviour trees: a technique we’ve previously highlighted in our video on the AI of Halo. The monster has over 100 nodes hidden within its behaviour tree system, with the top level of around 30 nodes responsible for selecting what type of behaviour it was about to execute. These top level nodes would then have the alien execute within large sub-sections of the tree responsible for specific sub-behaviours relating to specific tasks.
To add to this, certain parts of the behaviour tree are — on starting the game — locked off. The system gradually unlocks these behaviours in the tree as certain conditions are met throughout the game. This ensures that the longer you play, that the alien starts to exhibit new traits that keep you on edge. In a sense, it gives the impression that the alien is beginning to learn from experience, given the players behaviour is triggering the conditions that unlock it. Though as Andy Bray was keen to point out: none of these conditions come from events that lead to a players death. Otherwise the AI may develop an unfair advantage: given you might never figure out what you're doing wrong that is resulting in a gain for the alien. One concession however, is there are triggers in the final build of the game that unlock behaviours at specific points in your campaign if they haven’t already, that way the creature can keep pace with the player as they get better at the game.
When given a specific job to complete from the director, the alien is reliant upon a fast and efficient pathfinding system, with heuristics based on particular sensors the alien has. The alien can 'sense' player footsteps when walking or running, gunshots, and even the motion tracker when the player is around 1.5 meters away. Lastly, while it does not have sensors in the tail, it does have short-range ray traces that look behind it - eyes in the back of its head - with the intention of ensuring that players do not avoid detection by walking closely behind it.
[The alien] literally has eyes in the back of its head… ensuring that players do not avoid detection by walking behind it.
Finally, we consider the aliens movement patterns: those who have played Alien: Isolation will know that the alien is prone to pacing around an environment for several minutes. This thing isn’t moving towards a specific location in an optimal fashion; it’s searching, it’s hunting. This is achieved by giving the alien particular areas of interest to explore— either hand-tuned by designers or generated dynamically in the environment. Sometimes these are specific locations the designers want the alien to visit, and other times it’s responding to players given they have made too much noise. A perimeter of nearby locations is established and the alien will devise a path to visit them all in a sub-optimal fashion — meaning it will visit every point, but not with any guarantee it does so in the shortest sequence. These positions are prioritised based on their visibility by the alien and results periodically in the creature backtracking on itself: a behaviour designed on purpose to give the illusion it’s double-checking or doubting itself. Locations for alien movement are separated into search locations: those that the alien will visit, and spot locations: where it will stay where it is currently standing and then turn to look at the area of interest. For safety, the designers were able to dictate specific areas the alien never looks, ensuring it doesn’t catch you out in unfair situations.
Considering all this design effort, you’d be quick to think that despite it all, the game designers would still allow for the alien AI to cheat periodically by either teleporting or being clairvoyant in its knowledge. According to Bray, this is categorically untrue. Throughout the entire 12–18 hour campaign, the alien only teleports twice to be in very specific locations and is only done to enable it appear in cutscenes.
Alien: Isolation is an achievement: an AI-driven game that holds your attention for the most part through the experience of interacting a primary antagonist. A real feat in and of itself, the fact that this is then achieved within the context of a horror game is all the more impressive. Fortunately this was largely agreed upon by critics, who hailed the alien and it’s AI behaviour as a real driving force behind the game. This is the summation of intelligent design principles being applied to tried and trusted AI techniques. The illusion of an intelligent and ferocious creature can be managed on multiple levels of complexity. Provided that illusion holds true, then the resulting product will prove memorable for players.
This piece is adapted from the video posted on my patreon-funded YouTube Channel ‘AI and Games’. My thanks not only to my Patreon supporters, but also to Andy Bray of Creative Assembly who was kind enough to answer some questions about the game.