• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Rascal Nag

Sergeant
62 Badges
Jan 22, 2013
63
144
  • Crusader Kings II
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • Victoria 2: A House Divided
  • Stellaris
  • Sengoku
  • Victoria 2
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Mount & Blade: Warband
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Conclave
  • Stellaris: Nemesis
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Tyranny - Bastards Wound
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Necroids
  • Europa Universalis III Complete
  • Crusader Kings III
  • Europa Universalis III Complete
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Crusader Kings II: Holy Fury
  • Stellaris: Megacorp
  • Europa Universalis IV
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Victoria 2: Heart of Darkness
  • Semper Fi
  • Darkest Hour
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis III
  • Europa Universalis III Complete
First, I put this here because I'm not sure where else it would be appropriate, it isn't modding per se since I don't intend to change anything and am not running any mods, but it isn't a glitch or anything like that. Hopefully this is the right place.

So I was always curious why lots of diplomacy in HOI3 is basically hopeless, with many interesting avenues of play met with a demoralizing "Impossible" response when trying to do things like offer alliances and what not to chart your own course against history. I decided to look into the scripts and I found two things:

  1. Diplomatic distance is broken - say you are playing as Poland and want to try to ally with one of your neighbors to help when Germany attacks. Well, even if I border, say, Romania, their evaluation of me gets a -60 plus modifier because diplomatic distance is literally just the kilometer distance between capitals, and that divided by 10 is the calculated malus to acceptance chances.
  2. There are "Friendliness" and "Antagonism" values. Half of antagonism is a malus to the acceptance score, half of friendliness is a bonus - this is NOT relations. Relations is separate and is a direct malus if negative, or is divided by 10 and added as a bonus if positive.
The methods for determining friendliness and antagonism appear to be C++ functions, so I can't figure out what they do, but I am madly curious about it. They are functions of the "TargetStrategy" class and they simply take the relevant country's tag and tell you how friendly/antagonistic they are towards the country being offered the alliance:

Code:
            loDiploScoreObj.Score = loDiploScoreObj.Score + loDiploScoreObj.TargetStrategy:GetFriendliness(loDiploScoreObj.ministerTag) / 2
            loDiploScoreObj.Score = loDiploScoreObj.Score - loDiploScoreObj.TargetStrategy:GetAntagonism(loDiploScoreObj.ministerTag) / 2

That's Hearts of Iron 3/tfh/scripts/ai_diplomacy.lua.

Now, my intuition is that this is supposed to be the target country's "strategy" in the sense that this is how they view the nations of the world and these values are hardcoded somewhere to try to get countries to be friendly with their historical friends and enemies with their historical enemies. So the function is probably doing little more than grabbing a value from a map or something. But it does change over the course of the game. Probably just decays over time (though maybe not at a constant rate, nor one that is consistent between countries), but I REALLY wanted to just ask for the hell of it how one can change it if possible. Can I influence it with diplomatic actions? Intelligence? I don't think it has to do with alignment either, but I could be wrong.

If anyone else has dug into this before and pulled up answers, please share them!

Or, if anyone at paradox is interested in pulling back the veil on these two functions and satisfying my curiosity, I would be very grateful. I beg you!
 
A) best bet would be to check with the Mod forums, they *might* have something about it (I've never seen these brought up though).

B) the function is basically saying:

"New Diplomacy Score = Old Score (+/-) half of the ministerTag."

Why it's halved, no idea (why wouldn't they have just halved all of the input values and saved a calculation, beyond me). What the methodology is, also no idea, but I'd imagine that it only impacts the AI (given that it's in the AI file). You can see in save game files that some nations have an "antagonize" or "befriend" listing on their diplomatic relationship section. Thinking about it, it might be how the AI determines if they're trying to swing one way or the other, and it looks like it's based on ministry input (think the ministers that sway one way or the other).
 
  • 1Like
Reactions:
You can see in save game files that some nations have an "antagonize" or "befriend" listing on their diplomatic relationship section. Thinking about it, it might be how the AI determines if they're trying to swing one way or the other, and it looks like it's based on ministry input (think the ministers that sway one way or the other).

Ah, good catch in the save files. It looks like the values in there are actually the same as the values I see when the calculation of the offer likelihood is made, so that only leaves what initially sets them and how they decay over time (never have seen them increase). Also, I think the minister bit is an abbreviation for the ad"minister"ing country, though it would be interesting to see if ministers can have an effect on the evolution of this antagonize/befriend thing over time. Another thing, I think a coup resets it; I got Czechoslovakia to flip to social conservatism as Poland and from then on the values were both 0. I may also follow your suggestion of asking the mod forums at some point as well to try to get more info.
 
