@ldvhl - just released the final test BETA (V1d). I don't expect any more changes during the testing period (2 weeks). Will make any needed changes at that time, then release.
@Enginseer - Yes, the AI uses all the covert ops (except for 'conduct reconnaissance'). The attacks are "simulated" - you won't see enemy Covert Operators roaming all over your territory. The AI simply uses civilian units poorly, and as the CO missions can be quite impacting, this represented a huge benefit to the human player.
Current design revolves around 3 basic "components" of the AI CO function:
1. Mission Scheduler: Every turn, the mod checks to see if an AI civ will "schedule" a mission sometime in the future. They can only have a few (dependent on game difficulty) missions "open" at a time. If they are able to launch a mission, the mod checks the AI civ Leader's "Covert Operations Propensity." The COP is a value derived from the Leader's stats (Victory Competitiveness, Boldness, Warmonger Hate, Meanness), Major biases (MAJOR_CIV_APPROACH_WAR, MAJOR_CIV_APPROACH_AFRAID), and Flavors (FLAVOR_ESPIONAGE, FLAVOR_OFFENSE, FLAVOR_DEFENSE). It lets the mod know how likely the Leader is to launch a CO, with more aggressive leaders more likely to launch. The mod rolls a random number and if it beats the COP threshold, then the Scheduler adds a certain number of game turns to the current game turn to determine "when" the attack will occur. This number is "about" 10 turns, but is lower for more difficult games.
The mod then goes through a series of tests to determine "who" the target of the attack will be. About 33% of the time, the target will simply be a random civ the attacker has met. The rest of the time, the mod tests for several factors (does the target civ own our original capital, have they nuked us in the past, are we at war, have they denounced us, are they reckless expanders, have they bullied friendly city states, are they unhappy/very unhappy/super unhappy?). The mod also tests for "power ratios" - i.e. are they much weaker/stronger than us? After a small random adjustment to the overall score, the mod helps the AI civ decide who they're the most mad at, and selects that civ as the target civ.
The "where" the mission will attack is semi random: 25% of the time it will be against the capital, 25% of the time against the largest city in the target civ (by population), and 50% of the time it will be any of the cities in the empire (truly random).
The mod then decides what mission to attack with. This is a simple random selection, based on the level of the attacking civ. In other words, if the civ is in the Medieval Era, it can only use Level 1 and 2 missions. So it will select one of those 6 missions randomly. There are varying random values for each mission, e.g. there is only a 2% chance the "steal city" mission will be selected, demonstrating its potential for devastating international reaction. However, there is a 10% chance that "spreading rumors" will occur, due to its smaller chance of causing a punishing reaction. Basically, the mod will select less impacting missions more often than more impacting missions.
2. Mission Warner: If the human player is the target civ, then about 2-5 turns before that launch, a Notification will show up on the screen giving some warning about the upcoming attack. There are 4 variables in the warning (who is attacking, what mission, target city, what game turn. Depending on the "Espionage Posture" of the target city, there is a better chance of getting detailed information on any of these 4 variable. Espionage Posture is determined by the defensive buildings in that city (e.g. constabulary, police station, covert ops mod buildings, palace, etc.). Additionally, a fraction of the capital's defensive buildings is added, demonstrating the influence of the national government espionage posture on local events (more cities means less overall capital EP influence), and the number of spies the civ has. If the target city has a friendly spy assigned, it will also get a nice bump to the target city's EP.
Sometimes, there are no warnings at all, due to the nature of counterintelligence (CI) work.
These warnings are intended to let the human player know there is another civ is interested in using COs against his civ, and to adjust accordingly. For example, if you receive a Notification that says, "Impending Covert Operation against London in a few turns" - you can purchase buildings that improve Espionage Posture, move one of your spies to that city, or move additional units inside the cultural boundary of the city. Each of these improve the EP and increase the odds of stopping the mission. All units help with this (land units, air units, naval, and civilian), however the Covert Operators (Vagrants, Arsonists, etc.) help much more in blocking these attacks, and serve as a good place to assign older/outdated units - to protect vital cities.
Occasionally, if the civ's EP is high enough, you will receive Notification about attacks that occur in other civs (AI on AI attacks) - with varying degrees of ambiguity.
3. Mission Launcher: When the turn comes to launch the CO, the mod conducts the operation using the same code as for human Covert Operations - with similar results based on similar conditions. The target city's EP will greatly influence whether or not the mission succeeds and also in identifying the attacker. A human player's "friends" (civs we have a DoF with) may decide to denounce or DoW that attacker - but only if he is identified.
--------------------------------------------------------
So - hopefully you can see there is a lot of work going into the AI function - based on useful game features - that hopefully gives the AI a better chance of conducting covert ops in a way that "looks" like a human player conducted it. From what I've seen in the long game tests, in King difficulty games, the AI will launch an operation somewhere on the map about every 3-6 turns. This means the human player will see an attack every 20-30 turns, although sometimes it is much more frequent, especially if the human player has expanded aggressively.
Unfortunately, you won't see AI covert operator units wandering all over the map - which was the original design. It was just impossible to get them to go to specific locations to conduct specific attacks, and they were much too easy to block/prevent due to the AI's inadequate pathfinding code. This means, if I simply surrounded my city with units - any unit (worker/missionary, etc.) - I could prevent an attack from ever happening. There are work arounds for that, but none of them "looked right" during earlier tests. That's why the attacks are now simulated, and hopefully the improvement in AI effectiveness will outweigh that loss of aesthetics.
OK. The mod is "out there..." Appreciate any and all comments on what needs to change to make it better. I'm really trying to scope the mod so it makes the basic Civ V game more interesting/challenging/fun, but not break the game, either with an OP human feature or a massive distraction from normal game play ensuring one's EP is just right for each city.
Thanks!