AI and Games is a crowdfunded series about research and applications of artificial intelligence in video games. If you like my work please consider supporting the show over on Patreon for early-access and behind-the-scenes updates.
When creating a video game we're driven by a desire to craft a fun and interesting experiences for players: to put them in new scenarios or retread familiar ones. Now sometimes in order to pull that off, we have to cheat a little bit. We make tweaks gameplay systems or concessions in how a certain feature is built to reinforce the pillars of the games design and this applies just as much to non-player characters. Alien Isolation's Xenomorph that has short range sensors in the back of its head and a director that always knows where you are, the enemies in Far Cry that become less accurate the more that are fighting you, or the demons in DOOM that patiently wait their turn to tear you to shreds. It might sound counter-intuitive, but by limiting a characters behaviour, or giving them knowledge and skills they shouldn't otherwise have sometimes makes sense in reinforcing the players experience. And this brings me to Ubisoft's 'Ghost Recon Wildlands': an open-world action game released in 2017 that has players slowly dismantle the Santa Blanca drug cartel.
In this article I'm going to talk about the three AI-controlled non-player characters that work alongside the player when playing Ghost Recon Wildlands offline: Holt, Midas and Weaver. This ghost squad needs to be able to respond to player commands and react to the world around them, but also maintain the power fantasy that the game delivers as you stealthily take down entire enemy command posts, or roll in with an attack helicopter and blow everything to pieces. It's an interesting design problem and it's arguably one of the most prominent examples in recent memory where an AI frequently cheats, not because it needs to be able to do what you expect of it, but because as players we have a low tolerance for their failure.
The Ghost Squad
The AI squadmates throughout the Ghost Recon series are built to support the player and reinforce the experience of a being a covert operative that sneaks into installations and eliminates opposing forces. This includes being able to spot targets for the player, synchronised kill shots of multiple enemies on your command as well as holding their own when everything goes loud. Ghost Recon Wildlands takes this premise and blows it up with a massive increase in scale and this presents a real problem for game designers. Unlike more recent entries such as Ghost Recon: Future Soldier, the number of unique circumstances that can arise has grown exponentially - and this is in part due to the systemic gameplay systems that drive weather, patrolling enemies and rebels, civilians and more. Players can attack encampments from any angle they like and approach it using a variety of tools at their disposal. So the AI systems for friendly characters need to accommodate and in some instances relax their rules or outright cheat to support the fantasy that Ghost Recon promises. Now all character AI in Ghost Recon Wildlands is reliant on a behaviour tree system, with the friendly AI running a much more sophisticated system than the enemies. I'm not going to focus on the actual behaviour tree implementation this time around, but instead explore the design rules enforced and the supporting systems that help control your AI buddies.
The buddy-AI in Wildlands was headed up by a small team at Ubisoft Montpelier whose design philosophy put player at the centre of all friendly AI behaviour - and dictating the systems that were built and how they would operate. This philosophy was built atop three core pillars.
- Don't Steal The Limelight: Teammates would support the player without stealing the limelight.
- Support Where Needed: Ghost AI must react to surroundings and help where necessary.
- Follow Orders: Do what the player tells them to do as best as they can given the circumstances.
All of this is designed to reinforce one rule: to keep players in control of the experience and not feel like the games systems aren't doing what they want them at a certain point in time. In each instance the player dictates the behaviour of these AI characters either directly or indirectly. And in an effort to reinforce the fantasy each of these circumstances creates: either sneaking past the enemy, gunning them down or reviving us when needed, the friendly AI repeatedly cheats to achieve it and this requires numerous gameplay systems as well as specific concessions in both the friendly and enemy AI to pull this off.
As detailed in Mathias Rolland's 2017 GameAI North talk, teammate management is composed of three gameplay systems that drive the ghost squad AI:
- The 'Smart Recon' system: that finds items and characters of interest within local proximity
- The 'Balance of Power' system: that influences how effective your teamates are in combat.
- And both of these tie into the biggest system known as Overlord: a suite of sub-systems that identifies all threats within proximity of the player and a variety of useful information that the squadmates can use to full effect in combat.
All three systems regularly interact with the player through the companion characters and have control over how they behave and operate within the space.
So if I was to attack a given base such as this one in the screenshot above, it's a pretty busy location, there are enemies, vehicles, and no doubt patrols and guard posts set up in the area. As I move closer the Overlord system kicks in and starts to identify all enemies within roughly 100m of where I'm standing. It's not just storing how far away they are, but also whether I and the rest of the ghost squad have line of sight on them. Meanwhile Holt, Midas, Weaver sneak up to the base behind me. In order to know where to go, my player character is leaving spots on the navigation mesh like breadcrumbs for these guys to follow. Upon reaching the camp, they take instructions from the Overlord as to how to move through the space. Having gathered all the information it needs about enemy characters in proximity, the Overlord knows what areas of the map the ghost squad should not move into so as to not to be spotted.
It's at this point one of the team warns me about the chopper overhead. So I need to lie down until it clears. But it doesn't matter for the squad: because while I'm in stealth mode and not spotted, they're invisible to the enemy. The overlord is helping them appear to look like they're being stealthy and until I either command them to move into a location where they are then spotted or I am spotted myself, they will continue to remain invisible.
While I've been moving towards the camp, the Smart Recon System registers nearby props such as anti air defences and power generators, but also nearby enemies. It grades them based on a perceived relevance as well as the potential of my being able to take them out. It's at this point I'm notified that there's a soldier nearby, but also given some contextual information about where he is and he's placed both on my HUD and in the minimap. While it might not fit the reality - given sometimes they call out things they might not actually be able to see - it provides a supporting mechanism that prevents me screwing up early on and identify targets and points of interest I might otherwise have missed.
However, I opt instead to spot the snipers on the towers and quietly take them out. To do this, we use the sync shot command, where I select up to three enemies to be taken out by the ghosts. Now what makes this interesting is that these sync shots rely on the player being able to mark the target, then the friendly AI being able to take the shot. But sometimes the shot is not actually possible for the AI and there's a degree to which it will bend the rules to make the shot happen. So perhaps it has to shoot around a corner at times, but if the enemy is in a bunker and there's no way there could be a line of sight from that angle, the squad mate will tell me they can't get the shot.
Now having said this, you might be wondering about whether the ghost squad can miss. Well, it's impossible for them to miss, because they don't actually shoot them. This is what the Wildlands AI team refer to as the Magic Shot: where the squad pretend to shoot the enemy on your command and all the enemy AI just simply drop dead. By simulating the killshot, it ensures they don't miss and as a result don't screw up the mission for you in the simplest way possible.
So as I move into the base, this process continues. The squad continue to follow the Overlords rules about where they scan stand and we take out more enemies within the base using Magic Shots. Plus the smart recon system points out to me the power generator that I had failed to spot during my recon. Having snuck into the base, the teammates slowly begin to follow me inside, with the Overlord ensuring they only go through the safer areas that I have established. Not that it matters anyway, because they're invisible.
But I decide once inside the base to go loud and make a mess. It's at this point not only will the buddy-AI aim to rally on me and start attacking enemies. The Overlord system switches modes into combat and as such the information it's passing about target prioritisation as well as where to move in the world changes accordingly. On top of this, the Balance of Power system kicks in. This system is effectively a realtime balancing tool that makes the ghost squad more or less effective in combat the longer a battle continues: influencing their shot damage, attack frequency and their overall resilience. The better I perform in avoiding damage and eliminating enemies, so do the squad. Plus the squads gets an initial boost on the start of a fight so as to help me avoid getting slaughtered once it all gets a bit messy. Plus once again returning to the core design pillars, they'll not only frequently aim to support me, but also make sure they're within close proximity when they do it so that I know they're doing it. While the firefight has kicked off, the Smart Recon system is still in effect, they're still spotting targets such as snipers I forgot about as well as more attack helicopters.
Now it all gets a bit much and I wind up getting shot down and needing revived and this is when another system known as the Revive Manager kicks in. The Revive Manager selects one of the ghost squad, tells them to activate the corresponding behaviour tree and is designed to ensure that AI does not fail to revive me. If the player is surrounded by enemies, it will use magic shots on the nearest ones to clear the space. Did you get downed on a rooftop or awkward piece of geometry? Then the companion will teleport onto the surface or in the worst case literally on top of your body to ensure the revive goes through. This same system is also used to have allies revive each other whenever necessary.
And so this process continues until either we end conflict or are killed in action. In any case, the squad continues to provide information, become more effective as I turn the tide of battle and revive me until it's no longer possible. But despite all this, it doesn't make me invincible: otherwise it would remove all of the challenge. So in time, if I don't find a way to end the conflict I'll eventually get wiped out.
Now outside of this example there are still numerous instances where the squad act in very specific ways or cheat in order to assist my experience. The most obvious one for players is driving around in vehicles. If I get in a vehicle, the team will attempt to get in with me. However, if I drive off without them, they'll simply teleport into the vehicle so as to provide assistance. In the event it's a vehicle that can't carry all four of us, they'll simply teleport to me once I stop and get out on foot again.
One thing I did briefly mention earlier, is how AI are invisible when I don't tell them what to do. They cannot be seen and will not attack enemies until you give the go either by giving a sync shot command, telling them to attack using the command wheel or just start attacking the enemy yourself. The only time their invisibility is disabled is when the player issues a movement order in the command wheel and they're then spotted by the enemy. If in that moment they're spotted, that's on you. So as far as the game is concerned, the AI cannot be told off for making a stupid decision, because really it was you who made the mistake in the first place.
Building supporting characters for games such as Ghost Recon Wildlands is never an easy proposition. Players are... fickle shall we say, at the best of times. And as a result, we need to provide systems that can behave as expected in stealth incursions, big gun battles and just mucking around on the highway. As a game developer myself, I find it refreshing to see a AAA game such as this one makes such dramatic concessions to reinforce the experience. I use the word 'cheat' frequently in this piece, but it doesn't deny the player of the experience the designers intended. It just irons out many of the larger implementation hiccups that can easily drag down a game of this scale. Making smart AI for open world games is a lot harder than many would give credit and if it keeps you engaged than sure, let's cut the corners. Even if it means your AI can teleport into moving helicopters.
- Mathias Rolland, Teammates AI in the systemic open world of Ghost Recon Wildlands, Game AI North 2017