The underpinnings of RPG AI
emerged relatively quickly. Games like Ultima IV (1985) offered
comprehensive conversation trees that allowed players to query NPCs
(non-player characters) on specific topics. A major part of Ultima IV’s
gameplay involve traveling the world and learning from its various
denizens. The approach feels deep, even today, despite the fact that U4
shipped on two double-sided floppy disks.
Scale, cost, and complexity
The
first problem, Wardell explained, is that good AI doesn’t really sell
games. Gamers may value good AI, but it’s not the determining factor in
whether people buy a title. At the same time, AI is now tightly coupled
to graphics and must be communicated visually. It’s no longer enough to
tell the player, “The shopkeeper looks frightened,” as players want to
see that the shopkeeper is frightened.
Multithreading and the AI-vs-graphics tug of war
Unlike
graphics workloads, which can be easily parallelized and scale well,
artificial intelligence processing is difficult to multithread. The
job-based systems that many games use for multithreading don’t tend to
work well for AI processing, Wardell explained, because the AI is
constantly asking questions and must receive immediate answers.
Job-based systems are designed to launch and process workloads, not
facilitate constant communication between the job and the host CPU.
To
understand this better, consider interactions between the player and an
NPC shop owner. Bethesda games typically offer you the option to steal
goods without penalty, provided no one else sees you doing it. This
means the game is constantly calculating the shopkeeper’s line of sight.
If you’re trying to sneak around a camp full of bandits, the AI is
checking to see how much noise you made and whether the bandits heard
it. In both cases, the AI is asking a question and receiving an answer
many times a second.
A critical part of the reason why AI doesn’t
seem to have advanced much, even though computers today are orders of
magnitude more powerful than their predecessors, is because the
overwhelming majority of that compute capability has been devoted to
making games prettier, not smarter.
The impact of audio
Audio
processing doesn’t impact AI calculations the way graphics do, but
players now expect titles to be fully voiced. This has its own impact on
game design. In The Elder Scrolls: Skyrim, the phrase “I used
to be an adventurer like you…” became a popular meme partly because it
captured the monotony of traveling from town to town and hearing the
exact same banal observation repeated over, and over, and over.
I
was curious on this point, so I ran a completely unscientific survey of
my friends who had also played Skyrim. The question was: “If you had to
guess, how many unique lines of ambient conversation dialog do you
think a generic Skyrim guard has to say?”
How Ashes of the Singularity and DX12 can change things
Up
to now, we’ve discussed RPG AI, because it’s one area where poor AI
sticks out the worst. Wardell’s expertise is in RTS and strategy AI,
however, and with Ashes of the Singularity already in Early Access,
we wanted to talk about how RTS AI has evolved since the days of
Starcraft and the original Command and Conquer, and where it might be
headed in the future.
One thing that sets Ashes apart
from most games on the market today is that Oxide is deliberately
choosing to require a quad-core CPU to run the game. This effectively
limits Ashes to the slice of the market that owns a quad-core (the Steam
hardware survey shows the market is split on this point, with roughly
half of users owning a dual-core system and half with a quad-core).
The
reason Oxide opted to require a quad-core CPU is partly because it
wanted to improve AI. According to Wardell, the basic structure of AI in
any RTS to-date looks like this:
while(true)
{
DoStuff();
DoAI();
DrawStuff();
}
Here’s Wardell:
Do players actually want great AI?
As
frustrating as poor AI can be, the alternative may be worse. Imagine
playing Skyrim and fighting your way through a dungeon, only to discover
that an NPC group of bandits had located and raided the treasure first,
following the same clues that you did. Enemies in these games often
respond hilariously poorly to stealth-based strategies, quickly
forgetting that they’re under attack and walking mindlessly over the
bodies of stealth-killed compatriots. This scenario could
obviously be improved — but a game where guards established realistic
choke points and immediately ordered additional patrols might not be
much fun, particularly for low-level players.
Are there players who would relish
the chaos of an open-world game in which random bandits could depose
rulers and dragons would loot dungeons before you ever reached them?
Undoubtedly. I suspect some of them already play Dwarf Fortress. But
this kind of freedom makes it impossible for a game to present the
player with a coherent narrative. These are the kinds of trade-offs that
we won’t see resolved any time soon, since they strike at the
inherent difficulty of creating strong narratives while allowing for
interactive gameplay rather than any kind of limited resource.
The
advent of DirectX 12, however, should give developers more freedom to
experiment with better AI simply by giving game engines the option to
utilize multi-threading more efficiently. We’re hoping this yields
improvements across the entire game spectrum. We’ve been stuck with
wooden cutouts and thin interaction for a long time now.
12/14/2015
Why AI still sucks in video games — and how DirectX 12 could change it for the better
One of the most common user
complaints about gaming is the AI. It’s been this way for decades, which
doesn’t seem to make sense — computers today are vastly more powerful
than systems built 30 years ago. We recently sat down with Brad Wardell,
CEO of Stardock and the author of the AI in Galactic Civilizations II
about this problem — and how DirectX 12 and improved multi-threading
support offer hope of improvement.
Ultima
V (1988) added a day / night cycle, which means that two of the
fundamental building blocks of RPG gaming — robust NPC conversations and
realistic life cycles — were shipping nearly 30 years ago, in games of
less than 1MB. That doesn’t mean we’ve made no improvements since, but
according to Wardell, AI has actually become worse in some respects. There are several interlocking reasons why this is the case.
Virtually
all of what we call AI in games relies on scripted sequences, either
hand-written or procedurally generated. Bethesda’s Radiant AI, for
example, uses procedurally generated scripts to create goals and tasks
for NPCs, then allows them to determine how best to fulfill their needs.
The company famously had to tone down how the system functioned
in The Elder Scrolls: Oblivion after it became clear its original
approach produced unintended consequences. In one case, NPCs addicted to
a drug called skooma would buy the drug until they ran out of money,
then kill the dealer and steal his supply. Players would arrive to talk
to the dealer as part of a quest chain, and find he was already dead.
Because
AI actions and reactions are synched to graphics, AI workloads need to
be completed in time for an NPC to react to what’s going on in the world
around them. That means AI processing needs to happen within a 10-20ms
timeframe — and since AI workloads don’t thread well, the AI is probably
running on a CPU core that’s also handling other tasks. Most games
display more than one NPC at a time, so all of their collective AI
calculations must be handled simultaneously.
The highest guess I got was 75. Most people, including me, guessed between 10 and 30. The actual number is well above 400,
even after discarding near duplicates. But since not every type of
guard can make every remark, and some remarks only trigger under
specific conditions, NPC guards still feel like paper cutouts, rather
than actual persons. Guards may say hundreds of things, but we remember
the handful they repeated ad nauseam.
Before
the advent of voice acting, a small team of writers could theoretically
churn out a huge number of responses. Today, all those parts are
voice-acted. If dialog writing scaled poorly 20 years ago, dialog
voice-acting scales even more poorly today. Keep in mind, we’re still just talking about the generic guards.
If a named NPC has unique responses to your class, gender, or other
attributes, all of them must be recorded. This is why many games tend to
use a small pool of voice actors, and it’s part of why dialog trees are
often narrow, with multiple lines of conversation offering only minimal
differences between them.
Games
like Dishonored, which implements stealth tactics far more effectively
than Skyrim or Fallout, is also a very different title. Levels are
self-contained, with far fewer NPCs and no sprawling open-world. These
trade-offs are not accidental.
We had day/night cycles when these graphics were cutting-edge
Yes, this guard is attempting to arrest a fish
Dogmeat in FO3 vs. FO4. He responds to your actions and emotes various states in Fallout 4
Oh god. Not again.
Stealth mechanics are often frustrating
“What
Ashes does is eliminate the game loop thing entirely. But this comes
with a heavy up-front cost. It’s expensive (CPU wise) to have an
asynchronous job system that can answer questions as a job. That cost
comes in the form of us having to require four CPU cores as a minimum
requirement.
“What we get in return,
however, is that the AI is asynchronous to the rest of the gameplay so
we can ask lots and lots of questions (i.e. How dangerous is this
threat? What is their firing range? What is my firing range? What
terrain is nearby? What allies do I have nearby? Can I ask a nearby unit
for help? etc.). And have these answers be provided really fast because
we know the user has at least four CPU cores so we can make certain assumptions on response time.
“Eventually,
every game will require four CPU cores because of what I’ve outlined
here. Being able to have your job system (which is, by definition,
asynchronous) be able to answer questions (which is a synchronous task
by definition i.e. Q->A) in real-time means you can much more
sophisticated AIs in real time.”
DirectX 12
isn’t directly intended to improve AI calculations, but it has a
positive effect nonetheless. Distributing workloads across multiple
cores reduces overall CPU overhead and gives developers more headroom
for other kinds of work.
Things like this could happen less. We wouldn’t mind.
Subscribe to:
Post Comments (Atom)






0 comments:
Post a Comment