The Truth about AI in PC Strategy Games
[p align="start"]Multiplayer will not save your game.[/p][p align="start"]Strategy games must have computer opponents as a first-class game mode. They aren’t there to be “practice bots”. Even in games that are allegedly “multiplayer-centric”, fewer than 20% of players will press the multiplayer button, let alone actually play it.[/p][p align="start"]Yet many strategy games just handwave, putting in interesting computer opponents. You, reading this, know the folly of that, and yet they still do it. Why?[/p][p align="start"]There are two main reasons why computer strategy games tend to have bad computer opponents:[/p][olist][*][p]The game design kept changing until the 11th hour, making it impossible for the engineers to have the time to write a competent computer opponent.[/p][/*][*][p]The engineers making the computer opponents are not necessarily great strategy game players.[/p][/*][/olist][p align="start"]Ara: History Untold shipped with pretty decent computer opponents, for the first act anyway, but if you survived the first act, it was kind of a cake walk. Today, we’re going to discuss how 2.0 revolutionizes the AI in this game.[/p][p][/p]The Great AI Awakening
[p align="start"]The development of Ara: History Untold was a long, winding road. Throughout the years it was in development, many ideas were tried and discarded. At one point, there was a playing card system. Needless to say, it meant that the AI team was constantly having to rewrite the way the computer players played the game based on design changes.[/p][p align="start"]The attacking and conquest system in the game was pretty stable for a long time, and it shows. The AI is actually pretty good at picking targets to attack. Although as the game progresses and the supply chains become more sophisticated and the number of different items, recipes, and units grows, the AI really begins to struggle.[/p][p align="start"]Let me walk you through what the AI had to figure out in this game to be competitive in Act 2:[/p][olist][*][p]Cannons and Riflemen need gunpowder.[/p][/*][*][p]Gunpowder needs to be produced in an Armory.[/p][/*][*][p]An Armory can’t be built unless you have concrete and steel.[/p][/*][*][p]Concrete requires a cement plant OR, in a pinch, a Ceramics shop (which is busy producing lots of other things).[/p][/*][*][p]To get concrete fast, you need a resource that is currently called “sculpting material” (we need a better name, please suggest some in the comments, I will make sure it gets localized!).[/p][/*][*][p]Steel really needs a forge, and the forge needs metal ingots.[/p][/*][*][p]Metal ingots have to be produced by taking copper or iron and smelting it.[/p][/*][/olist][p align="start"]If you made it this far, you have probably figured out that the AI struggled with this, and this is what we focused on for version 2.0.[/p][p align="start"]We also had to deal with problems where the AI recalculated what its strategy was and abandoned things in favor of its new strategy. Not a terrible idea, but in a game where it can take quite a few turns to build something, it really messed with the AI’s ability to get anything done.[/p][p][/p]Section 1: The Improvement Hunger System - Breaking the Goldfish Memory Syndrome
The Problem: AI suffered from "Goldfish Memory Syndrome" - each turn evaluated improvements as if seeing them for the first time, leading to:
- [p]Abandoned construction projects (average: 47% completion rate)[/p][/*]
- [p]Strategic flip-flopping (changing priorities every 2.3 turns on average)[/p][/*]
- [p]Ignored beneficial improvements (some waiting 100+ turns)[/p][/*]
- [p]Unpredictable behavior patterns frustrating players[/p][/*]
Example:
[p][img src="https://clan.akamai.steamstatic.com/images/42553122/5295565b6fbbfa386bcb111d3789d89126fa4845.png"][/img][/p][p align="start"]So even though “on the ground” realities might adjust the bias of something being built, over time, it would accumulate a “hunger”.[/p][p align="start"]In the example above, a city improvement with a bias of only 6 has waited 93 turns to be built. That’s a very long time. Despite short-term priority being much less than the others, it has waited a lot longer and has bubbled to the top. This ensures that the AI actually builds things and doesn’t easily get distracted by a short-term change in strategy (within reason, we have a Crisis system too).[/p][p][/p]Section 2: Dynamic Crisis Response System - Intelligent Emergency Management
[p align="start"]Sometimes, you run into an emergency and just have to put off that Bakery that’s been waiting a long time. How do you do that?[/p][p][/p]Architecture Overview
[p align="start"]The Crisis Response System operates on a three-tier escalation model with dynamic bias adjustment:[/p][p][img src="https://clan.akamai.steamstatic.com/images/42553122/0536848c64d0e32af77fca8d56bc1abf0544a688.png"][/img][/p][p align="start"]This is where having AI developers with an understanding of strategy games comes into play because it’s subjective. You essentially come up with a list of things that are a crisis, rate them, and let the game respond.[/p][p][/p][p align="start"]Examples:[/p]- [p]Enemy at the gates: That’s an emergency![/p][/*]
- [p]Critical units can’t be built because you lack gunpowder: That’s a crisis![/p][/*]
- [p]Quality of life in Happiness has dipped below 30. That’s a warning.[/p][/*]