Diplomacy

Diplomacy is an act of contacting other factions' councilors, usually to trade, or to bribe them to improve relationship.

Faction Hate
Faction relationships are governed by FactionHate score. This is a float value that determines how poorly a faction feels about another; the higher the score for another faction, the more it's hated. Each faction has a separate hatred score for every other faction, including the aliens.

There are 3 different tiers of hatred levels for human factions:


 * Tolerance: < 20
 * Conflicted: 20 to 50
 * War: >= 50

Visiting trade screen allows determining hate score more precisely. From there, faction attitudes can range between following values:


 * Pleased
 * Tolerant
 * Wary
 * Conflicted
 * Displeased
 * Annoyed
 * Angry
 * Infuriated
 * Outraged
 * Hate

At each level, factions will prioritize aggressive actions and target hated factions more. In addition, they'll also be harder to trade and cooperate with. After the aliens reach the war phase, they'll start attacking faction's ships and habs until the threat drops below 50.

Factions also have a minimum hatred score for each faction. Ideological differences affect this as well as used mission control (MC) cap. If the minimum level climbs above the current hate level, the hate level is moved up to the minimum.

Aggressive actions and combat increases hatred against the attacking faction. There is a table of hatred increasing councilor and military actions below.

Every time a hatred modifier is applied, the value is multiplied by a random value between 0.8 and 1.2. This means that the hatred score changes you get in-game can be between 80% to 120% of the values listed in this post.

Hatred also changes over time. Each faction has a rival (referred to in the code as ) which is the faction that most threatens them. Threat is generated by CPs, tech score, MC usage, etc. Every month, each faction gains hatred for its rival faction and loses hatred for everyone else. The exact formula:

Hatred does not factor into the threat score, so you can be a tolerant faction's rival. If you're doing better than the AI, they'll likely hate you regardless of what you do.

Factions gain hatred for their rival proportionate to how much better the rival is doing:


 * 0 if the faction is ahead of its rival
 * +1 if they're equivalent
 * +2 if they're losing
 * +3 if they're losing by a big margin

If the rival also has an opposing ideology, this gain is increased by +2. Also, unlocking a faction's victory condition increases it by a further +1. For example, the Servant's hatred for the Resistance will increase by +6 every 2 months if the Resistance is their rival, is doing much better, and has victory conditions unlocked.

Hatred decays for all other factions:


 * -1 normally
 * -2 if the factions share a rival
 * -3 if they share a rival with an opposing ideology

Every other month (technically, every even numbered month), hatred also decays according to the above rules for the rival in addition to the usual hatred gain being applied. Following the example above, in August the Servants will both gain +6 hatred and lose -1 hatred for the Resistance. This means that if a faction is very far ahead of its rival and is not ideologically opposed to them (gain is 0), then they will slowly lose hatred for their rival.

Minimum hatred score is typically 0, but is set to 20 (Conflicted) for ideologically opposite factions. This means that you can never become Tolerant of Humanity First as the Protectorate. Conflicted extremist factions can't trade with their ideological opponents (HF and pro-aliens, Servants and anti-aliens).

Faction hatred can grow pretty much infinitely, so if you piss off a faction (or the Aliens) enough, it can become virtually impossible to get them back to Tolerance.

Missions
If a faction detects (and has basic intel on) a councilor of another faction performing an action that affects them and causes hatred on success, they'll gain hatred equal to its success hatred / 2 regardless of whether the action succeeded or not.

Alien Nation specific
Aliens lose hatred by destroying your space and ground assets


 * If the target is not "high value" (not a hab, army, or fleet), -1 hatred in all cases
 * If the Alien nation has formed:
 * If faction has no habs left after combat (they destroyed your last one), -50 hatred
 * If faction has no habs left outside the orbit of Mars, -25 hatred
 * Otherwise if the aliens haven't declared total war on faction, -8 hatred
 * Otherwise, if the aliens haven't declared total war on faction, -5 hatred

Contact with human factions
To conduct diplomacy, a councilor needs to do Contact mission on an adviser of target faction.

It's possible to trade following things:


 * Resources
 * Orgs (including assigned orgs)
 * Habs
 * Engineering projects
 * Non-aggression pact

Trade is the only action that decreases hatred directly. Equal trades decrease hatred by -9 and favorable trades decrease hatred by -18. Having a hatred score above a 6 with a faction hampers your ability to trade with them, so it's important to trade early and often with factions you want to ally.

Faction hatred significantly affects trade favorability:
 * Each faction computes a score for a trade by weighing it against what they have, what they're prioritizing, etc.
 * If hatred is greater than 6, that score is divided by hatred / 5, significantly reducing the trade's favorability score

