9 Ways that 4X AIs disappoint us

Every fan of 4X strategy games knows the disappointment of suddenly realizing that his impending and crushing victory, made against seemingly insurmountable odds, turns out to be against a bunch of hapless AI opponents. Below are the top 9 AI flaws that I recall 4X fans complaining about in various game forums.

As a developer of a 4X game, these shortcomings weigh heavily on my mind. Since my pet theory about how to write a good AI starts and ends with “Don’t do stupid things”, the items listed below are those I have either already fixed in Remnants or have concrete plans to address in the upcoming developer release (just weeks away).

Without further ado, here’s my list:

1. It doesn’t know how to play the game

This is a broad category but applies equally to almost every 4X title. For some reason, the AI doesn’t understand fundamentals about the virtual universe in which it inhabits. It doesn’t know how to explore nearby systems. It doesn’t expand well. It doesn’t understand how to develop its colonies. It can’t build a decent warship. These are all very common and cover every X in 4X!

In a release crunch, developers often conceal this shortcoming by giving the AI massive bonuses, but the curtain is soon pulled away when the player starts conquering systems and realizes that he’s playing against simpleton cheaters.

How I addressed this: Don’t wait until the end to write the AI. Lock down the basic 4X game mechanics early and get a basic AI going. Then as features are added, expand the AI to use them.

2. Love-Hate relationships

This is a common problem that makes diplomacy almost impossible. The Psilon love you so much. Oh wait, you sent an unarmed scout to explore a system — now they hate you! It was the scout, right? Or was it because we didn’t sell you our latest technology for pennies? It’s hard to tell because the root cause of diplomatic relations is often kept opaque to the player.

How I addressed this: Diplomatic events and their effects (good or bad) are tracked, and those effects decay slowly over time towards zero. This prevents the whiplash effect. The player can review these events in the Races UI, allowing him some agency in building relations with the AIs.

3. Empty threats

How many times has an AI declared war on you and done nothing? You lay in wait, bracing for an inevitable attack, and then 10 turns later that same AI laments, “This horrible war has gone on too long” and asks for peace.

This most likely happens because of some predetermined condition to trigger war (i.e. low diplomatic relations), but the AI is often too preoccupied with other things (like other wars) to muster a fleet against you before some turn counter expires and it re-examines its relations with you. We’re at war? Oh, let’s stop that.

How I am addressing this: When provoked into war, the AI will now enter into a silent “Cold War” stage against the player instead of announcing its intentions. During this time, it will prepare and launch attacks as if it had openly declared war. If the attacks never materialize and the AI changes its mind, the player is none the wiser. But if the attacks do launch, the AI will publicly declare war on the player right when the attacks begin. This way, there is an immediate connection for the player between “We are at war” and the enemy attacking on his colonies. This is how human players operate, so the AI should act no differently.

4. Suicidal tendencies

There is a breed of player who wants to control the galaxy without committing genocide and they see this a lot. Imagine that you have the Psilon cornered to a signal colony on a hostile planet and finally decide to cease the war and offer peace. Of course, they totally hate your guts right now and refuse, which doesn’t make a lot of sense. But they’re mad so, OK, let’s give them a bunch of stuff. No, they continue to attack you. So you have to exterminate the dumb AI.

This most likely happens because AI does not consider relative power levels in diplomacy, just the gradations between love and hate.

How I addressed this: Relative power levels are factored into decisions about declaring war and accepting peace. If the AI is more powerful than you, it will be more willing to declare war — even if it likes you. But if the AI is much weaker than you, it will be more willing to accept terms of peace — even if it despises you.

5. Knows who the player is

Have you ever noticed that you, the player, are often singled out for special treatment by the AIs? Perhaps they want to gouge you in every trade transaction but nevertheless trade freely among each other. Or maybe they declare war on you en masse while ignoring their own diplomatic squabbles.

Obviously, this is the developers trying to give you a challenge. Letting the AI know that you are not one of them and deserve special treatment is a lot easier than creating a competent AI.

How I addressed this: The player and the AI empires are represented internally so that they interact with each other through identical interfaces. As a result, the player is treated equally because no AI knows who the player is. This, of course, requires the AI to be relatively competent to provide a challenge.

6. Unable to concentrate attacks

Many times when the AI is attacking you, it does so in a particularly ineffective way by not concentrating its attacks. For example, it decides to send an armada of 100 ships to attack from multiple systems but they all arrive in different turns, meaning that you easily defeat each wave as they dribble in.

This is an understandable problem because writing code to plan large and coordinated offensives is pretty hard. However, it must be a solvable problem because we humans do it without expending a lot of brain power.

How I am addressing this: Attacking fleets use a nearby friendly system as a staging point. Only once the requisite number of ships have arrived does the invasion commence. For attacks that cannot be staged (e.g. transports for ground combat), travel speeds of individual transports will be tuned down so that they all arrive in the same turn. In the spirit of fair play, players will have this same option when they are launching transports as well.

7. Easily bribed

On the diplomatic front, it is often easy to abuse the AI by showering it with worthless trinkets. This makes it easy to keep potential enemies pacified without actually giving up anything. In the MOO series, for examples, technologies that have become obsoleted or unuseable are often still prized by the AI as if they had value. Players are quick to recognize and exploit this.

How I addressed this: There’s no way around this except to teach the AI the relative values of trade items, especially when those values can change drastically over time. For example, if the Sakkra have discovered Improved Terraforming +60, they need to know that Improved Terraforming +10 through +50 are now worthless. This even applies to special cases like realizing that Subspace Teleporters are worthless if everyone has Subspace Interdictors.

