Like most of our With The Best speakers, Martin Bedard is dressed casually talking into a webcam from what looks like a hotel room. But his presentation on NPC (non-player character) AI is as efficient as it is practical. He moves from discussions of testing and coverage to player’s perceptions of NPCs with precision and clarity.
“You can have the best pathfinding in the modern world, but if your NPCs look bad, for the player it will look like the AI is poor.” And Bedard should know. Having worked on numerous Assassin’s Creed titles (Revelations, Black Flag, Unity, Freedom Cry) his impressive resume concludes with what is, to date, his largest role working on Assassin’s Creed Syndicate, where “we had to overhaul the whole AI to support a huge systemic and dynamic world.”
Convex Hulls and the Industrial Revolution
For those not familiar with the latest title, Assassin’s Creed Syndicate is set in 1868s London during the industrial revolution. One of the few advantages of the setting was a substantial photographic record to help drive the goals of the development team.
“The whole world was in motion. We had massive crowds everywhere because London at that time was considered the centre of the the world,” he says. There were pedestrians and carriages on the streets, barges on the Thames, not to mention the very core of the industrial revolution, the steam trains lumbering out of steel stations.
Undaunted, the development team set out to create NPCs that reflected what people were doing at that time – manoeuvring around numerous obstacles, interacting with carriages, boats, horses and one another. This also extends to the enemy AI who have to run, jump and climb through this complicated, industrial terrain.
To give some idea of the size of the project, Bedard quickly outlines what was required: a road network (which provides a topology for London’s twisting streets); a traffic manager; and completely reworking the navigation mesh, the steering engine and the decision making system (although he admits the roads were slightly larger than scale to give the system a better chance).
The challenges facing the developers were legion, but Bedard outlines his method by talking about the practical steps his team took with the pathfinding of the horse-drawn carriages that filled London’s streets.
The addition of these new vehicles and complicated terrains meant that there were even more challenges the AI team faced.”
The steering behaviours of the horse-drawn carriages had to be reworked because a radius-based avoidance system (a circle which protrudes from the centre of the object) produced very awkward paths for the vehicles and created large “dead zones” that looked out of place on London’s busy streets.
To combat this, Bedard’s team designed a ‘convex hull’ avoidance system – a way of mapping an object’s shape in real time to create a contour around the complicated object. This contour was what allowed the irregular shapes of the carriages to pass each other on the streets of London.
While this complicated contour system is fantastic at recreating the streets of 1868 London, it can also overwork the limitations of the hardware. “For reasons of performance, the NPCs are player-centric. NPCs far from the player character have very limited graphics, AI and animations,” he explains. This system had been used in earlier Assassin’s Creed games, but the addition of these new vehicles and complicated terrains meant that there were even more challenges the AI team faced.
“The player will get on a vehicle to get away from NPCs who are chasing them, and the NPCs will try to get their own vehicle to chase them. But as the player moves away from the NPCs, their AI will be unloaded and the give up chase. This is a major exploit. And as AI designers, we hate exploits.”
This required ‘virtualising’ the NPCs, meaning the system will tag and track the NPCs’ vehicle but simplify the AI of the NPCs whilst they are inside of it. “Virtualised vehicles don’t have their own AI anymore. They’re managed by the traffic manager using the road network.”
The intended effect
It might seem obvious, but is easy to overlook, that the purpose of AI design is to reinforce the player’s fantasy: that they are an elite assassin breathing in the air of industrial London. “You don’t want the player to feel the NPCs are robotic. You want them to feel natural. You don’t want the player to feel the sequence of actions. A player’s perceptions of AI will be as good, or as bad, as its weakest part.” As to how to produce this effect, Bedard offers some more concrete plans for other development teams.
It might seem obvious, but is easy to overlook, that the purpose of AI design is to reinforce the player’s fantasy: that they are an elite assassin breathing in the air of industrial London.”
“As an AI designer, you want to avoid a small change breaking something else. You want to avoid having to retest the whole AI every time you’ve made a change,” says Bedard. His advice to other teams is simple. “If you have time to implement it, try to have as much automated testing as possible. This has to be done while the rest of the game is being implemented. Let’s be serious – if you plan to do this at the end of development, you just won’t do it.”
Register for our next With The Best online conference on IoT or VR/AR. More info at withthebest.com
Subscribe to our weekly newsletter pronto for more articles like this.