AI and Games is a crowdfunded YouTube series hosted on Patreon. If you enjoy reading this piece please consider supporting the show at www.patreon.com/ai_and_games
In 2016 Tom Clancy's The Division brought players together in the war-torn streets of Manhattan fighting against a variety of enemy factions, as well as one another. Ubisoft's RPG-shooter carries a diverse range of enemies to keep the player on their toes. But unlike other games I've covered to-date, The Division needs to deal with the practical issues of being an online co-operative game and how to manage all sorts of AI systems for thousands of players across the world.
In this first of a two-part series, I'm going to be looking at how developers Massive Entertainment sought to create a variety of interesting and challenging encounters throughout the world of The Division; how they designed their enemy opponents and manage their behaviours as thousands of players rush to battle online every day in the mean streets of New York City.
The Division
After an outbreak of weaponised smallpox, New York city breaks down into chaos and is quarantined from the outside world until the contamination is contained and order is restored. Players assume the role of an agent within the Strategic Homeland Division: a sleeper government unit that is activated in periods of national emergency in order to help first responders bring order to the region. Players can play individually or in groups of up to four completing a series of story missions and open world events in a region of Manhattan that at launch spanned over six square kilometres in size ranging from 21st street and 9th all the way to 55th and 3rd avenue.

To give players some variety and challenge, regions of the map are controlled by five rival factions: including the flamethrower-loving Cleaners, escaped convicts from Rikers Island, as well as the private military company the Last Man Battalion. In addition the most infected region of the city - The Dark Zone - has been cordoned off and is the games major PvP arena comprised of not only enemy AI but also fellow players who can go rogue at any time and begin to attack you.
As players explore the city of New York, they will interact with non-player characters (or NPCs) in one of three scenarios:
As Roamers in the open world: such as a wild dog, pockets of civilians, friendly JTF soldiers near safe houses or hostile mobs out on patrol.
Placed encounters: These are instances where players will find enemy mobs out in the game world, often deliberately positioned by the in-game systems with help from designers to force players into combat or to make an alternate route.
Narrative missions: specific designer-crafted missions that are part of the main story of The Division. These are lengthy plot-driven sequences with an emphasis on glueing together multiple individual firefights.
In each instance, the AI placed in the world has specific objectives that are aligned with one of two critical design goals:
To add to player immersion by enriching the in-game world and its design.
To provide puzzles to solve in combat.
The latter was the critical part of the game: given it aims to encourage players towards scouting areas prior to combat and establishing a base level of strategy. Once fighting breaks out, players need to continually re-evaluate their combat priorities and spatial awareness in order to come out intact. This requires enemy NPCs to carry interesting behavioural traits for players to recognise, but also some consistency in their basic behaviours, with a variety of subsystems that handle threat detection, dynamic objective handling as well as being able to react to players themselves.
The System
All NPC behaviours are achieved through use of a behaviour tree system, where subsections of the tree are activated to run specific behaviours that are seeded with certain objectives or variables. This can include the likes of target destinations for navigation, areas to explore potential threats, enemies to attack, cover to move into and so-on. I'm going to look at the design and structure of these for enemy NPCs, but if you want to learn more about how behaviour trees work: check out my articles on the AI of Halo 2 and 3 which cover some of this in more detail.

The behaviour tree architecture shown above (note: read from right to left) was reliant on a richly layered system, which was capable of providing multiple paths to each behaviour. This is because of the range of ways in which one specific action could arise and required the system to be as flexible as possible. The top layer of the tree [yellow-right] breaks down the three critical ways in which a NPC would react, including direct orders from in-game systems, to maintaining active combat or initiating combat if necessary. This moves down into the conditions layer [blue/purple-centre], which identifies what behaviours can be executed based on the current conditions of the world and the character itself, all the way down to the lower layer [left] which handles pretty much every variation of combat that is possible in the game.
What's critical here is that the middle layer is built such that it can link to a variety of different actions on the lower layer. This is to prevent behaviours being duplicated through the bottom half of the tree based on very specific conditions. As such all the different NPCs in the game (which I'll come back to in a minute), as well as tools such as the Seeker Mine - which is technically an AI character - can have similar sub-trees or behaviours to suit their purposes which are copied around. As you can imagine, this would result in a behaviour tree architecture that is rather complex - and you're right - what you see below is simply massive in scale and this required heavy collaboration between programming and design teams in order to get this working. Given the scale of the problem and the challenges faced, the programming team developed numerous tools for editing and eventually debugging each of the NPCs and built these into the Snowdrop engine that The Division is built upon. These debugging tools are extensive, given they allow for the developers to identify what is going wrong with a particular character in real-time in an online instance and I'll come back to talking about this later.
So now that we know a little more about the AI architecture, let's take a look at the design of the NPCs themselves.
Archetypes & Factions
At launch The Division had 36 enemy NPCs types spread across five factions. Archetypes help establish the type of behaviour of a given character, while factions govern attributes that are specific to all NPCs within them. To enable a bit of gameplay diversity, there are large number of archetypes in The Division:
Assault: Basic shooting and cover AI.
Rusher: Rush directly towards target.
Tank: Takes and deals large amount of damage.
Sniper: Long-range and accurate assault.
Thrower: Throw grenades and area-of-effect items.
Support: Assist teammates in combat (e.g. healing)
Heavy: Suppress players.
Leader: Provide buffs to nearby players.
andController: Fights via Proxy (turret)
There are also Special NPCs that do not adhere to the archetypes model - but these are only used in end-game and boss battles. Each of these archetypes are designed to give clear feedback of the immediate dangers to