Creative Chronicles: Analysing AI behaviour

Creative Chronicles: Analysing AI behaviour

15 January 2020

Creative Chronicles brings together key insights, information and statistics from the experts at Creative Assembly. We hope this will inspire students and those considering a career in game development.

In our latest BAFTA tutorial, we look at analysing and balancing AI behaviour in Total War.

This presentation gives insight into the challenges we face and what techniques we use when we analyse and balance AI behaviour in the turn-based mode of Total War games, focusing on the most recent release, record-breaking title; Total War: Three Kingdoms.

The complexity and depth of this grand strategy game makes it difficult to have a clear picture on how well the AI is performing, how smart it is, where it’s failing or whether the latest balancing changes have moved its behaviour in the right direction.

Analysing AI Behaviour in Total War - Creative Assembly and BAFTA Games Livestream

HOW DOES THE CAMPAIGN AI IN TOTAL WAR WORK?

The topic of AI in Total War is huge.

The Battle AI and the Campaign AI are also completely different; they are practically two different games within two different genres. The similarities between the two aspects of AI are the need to allocate appropriate forces to deal with multiple targets, and the low-level execution of the AI figuring out how to move armies or units to achieve the best outcome.

Focusing on the Campaign AI side, we can summarise it briefly as a set of AI systems, each of them being responsible for making decisions in a different game play system. For example, we have a Finance system, Construction system, Diplomacy system, Task Management system (army objectives), and the list goes on.

Some of these systems are heavily linked to others, such as Finance affecting both Construction, Diplomacy and other systems, while some are completely isolated, such as Technologies. As the AI processes its turn, it goes through these systems in a specific order and makes decisions one by one.

This means that instead of thinking of all decisions for each gameplay system in one mass and trying to come up with the best one, while still considering everything in the universe, it fragments the problem. This makes it more manageable and means decisions are made in a matter of milliseconds instead of minutes/hours/years. Usually this decision is made by assigning a score to the possible options and choosing the best one (or weighted and randomly picking from the top options). The method of assigning a score is like how any human player would evaluate a situation for example, when deciding who to ally with in diplomacy, considering diplomatic relations and faction strength.

When comparing AI factions; each has its own personality which determines how that AI opponent makes decisions in each AI system. We can define these AI personalities and the parameters of the various decision-making processes via a database, which makes it easier to tweak and experiment.

 

WHAT MAKES THE TOTAL WAR CAMPAIGN AI UNIQUE?

The depth and the sandbox nature of the Total War Campaign game provides an extremely high number of gameplay choices with a huge number of factors affecting each decision due to the game complexity. This creates a unique challenge as the AI doesn’t just have to come up with fun, sensible and smart decisions (which is already difficult) but it also must do this in a very limited amount of time. If the AI makes a stupid move or takes too long to decide, it may break immersion or not be fun.

The diplomatic gameplay between dozens of AIs is another unique aspect. The AI has to build relations and wage war just like the player does. If this is not handled carefully it can get incredibly messy, with 40+ or 100+ (in Warhammer) AI factions interacting with each other. This is fairly uncommon even within the Turn-Based Strategy genre.

 

KEY CONSIDERATIONS DURING CAMPAIGN AI DEVELOPMENT

The primary consideration is to always aim to create an AI that’s fun to play against/with. It must be believable and should have a personality, a character. We also aim to be true to the game’s sandbox nature, minimising scripted AI behaviour.

During development one of the main considerations is to implement features in a way where they are highly customisable via data, rather than changing the code to adjust AI behaviour. This allows our programmers to focus on implementing new features and fixing bugs, while designers can experiment with different settings and fine-tuning and balancing the AI. We aim to implement systems that are extendable, in line with system design best practice.

Read more about Programming at CA HERE.