Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs or learn how to Submit Your Own Blog Post
Grand Theft Auto 5's ambient pedestrian dialogue system makes its game world feel alive, and this article breaks down the basics of how it works.
For massive AAA games like the Grand Theft Auto series or Cyberpunk 2077, it’s not enough to only write dialogue for player-facing events, like quests, cutscenes, and ally conversations. To make a game world at this scale feel “alive”, NPC’s must be conversing amongst themselves without the player’s involvement, giving them a sense of independent agency. The best way to convey this agency? Incorporate ambient dialogue.
Ambient, or pedestrian, dialogue can be broadly defined as dialogue that plays without direct player input from the general NPC population. Standard dialogue in a game is player-initiated, i.e. a player walks up to an NPC, presses a button prompt, and starts conversing with that character. Ambient dialogue, instead, occurs autonomously, regardless of the player’s presence.
The ambient dialogue system uses a number of subsystems working in tandem, like NPC spawn zones. Source: Rockstar Games
Note: this is an educated inference on how Grand Theft Auto V structures their pedestrian dialogue system. This is not meant to be a definitive, wholly accurate summary.
As mentioned earlier, colossal-sized games like Grand Theft Auto V relies on using pedestrian dialogue to fill out the game’s soundscape and make Los Santos feel like a real metropolis. GTA V would feel significantly more empty without NPC’s, for example, asking for help feeding their 57 cats. These small, passing one-offs from the pedestrian population are an often overlooked, but critical part of the game’s interactivity.
A core part of how GTA V’s ambient dialogue system works relies on a connected, underlying mechanism: the NPC spawn system. Different NPC’s have a higher likelihood of spawning in certain sections of Los Santos than others, such as businessmen NPC’s primarily appearing around Rockford Hills, or country bumpkins spawning mainly in Grapeseed and Blaine County.
To conserve resources during production, Rockstar chose not to create individual dialogue pools per NPC, but rather created “archetypes” of NPC’s. Forest rangers, muscleheads, wannabe celebrities, Rockstar formulated several roles like these and created dialogue corresponding to their stereotype, then recorded male and female voiceover for each.
To stretch the use of these character archetypes further, Rockstar made the decision to not incorporate any location-specific voice lines in its pedestrian dialogue system. While this may make some ambient remarks from passerby NPC’s feel plain, this decision helped to simplify the archetype logic by not having to create location-based variations for each role (ex. having one generic rich person NPC vs. having specific ones for Vinewood, Rockford Hills, Vespucci, etc.).
This methodology also applies to characters conversing with one another. When an NPC is being talked to by another NPC, they will typically respond with a very brief (often disjunct) line, which ends the conversation (“What?”, “Who cares!”, “Unbelievable!”, etc.). Like before, this is to get the maximum amount of use from each recorded line, and helps to simplify the system logic running these random NPC dialogue events.
Regardless of what archetype an NPC is, or where they spawned, each of them has a set “pool” of voice lines to pull from. For instance, every NPC has at least one or two lines to react to the player getting too close to them, aiming a gun at them, hitting their car, and more. This not only simplifies the writers’ jobs by giving them a “checklist” of lines to write for each archetype, but also ensures that any NPC can properly interact with the player, while also having a healthy pool of ambient lines to say while walking around Los Santos.
With all these systems in mind, the basis of Grand Theft Auto V’s NPC system can be inferred. When the game spawns an NPC, the following steps (not necessarily in order) are executed:
1.) What archetype is this NPC?
Depending on the spawn zone the player is currently in, certain types of NPC’s will be much more likely to spawn then others.
2.) What are the general characteristics of this NPC?
Age, gender, race, etc.
The archetype selected may limit the range of possible characteristics. For example, if the archetype is LSPD Cop, then “Elderly” would not be one of the possible characteristics.
3.) Find the dialogue pool asset that matches the selected characteristics and archetype. This can be boiled down to indexing a specific folder using each attribute selected (ex. index the audio asset folder path named “Cop_Male_White_Young”).
4.) Spawn the NPC at a nearby spawn point.
Select a human skinned mesh asset that matches the select characteristics (ex. a middle-aged white woman asset).
Apply the correct outfit based on the NPC’s archetype (ex. a formal business outfit).
Apply the matching dialogue pool to the NPC’s dialogue logic.
Once the system is understood, creating your own NPC ambient dialogue becomes simple. Source: Rockstar Games
Now that the core of the ambient dialogue system has been established, next comes writing the actual dialogue. While certain NPC’s will have unique sub-lists of voiceover lines (an LSPD cop will have specific groupings of dialogue recordings for calling for backup, for instance), the base pool is largely the same.
For our example, let’s create a simple NPC archetype: a laid-back surfer. The following bullet points will be each subfolder of voicelines within the surfer ambient audio pool:
Note: The framework for these bullet points comes from the scaffolding used by the diligent contributors of the GTA V Dialogue Wiki.
When Greeting Other People
“Sup, brah.”
“How’s it hanging?”
“Surf’s up, man.”
“Yo!"
Other Ambient Lines
“Waves are killer today, man.”
“You seen my board wax, bro? Or was it in my other trunks…”
“Lovin’ the sunshine lately.”
“I’ve got sand in my eeeverywhere, brah.”
“Need more tanning spray, used the last of mine this morning.”
Talking While Annoyed
“Leave me alone, man. I’m peeved.”
“Buzz off, bro-siff!”
“You’re really tickin’ me off, brah, not cool.”
“‘Scuse me, dude.’”
“Interrupting my flow, bro-jo.”
“Gotta get goin’, bro, c’mon.”
“Bro, what the-?!”
“You wrecked my wave machine, man!”
“I can’t afford the repairs, brah!”
“I’m catching your wave now!”
“Outta my ride, dude!”
“Let’s see how you like it, bro-siff!”
“Slow down, bro-siff, enough beach for everyone.”
“Harshin’ my vibe, man, watch it.”
When the Player is Standing Too Close
“You’re blocking my sunshine, man.”
“Stand back, brah, my tan’s getting uneven.”
“You’re skeezin’ me out.”
General Insults
“You got seawater in your ears or somethin’?”
“That better be sun stroke talkin’.”
“You don’t wanna see me with harshed vibes, bro!”
“Waves ain’t the only things I’m gonna pound!”
“Totally not tubular...”
“Go in the water and cool down, man.”
“Yeah, chillax already.”
“Brooo!”
“Whoa…that’s wild.”
“Awesome!”
“That’s bogus!”
“Not cool, brah!”
“That’s not chill, man!”
“No way, Jose!”
“Nuh-uh, not happenin’!”
“L-Let’s just catch some waves and relax, man.”
“Whoa! Ease up, bro-siff!”
“Beach is all yours, dude, calm down!”
“I was kidding, man!”
“I’ve got beach babes to see, I can’t die!”
“Bro! Where are you? Been scopin’ out babes without you…Impounded? What’s that?…It’s right next to the ocean, why do they care if you parked in front of the fire hydrant?…Whatever, man, sort that out yourself.”
“Dude, the waves are nasty today!…I got launched so high, thought I could see my mom from up there!…Well, no, the jail was too far, but I could almost see her…’Kay, just hit me up when you get here.”
“Hey bro, ‘sup?…Bro, I just worked yesterday, why do you need me today too?…Five days a week?! Heck nah, man, my board’s more important than rent, see ya.”
This breakdown of GTA V’s pedestrian dialogue system is not a 100% accurate diagram of how it works under the hood, but rather a high-level observation of how it could be achieved. This implementation would make sense for a game at such large scale, as it allows for flexibility, adaptability, and near endless mix-and-match NPC generation. Even better, this implementation is engine-agnostic, meaning a variation of the system could be implemented in Unreal, Unity, or Godot.
As seen above, I’ve experimented with implementing other game’s narrative systems in Unreal before. My goal for the future is similar: recreate Rockstar’s pedestrian dialogue system within an Unreal sample project, as a way of delving further into its mechanics on a programmatic level. This will necessarily entail a few other subsystems, like a randomize NPC spawner, NPC AI BehaviorTrees for routes and player reactions, and more. However, I believe this will be a fun, informative challenge, and something that I (or others, once released to GitHub) could plug into their full-fledged projects.
You May Also Like