Ministers do have the affinity functions:

Great Compromiser
  • Susceptibility to Axis +10%
Cloak-And-Dagger Schemer
  • Susceptibility to Allies +10%
Biased Intellectual
  • Susceptibility to Comintern +10%

Per the wiki. I think this drift is "working" (ie, some of the minister tech decays weren't).

I can't recall how specifically these work.

EDIT: Can confirm from posts that they do work, however, they don't "help" if you're already in a faction.
 
Last edited:
  • 1
Reactions:
Unfortunately, a lot of stuff in HOI3 was scrapped after the AI proved to be completely out of control in the initial release of the game. The entire sandbox Diplomacy system was rather hurriedly replaced by a scripted set of events and decisions, but bits of the old code and other things still remain. This may be one of them, with a purpose that no longer exists, but it would probably take one of the developers who actually worked on it to verify or refute that.
 
  • 4
Reactions:
Yeah, it definitely feels like either a holdover, or an addition as part of the effort to keep things from getting too crazy. Either way, not something one would be able to really be sure of, let alone change, without intervention from devs like you said. But thank you for the very helpful info! Kinda makes me wonder if one could mod the game enough to get a decent new score evaluation in place, using things one could influence like alignment proximity and mutual threats instead of this antagonize/befriend thing. Probably would be quite the undertaking, though.
 
I've been agitating for Paradox to let some of the modders and myself try for a community developed "DH"-style treatment for HoI3, but apparently, that would require a licensing agreement and they don't want to do that, even if it was only to make sure that the remaining bugs were corrected. Phooey.
 
  • 1Like
  • 1
Reactions:
Unfortunately, a lot of stuff in HOI3 was scrapped after the AI proved to be completely out of control in the initial release of the game. The entire sandbox Diplomacy system was rather hurriedly replaced by a scripted set of events and decisions, but bits of the old code and other things still remain. This may be one of them, with a purpose that no longer exists, but it would probably take one of the developers who actually worked on it to verify or refute that.
Yeah, vanilla HoI3 diplomacy was a total mess where any country with some leadership could basically pull off anything - Nazi US in 1939 was the least of the shenanigans possible. So instead of fixing it, Pdox just scrapped it and put in instead hard-coded things, like Turkey and Sweden always remaining neutral, and so on. Diplomacy now is only about trade deals and inviting your historical allies into your alliance at roughly the right time period.
 
i was initially impressed with the way Paradox set up Relations between each country, which apparently took a fair amount of historical research, but that positive first impression quickly led to disappointment when countries started forming alliances and placing guarantees at random, clearly without any constraints or rational reason behind it. Anything even remotely resembling WWII was purely accidental, although there were plenty of small, ludicrous wars, such as between Tibet and Paraguay. When the wonky diplomacy system was scrapped and replaced by scripted actions in the first couple of patches, all of that went out the window. The vast majority of countries were given 75 Relations, except for faction members who all got 0 with everyone outside their faction, plus between a few historical allies, who got higher values (200 between Italy and Germany, despite Italy being initially opposed to Germany annexing Austria).

The new values were put in place in a screaming rush to fix the game, and never reset to something rational. If anyone is able to get permission to mod the .exe and put the game back to what it was originally intended to be, they can use those original numbers, assuming that they have a copy of the original base game. Considering how absolutely terrible the game was upon release, it's amazing how far it came. I still mourn for what the game could have been if the diplomacy system had worked: a semi-sandbox game based on what MIGHT have happened in 1936 through 1945, rather than being tightly constrained by what actually did happen or venturing off into what would never have happened. Italy siding with Austria against Germany - quite possible. Japan declaring war on Finland - absurd.
 
Last edited:
  • 3Like
Reactions:
Diplomatic distance is broken - say you are playing as Poland and want to try to ally with one of your neighbors to help when Germany attacks. Well, even if I border, say, Romania, their evaluation of me gets a -60 plus modifier because diplomatic distance is literally just the kilometer distance between capitals, and that divided by 10 is the calculated malus to acceptance chances.
There is nothing relevant I can tell you about the math behind the curtains, but did you try to move Poland in the diplomatic triangle towards the country you intend allying with, e.g. Romania? By coming ideologically in the vicinity of that country, once the threshold has been reached an alliance should be on the table.
In order to achieve this there are a several instruments like:

1) trade (200 relations)
2) choosing the right foreign ministers
3) choosing to move towards the alliance (in the diplomacy screen) where that country is heading to untill you come close enough to it
4) Influencing the target via espionage (that's way too expensive for Poland though)
5) keeping threat low by not ammassing troops at the common border.
 
