- March 4, 2020
- Posted by: AIandGames
- Category: Blog
Tom Clancy’s The Division 2 introduces players to a war torn Washington D.C. A battleground not just in the streets, but the hearts and minds of its civilians as they fight to regain a semblance of order that is true to the values this city – and its country – are built upon.
It’s been seven months since the Dollar Flu destroyed New York City and humanity is clawing back piece by piece, presenting a new game design challenge for developers Massive Entertainment: building an open world game that is dynamic, emergent and immersive. Keeping players on their toes and giving a sense of life to the world.
This leads to enemy factions wandering the open world looking for trouble, friendly survivors patrolling near their captured settlements, supply convoys that either need to be defended from enemies or raided for extra goodies, or supply caches air dropping into DC, resulting in all sorts of trouble.
Continuing my discussion with Division 2’s Lead AI programmer Philip Dunstan, we discussed the process of building a system that allows for all these dynamic events to occur, the problems that arise when balancing these elements of systemic game design and the challenges faced as the established tools and systems migrated from the bitter cold of New York City, to the sunny streets of Washington DC.
Immersive Non-Player Characters
Philip Dunstan: “In New York you could stand on a street corner for a long period of time because there was very little movement through the open world. But in Washington if you stand a street corner for any length of time, you’re going to be engaged in combat.”
In the first Division New York City is designated a quarantine zone. It’s become a tomb, a monument to the devastating chemical attack just weeks prior and hence the number of non-player characters (NPCs) is relatively minimal, with pockets of scavenging friendlies and gangs of enemies found throughout the open world. But as the franchise moves from the chilling winter winds of the Hudson to the warmer summer breeze of the Potumac, the team at Massive wanted to increase the impact and spread of both friendly and enemy non-player characters in the game map.
Philip Dunstan: “As part of the immersion we wanted to give the NPCs a lot of purpose for being in the world. And some of this came through our design, it’s six or nine months after the outbreak. Washington has gone through the phase that everything is madness and chaotic and now the civilians are starting to group together into settlements and the settlements have structure and different factions all their own strongholds. We wanted to make that apparent not just through the story but through the players experience of seeing the NPCs interact and move through the open world.”
To achieve this, the development team put together a Living World Activity system into the Division 2, giving specific roles to NPCs as they enter the world and ensuring that they perform a given task or duty. So let’s walk through how it all works and then some of the weird and interesting problems that emerged as the existing AI systems were being adapted to work within the Washington DC map.
The Living World Activity System
Philip Dunstan: “We wanted Washington to feel much more alive, we wanted it to feel like there was always something happening that you could easily find a group of civilians or a group of Hyenas and so it meant having a system that let NPCs move through the world.”
The Activity system within the division two allows for a variety of different sequences to be executed each with their own objective. Throughout the execution of the sequence a NPC will assumes a role or duty within the world and as assigned to a post within a set space or space to operate within. What that means when you see a groups of NPCs travelling through the open, be it as a patrol team near a stronghold, a convoy moving between outposts or as a unit gathering resrources from an area with food or water, each NPC has a defined purpose within the activity to complete.
As mentioned each NPC has a given role or duty to complete for their assigned objective. These are split into two types: the special role which is given to one or more NPCs at the beginning of the action being executed, or the unscripted role which is assigned in an adhoc fashion depending on what’s happening in the world at that time. A special role may be the NPCs that are gathering the resources, or carrying the boxes of supplies in a convoy. While the unscripted roles are the guards providing overwatch, either standing in a fixed position, wandering a patrol path or taking control of a mounted weapon.
But in order for NPCs to have a role, they need to know not just what roles are available in a particular activity, but where they should be doing it. Hence every activity has a set of posts attached to it. Each post is set by designers to identify what duties can be executed at that post, the locations they should execute the duty from and the minimum number of NPCs that are required to satisfy it, given you might need two or three NPCs to maintain overwatch or patrol a region. These are different types of locations that can be attached to a post: volumes for when they’re gathering resources or guarding a region of the map, waypoint paths that are for patrol duties and fixed points such as a mounted weapon.
Whenever the active objective changes, the server attempts to assign NPCs that already have an active duty to a new one in context of the current task. But also priotises what posts should be assigned, so mandatory posts that really help sell what these characters are doing are filled first, with other unfulfilled posts being populated depending on the makeup of the remaining NPCs.
This all does a great job of reinforcing the performance theatre of the game: characters know where in the world they should be standing and what their job is at that point in time. But what happens when an opposing factions appear – or the player in fact – and things start to kick off? Well each NPC post does actually dictate whether or not it should be maintained in combat and if so they’ll continue to operate the behaviour once the fighting starts. After all, there’s no point standing around on that mounted machine gun if you’re not going to use it. Plus in the event an AI decides to execute a specific behaviour, the behaviour can dictate whether or not to release itself from a given post and get into the fight and provides a nice continuity between passive and active activity.
So with this fairly extensive overhaul of the systems to facilitate the introduction of more dynamic and systemic AI throughout the open world. There were still issues the team had to address, and much of that comes largely from the change of scenery:
Philip Dunstan: “The openness of Washington was one of the biggest challenges coming from New York. It’s not just the fact that the streets in New York are so narrow and also high skyscrapers on either sides of the street, hyper tall buildings, it’s also the amount of traffic you expect to see with broken-down cars and buses in New York meant that we had a lot of control over very long sight lines. So the combat tended to be you know quite short range or mid range combat even in the open world.
And you get to Washington and one of the things we wanted to show was a diversity of environment that wasn’t necessarily there in New York. We wanted wide boulevards, tree-lined boulevards, we wanted big grassy open spaces, we wanted sort of you know more sort of university-type, queenstown-type locations and that put a pressure not just on the performance as you mentioned but it actually put quite a bit of pressure on our NPC behaviours and our NPC systems. We hadn’t really you know, when we’d created the NPCs for the Division we had designed them around a short-to-medium distance combat and now something we had to deal with you know a lot longer sight range. And what happens if you engage with a Rusher at 60 metres are they just going to run towards you for 15 seconds.
We didn’t really want to increase our budgets for the numbers of NPCs that we had in the game because we thought the number of NPCs was working quite well in the Division 1. We wanted to maintain the budgets at around the same level which meant that we had a problem then of what happens we you need to bring reinforcements into a fight. Because if you wait until you’ve almost killed all of a group of NPCs, then by the time the reinforcements spawn and come in the players been idle for several seconds. But spawning is a problem because you know its difficult to find a space that’s out of line of sight, of the players if the player is in a big open area. So it put quite a bit of pressure on both our NPC design as well as performance.”
This resulted in a number of changes to how existing behaviours within the Division AI is executed. The first major change was that behaviours for archetypes were retooled such that they were more competent when fighting the player at range, with archetypes having additional tweaks to their behaviour to compensate for the increased range. This leads to some novel cases such as the Black Tusks Rusher which has an assault drone, so if the player is too far away it won’t expose itself and instead rely on the drone to attack you. The second major change to the systems was the NPCs would actively move around the open world. In the original game, NPCs could only move in very small groups and even this was kept within fairly tight ranges. Now convoys and control point attack units are moving through at a larger scale but they also had a direction and goal to complete. This helps contextualise their position in the world and either results in you sneaking up on them and catching them off guard, or accidentally bumping into them in the open world and creating a chaotic combat sequence.
This all has a knock-on effect on managing the AI behaviour server-side given – as mentioned back in my blogs on the first Division game – AI decision making happens server side and the client visualises these decisions on your PC or console. This resulted in the game’s servers running low level simulations of where groups of NPCs are in the world and their objectives. Spawning them into the game when necessary and de-spawning them should they complete a given task. But not only is the number of active NPCs increasing and the tasks their being assigned more complex, there’s also the issue of having them spread across a larger map. Division 2’s map is pretty much a one-to-one reproduction of downtown Washington D.C., stretching from Roosevelt Island and Georgetown in the west with the National Mall leading up to the Capitol Building in the east. Totalling at around 4 square miles of map, it’s an area that is around 30% larger than the original map of the Division, which was of course a scaled reproduction of midtown manhattan. This resulted in a more aggressive level of detailing or LOD system compared to the first game. The LOD ensures that AI behaviour processing server-side is minimised if players are not near them, as well as client-side rendering and animation operating at lower levels of fidelity if they’re clearly farther away.
So this addresses the issues of map size and increasing the density of AI activity in the map, but this didn’t resolve all the problems that emerged during development. There were still legacy problems emerging from working on the first Division. Namely that Manhattan has rather strict rules on how verticality is introduced to gameplay:
Philip Dunstan: “Washington introduced challenges that were more than just the sightlines, we have a lot more uneven terrain. New York for instance was surprisingly flat. Not surprising if you’ve been there. Manhattan is a very flat area. But Washington is definitely not flat. So that again pushed the NPCs into a whole new set of problems we hadn’t had to handle in Division 1. To be able to handle NPCs fighting on slopes and taking cover on slopes and climbing on top of trucks while the truck is one a slope. And then in addition Washington is just so much more colourful than New York was, so we had to do a lot of work with our NPC design so that they were going to be visible in the different sort of environments.”
But with all these improvements, it led to another issue. The increased sight lines meant that AI could more readily engage the player as they walk down an open boulevards, but this leaves it open to a potential flaw, in that enemy AI factions are much more likely to spot each other.
Philip Dunstan: “It an added an extra level of difficulty we hadn’t initially expected. The NPCs because of the long open spaces can see quite a long distance. We need to tweak how they saw the player, but we ran into a problem that they would very easily see each other going through the world. So we had all the different factions mixed in together moving through the world, heading to control points and heading to resources. At one stage during development, this would all just break down as they would spot each other from you know 100 meters away and get into a fight and kill each other. The player would either get there and there’d be fighting going on or the player would get there and there was only person left alive or something. We eventually had to dial down what we call the detection system like the line of sight and how quickly NPCs go into combat. Those systems we had to dial those down when it was faction-vs-faction when it was interacting in the open world, because we needed more control over that simulation.”
Building open world environments in games that feel lived in, that feel dynamic is an increasingly demanding challenge as the scope of games being built continues to grow. The complexity of these characters and their ability to handle emergent gameplay as it happens in-game has no clear solution. But here we’re seeing a natural iteration of the tools and systems from Tom Clancy’s The Division, alongside many of the interesting challenges that they’ve faced along the way.
But there is still more to talk about on the AI of Tom Clancy’s The Division 2, I’m going to take a look at one of the most powerful applications of AI within the game that players never get a chance to see: the testing bots whose job it is to play the Division during development that identify bugs or faults within the game. And I’ll be telling you all about that next time.