Aliens
In the code, the aliens are treated as yet another faction, so they have a relationship/hatred score with each faction as well. For the alien faction, there's only 2 tiers: not at war (< 50) and war (>= 50). The alien threat indicator on the intel screen shows the estimated alien hatred level, with each light corresponding to an increase of 10 hatred. However, it's important to remember this is an estimate of the alien's hatred level, whereas the human factions level on the intel screen is accurate.

All of the hatred score rules for the human factions also applies to the aliens. Actions that increase hatred for human factions also increases it for the aliens.

Hatred also changes over time with the aliens. The every other month decay for rivals matters more than for human factions. The aliens will likely evaluate themselves as being ahead of your faction until mid/late game, so their threat level/hatred for your faction will decay even if you're the most powerful human faction to start. However, once you're a significant threat/very advanced, they'll start gaining threat like the other factions.

Unlike human factions, the minimum hatred level is now influenced by MC usage. For anti-alien factions, the minimum hatred level is either  or , whichever is higher. For the other factions (excepting the Servants, which are permanently allied to the aliens and cannot gain hatred), the minimum level is just. Difficulty level modifiers are as follows:


 * Cinematic: 0.05
 * Normal: 0.4
 * Veteran: 0.6
 * Brutal: 1

Some factions have research projects which decrease hate generated by used MC. Only used MC, and not MC cap affects hate levels. This means that increasing your MC usage enough will increase the minimum hatred level past the point of being at war with the aliens. For example, if you have 125 MC on normal, it is impossible to be at peace with the aliens (125 MC * 0.4 = 50).

Servant hatred and alien hatred scores are related. Gaining hatred with one will increase hatred for the other according to the following relationships:


 * If the Servants gain hatred on a faction and can contact the aliens, the aliens gain the same amount of hatred / 4
 * Otherwise, the aliens gain the same amount of hatred / 8
 * If the Aliens gain hatred on a faction and can contact the Servants, the Servants gain the same amount of hatred / 2
 * Otherwise, the Servants gain the same amount of hatred / 4

Same situation applies to the Protectorate, but only if they can contact the Aliens and to a much smaller extent


 * Amount / 10 given to the Aliens for actions against the Protectorate
 * Amount / 3 given to the Protectorate for actions against the Aliens

While it is possible to decrease hatred with the Servants/Protectorate through trade, that decrease does not transfer to the aliens.

Protectorate has a few technologies which allow

The alien threat indicator is only an estimate of the actual alien hatred level. It is stored in  key for each faction. At the start of the game, the estimated level will be at 0 for all factions. In contrast, the actual level will start at 20 for anti-alien factions (the Resistance and Humanity First). Every time hatred increases for the aliens, the hatred value is added to the estimated threat level before the 80-120% variance is applied. As a result, the estimated level change can be higher or lower than the actual change depending on RNG. The estimate is only corrected to the actual value after detaining an alien councilor or contacting the aliens as the Servants/Protectorate. All of these changes means that the alien threat indicator can be wildly off the real alien threat and it shouldn't be trusted before detaining your first alien. Aliens lose hatred by destroying space assets and armies. However, after the aliens declare total war after a certain period of time has passed, this no longer applies (without all of your MC being wiped out). The number of years before total war is declared depends on difficulty:


 * Cinematic: 25 years
 * Normal: 20 years
 * Veteran: 10 years
 * Brutal: 0 years

Aliens also need 300 hate to declare total war.

Note: even on brutal difficulty, the alien's hatred score still needs to reach 50 before they start going after you. Also, if you're playing as the Servants, this relationship is inverted; higher difficulty means more time until the aliens get serious.

Contact aliens
Factions that can speak Hydra language may contact alien operatives. This makes alien threat level. Other than that, there doesn't seem to be a reason to do this. However, there are lines of alien diplomatic contact dialogue in game files:


 * FAC_SubmitCouncil_128.pngnts: Greetings, faithful servant (Kneel, domestic animal ). You are loved (you are nothing ).
 * FAC_AppeaseCouncil_128.pngctorate/War: Yield (die ).
 * FAC_AppeaseCouncil_128.pngctorate/in conflict: Submission=survival (Resistance=obliteration ).
 * FAC_AppeaseCouncil_128.pngctorate/Tolerance: You are tolerated (You present no threat ).
 * FAC_CooperateCouncil_128.pngmy/War: Undesired obstacle (Expunge the threat ).
 * FAC_CooperateCouncil_128.pngmy/In conflict: Cease. Cease. Cease. (Threat. Threat. Threat. ).
 * FAC_CooperateCouncil_128.pngmy/Tolerance: Communication=acceptable (Human=persuadable? ).