Find out how to kick start your games industry career

Get Your Free Ticket Today

How Watch Dogs 2 brought its virtual San Francisco to life

Ubisoft designer Roxanne Blouin-Payer details what makes the game's colorful AI civilians tick

Watch Dogs 2 launched on Tuesday, but instead of spending the day scouring the internet for fan reaction or enjoying a post-launch vacation, Ubisoft's Roxanne Blouin-Payer marked the occasion by delivering a talk on the game's non-player character AI system at the Montreal International Games Summit. Blouin-Payer began by contrasting the approach the team took for the sequel with that of the original Watch Dogs.

"We had a really dark protagonist in Aiden Pierce. He was on a vendetta, and the interaction between Aiden and the civilians was mostly fear. Civilians were there to call the police when you did bad things. They were scared and [there was] collateral damage to everything you did, pretty much."

For Watch Dogs 2, the developers went in a different direction. They changed the protagonist from a dour vigilante to a younger, more ambitious hacker, and moved the game from the often dreary Chicago to a more vibrant San Francisco. Considering how much of San Francisco's personality comes from its colorful inhabitants, the team wanted to create a world that felt properly alive, with infinite little stories for the player to take an interest in. The goal, Blouin-Payer said, was to create an anecdote factory where the developers might know how the story starts, but never how it ends.

To achieve this, they started with the idea of emergence, that these stories would develop and resolve of their own accord in a largely unscripted way. The developers relied on a reaction system where AI characters would have a number of different reactions to choose from, but the odds of them choosing each one changed depending on a number of variables in play.

"What's really cool with this is we could create different feelings per district. Just by changing the ratio of personalities in a district, we gave a really different mood"

In one example Blouin-Payer gave, if an AI-controlled non-player character is walking and then sees a different NPC insult a third character, there might be a 70% chance it will ignore the remark, a 20% chance it will stop and gawk at the situation, and a 10% chance they just don't deal well with any kind of verbal confrontation and will flee. But if the target of the insult by chance has a friendly relationship with the passerby, the odds change and they won't just ignore the remark. Instead there's a 45% chance they'll watch how the scene plays out, a 5% chance they'll flee, and a 50% chance they'll fight for their friend. The odds get further skewed if the insulter is considered an enemy of the NPC and the insultee is a friend; in that case, the outcome switches to fighting 100% of the time.

"It allows us to create really generic rules that work for most situations, and if need be, we can make more precise rules that [take precedent] over the less precise ones. In that case, the last one was the most precise."

One nice perk of the system is that even though the logic used by the game is pretty basic, the dialog characters spout during these exchanges can be non-specific enough that there's room for players to infer stories and relationships between characters that the developers never explicitly intended to be there. That worked to some extent, but there were lots of edge cases that made for some immersion-breaking moments of incoherent storytelling.

"It was really hard at first to have the player understand what was happening," Blouin-Payer said. "The reason for that is we had no logic at first between behaviors. So a civilian would maybe cheer a fight then be scared by the same fight and run away."

The developers soon realized that emergent behavior didn't mean random behavior. It's something that happens that was unpredicted, but not unpredictable. To further make the system more coherent, they added mood and personality traits to all of the NPCs which guided their behavior. Mood is a measure of how the NPC feels at the moment, while personality is a more general measure of how likely the person is to be in a given mood over time.

The developers settled on four moods: angry, relaxed, afraid, and happy. Each one corresponded with a number of behaviors, so an angry person wold be more likely to insult or punch people, while relaxed people would be more likely to observe, or perhaps take a picture. Each mood also carries with it a distinct walking animation, which provides more coherent transitions between actions and default behavior. For example, an NPC that just went off on an angry tirade against someone will storm off in a huff before cooling down and resuming the default walk animation because going straight from a rant to calmly walking away would break immersion.

On top of that, the developers layered on five personality types: Violent, heroic, pessimistic, optimistic, and neutral. The behaviors associated with a violent personality are self-explanatory, while heroic NPCs are more likely to help others or try to defuse tense situations. Pessimists are more likely to comment negatively about situations around them, while optimists are excited about everything, and neutral types just want to be left alone and go about their business.

"What's really cool with this is we could create different feelings per district," she said. "Just by changing the ratio of personalities in a district, we gave a really different mood."

So on the coast where there are lots of tourists, there are more optimistic and neutral people. In wealthy Marin, there are more optimistic and heroic people, but fewer violent ones. In Oakland where there are gangs, people tend to be more violent and pessimistic.

