Gayblack Canadian Man

Foreign Policy Analysis
The Diplomacy AI in Total War: Attila (Part 4 of 5) | AI and Games

The Diplomacy AI in Total War: Attila (Part 4 of 5) | AI and Games


Hi I’m Tommy Thompson, this is AI and Games
and welcome to part 4 of the AI of Total War. In part 3 of this series I explored the campaign
AI of one of the most pivotal entries in the franchise: 2013’s Total War: Rome II. A game
that completely re-built the campaign AI systems to accommodate for an increasingly more complex
series of mechanics, resources and consequences. Rome II’s adoption of the Monte Carlo Tree
Search algorithm is a critical step in bring the campaign AI up to spec for more contemporary
entries in the series. But the innovations at campaign level didn’t stop there. In this
video I’m going to look at how the MCTS systems were improved upon, as well as how the diplomacy
systems have been scaled up for the modern era as Rome gave way to 2015’s Total War:
Attila. Attila is the ninth entry in the Total War
franchise and transposes the conflict to the late 4th and early 5th century: a period of
history known as the Migration Period. The Roman Empire begins to falter, even fracture;
the empire is separated with the latin-speaking Roman Empire to the west and the greek-speaking
Byzantine Empire to the east. The Roman Empire is on borrowed time and will only survive
another 200 years at best as it is besieged by the vandals, franks, saxons and perhaps
most importantly, the huns. Players bring Attila the Huns rise to power as the Hunnic
empire forms over what is now eastern europe. Total War: Attila is in many respects a natural
successor to Total War: Rome II – with a campaign map of similar size and shape that succeeds
the rise of the Roman empire in the previous title, only to see it crack and crumble with
a total 0f 56 factions appearing as either ally or foe in the original version of the
game. But of course, it’s not just the change of
setting, the underlying tech continues to change and evolve as well. The introduction
of Monte Carlo Tree Search in Rome II, the focus of part 3 of this series, was a massive
undertaking. MCTS had not made the transition into AAA gaming at that time and naturally
there was still much to learn as to how to utilise the systems full potential. So let’s
take a look at the gradual changes and improvements made to the algorithm between post-launch
updates for Rome II, all the way the launch of Attila. The MCTS was updated to address some notable
issues in performance and results. Notably, the algorithm was slow to decide, but was
typically making good choices. A big part of this was that state space coverage becomes
increasingly difficulty the longer the game progresses: the number of AI factions begins
to grow, the number of possible future states grows at an exponential rate. In addition,
the underlying pathfinding tools to calculate distances between factions and the like during
MCTS playouts was proving very expensive. To resolve this, the algorithm was trimmed
to prune the number of strategies it considers. This required additional analysis of a given
state using metrics from the developers itself, to determine whether a target was unreachable,
a battle was unwinnable, there was a low probability of a strategy succeeding or a given path in
the tree was redundant and then removed it from the decision making process. This last
part isn’t as easy as it might sound, given a lot of strategies are essentially identical:
executed in a slightly different order and result in a similar outcome. This required
the system to break up searching into sub-phases such that is enforced an arbitrary ordering.
This helped identify multiple strategies that essentially the same when ordered a specific
way. In addition, this all required aggressive patching of the pathfinding system to pre-cache
some calculations and simply reduce the number of calculations taken, only asking if the
MCTS decision making process deemed it necessary. This resulted in a system that was more memory
efficient and ultimately faster. It shows that the MCTS algorithm, while relatively
simple in its design and execution, is also once that requires additional care when tackling
large and complex problem spaces. Given it may need some assistance in order to make
its decisions more efficiently. Especially when trying to ship it in a AAA product. One area of the franchise I have not yet touched
on is the notion of diplomacy: the process by which campaign AI players accept, offer
and negotiate trade deals and alliances. Diplomacy is driven by an entire AI system in and of
itself. Adding to the steadily growing collection of AI subsystems such threat analysis, pathfinding
and siege battles, which I will cover in part 5. Diplomacy is primarily interested in answering
three key questions for the campaign AI on a given turn: It needs to ensure the deal is valuable to both
parties. This is both valid for an incoming or outgoing deal, given it wants the other
faction to accept its proposal, but conversly it may need to haggle an incoming proposal
to its satisfaction. The Diplomacy system is driven by the same
information and logic as the player, it can’t take any shortcuts, even when two AI factions
are dealing with one another. They still go through the same process as a player would
either with an AI or another player. This is a highly data-driven process, with each
faction having specific and unique configurations of values that drive diplomacy in an effort
to ensure they all behave slightly differently. This is pretty important in deriving their
personality throughout a given campaign, which I’ll come back to discuss a little bit later. In order for the AI to pull it off, it transforms
these three key questions into diplomacy sub-systems (or sub-sub-systems I guess). Deal evaluation,
generation and negotiation. Each of these systems utilises four key metrics that are
generated by the system given the incoming information it has received: – The economic value: Is this deal going to
actually benefit me monetarily? – The stance value: Do I even like these guys
who are negotiating with me? – The strategic value: Will I gain a powerful
ally from this deal? This is important for war and peace declarations, given the current
threat as perceived on the campaign map (done so using influence mapping) can help determine
whether this will make life easier, or more difficult.
– And the diplomatic value: What will other factions think of me if I sign into this treaty? If diplomatic value is negative, it means
that everyone else *really* won’t like you signing this deal. In addition, things like
stance and strategic value are influenced by a balance factor that is hand-tweaked by
designers. The balance factor is incorporated into the difficulty and in-game progression,
such that when an AI is losing badly, it’ll be more likely to accept offers that might
not even by that useful, even from people they don’t really like. Given it may help
ensure their survival. For deal evaluation, all of these values are
then pumped into a weight summation function to give what is called the Deal Value: if
the deal is scored as higher than 0, it means that it is worth the AI player accepting that
deal. Meanwhile in deal generation, it needs to
make some smart decisions on what to offer. The list of all possible diplomatic actions
is took long to consider, as such the system will use a pre-filtered list based on the
current strategic situation, factoring strategic and economic values pertinent to the current
state of the game. It then prioritises each deal by evaluating it, with the actual evaluation
shifting throughout gameplay, given that a deal may have more or less value at different
times during a given game. Lastly, the system negotiates deals by starting
with a collection of generated deals that it evaluated as useful. It will then begin
to offer these to other players, but is mindful of previous offers it has made with a given
faction. If it receives an offer that the deal evaluation scoring disliked, then it
will make a counter offer with a given probability or simply reject it. The AI players are made
to weight a certain number of turns before attempting diplomacy with a given faction
again, so as to avoid spamming you with new offers every 2 minutes. The actual discussion
between faction leaders that takes place during negotiation is powered by a separate system
that ensures that the dialogue fits the style of the people of a given faction. Speaking of AI factions, by the time all of
the DLC was released for Attila, there was over 80 factions in the game. So how do you
make all of this diplomacy not feel stilted or samey with each and every faction you deal
with? As mentioned before, the diplomacy system is data-driven, so each faction is fed data
that influences how it behaves in areas such as budgeting, diplomacy evaluations and negotiations
and technologies. These components craft what Creative Assembly consider to be AI personalities.
Each of these components are often quite extreme and binary, with budgeting making the AI range
from Scrooge McDuck to Kanye West. Each of these personality traits are effectively communicated
via the user interface, such that players can establish just how to deal with a given
faction. But it’s not enough to have just a static
personality throughout a given campaign, it needs to change and evolve over time. As such,
each faction has a personality group with multiple personalities it can choose from.
The choice of selection which personality it wants to use is driven by a number of factors,
such as the current difficulty of the game and the stage of the campaign itself. As such,
ultra-aggressive BURN IT ALL DOWN style personalities don’t appear as frequently at the start of
the campaign, but are more likely to appear towards end-game. In addition, many of the
personality swaps are tied into the progression of faction leadership: with new personalities
adopted as a faction leader dies and their heir comes to power. While deciding how to conduct war can be challenging,
so to can be forging alliances and making peace with others. The scope and complexity
of Total War continues to be vast in scale, to a point that the number of minor AI systems
continues grow in order to support the unit, battle and campaign AI. But diplomacy isn’t
enough in times of conflict, sometimes we just need to force our point of view on our
enemies. To make them bow to our will. In part 5 of my exploration of the AI of Total
War, I’m going to look at another of the AI subsystems in play: one that is responsible
for laying siege to an enemy fortification. While these have been critical to the series
for many iterations, I’m going to take a look at the more recent innovations brought to
this system alongside some fresh perspective for the franchise: as history is cast aside
for fantasy and we enter the world of Warhammer.

