Having a super smart AI character in a game means nothing if the player doesn't understand it.
What is that character thinking? What is it trying to do? Is it trying to tell me something? If only
it just said it out loud, it just straight up told you. That would help, wouldn't it?
Well that happens in a myriad of games, and we have a term for it, they're called barks.
I'm Tommy Thompson, this is AI 101, and in this episode we're going to talk about the value of
barks and even the most basic of dialogue systems. This simple yet effective tool can
help enrich AI characters to appear smarter, better communicate their actions, provide
meaningful content to players and even help you out in a bind during critical moments of play.
So yeah, what exactly is a bark? Barks are simply clips of pre-recorded audio
that are played by a non-player character (NPC) in a game. That bark will only play in a given
situation and is done so with the intent of communicating information to the player.
In video games this is already a critical concept of core design,
the idea that audio will trigger based on in-game events like Mario collecting a coin,
firing a weapon in DOOM, or a unit being selected in Command and Conquer. In these instances,
we're confirming Mario collected the coin, that the weapon successfully fired, and that
the unit is now active. These are useful for a player to know their interactions with the game
are working as intended, and help you recognise that the action you executed has succeeded.
For barks, we're simply extending the idea to allow us to share other types of information.
The simplest analogy to bark systems is commentary in sports. Commentators are reacting to the events
as they unfold in the game, and then providing some insight into what is happening. In fact,
most modern sports videogames employ a bark system to react to the match based on the game state,
it's exactly the same principle - though it's worth mentioning more contemporary titles
have a much more complicated system than they did say 20 years ago.
Barks help address one of the bigger issues that impact the design of non-player characters:
they help communicate what they're thinking. Throughout AI 101 we've talked
about different methods through which characters can make decisions,
using the likes of say the Finite State Machines of Half-Life, the Behaviour Trees of Halo,
or Goal Oriented Action Planning like in FEAR. These are all great tools that allow designers to
figure out what decisions a character should make based on context. But once the character has made
that decision, an equally demanding challenge is communicating that decision to the player.
One of the simplest ways to do this, is to use a bark in which the character uses some dialogue to
express either what it is thinking, or what it is about to do. So if a character in a stealth
game is going to execute a search action because they're suspicious of a noise, sometimes they'll
just straight up say they're suspicious about the noise, and are going to search.
But similarly, barks are a great opportunity to provide the player with a lot of other
information. A bark can be used by an NPC to tell the player about an event that's happening
off-camera, a change to the game world that's important to them or even give you hints on
how to progress in a puzzle. In fact, this idea even extends into multiplayer games.
Left 4 Dead popularised the idea barks can be played in-game by specific characters, even
when controlled by other players, to communicate that an object, item or event was taking place,
without the need for in-game chat - essentially a precursor to the pinging systems we now see in
games like Apex Legends that often play an audio clip when the ping is created.
And then, you can then take this idea one step further:
what if you have a bark, that is only triggered, by the execution of another bark.
If we have an NPC playing barks in response to in-game events, and treat their bark as
a specific event, we can then have another NPC trigger an audio clip in response. And from that,
you have essentially crafted a simple dialogue between two characters. Sure, it doesn't sound
all that impressive, but it's a conceptually simple way to have two characters talk to one
another during play, given they wait until each bark is complete before the next one is executed.
We're going to get into some history, and well-crafted examples in a moment, but it's worth
highlighting that barks enable for an immensely important aspect of game design: they provide a
mechanism to have the game reflect the players actions back upon them. An often discussed,
if poorly understood, aspect of game design is idea of immersion: you want the player to feel
engrossed in the experience and continue to engage with it. One of the simplest, yet most powerful
mechanisms to do this, is to make sure that the game recognises the actions of the player, and
communicates that not only does it understand what they are doing, but how it is responding in kind.
Even the smallest of videogames are often comprised of a myriad of systems just to get
them to work. And while a developer can invest all their time and energy into making a super
smart opponent, or a companion that will help you out in a bind, if the player
doesn't understand what it's doing, this can be confusing and frustrating. Barks can help
offload the work required for gameplay designers, character artists, animators, UI and UX designers
and more to communicate the decision process of a non-player character or other gameplay system.
Sure, none of this is particularly intelligent, it's not like an AI is writing the dialogue. But
this is such a pervasive practice in modern games industry, that it's
important we highlight how it is used as part of non-player character design.
Okay, so that's enough preamble, let's look at some examples of how
all of this comes into practice.
Let's start by looking at how barks are used to communicate NPC behaviour. As a
player you encounter this in pretty much any action game of the past 20-30 years.
Think about what happens whenever an enemy NPC spots you for the first time.
That's right, they all bark. It's a simple mechanism to highlight to the player that
you're spotted and they're going to attack. And given it's an audio cue, you don't even
need to be looking in their direction to receive that information. The sound alone can
help communicate where they are relative to the player. What character type it was. Perhaps even
how far away they were. It's the easiest bark in the world for any game developer to adopt,
and one that most players will immediately understand.
The next stage up is to communicate what their next action is going to be.
This can be direct, where they simply state outright what they're going to do,
or a similar line of dialogue that still largely communicates the state they're transitioning into.
Often stealth games are a great example of this, ranging from the early days of Metal Gear Solid
and Thief, all the way to more contemporary titles such as Shadow of War, Splinter Cell
and The Last of Us. In each case, characters deliver barks when they become suspicious,
and can help communicate that they're going to start searching the area.
Typically this is paired with animations too, but ultimately they're making it
clear that their behaviour is changing, on account of a disturbance the player created.
Taking this one step further, they might say a line of dialogue that looks like
they're telling other characters to do something. A good example
is in the stealth sequences of the Batman: Arkham series.
What's critical to appreciate here, is that - in pretty much every game I've ever researched - the
bark from one NPC does not trigger the other NPC to execute that action. In each case,
the decision has already been made (either by the NPC or another gameplay system), but before it
moves into that behaviour, it waits until another nearby character plays the line of dialogue.
This makes it look like they're taking orders and working together,
even though odds are those two characters don't even know each other exists in the game world.
This has been discussed previously in my videos on the AI of FEAR, but even in the likes of
Gears Tactics, where the Commander behaviour is a specific bark and animation, that is deliberately
injected into the enemy turn, to make it look like the other NPCs are acting on their command.
Now that your barks are being used to highlight individual AI characters, perhaps you also want
barks that feed you more contextual knowledge. Is there a risk you're going to get hurt or killed?
Where should you be heading next? How do you get past this particular puzzle?
In order to understand the complexity, and scale, of this challenge, let's take a look
at the game that defined how barks would be used for future generations: Call of Duty II.
Released back in 2005, Infinity Ward's Call of Duty II cemented the franchises growing popularity
courtesy of both an epic World War II narrative,
and of course the multiplayer. But it's the campaign that is what's important to us here.
The campaign of Call of Duty 2 is notable in that it's one of the first AAA titles to really
push the idea of barks as a mechanism to feed the player information. If a Nazi soldier is shooting
at you with a mounted machine gun, an ally pinned down nearby will tell you what's happening. They
call out positions of enemies relative to where you are, when they're moving out of position,
and even the enemies themselves shout to one another to take cover or push forward.
But of course, the part that most people will recognise, is that many of the other
soldiers speak directly to the player, often instructing you on where to go,
and this typically arises from the player completing objectives,
or simply entering an area of the map that will trigger that dialogue to occur.
There are over 20,000 lines of dialogue in Call of Duty 2,
recorded in multiple languages, designed for characters to utter
in very specific circumstances. Meaning they not only needed to record all those lines,
but afterwards the logic was encoded for how and why any one particular line was going to
be uttered. But also, it's important that they then add cooldowns and other logic to ensure that
a particular voice line doesn't get repeated too frequently. It's not exactly fun if your
allies keep shouting at you every two seconds to take out that sniper on the first-floor balcony.
When you then look at the rest of the Call of Duty franchise, you can see how critical
this new bark system is, given it's used in pretty much every subsequent release.
It's also used in the multiplayer, in much the same way Left 4 Dead later adopted it. Given
the avatars of players will yell that they're reloading, and need other players to cover them.
And while Call of Duty 2 set a standard that many other games sought to emulate, it's worth
taking a look at a more contemporary example, to see how these ideas are still being adopted.
The hot grumpy Dad simulator God of War, developed by Sony's Santa Monica Studio and
released in 2018, is a great example of how bark systems are used in contemporary games.
While players lump around having a right good moan as Kratos,
the narrative and gameplay revolve around interacting with your son Atreus, aka... boy.
Atreus acts as your companion throughout the game, and his barks provide a lot of
useful contextual information that is designed to support the player,
while also keeping in line with the idea that he's still a young boy on a trek with his dear old Dad.
So for example, he points out when you veer off the main path of the current mission, he gives
feedback or guidance during puzzle segments and also shouts information to you in combat.
In combat it provides an extra level of information, identifying specific enemy types,
identifying when a character is vulnerable and open to attack, and often shouting when an enemy
is approaching from behind and about to land a blow. This last element is already catered by
the HUD, which shows that you're about to be hit from off camera, but having Atreus yell it not
only provides an additional cue (given you might be too engrossed in the fight to notice the HUD),
but it reinforces the relationship between the two characters,
as the boy expresses his concern for his father's safety.
Now as mentioned already, you can take the base concept of a bark, and embellish it to become a
simple dialogue system. This is quite a common practice for characters to have conversations
in parts of the game outside of cutscenes, given those are entirely prescripted.
Note also, that when we're talking about dialogue, I'm not referencing the more complex
narrative trees and interaction of role-playing games. These are much
more complex narrative systems complete with reactions and responses to player input. Here,
we're simply looking for ways to trigger a simple exchange of several lines between characters.
You're used to seeing that in games such as Gears of War or Call of Duty, given the player
will enter a part of the game where this dialogue is triggered, typically using a trigger volume or
a similar technique in the game engine. This will trigger the first line of dialogue, and
then all subsequent lines are triggered after the previous line, often with a small delay. In fact,
much of the narrative and storytelling of games such as The Last of Us and God of War are reliant
on this, given Ellie and Atreus respectively act as your conduit to the main storyline, often
having conversations with Joel or Kratos during the quiet between combat and puzzle segments.
Taking this concept and applying it at large scale is quite feasible,
and arguably the most interesting example of this in recent years, is Hades.
Developed by Supergiant Games and released in full in 2020, Hades is a roguelike that combines
procedural generation with the isometric gameplay that the studio is known for.
But more importantly for us, Hades has an ongoing narrative that unfolds as the player takes control
of the demigod Zagreus and interacts with a myriad of gods from the Greek Pantheon as he seeks to
escape the Underworld and reach Mount Olympus. To pull this off, the game adopts a dialogue
system as I've described, where specific lines of conversation are triggered by in-game events,
and the rest of the conversation plays out by following the previous lines.
Dialogue in Hades relies on a myriad of gameplay variables,
so your first encounter with a given character is typically a unique interaction. After which,
you need to satisfy specific gameplay conditions, such as defeating a boss,
levelling up an item or accomplishing a specific feat, to trigger a particular conversation.
A great example of this is the conversations you have with Hypnos,
who greets Zagreus on his return to the House of Hades whenever the player dies. Hypnos
has 75 different responses that run based on specific and unique deaths.
This speaks to just one small part of the overall scale
of Hades' conversation system. Around the time of launch, the project's creative director,
Greg Kasavin confirmed [in a conversation with Jimmy Donnellan at Cultured Vultures] that the
Hades script contains around 300,000 words, of which 200,000 is dialogue.
In fact, in late 2020 Supergiant posted on Twitter that there are over
21,000 different lines of fully voiced dialogue in the game. Of which around 40% belong to Zagreus,
while the titular Hades - your ever disappointed father - comes in a distant
second place with only 1600 lines, which is only around 7.5% of the complete set.
If you're keen to learn more, I highly recommend the interview that the team from People Make Games
had with the developers over at Supergiant on the dialogue system,
which I've linked to in the description.
Barks are a simple, yet incredibly powerful mechanism to reinforce the gameplay experience,
giving players additional information that helps improve immersion, but also just helps recognise
that your actions in the game are having an impact. Hopefully having watched this video,
you now recognise barks in the games that you love. Get down in the comments
and share with us what your favourites are, even the ones that don't make sense.
Plus it's amazing how easily it can be embelished to create simple dialogue systems.
For any game devs watching keen to put this to practice, I highly recommend the GDC talk by
Elan Ruskin on fuzzy-pattern matching for dialogue systems originally built for Left 4 Dead, with the
link in the description for you. It's a very accessible talk, that goes into detail on a
lot of more complicated approaches you can take to building your own bark and dialogue systems.
AI and Games is a channel that's brought to you thanks to my Patreon supporters.
By supporting my work, you get more videos, watch them early, vote on topics, and much more. So
join all these lovely people, in helping me do what I do. Take care folks, and I'll be back.