This is the second part of the article on Total War artificial intelligence. In the
first part of the article, I talked about
Shogun: Total War , a game that changed the face of real-time strategy games, in Creative Assembly 2000. In
Shogun, there are three separate layers of AI systems:
AI units , managing individual units and preserving their structure and location,
combat AI , grouping and defining units, and
AI campaign / diplomacy , leading a step-by-step strategy and seeking to seize control of feudal Japan. I finished the first part on
Medieval: Total War 2002: a game that redefined and improved the fundamental systems created by
Shogun . But it was only the very beginning of a long journey to improve and restructure the AI ​​systems of the franchise, both from the side of the Creative Assembly and from the hands of
Total War fans. Therefore, let us consider the following releases of the series and observe how the evolution of the war took place.
Rome and the flowering of the modder community
Rome: Total War 2004 made changes to the gameplay and significantly improved the graphic part of the game. In the third part of the series, a three-dimensional diplomatic map, as well as fully rendered 3D units, appeared. The plot of the game was transferred to Italy in 270 BC, at the time of the birth of the Roman Empire. It is this part that turned the niche strategic simulator into a full-scale bestseller. However, it also began to show the flaws of the gameplay. They are most noticeable in a campaign where the AI ​​is trying to be as efficient as possible in a rich and interesting set of diplomatic mechanics. This is partly due to the longer and more thoughtful development of the actions necessary to build and grow their own corner of the Roman Empire. As I said in the first part, the AI ​​campaign is based on state machines and is reactive in nature, that is, it is not very good at making long-term decisions, because such an approach rarely considers the history of previously performed actions and long-term consequences.

Despite these problems, the game remained a valuable and interesting contribution to the series, creating a large and strong community of fans around itself. Rome was the beginning of a long history of mods created for Total War. It was easy enough to work with him, because most of the data that controlled the gameplay of the early parts of the series was available to the player in the installation files. Therefore, the modders managed to create tools for data manipulation for their own purposes. Many of these mods were aimed at improving graphics and management, expanding the narrative and creating a richer world, for example,
Roma Surrectum and
Rome: Total Realism . Some of the mods even took the basic mechanics and AI, and transferred them to other worlds, for example, the mod in the world of Tolkien
The Fourth Age and, ironically, the
Warhammer: Total War mod. One of the most impressive was
DarthMod : the first of a series of mods by Nick Tomadis, developed from
Rome: Total War up to
Total War: Shogun 2 released in 2011.
DarthMod not only changes the appearance and gameplay of the game, but also often makes significant changes to the parameters affecting the behavior of AI in combat and campaigns, giving more experienced players the opportunity to turn around: new combat constructions have appeared, improved performance characteristics and more flexible and aggressive behavior created. AI.
The deep-seated problems that arose when the engine was reworked in Rome reached their peak with the release in 2006 of
Medieval II: Total War .
Medieval II is essentially a rework of
Medieval: Total War on the
Rome engine, but many of the underlying structural problems of AI have survived. However, the evolved community modders most of them fixed. Therefore, it is time to change, the AI ​​systems needed to be rebuilt from the very foundation, which happened with the release of
Empire: Total War .
')
AI empire
While Rome was a rework aimed at updating basic systems and gameplay,
Empire: Total War of 2009 sought higher goals. The game had to not only update the basic formula of Total War, but also make the game more accessible to a mass audience. This led to an update of the UI systems, hints and tutorials, as well as the basic gameplay components. In combat, a large variety of units that depend on firearms appeared: cavalry, musketeers, riflemen and heavy artillery; along with this, a free system of detachment navigation using shelters was added, allowing them to use relief details while hiding from intense fire. The most serious innovation of the Empire was the transition to sea battles in real time, when players give orders to fleets of ships and attack enemy forces. In addition, the main campaign now occupied a much larger area - both America, Europe and India, not to mention the sea routes connecting them. To further enrich the game, at this stage, the AI ​​campaign also had to control armies and flotilla, perform a spatial analysis of the game map, recognize the enemy threat on different types of terrain, engage in diplomacy, control their resources, and make decisions about taxes, construction and much a friend.

