• 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.
That is not how that system works. The focuses set to 1 are never chosen and the choice is between the 12 and the 10. We could fix this (and I have pushed for it before) but it shouldn't be as big of an issue come 1.6 anyway.
That's not true, I saw army innovations being picked once (out of +200 attempts), and that one has a weight of 1. So obviously they get picked but in a different way as the actual data suggests.
 
Last edited:
I checked the code and I see nothing that prevents picking focuses with weight 1. The weighting is skewed however and does not work like in other places that use weights like this. Each focus rolls a die from 0 up to its ai_will_do value and the largest value wins. For example if one focus with ai_will_do 1 is available and another with ai_will_do 2 the pick ratio the latter wins in 50% of the cases where it rolls above 1 and half of the remaining cases where both roll between 0 and 1. So the pick rate is not 33% vs 66% but actually 25% vs 75%. Simulating this method with all the German starting focus weights 100000 times I get ~136 times Oppose Hitler, i.e. it takes on average 735 games to get this start.

Code:
import random
successes = 0
for i in range(100000):
    fourYearPlan = random.random()*10
    airInno = random.random()*1
    armyInno = random.random()*1
    rheinland = random.random()*12
    oppose = random.random()*1
    naval = random.random()*1
    successes += oppose > max(fourYearPlan,airInno,armyInno,rheinland,naval)

Edit: also the dice roll is not done for ai_will_do's below 1; this means 0.999 is twice as likely to be picked as 1.0
 
Last edited:
That is not how that system works. The focuses set to 1 are never chosen and the choice is between the 12 and the 10. We could fix this (and I have pushed for it before) but it shouldn't be as big of an issue come 1.6 anyway.

When i was playing WoW a few years ago i read the one of the changes made to the RNG was the "bad luck" system, basically, since there are millions of players the worst possible odds will happen to thousands of them, and so they implemented this system to prevent horrible luck from happening, i don't know the formula they used but it prevents players from having a string of bad luck specially when looting items required for quests.

I would like there to be a similar system for HoI where the AI knows it hasn't picked a certain focus path for a long time and so this next game it will fudge the numbers to pick it. I'd like to experience every possible combination of focus paths every country has available, at least at the beggining, France going fasicst never happens for example, or the Soviet Union losing the civil war, it never happens either...
 
Then why have an a-historical mode then? If the AI will never pick unlikely options because they are weighted so low?

Another reason is that there was incredible backlash at the bare notion of it even being conceivable of AI Germany ever going ahistorical, so when it was discovered that there is an issue in the weightings (AFAIK any focuses with less than 1/3rd of the chance of other foci never get picked) I didn't increase the value for Oppose Hitler. As stated, with 1.6 it won't be an issue anymore, since if you want Oppose Hitler to get picked you can set the AI to do so.
 
I checked the code and I see nothing that prevents picking focuses with weight 1. The weighting is skewed however and does not work like in other places that use weights like this. Each focus rolls a die from 0 up to its ai_will_do value and the largest value wins. For example if one focus with ai_will_do 2 is available and another with ai_will_do 4 the pick ratio the latter wins in 50% of the cases where it rolls above 1 and half of the remaining cases where both roll between 0 and 1. So the pick rate is not 33% vs 66% but actually 25% vs 75%. Simulating this method with all the German starting focus weights 100000 times I get ~136 times Oppose Hitler, i.e. it takes on average 735 games to get this start.

Code:
import random
successes = 0
for i in range(100000):
    fourYearPlan = random.random()*10
    airInno = random.random()*1
    armyInno = random.random()*1
    rheinland = random.random()*12
    oppose = random.random()*1
    naval = random.random()*1
    successes += oppose > max(fourYearPlan,airInno,armyInno,rheinland,naval)

Edit: also the dice roll is not done for ai_will_do's below 1; this means 0.999 is twice as likely to be picked as 1.0

We were specifically told by the person who made the system that this is not how it works. There is no dice roll on the base value, it just takes the ai_weight of all the available focuses, adds a random value of up to 50% to it, and then picks the focus with the highest value. That means if a focus is not within 50% of the base value of the highest available focus, it will never be picked.
 
Then why have an a-historical mode then? If the AI will never pick unlikely options because they are weighted so low?

I'm not trying to be snarky, but why would you want Germany to go ahistorical in HOI?
Genuinely curious.

This goes for OP too, I guess.
 
I'm not trying to be snarky, but why would you want Germany to go ahistorical in HOI?
Genuinely curious.

This goes for OP too, I guess.
Well, the most obvious example is when you're doing an Austria-Hungary run, the last thing you want is Germany demanding the sudetenland :p
I have had plenty of times where i'm trying something wacky, only for it to fail and think "If only Major power X had gone A-historical, then Y wouldn't have happend and i would've won" or something along these lines :)
 
It hasn't been brought up so far, at least through my quick skimming of posts, but what nation and ideology are you playing as? Also what focuses are Germany picking first?

I've had ahistorical Germany pick both the Industry and Military tree first several times in my ahistorical games before picking one or the other of the political options. My last game as a Mouvement Franciste Franch saw Germany oppose Hitler and I had to deal with a Democratic Germany. Wasn't quite what I wanted but c'est la vie. I've also seen the opposition fail a few times too.
 
