Breakdown: The AI of Total War

Breakdown: The AI of Total War

Tommy Thompson has published a brilliant breakdown of how the game works, combining multiple modes of strategic gameplay.

How does one deal with AI in RTS games? What are the challenges here? How can you make all the units work together in a logical way? Let’s take a look at the brilliant AI system of Creative Assembly’s Total War, for example. Tommy Thompson has published a brilliant breakdown of how the game works, combining multiple modes of strategic gameplay. You don’t want to miss this one.

Here is a small piece of the article to get you interested:

So what makes Total War so special and challenging for an AI system? Creative Assembly’s strategy series is interesting in that it combines multiple modes of strategic gameplay into a single game: with players managing turn-based resource management and political strategy alongside real-time combat with large scale armies. In addition, the combat juggles between micro and macro levels: requiring not only AI control of individual units, but more abstract control of unit types and managing the combat formations and troop deployments on the battlefield at runtime.

The first entry in the franchise, Shogun: Total War, balances the combat simulations that strive for realism and authenticity, alongside the political strategy that is aimed to give context and stakes to each conflict. The original Total War is set in 1530, during the Sengoku Jidai period of feudal Japan: a time largely popularised in contemporary fiction by the works of Japanese film director Akira Kurosawa, with films such as Kagemusha, Seven Samurai and Ran proving influential on the design and development of the game – with clips of the latter being used as part of the games cinematics. Both the player and opposing AI assume the role of the ‘Daimyo’: local-lords who control provinces of Japan with a need to conduct both diplomatic strategy alongside military movements. When rival factions are drawn into conflict, players take control of the ‘Taisho’ (General) and move hundreds if not thousands of troops across the battlefield. Sengoku Jidai made for an ideal period of history for the game, given the politics and even the economics of the period was built around the logistics of fielding armies in defence of the Daimyo and his ambitions.

The campaign map of Creative Assembly's 'Shogun: Total War'

Total War deviates from many traditional real-time strategy games in that it removes mechanics such as Fog of War from combat gameplay as well as the need for resource management outside of unit counts from combat decision making. Given the nature of the game itself, the AI player is comprised of two distinct AI systems:

  • The Campaign and Diplomacy AI manages the turn-based strategy of the game and is responsible for moving armies around the map, conducting diplomacy (be it by sending envoys or assassins to forge alliances or eliminate opposition) and building the agriculture and infrastructure of owned provinces.
  • Meanwhile the Combat or Battle AI dictates combat unit formations, strategies and attack patterns. Much like human players, this is only responsible for managing the strategy of specific groups of units, given the units themselves are already controlled by AI techniques.

So to get to grips with the AI of Total War, I’m going to explore the AI systems from lowest to highest level: from individual troop control systems all the way strategic systems that seek to conquer all of feudal Japan.

Combat in Shogun: Total War

Unit AI Behaviour

Total War combat is driven by units: groups of specific troop types that can be deployed in formation ranging from melee types to archers to cavalry. These combat units are not only expected to keep formation, but to move around and conduct combat as a unit. Movement is often a tricky task, especially when asked to navigate through or around a variety of terrains such as mountains and forests.

Neural networks act as a weighted summation function of incoming data. By customising the weights between each simple compute node or ‘neuron’, we can change the result of the data being pass to the layers on the far right. [IMAGE SOURCE]

To achieve this, Total War adopts artificial neural networks for managing individual units. Neural nets are a fast and effective means to achieve quick and reactive responses to a pre-defined objective. A neural network processes data via ‘neurons’: simple processing units that take incoming data via ‘synapses’ that are weighted.  By changing the weights, we change the outcome of the data being passed through the neural net.  We typically train these weights using machine learning methods but they can also be tweaked by hand if the network is small enough. What makes this so effective is that once they are trained, the processing time to make decisions is lightning fast. In addition, a well-trained neural net is able to generalise its decision making process: meaning it can recognise the similarities in numerous individual circumstances and in each case give a similar answer.

Despite this, neural networks are typically not great when being given multiple objectives to complete at once, especially when they oppose one another. In this instance, the troops have different neural nets they can trigger in depending on the objective they’re trying to solve, whether it’s moving formation, avoiding oncoming enemy fire or taking position to attack themselves, be it up close or from afar. Each of these networks is pre-defined and is not tweaked or optimised during gameplay, so it’s not learning to be better at the game as you’re playing it.  These Unit AI systems are in effect regardless of whether a human or AI is in control of the army, as each requires these neural net systems to manage the individual troop behaviours.

Tommy Thompson 

Make sure to study the full breakdown here

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more

    Breakdown: The AI of Total War