15 comments on “The Diplomacy AI in Total War: Attila (Part 4 of 5) | AI and Games

  1. How do you get information for these videos? Do game developers publicly share how they built some of their systems, and if so, where I can I look to research AI in other games on my own?

  2. Sorry for the off the point question of what does Tommy's accent is called? It's not like Irish or Scotch but I can't be sure about it…

  3. Great series of videos, man, these are super interesting. Total War is a series which, from the player's perspective, has a lot of quirks and weird AI behaviors, but thanks to these videos I'm starting to understand how complex these systems are and how revolutionary TW's AI really is, at least considering all the things it has to take into account. It may not be perfect and it may be very silly at times but it's really worth praising.

    Also, it's a shame Attila didn't get as much attention from the public compared to other titles. I really like Warhammer but I just wish Attila was more appreciated, especially by modders, since having some total conversions would have compensated for the less-than-popular setting. Then again it's true that the lack of big mods is also due to the complexity of these new titles.

    Anyway, keep it up!

  4. Really enjoying these videos! Originally I joined the channel mostly looking at AI representation of enemies / other players in single person titles, but its application to strategy games is very intriguing aswell!

  5. This was awesome so far. I always wanted the AI you described in the games I've played, but I've yet to actually experience the type of gameplay you mentioned.

    I'm redownloading Attila to put this to the test in early and mid-game, but I have to say that I really doubt it will work as "advertised". And all of the things you've listed are things the playerbase asked for, but I doubt they made it in before Warhammer (I or II can't remember which exactly). Maybe there are other factors preventing this decision from being taken by the AI which are not so transparent. This particular type of system was done by Paradox games, but they don't really leave it up to the AI system, it's just a blunt threshold. After the buffs and nerfs to the diplomatic relations are summed up and if they meet the threshold, the AI can take a diplomatic decision. It's not smart, but at least it actually works.

Leave a Reply

Your email address will not be published. Required fields are marked *