There is nothing relevant I can tell you about the math behind the curtains, but did you try to move Poland in the diplomatic triangle towards the country you intend allying with, e.g. Romania? By coming ideologically in the vicinity of that country, once the threshold has been reached an alliance should be on the table.
In order to achieve this there are a several instruments like:

1) trade (200 relations)
2) choosing the right foreign ministers
3) choosing to move towards the alliance (in the diplomacy screen) where that country is heading to untill you come close enough to it
4) Influencing the target via espionage (that's way too expensive for Poland though)
5) keeping threat low by not ammassing troops at the common border.
Mostly good advice, but remember that direct Influence is only available to countries with over 100 base IC, except for a couple of Axis-leaning countries that were allowed to influence with less than 100 base IC (Japan, Itlay), as well as in a faction. Poland not only can't afford the Leadership cost, it can't do it.

What you can do with spies is support their political party that's closest to your own, if it's not similar to yours. It won't work quickly, but can have a decent impact in the long run.
 
  • 1Like
Reactions:
What you can do with spies is support their political party that's closest to your own, if it's not similar to yours. It won't work quickly, but can have a decent impact in the long run.

Agreed with your observations.

@Rascal Nag, you might find something of interest on the topic from this text I found on a personal manual, where I'm noting everything new and relevant. Can't say who is the original source.

"To enable the option to invite a country to your faction:
  • The target country must be closely aligned to your faction (use Influence Nation [, or align to a faction leader in the direction of the prospective ally]);
  • The target country must have an effective neutrality less than 25 (use Increase Threat on one of their neighbours).
This will make the "invite to faction" option available. Whether or not a target will accept the invitation is based on:
  • The enemy of my enemy is my friend: If you and your target are at war with the same country, they will accept your invitation to the faction automatically. This criterion overrides all other effects.
  • Acceptance chance: The game calculates an acceptance "score" from 0% to 100%, which is based only on the following three factors:
    • Your target's base neutrality, which is independent of how threatened they feel
    • If the target's governing ideology is the same, the chance increases by 10%
    • Country specific modifiers."
It looks like your efforts to ally with Hungary or Romania must surpass some serious hurdles, especially the under 25 Neutrality conditionality. The reason might be that the game developers wanted the war to evolve along historical lines.
 
Last edited:
  • 1Like
Reactions:
Yes, ultimately the biggest hurdle is the stuff behind the curtains. I do not know what affects those variables (could be any or all of the things you mentioned), but maybe some more experimentation will reveal some ways to influence it. I couldn't get a good read on whether or not these values changed dynamically or only with time, other than a coup seeming to reset them. Even then, the diplomatic distance thing is a huge malus.

Looking at ai_diplomacy.lua reveals only a few ways to improve one's chances:

  1. Have good relations - up to a 20 point bonus (relations/10)
  2. Be of the same ideology (+10)
  3. Be fighting the same people (+20)
  4. Have "friendliness" with them (half of friendliness is added to the score)
Unfortunately, the last one is not in the player's control (At least not directly - it looks like a variable determined by each country's particular "strategy", which changes over time, but maybe it can be influenced), the third one is not in play for Poland and Romania under normal circumstances, and the remaining options only provide +30, which is not enough to overcome the over 60 point malus from distance. Only potential option I can imagine is a coup, which I believe resets friendliness/antagonism (antagonism is big for Poland and Romania at game start), and then hoping friendliness grows over time in certain cases. But the coup would need to happen very early and friendliness would need to grow quite a bit - at least to 70 or 80 to get the score positive after the distance malus, and much further to make it likely. All big question marks.

Here's an interesting potential bug, though. The ai for figuring out if one should guarantee a country has this section:

Code:
 -- Now add our relations
        if loDiploScoreObj.Relation > 10 then
            loDiploScoreObj.Score = loDiploScoreObj.Score + (loDiploScoreObj.Relation / 10)
        else
            loDiploScoreObj.Score = loDiploScoreObj.Score - loDiploScoreObj.Relation
        end

Looks like you could greatly inflate your chances of getting a guarantee by getting yourself hated by a country, thanks to a flipped sign in the else block - if relations are negative 200, you would actually GAIN 200 to the evaluation of that guarantee. Would absolutely be an exploit, but maybe it could get you an otherwise impossible defensive ally. Worth trying out.
 
  • 1
Reactions:
Sometimes, even basic maths escapes us... The logic should first check to see if relations are above a certain level of positive (because the negation would mean that we don't bother); then start doing the maths to see if it is reasonable, rather than any of that.

But the Luas were so full of bugs I'm not surprised that it's a thing.