8. Short-term memory

Remember that time when an AI made a request or an offer to you, that you refused, and then they asked again? And again? And again? Diplomatic spamming does not occur in every game but, when it does, it’s extremely annoying. Some players solve this problem by turning off diplomacy entirely and waging all-out war

How I addressed this: AI diplomats have a memory. If one asks to trade the Deflector Shields IV technology for Controlled Radiated Environment and you refuse, it permanently stores that and will never ask again. Your refusal may not have a negative diplomatic effect, but it force you to re-initiate that particular request if you change your mind. This applies to all diplomatic requests.

9. No Personality

Getting insulted by an warmongering AI belongs in every 4X game. Listening to a defeated AI grovel or plead for mercy should also exist. But many 4X games focus more on the types of diplomatic transactions available (Declare War, Offer Alliance, etc) and less upon the distinctive verbage that actually makes an AI seem like a real opponent.

How I am addressing this: I bit the bullet and hired a writer to write custom dialogue for each of the races. I thought I could write well enough to do this until I saw what an actual writer could create, so I figured that I should defer to the competent one.

I hope this list was enlightening and enjoyable to read. I couldn’t think of a good tenth item but I am confident I forgot quite a few. Feel free to add your own in the comments!

Advertisements

9 thoughts on “9 Ways that 4X AIs disappoint us”

  1. Outstanding – you may be my hero of 4x gaming hahaha. I like how you tackle the pieces head on and leave no fluff. So many games these days hide behind (what I call) fluff – tricking the gamer into the purchase and then exposing the flaws after a few hours of game play. (Admittedly sometimes the flaws are not “intentional” per say – just bad design or a design not to my own liking)
    I have become a very cranky gamer and fluff bothers me when that is the meat of a game.
    You seem to be a designer/developer who sees right through that and tackles it head on.
    Thank you for sharing

    B

    Like

    1. If you can solve these eternal issues, and in the context of a game I love, you deserve adulation. If you can come close, that will be wonderful.

      Like

  2. Great writeup and succinctly explains the problem and what you are doing to fix it. Remnants wasn’t on my radar before but it is now. Diplomacy in a 4X AI is one of those challenges that sounds quite fun &(& challenging) to tackle.

    Like

  3. I think that point 6 you mentioned is only part of a bigger problem: Many war-AIs (and certainly the AI in the MOO1) are basically stateless, i.e. they decide what to do on a turn-by turn basis and are completely unable to plan ahead. There is no internal separation between strategy and tactics and no commitment to subgoals (such as e.g. taking a planet or a group of planets). The inability to concentrate attacks to achieve STOP (same time on point) is only the most evident problem.

    A better way to go about this (which also avoids having transports of different speed in transit) might be to have the AI doing global strategic evaluations every couple of turns and have it define subgoals, which then get executed by a separate subsystem with limited local and temporal scope. Such a goal might be “conquer Planet X and Y”.

    At first, the necessary resources (existing ships, production and pop) are determined, working backwards from “D-Day” considering production and flight times for all possible target orders (“X then Y”, “Y then X” or “X and Y” simultaneously). Then the best plan “operation XY” is taken and execution is delegated to a “general”, a special purpose AI subsystem. The AI keeps a “calendar” (could be a simple bitmask) for each planet which allows to “book” certain years (game turns) of production or pop grow for military operations. The plan is then simply a queue of production and movement orders which get executed in temporal order.

    Technically, the algorithm for planning is essentially a breadth-first search with iterative deepening starting at the target. The depth is the number of game turns for the whole operation. The more time you allow, the more O(t^2) planets and the more production turns O(t^3), pop O(t^2) and existing fleets become available for the operation. The search terminates successfully when enough resources can be mobilized or the maximum time is exceeded.

    The case of large and huge ships which might take several turns to produce is handled implicitly and requires no extra logic: If the time slot for production on a planet is large enough, then a Dreadnought is an option there, otherwise not and the planet can only contribute smaller crafts. All that has to be done, is to allocate the required ship-production from large to small.

    There are two modes: aggressive (1 wave: ships and transports arrive the same turn) and cautious (2 waves: transports get sent only after the planet is taken). The latter is necessary when the planet has not been scouted yet (in that case, the planning can be split in two parts and the invasion planning can be triggered after orbit has been taken).

    For starters, it would suffice to make the AI handle only single planet invasions; handling of multiple targets (campaigns) can be added later.

    Numerous refinements are possible:

    As the search is iterative, it is trivial to make the assumed hardness of the target (and thus the required resources) a function of time (e.g. assuming that the enemy will start to rush-build bases once the first fleet enters visibility).

    Reserve spending can also be added easily. Just allow the algorithm to “book” production on distant rich and UR planets and “beam” the resources to the frontline.

    When the operation fails, the reason should be remembered (e.g. not enough bombing or ship-to-ship capacity) and a new attempt on the same planet and/or player should require a higher safety factor on the employed resources to avoid the common case of attacking the same planet over and over.

    The resource-planning can be multi-dimensional e.g. pop (gropo), anti-small-ship, anti-large-ship, anti-planet and those evaluations can be on a per-player basis to account for different opponent techs. (A bomber design might be useless against player A which has SP-rockets but still perfectly valid against opponent B).

    As the planning algorithm is not very expensive, it can also be used in strategic planning. The AI would then routinely plan attacks against all reachable planets to identify interesting strategic targets.

    The same method can also be used in defense to plan for the rescue of a planet which is under attack. Simply run the algorithm with a max. time equal to the ETA of the incoming stacks to bring reinforcements and ground defenders there in time.

    Liked by 1 person

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s