'AI and Games' is a crowdfunded YouTube series that explores research and applications of artificial intelligence in video games. You can support this work by visiting my Patreon page.
The Locust Horde are a formidable force: a near-endless army of subterranean monsters set on annihilating all human life on the planet of Sera. They’re vicious, ruthless, and seemingly unstoppable. In Gears Tactics, players take charge of the remnants of Alpha Squad, as Gabriel, Sid, and Mykala fight for their lives and rescue as many civilians as they can from the unrelenting might of the mad scientist Ukkon.
By crafting a turn-based tactics game that embraces the design pillars of the Gears of War franchise, developers Splash Damage and The Coalition seek to reproduce many of the mechanics and dynamics players know, love, and dread from the series. And this presents an interesting design problem for developers to overcome in how the locust horde plan their attacks against the player's small but determined group of soldiers. A process designed not just to put the pressure on you with every move, but to deliberately make it easier for the player to survive their next assault.
Coordinating Enemy Characters
Released for PC and Xbox Series X in 2020, Gears Tactics continues the modern-day revival of the turn-based tactics genre brought about by X-COM: Enemy Unknown. And on first passing, you’d be forgiven for thinking that the game is a mere reskin of Firaxis reboot. Players deploy their units across the map with each turn of the game: utilising a limited amount of action points to move into position, attack targets, set up defensive perimeters or utilise special abilities. But this rigorous adoption of the genre’s tropes belies an intensity and challenge that evokes the core games of the Gears franchise. Enemies come at you thick and fast, each with their own attack patterns, weapon types, and special abilities that will be familiar to anyone who has accompanied Marcus Fenix on his many adventures.
To build this intensity, the Locust need to appear intelligent, make decisions quickly and coordinate their attacks when it's their turn to strike. As we’ll see in a moment, the actual decision-making process for each enemy archetype is relatively straightforward. But the interesting part about Gears Tactics AI systems is that while monsters in the Locust army make decisions on their own, there’s an entirely separate AI system in the game that has to figure out how to synchronise them – not just so it looks cool and maintains the ferocity that Gears fans expect, but to prevent Locust from contradicting one another, interrupting each other’s actions and – in an effort to ensure the player’s enjoyment of the game – minimise how much the camera has to move around the screen to communicate what’s happening during the enemy turn.
In Gears Tactics, there are often dozens of enemy units on the field at once, and whether you’re dealing with drones, wretches, boomers, tickers, snipers or any of the other handsome chaps of the locust horde, they all move at different speeds, behave in different ways and quite often appear at different times, given some of the missions are semi procedurally generated. Despite all of this, players should be able to follow along with what is happening in every mission. The solution to this is what is known as ‘Tactical Clarity’
In an Unreal Fest talk from 2020, lead AI programmer Matthias Siemonsmeier explains that Tactical Clarity is a critical design pillar of Gears Tactics, that aims to ensure players are always able to understand what is happening during an enemy turn. It should be clear to the player where they’re being attacked from, how locust units are moving around the map and what the most immediate threat is to their units. And one easy way to make this happen is minimise how frequently the camera pans around the map. If the camera has to follow each individual unit moving and no consideration is given to where they are in the map relative to one another, then the camera will suffer whiplash as it bounces from one unit to another, to another in a very short period of time.
Locust Decision Making
So let’s start by exploring how the locust makes decisions. Each individual unit uses a behaviour tree to decide how to spend the limited amount of action points it has available for that turn. If you’re not familiar, a behaviour tree is a type of data structure that allows for branches to handle specific types of logic and decisions based on what’s happening in the world. Each locust unit type has its own bespoke behaviour tree that customises their actions based on the type that they are as well as specific characteristics that unit may have.
Each unit will focus on the goals the locust must satisfy on that turn – a point I’ll come back to in a minute – but also what they each individually want to achieve, such as pushing into a specific point of cover, or taking fire on an enemy. They don’t pay attention to any other units on the map and are largely unaware that they even exist. However, while a unit may select a specific action, they don’t always take up their full allocation of action points, hence they’ll try to use those up in relevant ways. A standard grub may apply overwatch over a region in front of them, or a sniper will deploy their pinned status on an individual unit, forcing you to dig in. Once that collection of actions is decided upon, it submits them to a separate AI system, the tactical planner, whose job it is to figure out the order in which these actions should all take place.
The Tactical Planner
Gears Tactics uses a planning system in order to decide what are the high-level goals the locust want to achieve, as well as figuring out the execution order of the enemy turn. Each level and skirmish contains level mark-up that a separate goal planner uses to decide what the active goals of the locust should be, such as capturing a point, pushing an enemy out of cover, identifying characters that need a heal or buff, that sort of thing. As we mentioned already the locust make decisions by themselves, but those decisions are going to be influenced by the goal planner. So some units will be given a role or job for that turn, such as a grenadier being told to flank the player or a Kantus being told which ally needs a buff. After that, it’s up to those characters to decide by themselves how to achieve those goals – and anything else they want to do – during that turn.
Gears Tactics is conducting what is known as partial-order planning, meaning it’s taking a set of actions but it doesn’t commit to the order in which they’re executed straight away. When the planner receives the decisions of each unit, they’re receiving chunks of actions that are in total order: meaning that they have to be executed in the order they’re given. So if a unit moves from one piece of cover to another, takes a shot at the player, and then deploys overwatch, we need to execute those actions in that exact order, otherwise, it might look stupid or is impossible to execute – given a unit can’t act again after deploying overwatch. However, if there are three locust on the map at once, each with its own set of total-order actions, if we executed those chunks of actions in sequence, one after the other, it would violate the tactical clarity principle as the camera bounces around trying to follow them.
Hence the planner is responsible for figuring out how the execution of these individual sets of actions can interweave, given while we can’t interrupt the order of one unit’s set of actions, we can execute the actions of other units in between. But this presents a new problem that in partial-order planning is known as a 'threat'. A threat in Gears Tactics is when an action by one character will violate the actions of another. For example: if two locust interact with the same piece of cover: one is pushing up into it and deploying overwatch, while another also runs to the same cover and then moves along the wall, then those actions needs to be ordered such that they don’t conflict with one another. In each case, a drone moving into cover has a precondition that says it will only move into that cover if it is free to use. But if the first drone moves into cover, then deploys overwatch, it won’t move anymore and that piece of cover is now being used. This presents a threat to the execution of the second drone because the precondition of its action to move into cover is violated by the effects of the actions of the first drone. Hence the planner realises it makes sense for drone 2 to push into cover first, then as it moves along the wall, drone 1 can move forward.
But in amongst all of this, there’s an opportunity to make the locust appear to be smarter than they really are. As mentioned earlier, each unit makes decisions on its own. But the tactical planner makes an effort to get locust to work together. This is achieved in two different ways: first of all, the goal planner comes up with specific goals that require multiple units to execute, hence individual units can satisfy those goals and by doing so, it looks coordinated. A good example of this is a flanking maneuver, where the goal planner needs someone to pin the player down while another character makes a move. But there’s also another step that takes place during the action ordering process. This is achieved courtesy of a subsystem known as the Combo Move Analyser. It takes the current plan and then re-orders actions and merges them into what are known as combo moves. Combo moves provide a means to highlight units whose actions could be executed in parallel without violating one another and would improve tactical clarity.
Combo moves might mean a group of wretches can run across the map together, a squad of drones can push forward into cover, or two enemies concentrate fire on the same character. In each case, tactical clarity is maintained, given we can watch five units push up together instead of watching them all do it separately, or all the actions being taken against one of our characters are framed in such a way we can follow the action.
In fact, one of the coolest examples of this, is the Commander unit: a commander is a unit in a given fight that looks like its acting as the leader of the pack. During a given turn, a commander will gesture to other units to make a move and it helps make that coordinated deployment look all the more realistic. But it’s a complete fabrication brought on by the Combo Move Analyser. When the system finds combos of units acting together, it tries to find a nearby unit that could be considered the commander. It then injects an action into the plan to animate the commander so that it looks like they’re following orders. Except none of it is real, all of the locust made their decisions entirely on their own, and its the tactical planner adding that little bit of spice that makes it look all the more convincing.
Execution & Interruptions
The last thing to mention is how does the planner prioritise all of this so it runs smoothly and what happens when the execution is somehow interrupted. It’s important for the pace of the game that the AI does not take too long to make decisions. Hence the tactical planner interweaves its planning process alongside the execution of the plan itself. So when you see a squad of locust moving forward, the planner is still figuring out the ordering of the rest of the plan and using that downtime as means to figure out what to execute next. This means that an enemy turn doesn’t have long wait times at the start, and when combined with the combo move system, what could take over a minute to process and execute, is pulled off in under 30 seconds, and players are none the wiser.
But what happens when the plan is interrupted? Players can deploy overwatch to open fire on enemies that come within their line of sight, or proximity mines can be deployed to catch the enemy unawares and this could even interrupt movement patterns as cover is destroyed or areas are no longer safe to traverse. So if a plan is interrupted, but the units still have spare action points, the tactical planner stops what its doing and replans the interrupted units. Hence a character that was originally pushing up to take a shot at the player, might dive into nearby cover after being caught in overwatch. On one hand, this might seem counterintuitive, given you could try to anticipate all the things that players could do to interrupt the execution, but when you factor in the process of scheduling all the actions and the combo move process, anticipating every possible outcome that could impact the plan becomes very difficult. Hence, it’s ultimately easier – and faster – to just restart planning from that point.
Tactical Clarity is a design philosophy laced through Gears Tactics all in an effort to keep the player engaged: understanding the threats the enemy AI present and how best to address it. The AI planning system running under the hood not only helps deliver an experience befitting the Gears of War franchise but reminds us of the value in ensuring players can see what AI characters are doing given how big an impact that has on our own behaviour.
- Matthias Siemonsmeier, "Make It Fast: Simultaneous AI Actions in Gears Tactics", Unreal Fest Online 2020.