Square Enix veteran Youichiro Miyake talked in detail about the AI that governs NPC behavior in Final Fantasy XV in a fast-paced, data-rich talk: “Eos is Alive: the AI Systems of Final Fantasy XV.”
The grand goals of the AI were to make believable characters and a living world—goals that would be familiar to any developer who’s used such tools—but there were a few interesting quirks of FFXV’s system that were worth highlighting, particularly in the fine degree of stratification that divided motivations and actions for each NPC.
In the case of FFXV, this graduated system was used to create believable, human (or, at least, intelligent) behavior on the part of NPCs. There are three systems: Meta AI controls an NPC’s behavior, while Character AI handles an intermediate layer of behavior that is akin to abstract decision making, and the Animation AI makes it all appear dynamically on screen. Each responds independently to stimuli, working in concert to produce what Square Enix hoped was a smooth visual outcome that overcame the unintentional AI comedy endemic to so many open-world games.
As Miyake put it, an AI’s actions must be in harmony with its artificial environment, sensibly responding to the world before it and the people (including the player) within it. The dynamism of FFXV’s system was on full display as Miyake showed a video where a player/NPC interaction was set side by side with a colourful branching tree that visualized the full field of NPC choices, with different mob actions highlighted depending on where the player positioned himself; rule-based AI governed the actions; “if player stands here, do x.”
But the entire system is layers upon layers, bracketing actions like shooting and running into different “states” that contain a tree of potential sub-actions and routines, or where the “common logic” of various AI have sub AI groups for specific kinds of creatures.
The Navigation AI also has a few interesting tricks that Miyake described in detail: The Point Query System (PQS) is used by NPCs to, for instance, rank the optimal points for firing a projectile, filtering out suboptimal locations and giving the NPC the best possible position for getting the drop on the player or one of their allied NPCs.
Something as seemingly simple as face-to-face conversation is mediated by all three AI systems, which calculate optimal points in a similar fashion by gathering data on the distance between characters from all points and facings, while the Animation AI moves the NPC body in relation to the player.
The Ambient AI was the last system Miyake described, which governs friendly NPCs in towns. He talked about the importance of what he called “smart objects,” where something as mundane as a chair has a range of characteristics built into that then govern the interactions of NPCs who approach it, suggesting an action and an animation to go with it (looking reserved, perhaps). In this way the towns are populated with people who seem engaged with their environment.
Miyake suggested that gathering group data on your NPCs, such as producing heat maps of behavior in a given area, could be used strategically to adjust one’s Meta AI or the overall pathing of characters; showing how a similar map illustrated the way NPCs in a given town gave a market street the feel of being busy while leaving side streets to be lonelier affairs, reinforcing a natural feel for each.
The three layers of FFXV’s AI—Intelligence, Body, and Animation—work in concert to produce the game’s lifelike appearance. How Miyake defined “Body” was quite interesting. It was configured in the game’s systems as an intermediate place between the abstract decision-making process and the animation it produced, rendering it a kind of motility (think, the act of moving rather than the specific visual appearance of, say, walking over a rock). As a unique layer of AI design, it offers an interesting way of conceptualizing how a character’s “mind” and “body” may, in fact, be more alike than previously conceived. It’s gotten a lot deeper than simply “AI says do x, animation engine renders x.”
Now there are layers that govern naturalistic thoughts, treating bodies as the extension of a rational actor (or, in the case of non-sapient creatures, a truly living actor with instincts).