"Covert Operations" Mod Collaboration Thread

Currently working on the AI Covert Ops function. Spent most of yesterday testing AI missions, cleaning up the code so it better accommodates AI on AI attacks, notifications, etc.

Today, the focus is on the 1st component of the AI function: when & how the AI decides to attack. I'm looking at 9 different aspects of a "leader", and weighting those values to come up with a "Covert Operations Propensity" (COP) coefficient. The variables in the formula are: Victory Competitiveness, Boldness, Warmonger Hate, Meanness, Approach to War, Approach to Fear, Espionage Flavor, Offense Flavor, and Defense Flavor.

The formula weights each of these variables based on how important they are to the leader when deciding whether to launch an operation or not. The formula uses these values to determine just how aggressive the leader is. Most of the aspects "add" to the total value, but the Approach to Fear and Defense Flavor actually subtract from that total value - i.e. the more "afraid" a leader is, the less likely they are to do something so monstrous as unconventional warfare...

Below is a snapshot of the spreadsheet I've used to derive the COP value. The numbers in yellow are the weighting values, demonstrating relative importance to the overall calculation. I'm leaning towards using the 33% adjusted numbers at the bottom. This would mean that if on a given game turn and the leader has the option to launch an attack, this number represents the percentage change that they will.

upload_2018-1-13_4-30-26.jpeg

I'm still working through what constitutes what gives the leader the option to attack. At this moment, it depends on how many "Scheduled but not executed missions" the leader has open (currently 3 is the max) and how many turns since the last mission occurred (currently 10 turns). So, a leader can only have 3 open missions, and the last mission had to have taken place 10 or more turns ago. If those conditions are true, they have the "option" to launch this turn - based on the adjusted numbers in the spreadsheet.

For example,
- Elizabeth has 2 open missions, and the last mission executed 8 turns ago. She does not have the option to launch.
- Alexander has 2 open missions, and the last mission executed 12 turns ago. He has a 33% chance to schedule a mission this turn.
- Askia has 3 open missions. He does not have the option to launch.

These numbers are subject to change. In fact, they're moving all the time as I run more and more 500+ turn Live Tuner games and collect data on how many missions were launched, by whom, against whom, and the total changes made (how extensive the game impact). Obviously, this will also change after players start telling me "it's too much" or "it's not enough" during testing. I still wanted to at least attempt to get the frequency of attacks looking somewhat a player would expect.

Any thoughts?
 
Am finished with the AI portion of the CO mod and pretty much like how it's going. Am running some 500+ turn test games now to see how often the AI uses the missions and see how the various functions (target picker, mission picker, etc.) are working. So far, I'm liking what I'm seeing.

I've added the possibility of an occasional "RUMINT" (military slang for intelligence based on rumor) Notification that occasionally appears during the human player turn - informing them of various covert missions happening around the world. Eventually, I'll add the limiting factor of only displaying notifications for civs the human player has already met, but for now it's kinda cool to see how much AI activity there is out there. The notifications over variations to the report, based on how good the human player's espionage aparatus is. Sometimes the report is total crap, sometimes very detailed.

Some screenshots to show how it works:

upload_2018-1-14_18-27-55.jpeg upload_2018-1-14_18-28-1.jpeg upload_2018-1-14_18-28-6.jpeg upload_2018-1-14_18-28-12.jpeg upload_2018-1-14_18-28-17.jpeg upload_2018-1-14_18-28-22.jpeg upload_2018-1-14_18-28-27.jpeg upload_2018-1-14_18-28-31.jpeg upload_2018-1-14_18-28-36.jpeg

Still a few more items to clean up (removing all the testing adjustments), but I'm hoping to release a version today. Should make playing the mod more fun if the AI can hit back. And it does... :lol:
 
Last edited:
Latest version released (V1c) - This one has the AI Covert Mission Function included. So, at least from here out, they're shooting back....

Appreciate your feedback - especially concerning too many attacks, not enough, etc. The intent is to make the game more "interesting" but not a headache in the process.
 
Latest version released (V1d) - which I think will be the final BETA for testing.

