Nearly all games need some amount of artificial intelligence — most commonly to give the player non-human opponents. But conversations about good AI in games are still dominated by Façade, Black & White, The Sims, Versu, and F.E.A.R. — all of which came out years ago.
Those games are hardly the only examples we can draw from in envisioning artificial intelligence systems. We reached out to several developers for their input on more recent games making innovative and instructive uses of AI.
The following list of games are all notable for the interesting, clever, and/or novel ways in which they use AI, and all are well worth a closer look if you’re eager to let a little algorithmic thinking improve your game design. The underlying ideas they explore point toward the exciting and diverse future artificial intelligence could have.
The Division‘s enemy AI has had a mixed reception — at one moment they’ll stand out in the open, completely unprotected, then the next they’ll sneak around the back and give you a surprise bonk on the head. Its attempts to step up from the highs set by F.E.A.R. a decade ago are well worth closer examination, but the real star of The Division‘s AI routines is its path finding for changing cover.
Like in Tom Clancy’s Ghost Recon, players can scan for cover, but here they can also hold down the cover button and their character will automatically run to the new spot. Essentially, this means that movement between covers is automated so that the player can concentrate on tactics. And since the path is shown on-screen ahead of time (it’s drawn in a thin white line), the player can see exactly how they’ll get there — which further helps in sorting out tactics because they can guess how long it’ll take to make the automated dash.
TAKEAWAY: AI can drive mechanics that help the player get around faster and more effectively, which leaves them with extra mental bandwidth to process the important stuff, like who to shoot and how.
Since its inception in 2005, the Forza series has favored a learning neural network to traditional AI design for controlling non-human drivers. This Drivatar system watches you play and imitates your driving style — kind of like an amalgam of dozens of time trial ghosts.
In the most recent iterations the Drivatar system is hooked in to Microsoft’s cloud services, where it can pull in AI racers based on other human players as well as crunch greater amounts of data from each player. Now your AI opponents mimic other players from around the globe — their silly mistakes, quirks, strengths, and weaknesses — which makes for a more unpredictable experience.
The good side of this is that AI drivers learn to do all sorts of complex maneuvers and each exhibit a distinct racing style, which makes them seem more human. Unfortunately it also means that even with the difficulty maxed out, racing sim purists have a tougher time finding non-human opponents to practice against — because few drivatars actually drive anything like a professional race car driver.
TAKEAWAY: Learning AI that mimics real people can make enemies and opponents seem more human, but you still need to keep in mind that most people who aren’t professionals in the game’s closest real-life equivalent will behave nothing at all like the real professionals.
First-person shooters normally showcase enemy AI that’s just smart enough to challenge the player as they go around shooting everything that moves. The player is a predator, and the hordes of lookalike bad guys scurrying around the screen are the prey. But Alien: Isolation‘s Xenomorph reverses that convention. The free-roaming alien is the one in a position of strength, and the player — stripped of her power — gets to feel what it’s like to be hunted. You carry a gun, but to use it is to draw the all-powerful, unkillable Xenomorph to you. (A flamethrower eventually complicates the situation and gives the player some power back, but even then the alien remains the hunter.)
The alien may just be following the behavior trees and routines coded into its digital being (which becomes all-too obvious if you try to outsmart the Xenomorph or otherwise test its limits), but it’s hard to predict where and when it might appear nearby. That unpredictability combines with the alien’s sensing capabilities — it has keen hearing — and some sort of director system that drives the alien to always be somewhere in the player’s general vicinity. The result is a tense, terrifying experience that pushes players to hide in lockers for minutes at a time and to constantly look around for the hunter lurking in the corridors and vents.
TAKEAWAY: An enemy AI designed to relentlessly hunt the player as they roam about the game world can offer an unpredictable and tension-building element to the level design.
The Ice-Bound Concordance may seem at first glance to be an elaborate choose-your-own-adventure game, but its story of KRIS, an AI simulacrum of an author, is not built of branching paths. Rather, the player and AI combine pre-written (barring some variables) fragments of story text to piece together a novel. This is done through interactions both in the game — dialogue trees, player interventions in KRIS’s creative process, symbol and event choices for the plot — and outside of it, through the pages the player shows KRIS from an actual, physical companion book that the AI’s not supposed to see. The developers call their AI-heavy take on CYOA a combinatorial narrative system.
Where many older attempts to put algorithms in charge of a game’s story — such as Façade and Versu — have focused on social interactions, Ice-Bound looks inward to tell a more literary tale — or rather many tales. It can handle tens of thousands or more permutations of a literary framework that consists of many narrative fragments and a complex set of rules for how these might be activated and deactivated. The AI and player (and the designers who crafted the narrative fragments) thereby become collaborators in the storytelling process, with the AI’s goal being to ensure the player gets a dramatically-satisfying story.
TAKEAWAY: You can use AI to tell a dramatically-satisfying story — even if it’s literary in nature — that’s dynamically shaped by and molded to player choices in a more organic way than traditional branching paths.
Tower defense (and offense) game City Conquest is unusual in that its biggest use of artificial intelligence came in the design process itself. Here AI became a tool not for expanding or refining the player’s moment-to-moment experience but for evolving the actual design — to improve game balance and to (hopefully) engineer a more enjoyable overall experience by measuring how well the design at each iteration met its goals.
The AI wasn’t handling the design modifications, mind you. Designer Paul Tozour wrote a genetic algorithm that acted as a kind of automated, virtual playtesting team that could evolve into expert players and in the process identify dominant strategies and minor elements that needed tuning. By looking at how both these machine players and human players approached the game, Tozour found flaws big and small and gained lots of data to help him tune the game’s parameters.
TAKEAWAY: AI can help you make your game better before it’s even out by playtesting to find dominant strategies.
Jonathan Blow wanted walking in The Witness to be as smooth and unobtrusive an experience as possible. If players got caught on edges or tapped in walls, or if they could traverse terrain in one direction but not the other, it would pull them out of the world. It’d break the immersion, and immersion was paramount to the game’s vision. To ensure this didn’t happen, he asked programmer Casey Muratori to improve the player movement code. Muratori responded by writing an algorithm that tests for collisions.
His algorithm hopped in to replace the player and explored the entire island. As it walked it created nodes and displayed lines atop the ground that connected these. White lines meant walkable, red not walkable. (It could explore areas close to boundaries at higher density, too.) If the state changed — say, a door opened — it could go back and pick up from that point and continue to the area beyond. And from seeing the results the dev team could find problems with the movement code or with level geometry that needed refinement.
TAKEAWAY: AI can do the grunt work for you in finding all the nasty problems that could frustrate players simply trying to explore your game’s world.
Several years on, the AI Director used in the two Left 4 Dead games remains a fascinating system for controlling the flow of a cooperative multiplayer game. The Director handles typical AI tasks such as enemy movement and human player proxies in a satisfying, believable manner. But what really makes it interesting is the higher-level impact it has on every session.
The Director’s main job is to manage the pacing. It builds up the intensity to a peak, then eases off, then builds up again, and repeats this throughout the session as players edge closer to the exit. It does this by modeling stress levels in players (affected by things like close versus long-range combat, ammo and health levels, zombies in proximity), then adjusting how the zombies attack — where they come from, how many of them attack, which types attack, and who they focus their attack on.
AI Directors have since been used to great effect in many other games, such as the post-Left 4 Dead Far Cry games, Evolve, and Rocksmith 2014 — which used its director to handle musical accompaniment to your live guitar play in the game’s session mode. But Left 4 Dead remains the best example to study.
TAKEAWAY: Every player is different, and by having an that AI alters the flow and intensity of gameplay to fit their moment-to-moment needs you can ensure that everybody gets a satisfying, challenging experience.
As these examples show, artificial intelligence can be used in games in myriad ways. It could be a testing tool to make your code or design more robust and to make the final game more fun, or it could make non-player characters seem smart even as they continue to be dumb — just by exhibiting some rudimentary learning strategies or adaptability.
AI can be the unseen hand directing the whole show or the bullet sponges and companion characters right there with the player. AI can guide players or mislead them, help them or hinder them. It can make the bad guys act like they’re genuinely cooperating to kill or maim the player, or it can turn a single enemy into a terrifying hunter. AI can mimic, imitate, learn, forget, teach, and collaborate.
It’s just algorithms, so it’ll do whatever you want it to. You only need to think of creative ways to leverage its powers to entice, bewilder, muddle, aid, hinder, process, and share. Don’t think so much about AI in terms of enemies that are just barely smart enough to slow the player down. Rather, imagine how it could elevate the experience in some small or big way.
Thanks to Jonathan Tremblay, David Churchill, and Anne Sullivan for their help with putting this article together, and to Tommy Thompson for his AI and Games YouTube channel — which provided further guidance.