The AI of Shogun: Total War (Part 1 of 5) | AI and Games

[Music] hi I'm Tommy Thompson and this is AI in games a series on research and applications of artificial intelligence in video games since the beginning of this channel have explored a variety of AI techniques to solve specific problems within video game design that require both immediate reactive behavior in conjunction with long-term and strategic decision making first-person shooters are certainly a common genre from which interesting AI can emerge given its predicated on fast reactive and engaging gameplay but if we were to consider the need for effective systems that balance both short and long-term decision-making in games there's no greater problem space to explore than realtime strategy both the RTS and FPS genres have continued to innovate the state-of-the-art in triple-a video gaming in an effort to satisfy their design by RTS games have much larger considerations for the long term Empire of quick and reactive decisions as well as the need to manage resources of varying levels of abstraction and complexity over multi hour gameplay sessions when considering the challenges and innovations faced in AI for strategy games as a player developer or researcher there's one franchise you simply cannot go without discussing creative Assembly's total war total war has grown from strength to strength since the launch of the franchise in the year 2000 as each game becomes more ambitious the challenges faced by the AI systems continues to increase in scope and complexity this has resulted in a development team that continues to push the state-of-the-art in game AI unlike any other in videogame history but the journey to reach more recent entries at the time of this video such as Total War Attila and Warhammer has had more than a few bumps in the road along the way so in this first in a series I will be looking at not just the core tenets of the AI of total war but how each entry in the series aims to solidify tweak or completely rewrite parts of these systems in addition a look at the response to these changes from the fanbase the modding community that's with in total war and how creative assembly adopted groundbreaking academic research to help innovate from the very first entry all the way to the more recent releases so let us begin our march to total war but first let's get into the real-time strategy genre and understand where total war sits within this space view time strategy games are focused primarily on the control of territory and assets whereby two or more opposing forces will appear in the same map in an effort to assert dominance by securing resources or locations within the existing defined area often in order for this to be achieved each force will build collections of structures and units that either improve the resource collection within a given area defend existing structures and land or scout and secure areas of the map by force the lats are often acquiring the destruction of opposing forces units in the process this process typically requires players to explore a previously hidden environment by piercing what is referred to as the fog of war in order to establish enemy and resource locations in addition over time each faction is expected to build upon the structures and units previously established by enhancing their existing capabilities and resource acquisition while arguably not the first RTS game ever made westwoods 1992 release June to the building of a dynasty acted as the archetype for future games in the genre such as Westwood zone command & Conquer series but also Age of Empires total annihilation dungeon keeper homeworld and Wizards Warcraft and Starcraft franchises the genre has continued to evolve and branch off since the late 1990s with the lake's of real-time tactics games like Dawn of War and Star Wars M tired of war emphasizing tactics of a resource management meanwhile games such as 1994's UFO enemy unknown have explored a balance between the real-time and turn-based decision-making with its still proving popular to this day with the franchise being successfully rebooted as XCOM in 2012 arguably the largest deviation as the rise of the multiplayer online battle arena or MOBA genre popularized by the Warcraft 3 mod Defense of the Ancients and to provide by games such as dota 2 and League of Legends where players assume the role of hero units on the ground to define and assist the larger strategies playing out during a match AI applications within realtime strategy games have existed since the inception of the genre with players responsible for managing the movement of faction units by telling them where to go but without direct control of their actual movement as such players are expected to interact with these systems in order to yield desired outcomes in addition AI is critical to the single-player aspects of these games given that players play off against opposing commanders responsible for managing their own units and construction strategies for all of the AI player as one that is tremendously challenging and is considered to be one of the largest challenges facing academic research in games this has led to the forming of numerous academic benchmarks and projects including the Starcraft AI competition hosted at the triple AI conference on artificial intelligence and interactive digital entertainment this is a video in and of itself but don't worry I'll be talking about how an AI in games in the near future so what makes Total War so special and challenging for an AI system creative assembly 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 jungles 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 bat filled at runtime the first entry in the series 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 son Goku GI period of feudal Japan a time largely popularized in contemporary fiction but the works of Japanese film director Akira Kurosawa with the 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 game cinematics both the player and opposing AI assumed 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 Tai sha or 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 defense of the daimyo and his ambitions total war deviates from many traditional realtime 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 AI unit counts from combat decision-making given the nature of the game itself the AI player is comprised of two distinct AI systems the diplomacy AI and the combi AI the 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 envoy's or assassins to forge alliances or eliminate opposition and building the agriculture and infrastructure of owned provinces meanwhile the combat 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 to the strategic systems that seek to conquer all of feudal Japan total war combat is driven by units groups of specific troop types that can be deployed in formation ranging from melee units to archers – cavalry these combat units are not only expected to keep formation but to move around the 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 to achieve this Shogun Total War adopted artificial neural networks from managing individual units neural nets are a fast and effective means to achieve quick and reactive responses to a predefined objective we typically train them using machine learning methods but they can also be tweaked by hand of 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 neuron there is able to generalize its decision-making processes meaning it can recognize 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 depending on the objective they're trying to solve whether it's moving formation avoiding oncoming enemy fire or taking position to attack be it up close or from afar each of these networks is predefined and is not tweaked are optimized during gameplay so it's not learning to be better at the game as you're playing these unit a 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 behaviors moving up from units we then have to think about the combat level the combat level is the AI system that controls opposing forces akin to players in battle situations this AI needs to decide the group formations and actions of units moving segments of its army together in order to achieve a specific tactic or micromanage movement of units giving the terrain or weather that is currently in play to achieve this Shogun Total War employs a logic system that allows for specific decisions to be made based upon the current state of the world these decisions are derived from the art of war a collection of strategies by Chinese military strategists sanzu that dates back to around 500 BC the use of a logic system is well-suited to adapting the texts given that in many instances a set of conditions are in play that should result in a particular response from the system these rules consider the type condition and size of both our units and our opponents the current terrain the weather and state of troop morale it's been stated that there are 220 rules embedded in the combat AI system across three distinct versions each with their own slightly different set of behaviors a driving force behind this was to ensure that combat was as realistic as possible deviating away from the tactics that had driven many realtime strategy games of the era as make Simson development director of creative assembly stated most games use simple scripts of can behavior that fire when you bump into them and very simple swarming behaviors but limited and a gamey rather than real-world why I mean by that is that the tactics you use to beat them are something that you have to learn for each game or sometimes each scenario or level and bear no relation to reality what we strive for is a game where real-world tactics actually work it's not the easiest path to take but it is the most rewarding the final layer of Shogun's AI systems is the diplomacy system this is in control of all decision-making on the main campaign map managing army movement conducting diplomacy between factions and building infrastructure within provinces this uses a mixture of classic state machine decision-making alongside the use of a genetic algorithm in order to customize the tactics made by each daimyo genetic algorithms are a form of machine learning where we create large quantities of candidate solutions to a given problem that learn to solve it by breeding the best ones with each other these candidates aren't cold they're an encoding of how the AI behaves typically is a string of numbers which is then translated into the AI behavior itself to dictate how it should operate this allows for us to create a collection of diverse solutions for a given problem they don't all behave in the exact same way and can have their own slight characteristics as a result has a unique diplomacy behavior from a player's perspective this gives them each some sort of personality allowing for dime users are mobile to conduct diplomacy to others that will take a more aggressive stance in expanding their territory attacking both human and AI player alike with these three systems the core tenets of the AI of total war are in place to manage individual units whilst retaining cohesive behavior to group units of troops together in a manner that is responsive reactive and challenging towards players and to create strategic opponents with personality despite being built back in the year 2000 the core principles of combat strategy combined with the systems built in Shogun have carried the Total War franchise forward into new and varied theatres of war in many a subsequent release despite these innovations buying the scenes even from the very beginning the AI has never proven infallible and as such with every release there is a drive to tighten up and improve it as best as possible the first changes came as the series migrated from feudal Japan in 2002 with the launch of medieval total war medieval pulls the game father back in time to the late 8th century all the way to the 14th century with players taking charge of a variety of factions at different periods of history with the lake's of the Viking era in Britain where much of the country's fractured following its abandonment by the Roman Empire all the way to the late medieval period where much of Europe has taken shape as actual countries medieval total war is in many respects a refinement of the original game and is built on an improved version of the original Shogun engine that among other things allowed for larger battles than its predecessor there are no major innovations between Shogun and medieval for the underlying AI tank just a number of optimizations and improvements the Unity AI systems were improved to prevent bottlenecks and tight spaces such as bridges in addition the suite of combat systems was expanded to allow for greater versatility all in all this resulted in a game that Rock Paper Shotgun referred to as near perfection Rob's acne says I'm still not sure a more balanced total war game has ever materialized the RISC style map is easy for the AI to manage and the different starting positions of each Kingdom and Empire allows for some true AI superpowers to form and challenge players late in the game medieval is a triumph of simplicity and it took a decade for total war to come close to matching it but all in all this is just the beginning of the franchise and it's safe to say that the road to war is not a smooth one with each subsequent release the challenges have become larger and the scope has increased significantly while war never changes the AI behind it most certainly does I'll return in part two with an exploration of the modding community that arose from 2004 from total war how the release of medieval turds over need for the core systems to be rewritten and rebuilt in Empire and how the seismic change impacted the franchise all the way to total war Shogun 2 [Applause] [Music]

Watch this on YouTube

Add Comment