I'll collect feedback for a couple of weeks, then make any needed changes to prepare for final release both here and on Steam.

Thanks everyone for all the help!
 
Received a very interesting suggestion from @havox79 - he asked about the possibility of eliminating the human-only units and using the human attacks in the same way the AI does - virtually.

I think it's quite possible I could layer a button on top of the "Espionage Overview" UI that could be used to launch a mission - whether by restricting the ops to only in cities where you have a spy or open it up to any city you have visibility to.

Would this be preferable or would you rather keep the units in the game for the human player?
 
HEADS UP!!!!

In the next couple of days, I'll be coming back to this mod to finish it for BETA. If you have any feedback, I'd really appreciate it if you can let me know immediately.

I'm especially interested in your thoughts about whether the mod should go "unitless" and only manage covert operations via the Espionage Overview UI or not.

THANKS!

ps. Teaser pics for "unitless" CO Mod:

upload_2018-1-31_11-58-31.jpeg upload_2018-1-31_11-58-35.jpeg upload_2018-2-1_11-12-4.jpeg upload_2018-2-1_10-47-21.jpeg upload_2018-2-1_11-9-47.jpeg upload_2018-2-1_15-33-33.jpeg upload_2018-2-1_17-46-39.jpeg upload_2018-2-2_5-36-15.jpeg
 
Last edited:
V3 released - both here and on Steam. Pretty major update:

Cleaned up/simplified mission removal process. It is now possible to make a small, simple text change in the Globals file that will safely remove an unwanted mission from the game.

Added several popup menu pre-checks. The "You Can Launch a CO" notification now only appears if the human player actually has at least 1 valid mission that can be legally conducted. Before, you would get the Notification, even if all your spies were moving and unable to actually conduct a mission.

Menu Pre-Checks: Missions that cannot possibly succeed are removed from the menu so they cannot be chosen. For example, if there are no Great Persons around a target city, you will not see the "Assassinate Great Person" mission on the menu. If there are no target civ units near the city, the "Sabotage Unit" will not appear. If there are no improvements, then "Pillage Improvement" will not appear. If the attacking civ has no spare Uranium, then the "Nuclear Suitcase" mission will not appear, etc.

Nerfed mission success chances and lowered frequency of AI mission launches.

Added the "Nuclear Suitcase" mission. New mission damages city defenses, units, and leaves fallout – both on the ground and in the political environment. A civ must have 1 free Uranium resource to conduct the mission.

Added a check to the AI Target Selection routine that cuts the chance roughly in half of a civ becoming the target of an attack if they have a DOF with the attacking civ. Making friends with other civs will definitely lower your chances of being attacked with Covert Ops by them!

Added difficulty-based AI mission success adjustment, so that at higher difficulties, the AI has a greater chance of CO mission success. At King, there is now +2% increased chance of success; at Emperor +4, at Immortal +6, and at Deity +8.

Buffed Agent Rank impact to Espionage Posture.

Fixed formula error in Steal Gold mission so it would get the correct amount of gold.

Increased chance of perma-war, decrease chance of allied denounce/DoW.

Fixed an error in the "Sabotage Production" mission that did not remove the correct amount of production for National Wonders.

Modified AI mission selection function to allow a wider variety of mission choices when AI is low on Gold; expanded possible random missions so later eras would see more advanced missions.

Adjusted the AI mission scheduling routine, so they would not schedule missions too early in the game.

Added improved international response messages when the human player is the target civ; increased the chances of getting more details about the attack and attacking civ.

Changed AT Target Selection function so that it now also considers known civs with the highest score as an additional criterion in deciding who to attack.

Changed "Poison Wells" and "Spread Plague" missions so they remove all excess food from the city. Buffed upper limit to population loss.

Increased the occurrence of Foreign Intel Reports (FIR) – and increased chances of getting more details in those reports.

Added a test to AI Mission Execution function, so that now an attacking civ must be alive at time of launch, not just at time of scheduling.

Increased the Palace, Police Station, National Intelligence Agency impact on Espionage Posture.