"The player is special, and it's OK to treat him like a special person because he won't act like a normal person walking in the street. He'll do some crazy stuff and you need your AI to react appropriately to that"

Another challenge the developers faced was finding the right amount of reactivity to the player. Originally they wanted a "non-player-centric" approach, where NPCs react to the player's actions in the same way they reacted to each other. But when they tested that, they found the world wasn't reactive enough to the player trying things. And when they boosted the reactivity, they found NPCs would just constantly get in fights with one another.

"One thing we discovered with that is non-player-centric doesn't mean it's not player-proof," Blouin-Payer said. "The player is special, and it's OK to treat him like a special person because he won't act like a normal person walking in the street. He'll do some crazy stuff and you need your AI to react appropriately to that."

When working with an AI system like this, Blouin-Payer stressed the need to invest in good debugging tools. In an emergent system like this, a relatively small oversight can quickly be compounded and leave everything in chaos. Without a way to record what's happening and see how the AI progressed along behavior trees or which animations started, finished, or were interrupted, it would have been far more difficult for the developers to track down bugs and other issues with the system.

However, Blouin-Payer said when it's done right, emergent behaviors in AI help to make characters appear more intelligent. Players can see patterns in scripted AI particularly easily, but emergent behavior helps sustain the illusion that there's more going on under the hood. It helps worlds to feel alive, she said, like they will live by themselves whether or not the player is there to enjoy them. And perhaps most important of all for makers of massive open-world games, it allows developers to systemically create more content without handcrafting everything.

That said, there's still room for improvement in how Watch Dogs 2 handled its AI. Blouin-Payer said she'd like the synchronization between player behaviors to be more systemic. It's fine to have everyone doing their own thing in a heated exchange because angry people shout over one another and don't listen when they're fighting anyway. But for something as subtle as flirting, you really need one character to understand what the other is saying to respond appropriately. Beyond that, she also wants to explore emergent systems for other AI systems, particularly combat, as a way of making them more unique and fun for players.

Disclosure: MIGS has a media partnership with, and paid for our accommodation during the event.

Find out how to kick start your games industry career

Get Your Free Ticket Today

More stories

Ubisoft employees upset with lack of communication on misconduct reports

Multiple developers told Kotaku the publisher's maze-like complaint process lacks follow-up, transparency, and in many cases resolution

By Brendan Sinclair

Ubisoft employees call for removal of 'role model' evaluation goal over concerns of misuse

Group claims it could favour abusers, but publisher maintains it is part of changes for "safe, respectful and inclusive workplace"

By James Batchelor

Latest comments (3)

Bonnie Patterson Narrative Designer, Writer 4 years ago
Definitely buying this. Emergent storytelling, when it works, can be so utterly fascinating, and it all comes out of such simple building blocks.

Honestly, I'm surprised more game developers don't publish papers on their new AI mechanics in computing journals, but I suppose you do have to protect the company secrets to maintain an edge.
0Sign inorRegisterto rate and reply
James Brightman Editor, North America, GamesIndustry.biz4 years ago
AI is one of those things that feels hard to write about in an interesting way, but the field of AI is so critical to the games we love that it definitely deserves more coverage.
2Sign inorRegisterto rate and reply
Bonnie Patterson Narrative Designer, Writer 4 years ago
Anything that gets us closer to that ultimate end goal, where games can create unique, new virtual worlds for us that live and breathe and create their own constantly fresh and original gameplay.

I mean, imagine if in World of Warcraft, those orc NPCs only sent us out to kill 10 wolves if packs of AI wolves were killing their [whatever the orc equivalent of sheep is]. And if said wolves reacted to such depredations intelligently - do they flee the area or become more desperate in their raiding and more territorially aggressive? Or maybe the orcs decide they need to move to better grazing lands with fewer wolves and start pushing out quests to go knobble the neighbours.

Or imagine making a variant of Watch Dogs 2's NPC relationships and interactions - expand it a little to take inputs from other factors in the world, like resource availability and history - and use it to create AIs for national leaders in a large world setting. :D

It's all exciting as hell to me.

I'd love to know more about the horde mechanics in 7 Days to Die and State of Decay, too, as both games have very interesting zombie behaviours that I suspect could be twiddle to make believable, flavourful behaviours for any "crowd" population.

Wow. Now I need a glass of milk to calm down.
2Sign inorRegisterto rate and reply

Sign in to contribute

Need an account? Register now.