Featured Blog | GTA V's Pedestrian Dialogue System Analysis: An Analysis with Speculative Examples

What are environmental and pedestrian dialogue?

For big AAA games like the Grand Theft Auto series or Cyberpunk 2077, it’s not enough to just write dialogue for player-facing events like missions, cutscenes, and conversations with allies. To make a game world on this scale feel “alive,” NPCs need to converse with each other without player involvement, giving them a sense of independent agency. The best way to convey this agency? Incorporate ambient dialogue.

Environmental or pedestrian dialogue can be broadly defined as dialogue that takes place without direct player input from the general NPC population. Standard dialogue in a game is player-initiated, meaning a player approaches an NPC, presses a button, and begins conversing with that character. Ambient dialogue, on the other hand, happens autonomously, regardless of the player's presence.

How are environmental dialogues implemented in GTA V?

A screenshot from Grand Theft Auto 5, overlooking Mount Chiliad at sunset, with the Vinewood sign and a plane visible.

Note: This is an educated inference about how Grand Theft Auto V structures its pedestrian dialogue system. It is not intended to be a definitive or completely accurate summary.

As mentioned above, mega-sized games like Grand Theft Auto V rely on the use of pedestrian dialogue to fill out the game's soundscape and make Los Santos feel like a veritable metropolis. GTA V would feel significantly emptier without NPCs, for example, begging for help feeding their 57 cats. These small, fleeting, unique elements of the pedestrian population are an often overlooked, but vital part of the game's interactivity.

NPC Spawn Zones

A key part of how GTA V's ambient dialogue system works relies on a related underlying mechanism: the NPC spawn system. Certain NPCs have a higher chance of spawning in certain sections of Los Santos than others, such as the NPC businessmen who spawn primarily around Rockford Hills, or the country bumpkins who spawn primarily in Grapeseed and Blaine County.

NPC Archetypes

To conserve resources during production, Rockstar chose not to create individual dialogue pools for NPCs, but instead created NPC “archetypes.” Rangers, musclemen, wannabe celebrities, Rockstar formulated several roles like these and created dialogue corresponding to their stereotypethen recorded the male and female narrator for each.

“General purpose” dialogue

To further expand the use of these character archetypes, Rockstar has decided not to incorporate any location-specific voice lines into its pedestrian dialogue system. While this may make some of the environmental observations of passing NPCs seem trivial, this decision has helped to simplify the archetype logic by not having to create location-based variations for each role (e.g. having a generic rich NPC vs. having specific ones for Vinewood, Rockford Hills, Vespucci, etc.).

This methodology also applies to characters conversing with each other. When an NPC is spoken to by another NPC, they will usually respond with a very short (often disjointed) phrase that ends the conversation (“What?”, “Who cares!”, “Unbelievable!”, etc.). As before, this is to get the most use out of each recorded phrase, and helps simplify the system logic that handles these random NPC dialogue events.

Dialogue Pool

Regardless of an NPC's archetype or where they spawned, each NPC has a “pool” of voice lines to draw from. For example, each NPC has at least one or two lines to react to when the player gets too close, pulls a gun on them, hits their car, and more. Not only does this make the writers' job easier by giving them a “checklist” of lines to write for each archetype, but it also ensures that any NPC can properly interact with the player while also having a healthy pool of ambient lines to say as they walk around Los Santos.

Put it all together

With all these systems in mind, we can deduce the basis of the NPC system in Grand Theft Auto V. When the game spawns an NPC, the following steps are performed (not necessarily in order):

1.) What archetype is this NPC?

  • Depending on the spawn zone the player is in, some types of NPCs will be much more likely to appear than others.

2.) What are the general characteristics of this PNG?

  • The archetype selected may limit the range of possible traits. For example, if the archetype is LSPD Cop, then “Elderly” would not be one of the possible traits.

3.) Find the dialogue pool resource that matches the selected characteristics and archetype. This can be reduced to indexing a specific folder using each selected attribute (for example, index the folder path of the audio resource named “Cop_Male_White_Young”).

4.) Spawn the NPC at a nearby spawn point.

  • Select a mesh asset with human skin that matches the selected features (e.g. a middle-aged white female asset).

  • Wear the correct clothing based on the NPC archetype (e.g. formal business attire).

  • Apply the corresponding dialogue pool to the NPC's dialogue logic.

