Uncharted 4 is not as scripted as you might think
Designer Matthew Gallant explains how the studio incorporated systemic combat AI into Uncharted 4, and what went wrong along the way
The Uncharted series is industry shorthand for the type of highly polished and diligently authored roller coaster rides that have made up the AAA market for some time. However, as Naughty Dog game designer Matthew Gallant will discuss at the Montreal International Game Summit in just over a week, the most recent installment in the series may be slightly less authored than some players expected.
Speaking with GamesIndustry.biz recently, Gallant discussed how the enemy AI in Uncharted 4 adopted a more systemic approach than previous versions of the game.
"The things that worked really well in Uncharted 1 to 3 were the designers having a really heavy hand and making these bespoke, hand-authored layouts," Gallant said. "Design was often going to the point where we'd say, 'These NPCs are going to hang out here, and if the player moves here, they'll counter by moving here.' Or we'll send in the heavy guy and when he dies, the other guys will move up... It was really terrific for those games because we had combat designers who had time to go in and really sweat all those details really, really carefully."
That approach had to be modified for Uncharted 4 because one of the game's key additions were nearly open-world areas (Gallant prefers the phrase "wide linear") like a Madagascar section that players can explore on foot or by Jeep. With players given more freedom to choose how they approach wide linear combat encounters, it seemed a fool's errand to try to customize AI actions for every possible scenario in play. To address that problem, the Naughty Dog team took inspiration from its previous project, The Last of Us.
"In a way, The Last of Us really got us thinking about systems," Gallant said. "It's not that the AI was completely unauthored, but we had interesting AI systems driving AI behaviors for regaining stealth, flanking, and NPCs that could really interact with the environment in lots of interesting ways."
Early on in development, Gallant said that inspiration took them a bit further down the systemic path than they needed to go. They created AI systems so that enemies in combat would try to independently identify strategically strong locations, or give them hyper efficient routines to search for players when they run and hide. They quickly spotted problems with that approach.
"A lot of those things we tried couldn't create good enough results consistently. But more importantly, in some ways I felt we were reverse engineering the high-level decision making."
"Although in an algorithm-y, computer science sense, they were searching very efficiently, when a player saw them, they looked not human, not how a person would look," Gallant said. "They looked a little lost, or hesitant and undecided. And they also didn't present an interesting stealth challenge to the player. We had to take a step back and say that the goal of these NPCs searching for the player isn't to find the player. It's to present interesting gameplay, to spread them out in a layout, have them looking human and smart, and moving in ways that are mildly predictable for the player so they have some ability to sneak up behind them."
He added, "A lot of those things we tried couldn't create good enough results consistently. But more importantly, in some ways I felt we were reverse engineering the high-level decision making. And that just wasn't a really great idea in this particular case."
Ultimately, Naughty Dog settled on a hybrid approach where there would be a handoff between authored and systemic control of the characters. For example, to deal with the issues of wide linear combat situations above, level designers would mark up combat zones, telling the AI where the exit is supposed to be, highlighting where a few strong positions might be, and setting variables such as how inclined they are to flank or take cover, how easily they lose track of the player, or how dogged they are about chasing a fleeing player to finish the job.
In another instance, they used some pathfinding AI from The Last of Us to get enemies from point A to point B. Gallant said it was soon clear that the AI worked especially well in The Last of Us because the game's tight, complex environments ensured that the enemies would traverse environments in mostly human ways, using aisles and doorways, walking around desks and other obstacles in the layout. But in Uncharted 4's larger, more open layouts, moving from point A to point B usually meant travelling in a perfectly straight line, which wasn't terribly interesting.
The solution was to run paths throughout the layout that AI would move along, trails that would have them reasonably making their way throughout the level, perhaps clearing out corners or other places the player could be hiding on the way to their destination.
"Our design values at Naughty Dog mean we're never really going to be OK with AI quirks or difficult situations like that. We're going to push to make these guys look terrific and smart in as many locations as we can."
While systemic design may be experiencing a boom period these days with the resurgence of Deus Ex-like action sims, systems-heavy series like Fallout and The Elder Scrolls, as well as more experimental indie efforts in procedural generation, it's not a trend Gallant expects Naughty Dog to chase. The more systemically driven games are, the more likely players are to stumble upon scenarios the developers never planned for, and the more likely the AI will fail to respond appropriately.
"Our design values at Naughty Dog mean we're never really going to be OK with AI quirks or difficult situations like that," Gallant said. "We're going to push to make these guys look terrific and smart in as many locations as we can."
And even though Uncharted has a fairly limited set of verbs for players, Gallant said unconsidered scenarios still crop up in testing. For example, when players hunker down in Uncharted, the AI actually gets more accurate to represent that they're aiming for a stationary target, while it suffers a penalty when the player is jumping, running away, or swinging on a rope. That seemed fine until the QA team found out that they could abuse that modifier by simply hanging out on ropes for long stretches in the middle of a firefight.
"Even relatively simple games have a lot of states the player can be in and things the player can do, and you have to be really thoughtful about catching all those examples," Gallant said.
Of course, most Skyrim players understand just how wide open the game is, so when they throw the game a curveball and it reacts inappropriately, they tend to be more accepting. But even if it fosters a greater sense of forgiveness from players, Gallant was clearly not a fan of communicating to them exactly how systemically driven Naughty Dog's games might be.
"My hope is always that the work we do is not obvious to them at all," Gallant said. "We never want the combat AI side of it to show through at all. We don't ever want people to be thinking, 'Why did that NPC do that?' We want them to be thinking of it in terms of 'that guy over there with the gun' and really be in the moment. And when things are good enough end to end, you really get lost in the experience and don't have to think about whether it's authored or systemic. It's just believable."
Disclosure: MIGS has a media partnership with GamesIndustry.biz, and is paying for our accommodation during the event.