There is no doubt that this has led to an increase in the scope of the franchise and heightened the need for improved technology. For Empire, Rome: Total War was completely rewritten, which led not only to the new implementation of AI at the unit, combat and campaign levels, but also made changes in the presentation of the game to the user, which greatly influenced the further development of modding tools.
In
Empire: Total War, developers completely rebuilt AI campaigns and combat to get rid of reactive and state-driven behavior: thus, the systems not only learned how to actively respond to decisions made by opponents, but also had their own personality, driven by sets of configurations and behaviors. When developing Empire, the authors sought to create an AI that takes into account longer-term results, as well as balancing several goals simultaneously. This led to the use of
Goal Oriented Action Planning (GOAP) in the development of a method for
planning actions . This technique became popular in 2005 thanks to
First Encounter Assault Recon (FEAR) and was used in games such as
Fallout 3 ,
STALKER: Shadow of Chernobyl and
Deus Ex: Human Revolution . GOAP is a classical planning method: agents (AIs) use an abstract model of the world to make a series of decisions that transform the world in order to create the desired result. This approach is ideal for situations in which there are many consistent individual actions; he can evaluate several goals at the same time and carry out actions to achieve them, if they do not contradict each other. Many of the original tactics of
Shogun were able to be transferred here quite simply, given that the logic of
Art of War can be coded for search and execution in the planning language. If you want to learn more about AI planning and how it works, study my
FEAR and Goal Oriented Action Planning , as well as using GOAP and
planning based on hierarchical tasks in Transformers High Moon Studio
games .
One of the most important aspects in this version was that now AI was modeled inside the game itself. In Rome: Total War, the AI ​​game combined with the logic of the game itself. This meant that he had become part of the game and could potentially perform inaccessible actions for the players or have access to information that he should not know. In this and subsequent versions of the AI ​​campaign is separated in such a way that now he actively plays the game as a person; its interface is associated with a code base, which allows it to exchange data with the game, and vice versa.
The actions of the AI ​​campaign are determined on the basis of three main questions:
- How good is my current state?
- What can I do next?
- What resources can I allocate for this?
These three questions allow you to use the
model of beliefs, desires and intentions (BDI system). This means that the campaign's AI models a set of beliefs, desires, and intentions that govern its decision-making processes. Beliefs give the AI ​​an understanding of the world, but given the fact that they may be wrong, for example, regarding the location of the player’s resources or his relationship with other factions. Desires are the motivational stimulus of the player and set the goals that the system wants to achieve, both immediate and long-term. Examples of desires could be the seizure or defense of a territory, obstructing enemy agents, recruiting armies, setting priorities for construction and conducting diplomacy with neighboring factions. The last aspect is extremely complex, I will return to it and will discuss it in more detail in the next part of this series of articles. Finally, intentions represent the contemplative state of an agent: as soon as he chooses to do something, these intentions stimulate him to continue striving towards the goal, even he is distracted by another goal until it is achieved. It works in the system on the basis of planning as follows: it can continue to track unfinished goals and strive to fulfill them while solving immediate tasks. However, as we will see from the third part of the series of articles, the system cannot recognize many of the overlaps arising from its actions, and the conflicts they create in their own decision-making systems led to another improvement in the AI ​​campaign several years later.

