Improving the Fleet Commander AI

Now that the AI is smart enough to notice enemy ships in orbit around its colonies, it had to be smart enough to DO something about it. A few new “Fleet Plans” were developed and tested tonight.

The “Repel” plan is designed specifically to drive away enemy ships from colonies and is currently the highest-priority fleet plan. It currently sends a token fighter, but this will eventually scale up to the size of the orbiting fleet.

The AI needed to be smart enough to defend colonies that have not yet finished building their missile bases, so I added a new “Guard Colony” plan that does just that. The size of the defense force (+bases) depends upon the security of the colony.

If it is an “Inner” colony not easily reachable by an opponent, a minimum defense is established. If it’s a “border” colony,  a larger defense is used. If it’s a border colony in range of an empire that it is at war with, then it is considered an “attack target” and an ever larger defense is established.

All of this seems to work but there’s no resolution yet as I have not yet implemented auto-resolution of ship combat. I’ll probably start working on that this weekend.

Advertisements

Warnings from the AI

The first warning message is in: a “trespass” warning from the AI when you have ships orbiting his colonies. The severity of the warning is calculated based upon the firepower of your fleets vs. the planetary shields, and is doubled if you are at war or if he is xenophobic. There’s a minimum severity so that unarmed ships can potentially trigger this warning.

Since this is the first possible warning of many to come, it involved setting up some code infrastructure to look for  possible warning situations initiated in the current turn, determine their severity, and then issue a warning if their accumulated severity exceeds a value. If so, you are issued a warning about the most severe violation.

Since trespass violations are checked every turn, you will be warned continuously if you do not retreat your ships. Eventually the accumulating diplomatic penalties could result in a declaration of war.

Since the diplomacy system in MOO1 is overly simplistic and easily exploited, I am reworking the internals extensively although the outward effects to the player should appear the same.

To avoid AI spam to the player, an AI opponent will initiate no more than one message to the player per turn. The most severe messages are checked first (declare war?) and then progressively less-severe messages are checked (break treaty? issue warning?) until finally the AI is cleared to offer a request such as a treaty.

This means that constantly irritating an AI to cause warnings will result in him never proposing anything constructive. Why should he? You’re being a jerk!

Here’s a screenshot of an example trespass warning (note that the Meklar graphics are currently used as placeholders for all of the races).

WarningTrespass02

Erratic War

The first AI declaration of war is in… the easy one. When the AI has an erratic leader, then there is a 2% chance per turn that he will declare war on you. This one is easy because it is completely self-contained and requires no detection of what is going on in the game.

Below are first contact and declaration of war screenshots. Please note that the font will change (I don’t like it at all) and there are still no animated waving flags for the AI in the shots yet.

Currently, I am working on creating Diplomatic Events for the AI to detect and respond to. The first, and one of the most straightforward, is the Trespassing event along with the associated Warning that the AI may give you.  Hopefully I’ll have that working tomorrow. There are currently 26 planned diplomatic events to code for as well as 30 different notifications (praises, warnings and threats) to work on. So, as you imagine, there is a lot to do just to get the AI to the point where it can have an “intelligent” conversation with the player.

First Contact from the Meklars:

MeklarFirstContact

Followed later by the declaration of war that makes it clear that you are dealing with an erratic leader:

MeklarErraticWar

Fun stuff!

Quantifying the diplomatic AI

In the original Master of Orion, your diplomatic status with various races was generally reduced to 3 items: your treaty status (none/war/peace/pact/alliance), your trade level, and your relations level.

The last item was what controlled the AI’s willingness to deal with you or declare war on you. Because it was a single number, it was fairly trivial to manipulate once you understood what affected it. You could literally be driving two warring races to extinction, but they would be happy with you because you were at least killing the other guy as well.

With 20 years of hardware advances and hindsight, it’s a safe bet that Java MOO will not be internally implementing the diplomacy AI in the same way.

Diplomatic events will be quantified and tracked independently so that a more responsive AI can be coded. Each event will make a positive or negative impact to the relationship which will fade over time, but a time that is variable based on the severity of the event. Some  events will not bother certain races very much at all, while others will more seriously aggravate others. It is up to the players to understand what motivates each AI race and then make moves necessary to achieve his diplomatic goals.

Here’s a listing of the diplomatic events that will be evaluated:

Direct military interactions:

  1. Trespassing – ships in orbit around colonies
  2. Skirmishes – ship battles around colonies or neutral systems
  3. Attacks – direct attacks on colonies
  4. Biological Attacks – same, but with biological weapons
  5. Invasions – troop invasions of colonies
  6. Captures – troop captures of colonies
  7. Destruction – destruction of colonies

Diplomatic interactions:

  1. Establish Treaty
  2. Break Treaty
  3. Declare  War
  4. Offered Tribute
  5. Demanded Tribute
  6. Threatened
  7. Traded Technology
  8. Vote For/Against/Abstain  for Galactic Council
  9. Espionage: Steal Technologies
  10. Sabotage: destroy factories
  11. Sabotage: destroy missile bases
  12. Sabotage: inciting rebellion

Indirect Events:

  1. Local Expansion – founding a colony in ship range
  2. Military Buildup – amassing ships within ship range
  3. Biological Weapons – general use of these weapons
  4. Genocide
  5. Galactic Expansion – becoming dominant  in galaxy
  6. Attacked Ally
  7. Attacked Enemy

These are all of the events currently planned for support. Each will have a separate defined weight (how serious is the event) and rate of decay (how long will it be remember).

In addition, these could be affected by leader personalities and objectives.