Creating our own NPC dialogue pools

A screenshot from Grand Theft Auto 5, where the player is on a yacht and takes a photo of Del Perro Beach with his iFruit phone at night, with another boat and the Los Santos skyline in the distance.

Now that the core of the ambient dialogue system has been established, the next step is to write the actual dialogue. While some NPCs will have unique sublists of voice-over lines (an LSPD cop will have specific groupings of dialogue recordings to call for backup, for example), the core 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 voice lines within the surfer's ambient audio pool:

Note: The structure for these bullet points comes from the scaffolding used by the diligent contributors to the GTA V Dialogue Wiki.

Basic conversation lines

When greeting other people

  • “How is it going?”

Other environmental lines

  • “The waves are killer today, man.”

  • “Did you see the wax on my table, friend? Or was it in my other costumes…”

  • “I'm loving the sun lately.”

  • “I've got sand everywhere, man.”

  • “I need more spray tan, I used the last of mine this morning.”

Talking while annoyed

  • “Leave me alone, buddy. I'm pissed.”

  • “Go away, bro-siff!”

  • “You're really pissing me off, man, that's not nice.”

When hindered by the player

  • “'Sorry, buddy.'”

  • “You're interrupting my flow, man.”

  • “I gotta go, buddy, come on.”

In case of an accident (while in a vehicle)

  • “You destroyed my wave machine, buddy!”

  • “I can't afford the repairs, mate!”

When you pull the player out of a car / Retaliation from a carjacking

  • “Now I'm going to catch your wave!”

  • “Out of my loop, buddy!”

  • “Let's see how you like it, bro-siff!”

  • “Slow down, bro-siff, there's enough beach for everyone.”

  • “Careful, friend, let me hear you.”

When annoyed/insulted or arguing

When the player is too close

  • “You're blocking out my sun, man.”

  • “Back off, buddy, my tan's getting patchy.”

  • “You're making me sick.”

General Insults

  • “Do you have sea water in your ears or something?”

  • “It's better to let a sunstroke talk.”

  • “You don't want to see me with the hard vibes, bro!”

  • “I won't just face the waves!”

When fled / walked away from while angry

  • “Not tubular at all…”

  • “Get in the water and cool off, buddy.”

  • “Yes, relax.”

When you witness something interesting

  • “Wow… that's crazy.”

When you are afraid of something

  • “It's not a quiet thing, buddy!”

  • “No, that won't happen!”

When you notice a player holding a firearm

  • “L-let's catch some waves and chill, buddy.”

  • “Whoa! Calm down, bro-siff!”

  • “The beach is all yours, buddy, calm down!”

  • “I was just kidding, man!”

  • “I have to see some beach girls, I can't die!”

Phone calls

  • “Brother! Where are you? You been ratting out the girls without you… Kidnapped? What is this?… It's right next to the ocean, why does he care if you parked in front of the fire hydrant?… Anyway, man, figure it out yourself.”

  • “Man, the waves are awful today!… I was thrown so high I thought I could see my mother from up there!… Well, no, the prison was too far away, but I could almost see her… Okay, contact me when you get there.”

  • “Hey bro, how's it going?… Bro, I just worked yesterday, why do you need me again today?… Five days a week?! Hell no, man, my food is more important than rent, see you later.”

Conclusions and further analysis (in Unreal)

This breakdown of GTA V's pedestrian dialogue system isn't a 100% accurate diagram of how it works under the hood, but rather a high-level look at how it might be implemented. This implementation would make sense for such a large-scale game, as it allows for flexibility, adaptability, and nearly infinite 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.

A demo video of my implementation of Cyberpunk 2077's conversation system

As mentioned above, I have experimented with implementing narrative systems from other games into Unreal. My goal for the future is similar: to recreate Rockstar’s pedestrian dialogue system within an Unreal example project, as a way to further dig into its mechanics programmatically. This will necessarily involve a few other subsystems, such as a randomized NPC spawner, NPC AI BehaviorTrees for player pathing and reactions, and more. However, I think this will be a fun and informative challenge, and something I (or others, once released on GitHub) could incorporate into their own projects in their own right.

https://randenbanuelosdev.wixsite.com/home

Leave a Comment

url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url url