When i was playing WoW a few years ago i read the one of the changes made to the RNG was the "bad luck" system, basically, since there are millions of players the worst possible odds will happen to thousands of them, and so they implemented this system to prevent horrible luck from happening, i don't know the formula they used but it prevents players from having a string of bad luck specially when looting items required for quests.

I would like there to be a similar system for HoI where the AI knows it hasn't picked a certain focus path for a long time and so this next game it will fudge the numbers to pick it. I'd like to experience every possible combination of focus paths every country has available, at least at the beggining, France going fasicst never happens for example, or the Soviet Union losing the civil war, it never happens either...

The WoW mechanic was basically that loot chances for a quest item would increase with each kill and reset to baseline each time the item spawned. It effectively created a maximum amount of kills you needed to complete the quest. Really a quite clever system actually!
 
I'm not trying to be snarky, but why would you want Germany to go ahistorical in HOI?
Genuinely curious.

This goes for OP too, I guess.

Why not? It is interesting and changes up the gameplay. But specifically, I wanted to recreate the Central Powers (but not as Germany) and get few achievements out of the way.
 
Simulating this method with all the German starting focus weights 100000 times I get ~136 times Oppose Hitler, i.e. it takes on average 735 games to get this start.

Edit: also the dice roll is not done for ai_will_do's below 1; this means 0.999 is twice as likely to be picked as 1.0

This lines up more with when I saw with the AI pick Army Innovations as the first focus, it took over 200 game starts to see that start. But 735 is more dire, I guess I have to wait for 1.6 to play my game, no harm in putting HOI4 down and picking up EU4 for now.
 
As stated, with 1.6 it won't be an issue anymore, since if you want Oppose Hitler to get picked you can set the AI to do so.
But as far as i understood, 1.6 game rules are not achievement-friendly. So it will be the same issue still
And for me main question most important quesion is - can we have true random ai behavior? I wouldn't want to specifically set Germany to pick opose Hitler focus, but if it would happen on its own in some games - would be very cool.
 
One thing I've seen asked for (and have asked myself) is to have a crazy ahistorical setting where the weights are all pretty much the same on the political trees. Seems reasonable to me.
 
Some of us would still want an ahistorical game where these things could happen randomly. I appreciate that we can choose AI GER to Oppose Hitler in 1.6 but it would be nice if it could choose this for itself once in a while, with historical off.
 
We were specifically told by the person who made the system that this is not how it works. There is no dice roll on the base value, it just takes the ai_weight of all the available focuses, adds a random value of up to 50% to it, and then picks the focus with the highest value. That means if a focus is not within 50% of the base value of the highest available focus, it will never be picked.
For anyone playing on linux that knows a bit of gdb here are steps to verify my claim:
# switch the game version to 1.5.3 in steam
# then in terminal:
cd ~/.steam/steam/steamapps/common/Hearts\ of\ Iron\ IV/
gdb hoi4
# then in gdb shell:
set pagination off
break *0x87c4b2e
command
x/s *(char**)($edi+8)
continue
end
break *0x87C4C9A
command
p/d $ebp
continue
end
run

# when in-game, start a game as Germany, without ironman and without historical focuses
# enter "ai" and "human_ai" in game console to have only German AI running
# unpause the game. In gdb shell you should now see focus IDs and their dice rolls being printed
# they are scaled by 100.000, e.g. Rhineland will roll between 0 and 1.000.000
# Sample output
[Switching to Thread 0xe7c6eb40 (LWP 5768)]

Thread 21 "hoi4" hit Breakpoint 1, 0x087c4b2e in ?? ()
0xd9b997c: "GER_four_year_plan"

Thread 21 "hoi4" hit Breakpoint 2, 0x087c4c9a in ?? ()
$400 = 117000

Thread 21 "hoi4" hit Breakpoint 1, 0x087c4b2e in ?? ()
0xda7ddac: "GER_air_innovation"

Thread 21 "hoi4" hit Breakpoint 2, 0x087c4c9a in ?? ()
$401 = 24000

Thread 21 "hoi4" hit Breakpoint 1, 0x087c4b2e in ?? ()
0xda80e7c: "GER_army_innovation"

Thread 21 "hoi4" hit Breakpoint 2, 0x087c4c9a in ?? ()
$402 = 51000

Thread 21 "hoi4" hit Breakpoint 1, 0x087c4b2e in ?? ()
0xda8649c: "GER_rhineland"

Thread 21 "hoi4" hit Breakpoint 2, 0x087c4c9a in ?? ()
$403 = 261000

Thread 21 "hoi4" hit Breakpoint 1, 0x087c4b2e in ?? ()
0xdaad05c: "GER_naval_rearmament"

Thread 21 "hoi4" hit Breakpoint 2, 0x087c4c9a in ?? ()
$404 = 3000
 
I'm not trying to be snarky, but why would you want Germany to go ahistorical in HOI?
Genuinely curious.

This goes for OP too, I guess.

Well, there will be other ways to get WW2 started anyway, probably with Soviet Union or Japan.
I'm just saying that if you set to ahistorical possibilities and the AI never chooses an ahistorical option, then why bother having the option in the first place?
Granted, @Bratyn just reminded us that in 1.6 we will be able to set up rules for the majors, so that will help with people that wants to play certain ahistorical scenarios.