AtG AI Mini Update

Woohoooo, the first post-Kickstarter AtG update! This is going to be a fairly short one, but I wanted to let you guys know what I’ve been up to, lest you worry that I’ve run off to a Caribbean island or something. My intention is to post one major update every month, with smaller unplanned ones in-between going up here and over on our forums.

So for the past couple weeks I’ve been heavily focused on designing the basic structure of the AI. As I’ve noted in previous articles, the basic goals are effective behavior and minimal mistakes, achieved with simple, targeted systems.

I’ve been creating several “scenario sandboxes” in the AI brainstorming docs to establish what an AI response should be to various situations, along with the process for how decisions are made. [Shameless Plug] If you’d like access to these and other documents, you can use PayPal on our website to get up to the $125 tier! [/Shameless Plug]

Right now my brainstorming has led me to an AI design with four main systems:

  • Objectives AI (OAI) – The meat of the AI where strategic plans are laid. Its varied Objectives range from, “I’m out of Metal… spawn an Objective to grab that Iron deposit over there” to “The resources in this area are diminishing, I need find and head for a more fertile one” to “I don’t like the Picts and they’d be easy to attack, so let’s prepare an invasion.”
  • High Command AI (HCAI)- This divvies up the player’s Units between various “Military Goals” and orders them around. If we’re trying to muster an invasion force on the eastern flank and need to draw strength from various parts of the kingdom, the HCAI is what makes that happen.
  • Tactical AI (TAI) – This system takes over from the HCAI when there are very specific, intricate tasks that must be accomplished (typically when there are enemies nearby). It runs through and scores a large number of possible action combos, choosing the best option. An approach like this is necessary if the goal is to reduce the number of mistakes to the absolute minimum – trying to teach it to “do everything right” in one go is basically impossible when there’s as much to consider as there is in AtG. If the TAI slips up just once and forgets to protect a single Supply Camp, it could very easily be the end of everything.
  • Economic AI (EAI) – This handles production, spending of resources, etc. For the most part it hums along happily enough, just keeping things running. However, the OAI and HCAI can make “requests” of the EAI, such as “build more Units, ASAP!” (because we’re being invaded from two sides – but the EAI doesn’t know or care about that). The EAI does its best to balance these competing priorities.


There’s a lot more detail I could go into here, but I’ll save that for future updates, as I want to keep this one fairly high-level. In your guys’ opinion, what should the AI always/never do? What’s the most important thing for it (and me!) to focus on?

– Jon


Check out the thread over on our official forums dedicated to this topic!