Added a stat collecting/reporting function to assist in better setting mission success, international response, and other criteria.

Added a random adjustment to the "Combat Ops Propensity" values for each leader – which should provide some variety in leader behavior between games.

Fixed several formatting issues with the popup windows, which were squeezing text placement at the top of the messages and cropping text from the bottom of the popup.

Changed the Conduct Recon mission reports so that no "number of nuclear units" report will occur before the target civ reaches the Atomic Era.

Cleaned up code/globals, removing non-used legacy code.
 
Sorry, @pyramids, I'm not sure about compatibility. If that mod doesn't replace the "EspionageOverview.lua" file then there's a pretty good chance this mod will work. If it does replace that UI, then there's a very good chance it won't.

If you do give it a try, please let me know how it works. If there's a problem, maybe I can make some changes here to get it working better. Thanks.
 
You would have to edit the "00_Globals.lua" file in the mod's LUA directory, usually located some place like:

C:\Users\XXX\Documents\My Games\Sid Meier's Civilization 5\MODS\Covert Operations - Making Spies Great Again (v 4)\LUA\CovertOperations

You're looking for a line that looks like this:

[STEAL_CITY] = { "Steal City", 33, 75, 5, 5.00, ERA_POSTMODERN_ID, 3, NO, NO, 0, 0, 0, YES },

You need to change the 'ERA_POSTMODERN_ID' to 'ERA_CLASSICAL_ID'

Then save, exit, and reload the mod.

Note of warning - I haven't tested the mission cost formula for Steal City in the Ancient Era. It might be ridiculously cheap, and therefore OP.
 
Hello everyone - New version (V5) is published - both here and on Steam.

Big changes include fixing the denouncements by unknown Civs and the error that corrupted the Espionage Overview when you used the Escape key.

Full summary of changes:

- Removed the possibility of denouncements from unknown Civs.

- Fixed the "Covert Ops Menu" problem that when you used the Escape key to exit the "Espionage Overview UI" it would corrupt the entire UI. Using the ESC key is now safe.

- Changed the ToolTip when you hover over a Mission in the "Covert Ops Menu" – it now factors in relative Espionage Postures in adjusting the "Odds of Mission Success" and "Odds of International Response." The odds show will be much closer to reality than the generic chances shown before.

- Ideologies now impact Covert Ops. Civs with Autocracy perform better than normal, Civs with Freedom perform worse, while Civs with Order (or no Ideology) perform normally.

- Having certain Social Policies can improve or harm Covert Ops performance: Aesthetics, Republic, Ethics, Cultural Diplomacy, Treasure Fleets, and Humanism lower Covert Ops performance. Citizenship, Military Caste, and Professional Army improve Covert Ops performance.

- The function that selects the target Civ for AI Covert Ops now also considers game score. The function now sometimes will select targets based on higher score.

- The function that selects the target Civ for AI Covert Ops now will not allow Civs on the same team to be attacked by other Civs on that team.

- The function that selects the target city for Covert Ops now factors in 'visibility' –the attacking Civ must be able to "see" the city in order to attack it. However, the target Civ's capital is always available to be attacked, regardless of attacking Civ visibility.

- Added the ability to remove notifications of an available Covert Op by changing a setting in the "Enable/Disable Covert Op Popup."

- Nerfed the chance for 'Permanent War' as a response to a Covert Op in half (now is 2%).

- When looking at a specific Spy who is assigned in a foreign city, the ToolTip in the left-side panel contains basic information about the city and owning Civ – similar to some of the data in Reconnaissance Reports.

- The cost of the 'Conduct Reconnaissance' mission is greatly reduced, as is the possibility of an international response.

- Conducted further testing to ensure compatibility with the "SMAN's World at War" main mod.

- Cleaned up a few typos and other code issues.
 
Last edited:
i found some bugs using the mod:

Rumors don't work:
upload_2019-4-16_21-47-52.png

My friends don't record any impact, 11 cultures per turn before i launch the rumors, and during 10 turns nothing happens

BUGS where you recieve information about player/AI you don't yet have discovered:
upload_2019-4-16_21-50-50.png


