At modl.ai our goal is to help make game production smarter and faster thanks to our expertise in artificial intelligence. But in order to create the future of AI for games, we need to know its history as well. So in this History of AI in Games series, we’re taking a look at how AI has been used to create some of our favourite video game experiences.
Creating a fun experience in a video game is often like theatre: it’s all about lining up your actors in the right place and at the right time. If you have non-player characters in your game, then regardless of their intelligence, you need to make sure they’re placed in the game world in ways that the player will find and interact with them. This can help keep players focussed on the experience and build the immersion that helps separate good games from great ones.
But unlike an actual theatre play, not only is the audience participating in the performance, they’re also moving around a lot. So the ‘stage’ of the performance is constantly moving to where the player is, and this creates a challenge for game designers to ensure that players continue to feel like they’re part of the experience as they react to your actions. This becomes increasingly more complicated when you consider open-world games such as Legend of Zelda: Breath of the Wild, Far Cry 6, or Horizon Forbidden West are continuing to grow in scale and complexity. And the solution to all of this is a major innovation for game AI that we call Directors.
The Director’s Chair
As the name implies, a ‘director’ is a system responsible for managing the player’s experience. While the concept has evolved somewhat from its original concept, the core of the idea can be found in Left 4 Dead: the four-player survival shooter developed by Turtle Rock Studios (under then-ownership of Valve) in 2008. In Left 4 Dead, players are trapped in a zombie apocalypse, and a team of up to four players must fight their way through the wartorn and ravaged streets, as hordes of infected await you. The director is designed to manage the game’s pacing: it decides when to put the pressure on by adding more and more zombies, as well as well to take its foot off the gas and allow you some respite.
The director is really just a finite state machine, much like that used for the characters in Half-Life – a topic we will return to in the future – but instead of controlling a specific character, it has two jobs: it spawns in new zombies to chase the player and also decides which specific players to target. It decides who to attack because it’s monitoring your perceived ‘stress’ level, or rather how much you’re being attacked and from how far away. So if you’re picking off enemies from afar, you don’t seem too ‘stressed’, but if there’s a horde of zombies all scratching you at once, you’re probably more stressed than usual.
The director uses this information to move through the three states of the state machine:
- First, there is the build-up, where it tries to increase everyone’s stress levels by attacking different targets based on a need to increase their stress.
- Secondly, there’s the peak, where it wants to bring the tension to a head by throwing everything at you. Knowing that the team of players are all feeling the pressure as they fight off a myriad of different enemy archetypes.
- Lastly, there’s the cooldown, where the director waits for a time before it spawns more zombies. This gives you an opportunity to heal-up, reload and get those stress levels back down to normal.
The rate at which it moves through these three states isn’t consistent and is prone to change based on how a team of players performs. In fact, it places an emphasis on punishing players that don’t work cooperatively. If you’re playing like a team – supporting each other, offering items, and moving through the level at a good pace – it is actually a little less punishing. But if you’re moving too slow, or sprinting through the level, the director is much more aggressive and tries to knock you down hard. It also pays attention to how close players are to one another. So if one player goes rogue and tries to rush through the level on their own, the director will prioritise them as a target because they’re not playing by its rules.
Directors in Other Games
You still see directors used in a lot of games that share Left 4 Dead’s DNA, such as Vermintide and Payday 2 plus more recent games like Back 4 Blood. But the idea of directors is equally applicable in other genres. Open-world franchises such as Far Cry and The Witcher have systems that embrace directors to service their own game design needs. This can mean ensuring they only spawn AI characters near the player to keep performance costs down, or balancing how many attack you at once and how powerful they are.
It’s even used in horror games like Alien: Isolation, so the player can’t continue to evade the monsters hunting you down. It’s all about keeping that laser focus on the player’s experience, while also making sure these games don’t slow to a crawl as a result!
To find out more about how director AI is used in other games, be sure to check out the dedicated episode on the subject on the AI and Games YouTube channel.
Director AI is but one of the many innovations developers have created over the years to service their creative ideas. Be sure to catch up with more of our History of AI series as we discuss the likes of Half-Life, Halo, and how some of the oldest games in the world have had an impact on the development of the field.