In combat, AI systems fulfill many goals that allow them to be more effective not only in fulfilling their mission, but also in controlling their own resources. For example, an active combat objective of a unit may be an attack on a selected enemy unit, but at the same time it may have a goal of ensuring the safety of the flanks, taking into account the location of the enemy forces. The balance and priority of these two goals may vary depending on the events taking place at the current moment: taking into account the size and location of its own army, the actions it takes, the relief occupied by the enemy and the assessment of its forces. While the targets of an attack on an enemy may change or be eliminated after completion, defensive targets are constantly shifted based on the current situation, and priorities are distributed to all these tasks based on the current state on the battlefield. The result is a system that, even in the case when the current execution plan is interrupted due to a change of priorities (for example, for a short-term task of protecting oneself by maneuvering, or for saving the general from flank attack), can eventually return to the original goals and continue its implementation. And vice versa - when an AI attacks a player, it does not make rash decisions, for example, transferring artillery from a wide flank to attack another target, if this can pose a serious threat to the survival of the remaining forces.
Empire: Total War was released in February 2009, but, unfortunately, turned out to be ambiguous. At the time of launching the AI ​​campaign and the battlefield, they suffered under the weight of the problems they faced. And this was not particularly surprising: planning solutions to large-scale tasks of this type is incredibly costly, and developers could only foresee some of the many possible outcomes and situations. Here, as Creative Assembly creative director Mike Simpson said:
“This AI was not similar to any other, written by us earlier ... This is the most complex code construction I have seen in games. I wrote most of the AI ​​code of the campaign for Shogun and Medieval I, and I know that even a fairly simple "static" AI of evaluating actions without any planning or memory can be difficult enough to exhibit chaotic behavior (here we mean chaos in the style mathematical "butterfly effect"). It works as it works, but not quite as it should have been. Maybe this is good - we cut off bad behaviors and leave only good ones, as well as a simple system that is not too predictable.
AI Empire is much more complicated than in any of the previous versions ... As a result, we have an AI that plans actively and intelligently, but is at odds with itself in decisions on time and often turns out to be paralyzed by indecision. "
[Blog the Second, Mike Simpson, Total War blog, October 9, 2009]
Creative Assembly, for six months after release, tried to solve this problem by creating AI patches prior to version 1.5 of the game. These improvements were transferred to the 2010
Napoleon: Total War project, which in many respects remained functionally the same game, only in a different theater of operations. This was partly due to the fact that, during the development of
Napoleon , the AI ​​development teams of the campaign and the battlefield were forced to constantly return to solving problems in the
Empire . Therefore, in the next part of the game, only minor changes and improvements were made.
Modding
At the same time, the modders community stumbled across
Empire as a barrier caused by a change in engine. In previous versions of Total War, there were many variables and performance settings in the form of external data that were loaded into the game at startup, which simplified the creation of modding tools. Perhaps the ideal for modders was the state of the game in Shogun, but it was impossible to maintain it, since the size and scale of each new game increased: campaign cards and tactical combat possibilities expanded. During tests prior to the release of the game, it turned out that the increased amount of data and the expected limits on the amount of memory of gaming computers led to serious bottlenecks in performance. Therefore, most of the data was pre-processed and compiled into a ready-made executable file, which blocked modders access to much of the game's architecture.
However, the mods continued to appear, including in
Empire , the ever-popular
DarthMod was back , changing the internal parameters of the game to make the AI ​​more stable. The
Bran's Empire AI mod took DarthMod as a basis and perfected it, reducing the number of ridiculous AI decisions in the game.
Such difficulties in the development of mods forced Creative Assembly to invest more effort to provide modders access to the insides of later versions of the game.
Total War: Shogun 2 has more extensive mod support, and many subsequent releases have added compatibility with the Steam Workshop API.
Finally
The evolution of the war brought with it many problems, but as a result, it provided players with smarter and more fun gameplay. Players sought greater credibility and control over this process, and this led to the flowering of the modders community, which is still active in the many games of the Total War franchise. I hope you enjoyed the second part of the series, devoted to AI
Total War . In the third part, I will consider one of the most important, but conflicting reviews of the game series:
Total War: Rome II 2013. This part has made the most serious changes in AI and allowed to reconsider views on AI systems used in AAA-class games.