I will add that rumors are WAY WAY too punishing, i launch it successfuly 3 times and without the bug, my friend during 51 turns would generate 1 culture per turn.

The major problem either how easy it is to launch it or the massive amount you inflinct to the culture of your victim


EDIT: After reading the code it appears i misunderstood how rumors works^^ it works fine
 
Last edited:
after checking the code i notice that having a spy protecting your cities does not increase the % of failure from ennemies operation, this would be a good addition.

Edit: Also in order to avoid "spam" propaganda or poison well, or else, maybe the cost should rise? or for operation like propaganda, there is a limit of culture/golden age you can reduce.
 
Last edited:
@Cat - great profile pic! I love it, and cringe at the same time! :mischief:

The denouncements from unknown civs should have stopped with the latest version (V5). I removed all of the interaction with the game's Diplomacy system. Did you encounter these denunciations after clearing the game cache and starting a new game? Man, I hope not! :crazyeye:

I had intended to start working on improving VP compatibility with several of my mods - and started with getting the main 'World at War' mod VP compatible. Then I got jumped on by one of the VP developers for having the audacity of reusing a single icon, even though it's allowed under the Modiquette here. They then demanded I remove the icon and republish the offending mod. I promptly did so, then ceased work on anything related to VP compatibility. So, if you'd like expanded VP capability, I'd suggest you take it up with them. Let them provide all the content you want. I'm no longer interested in wasting precious hours on making things work with a mod I don't use in the first place.

The spy in the friendly city impacts the likelihood of successful attack by improving the city's defensive Espionage Posture. The delta between the attacker EP and the defender EP is the actual determinant on whether an attack is successful or not (with a little help from RNGesus). Having a spy raises it, as do several defensive buildings, the number of friendly units in the city's boundaries, etc. The local friendly spy is, actually, the largest influencer on defensive EP.

The point about adjusting cost or impact of propaganda/rumors is well-taken. Many people have reported this as too game-changing. So, in the next mod, I'll probably raise both, but with a lower chance of international response.
 
Hey thanks for your reply^^

The denouncements from unknown civs should have stopped with the latest version (V5). I removed all of the interaction with the game's Diplomacy system. Did you encounter these denunciations after clearing the game cache and starting a new game? Man, I hope not! :crazyeye:

unfortunatly, i... cleared the cache and still i get denounce by civ i did not encounter ^^'
I had intended to start working on improving VP compatibility with several of my mods - and started with getting the main 'World at War' mod VP compatible. Then I got jumped on by one of the VP developers for having the audacity of reusing a single icon, even though it's allowed under the Modiquette here. They then demanded I remove the icon and republish the offending mod. I promptly did so, then ceased work on anything related to VP compatibility. So, if you'd like expanded VP capability, I'd suggest you take it up with them. Let them provide all the content you want. I'm no longer interested in wasting precious hours on making things work with a mod I don't use in the first place.
Wow.. Did not know thoses things could happen between modders.

The spy in the friendly city impacts the likelihood of successful attack by improving the city's defensive Espionage Posture. The delta between the attacker EP and the defender EP is the actual determinant on whether an attack is successful or not (with a little help from RNGesus). Having a spy raises it, as do several defensive buildings, the number of friendly units in the city's boundaries, etc. The local friendly spy is, actually, the largest influencer on defensive EP.
Yeah after reading the code, i saw that the spies reduce the chance of success, but they can't be killed in case of failure if i'm not misunderstanding?

The point about adjusting cost or impact of propaganda/rumors is well-taken. Many people have reported this as too game-changing. So, in the next mod, I'll probably raise both, but with a lower chance of international response.
Good to read that :thumbsup:

Also i want to add that since i most likely play in multiplayer, is there a way to remove international response when a human player is the target? Because some times, this can lead to a very embarrassing situation where you didn't want to war (because you have less army than your opponent) and your neighboor who has a bigger army is very pleased by your international response:p

@Cat - great profile pic! I love it, and cringe at the same time! :mischief:

why cringe^^ ? because of "omelette du fromage":smug:
 
Top Bottom