8 thoughts on “AtG AI Mini Update

  1. One of my main issues with how AI in 4X games behave is that they often have no sense of retreat. If I locally outnumber the AI 5 to 1, they should be moving to retreat instead of fight. A sense of failure is also often lacking. If I have 10 units and the AI attacks me with 20, but I manage to kill 10 of them while only losing 2-3 myself, then the AI should reconsider if it really wants to fight that situation. An AI should never end up offering surrender terms to an opponent who pretty much only defended.

    1. Agreed. I think the problem here is that the AI tends to lack an “Operational” level that decides what it’s goals are and well or poorly they’re being achieved. If your objective is explicitly “stand and fight to the last” that’s one thing, but most of the time the AI doesn’t even consider whether or not retreating is a good idea. It just continues fighting as best it can. In AtG, this is the void I’m expecting the HCAI to fill.

      – Jon

  2. This may come out ultimately a little disorganized.

    1. AI also never have concept of Limited War in 4X games. Their goal setting tends to be myopic and unadaptive in nature.

    2. In Civ 4, for example, you could very clearly exploit the computers warfare AI, which would select a single target city it meant to conquer and obviously ignore targets of opportunity and threats. AtG needs AI that can recognize when it needs to shift strategy because its current strategy is imploding or being exploited by a player who understands it. Civ tends to try an create these strategy shifts implicitly through emergent behavior (AI tries to lobby other AI into war against you simply because it is at war with you and the other AI aren’t) but what if pulling an enemy AI into war with you was recognized as a high-level goal – a cornerstone of a pursuable strategy, or a contingency to prepare if a combat strategy backfires.

    3. In general, the AI should avoid picking fights it knows it cannot win (and be able to recognize those fights). Human players are savvy enough to recognize how to use strategy to open a back door in these situations, but computer AI rarely possesses the depth of nuance to recognize those situations, and usually if it seems it has its simply an error of human perception generating depth in the AI’s decision making process.

    4. 4X AI also needs to recognize economic/research imperatives. In Civ 5, without fail, even if the most up to date game you can infallibly break the computer by rushing to Artillery and waging defensive limited war with upgraded seige units — the computer falls for it every time and never recognizes what you are doing to it — finally you bulldoze them after they’ve impaled their front line against your seige units and lack needed defenses. But what if the computer understood the Artillery rush as a pursuable strategy? This is tricky nuance since an AI pursuing a focused strategy can so easily fall off the rails, but then that goes back to point 2 doesn’t it?

    5. One of the brilliant glories of Civ 5, was that its the first 4X game I’ve played (ever, including all Civ incarnations to date) in which I never spend time worrying about *if* I can win the game, but rather how I’m going to do it. Part of what rendered that possible was making smaller, focused empires formidable. Previous Civ titles and 4X titles treat expansion as an option, when it is in fact actually embedded in the game as a challenge, not a choice. Endless Space is particularly chaotic in this regard, as you quickly learn that hyper-expansion is always the right answer and failure to expand is always a mistake or a portent that you will lose the game. In Endless Space, it’s not a choice, and demonstrating it to the player as a strategic choice is a red herring and it’s fundamentally unfair.

    One thing I’d love to see you keep in perspective with AtG is that in most 4X games, an AI empire that hasn’t expanded violently and by force is rarely anything to concern yourself with. It remains an inescapable truth that AI opponents in these games can also be rendered as resources for the player to draw on to pursue his strategy. Can a 4X AI treat the human player the same way? Can it draw on the player as a resource to pursue its own high-level strategy? What if the AI in Civ 5 did that, lobbying me against a powerful rival to slow it down and permit the AI an opportunity to surpass its opponent (and ideally, me). Or what if it pursued a strategy of heavy research cooperation while simultaneously planning to leverage a split tech advantage against me at a future date.

    AIs in previous titles have often counteracted this shortcoming with monolithic advantages – like Civ 4’s insane unit stacks, stilted production and pacing bonuses that present warped challenges to the player as legitimate difficulty increases, tech trading in MOO2 and Civ 4 (a mechanic designed to keep all AIs at parity or ahead of the player who can’t ever trade as prolificly as the computer, even through intense micromanagement; especially when hideously unfair trade deals are all the AI will ever accept).

    6. AI needs to understand that it does not have to obliterate you to win. In fact, if it pursues that to its extreme it can pretty easily ruin the game for casual players who won’t play a losing war out to its conclusion. I’d love to see AI recognize that it can beat you simply by locking down a critical resource, or beating you to research benchmark. This also harkens back to my point that the player should never wonder if it is still possible to win, but should be able to approach the game from a determination to figure out how he’s going to win; how he can use the AI to help him win. Players can accept losses in war more easily this way.

    7. AI should recognize that an occupied opponent doesn’t present a clear and present danger and should free it to pursue other priorities.

    8. AI should not behave in erratic or unreadable ways. A long time ally shouldn’t spontaneously declare war on me without some way to have foreseen it. For example, if the Huns have been asking me to share iron with them repeatedly, reiterating that they really need it to protect against an opponent and I consistently refuse to help them — I’m going to more clearly understand when they betray me expressly to take control of my vulnerable iron supply.

    9. AI must not bring the universe upon themselves and declare war on everybody and make everyone an enemy. Even in cases when the AI is very strong and doesn’t regard another empire as a real threat, it should still recognize the value of allegiance in its strategic machinations. Civ does this a lot. The Celts are outscoring you, ahead in tech, have more cities, units, and money – so they just default to bossing you around. There’s never a carrot, always a stick. They make demands, get displeased when you refuse, and your relationship invariably deteriorates into war.

    I’m sure I’ll come up with more in time.

    1. Your #4 is an example of what I was thinking of when I suggested that AI should be able to recognise failure if their units are dying en masse without significant losses on the other side. Many times in Civ 5 would a strong civ send a large army to conquer me, because they have correctly seen that my total military power is significantly inferior to theirs, but with proper use of ranged units and terrain choke points, you can often still win the battle. I don’t expect the AI to be able to recognise and prevent the situation, but I do expect the AI to be able to add up the kill totals and see that obviously they aren’t as much stronger as they thought they would be. Yet normally they just attack, attack, attack until all their units are dead.

      1. Yes that happened a lot in Civ 4 and 5. They’d declare war, send a massive wave of seige units and horsemen, which get unceremoniously slaughtered at no losses to myself and then the computer is like “We’ll grant you mercy if you give me these eight cities” and I’m thinking “I think you have a very different perception of the last six turns than I do”

    2. Great thoughts!

      Much of it comes back to the AI having (or not) specific goals and plans. The main weakness of the Civ 5 AI is that “strategies” would turn on, but all these did was flip weighting switches rather than dictate something specific. This means the AI has no way to establish a chain of events, absolutely necessary when establishing effective plans. It couldn’t defend against an Artillery rush because it didn’t know what Artillery was – there was simply a vague “Siege Flavor” attached to various Techs.

      The approach I’m utilizing in AtG is almost the exact OPPOSITE. Instead of turning knobs, an Objective will outline very specific requirements that have to be met. This will be have the greatest impact with the performance of the AI in warfare and when making diplomatic deals.

      This more targeted design will require me to spend more time fleshing out what the AI can recognize and do, but there’s no doubt it will be smarter as a result. Another drawback is that the AI in mods won’t be as strong, since if it’s looking for something specific like Artillery that does a mod where it was removed no good! But we are releasing the source code for the AI, which should help mitigate this somewhat.

      – Jon

      1. An Objective should also outline specific abandon conditions. Like if the AI has an objective to seize an Iron supply, it might eyeball two or three and decide to move in on one it thinks is vulnerable.

        High Level Objective: Seize Iron Supply because I needs the Iron
        -Candidate Tactic: Take Iron from X
        -Candidate Tactic: Take Iron from Y
        -Candidate Tactic: Take unclaimed Iron at Z

        So it might decide it wants Iron from X, because Y is an ally and Z is too far away to effectively defend. So the AI builds a task force to attack and establishes the loss of that task force or key units in that task force as an Abandon criteria. When the first Candidate Tactic ends in failure, it re-evaluates the remaining Candidates to decide if one of them will work better here and tries to mitigate the political damage from the failed attack. It decides instead to lobby Y to share the Iron resource because Y has access to multiple supply points.

    3. 5. I do not agree about endless space. When playing on the higher difficulties you have to expand but you cant do it recklessly.

      In general I found the civ5 AI boring because it played to win. In civ4 the AI just played it’s personality and if it happened to win it was happy. That made it more fun to play against because it was more predictable and did not dislike you for doing well.

      6. This is very possible in civ4. You just give away a city in a peace treaty. It might be the only way sometimes.

      The AI gets displeased when you refuse demand but on the other side of the coin when the AI makes demands is a perfect opportunity to improve your relations.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

search previous next tag category expand menu location phone mail time cart zoom edit close