Advancing the Art and Science of Virtual Crowds
How Assassin's Creed 2 captures the rhythms of the masses
Every crowd has a silver lining. –P.T. Barnum
Every morning when Chris Weiler walks the 20 minutes from his home to work in downtown Montreal, he keeps his eyes wide open. Every gesture, every nuance, every stutter-step-he captures them all and makes a mental note. Sometimes he toys with other walkers' heads by tailing them and watching their reactions. "Sometimes they'll switch directions," he says. The specialty for the technical director of level design for videogame publisher Ubisoft is crowds.
Much like ringmaster Barnum was able to understand the contours and rhythms of the masses, Weiler and his team are similarly astute observers of human behavior. One of the defining characteristics of the game Assassin's Creed II, which was released this month, is the movement of the dozens of non-playable characters (known as NPCs in gamespeak) that dot the streets and plazas of late 15th-century Italy. You play favored son Ezio Auditore da Firenze-who turns assassin when his family is murdered-and the crowds play a crucial role as they aid your subterfuge throughout the game. The crowds serve as Ezio's unwitting accomplice and he exploits the bustling streets as cover for his various attacks.
To make his digital humans behave like real ones, Weiler tasked his team to focus on the small things. They added something called a "cycle breaker" to interrupt the way that NPCs would walk. Every few minutes, a character would cough or make a hand gestures, just a real humans do. They also implemented something called a "look axis" system which would trigger NPCs to stare at particular things. Sometimes they're fixated on Ezio, sometimes at a landmark, sometimes they even stare at each other. Characters also react to Ezio depending on what he's doing at the time. If he has his sword, they'll cower in fear or flee; if he's running, they'll turn their head at attention. For the first time in the series, NPCs also react to each other. When a guard passes another guard, they'll stop to talk, but if he passes a courtesan (that era's version of a prostitute), his agenda takes a turn for the, um, lascivious.
One of the hardest challenges for Weiler and his team was something called "pathfinding." Humans naturally do this whenever they interact in large groups. We pick a certain route and navigate our way through, predicting what those in front of us will do and adjusting our speeds along the way. Anyone who's shuffled through the throngs of SoHo or bustle of Venice Beach does so unknowingly, sliding past meanderers and slipping through crowds. With NPCs, it's not so easy. They often clumsily bump into each other and in the first Assassin's Creed, Weiner says traffic jams were a big problem. "When people move at different speeds, just like in traffic, they create jams as they catch up and slow down." Those pile-ups would grow exponentially and ripple outward as each NPC clogged another's movement.
Why does that happen? Last year, Japanese researchers released a video of "shockwave jams" which showed how traffic can grind to halt even if motorists are driving in a circle at a constant speed. NPCs are no different, and to fix the problem, Weiner programmed them to be mindful "drivers" and allow faster walkers to pass. They also widened the streets to allow the denizens a bit more room to maneuver.
Now, the big problem for Weiner is how to stop noticing fellow walkers. "It'll be with me for the rest of my life."
Jamin Brophy-Warren is a freelance writer living in New Haven, Connecticut. He is a former arts and entertainment reporter for the Wall Street Journal, a contributor at Slate, and editor of the forthcoming gaming magazine Kill Screen.