Company of Heroes 3 - AI Design
- Cam White
- Jul 7
- 4 min read
Company of Heroes 3 is a AAA real-time strategy game set in the Mediterranean theatre of WW2, focusing on intense tactical combat in fully destructible environments. Strategic choices come to the forefront in this installment with the addition of the Italian Dynamic Campaign, allowing players to approach RTS Missions how they choose and tell their own stories.
On this project, I was a Campaign Designer. I filled many roles during this game’s 5-year development, but my primary contributions revolved around world design and systems design on the Italian Campaign Map.
Campaign Map Overview
The Italian Campaign Map is a turn-based overworld that connects RTS missions across an open-world style Mediterranean theatre. From managing air, land, and naval units, to upgrading armies and securing critical towns, every strategic decision made on the map shapes the flow of the campaign and the outcome of historical battles on the road to Rome.
I like to describe the campaign map as the journey to the mission. The gameplay bookends the RTS mission content and the player’s choices lead to a very different story.
Turn-Based AI
One of my roles on this project was as the campaign map point of contact for the AI engineering team. In this role, I wrote AI system design documents, defined tasks, and attended AI scrums to help guide the engineering work. I also used many of the systems myself when designing encounters.
The AI’s responsibilities on the campaign map involved choosing high-level targets to attack/capture/defend, positioning units, using abilities, and requisitioning new units. It was also important to provide tools for designers to reliably influence all of these things based on objectives and campaign state.
Sandbox AI
The campaign map had significant sections of sandbox-style gameplay for the AI support. The intent was for the AI to pick its own goal targets based off its current composition of town types, like ports and airfields. The system created to achieve this evaluates all towns, then assigns point values to each target based off a tuning sheet. The highest scored points get AI enemies assigned to them first and there is a weighting to the proximity of player units so towns under threat have higher values, allowing the AI to react to the player's actions.
These tuning sheets could also be updated throughout the campaign to reflect the primary objectives. For example, during the final stages of the campaign, the AI devalues all towns except those surrounding Rome which creates the feeling of a large-scale retreat.
AI Overrides
Similar to the Rome retreat example, many of our objectives on the campaign map required enemy involvement where the AI behaviours were influenced by designers.
Enemy units could have their AI disabled, and I designed a ‘scripted phase’ system that allowed designers to script enemy actions at the beginning of their turn before the AI took over. This worked by queuing a set of actions for the next turn and was commonly used in cases like in the tutorial or during narrative events where the scripted AI actions could be paired with dialogue.
However, fully disabling the AI was often too heavy handed for our dynamic objectives. For this purpose I designed a ‘guaranteed targets’ system that allowed designers to specify priority locations for the AI to attack, but the AI still retained control over the moment-to-moment decision-making like unit movement, positioning, and ability use. This system was used for many of our objectives where we wanted an enemy presence in the area but didn't want to artificially spawn new enemy units and hand script specific outcomes.
Moment-to-Moment Behaviours
The turn-by-turn behaviours tied all these systems together. Much of the movement and positioning was designed around the concept of forming a front line. I wanted the AI to position its units in smart locations but also locations that evoked the fantasy of this grand strategy gameplay.
The system created to achieve this scores grid positions on the map based on their terrain type and proximity to the border of owned territory. This means the AI prefers to position its units along the edges of owned territory, with higher weighting to certain defensive terrain features. While moving however, the AI sticks to the fastest route, often leaving them exposed on road terrain, giving the player opportunities to attack with an advantage.
Ability use was another key moment-to-moment behaviour. Healing behaviours are triggered once the AI unit's health drops below a tunable threshold. Although the enemy unit can heal on the spot, the behaviour was designed for them to retreat to safe territory before healing to give the player a clear cause and effect to their attack, as well as a break in the pacing of combat.
Bombing abilities from aircraft and naval units was another key piece of the AI experience. Most of the AI's goals focus on moving land units to defend or capture, something aircraft and ships can't do. So, these bombing abilities were considered separate behaviours to be used alongside attacking land units. When an enemy company intends to attack a player's town it often sends a bomber first. This creates a feeling of cohesion to the AI’s actions, and fits the combined arms (air, land, sea) theme of the campaign map gameplay.
Result
The work put into the turn-based AI created a set of responsive, strategic enemy behaviours. This involved close collaboration with AI engineers, authoring system designs, and developing adaptable tools like guaranteed targets, and scripted phases. Although challenging to keep up to constant iteration of the core gameplay throughout development, careful planning allowed us to deliver an AI that adapts to the emergent gameplay of the campaign map.
Commentaires