1. Hearts of Iron IV
  2. News

Hearts of Iron IV News

Arms Against Tyranny | Feature Breakdown Video #3

Generals!

Our next Feature Breakdown Video on Arms Against Tyranny is here!

With it comes a look at the Finnish Focus Tree and a look at the first Major Feature of the Expansion: The International Market!

Make sure to check out the video here



Developer Diary | Norway Alt History

Hej everyone, it’s me, Carlo! Katten has been staring at me from the other side of the office all morning, which can only mean one thing: it’s time for me to write another Dev Diary! Now, I’ve already talked about Historical Norway, the Joint Focus Tree, and modding stuff so there’s only one more thing I could write about, and that’s our favorite kamerat, LevTrotskij.

Known outside of Norway as Leon Trotsky, he was one of the most prominent members of the bolsheviks in the Soviet Union, renowned marxist theorist, known for his permanent revolution, and even more permanent exile. He was Lenin’s successor apparent, but Stanlin’s political maneuvering forced him out of the government and eventually out of the Soviet Union. After that, he was allowed to move to Norway, with the newspaper editor, Konrad Knudsen. So far so good.


The important thing for us happens in an August much like this one, in 1936, when Quisling’s thugs ransacked Knudsen’s house, and would’ve gotten away with it if it wasn’t because Knudsen’s daughter drove them off. So much for the tolerant left, smh. This event will be represented in AAT’s Norway, regardless of the path you take, and it’s the start of trotskij’s event chain.


Historically, the pressure from fascists and stalinists was too much for the Nygaardsvold Cabinet, so he was put under house arrest in a farm in Hurum, which, by his own account, was one of the worst periods of his life. After that he was allowed into Mexico, and received by the artist Frida Kahlo and her husband Diego Rivera. And then they lived happily ever after. Though he was, indeed, kicked out when Diego Rivera found out he was having an affair with Frida Kahlo and then was killed with an ice pick by a Soviet Union agent. Other than that he had a good time in Mexico by all accounts.


Of course, you don’t need to care about what happened historically. You can just imprison him, or send him to Mexico right away and use this altercation as a justification for increasing political repression, send him straight to Stalin, and even put him in government. Those last two are especially useful if you’re going the communist route by the way.

Communist Route?... Oh, right, that’s what I was supposed to write about, Alt History content for Norway! Since I already wrote about Trotskij's fate, let me tell you about the options you have for
turning Norway even redder.


First step, the labor movement needs to regain its momentum, with the ‘A Resurgent Labor Movement’ focus. This will set Norway on to the path of Communism, but which one? You can compromise with the NKP to adopt their Stalinist stance or prosecute them and let the Labor Party embrace Trotskij’s teachings, and if you kept him in Norway you’ll also have him as an advisor and general.


Each path has advantages and disadvantages: you can be beholden to the Soviet Union and their support, or you can go your own path and bring the Permanent Revolution to the rest of the world.

Regardless of your communist goals, you will need to rouse the proletariat in states that are industrialized enough, and when you’re ready you can trigger the communist revolution and fight in a civil war against the old Norway! Now of course, riling up the workers has its cost, because they’ll do some heavy damage to your factories and infrastructure once they rise up for the revolution.


Let’s take a better look at the ‘Rouse the Proletariat Decisions’. The first level will grant you the state once the civil war starts, but will leave your buildings in a pretty rough shape.


You can reduce this damage by bringing it to Level 2 and you will also be granted 2 irregular divisions.


Then if you’re really serious about that state you can fully rouse its working class, reducing the damage to the buildings and upgrading those troops to Militias.


And before you think “But Carlo, what if I just rouse the whole country and I skip the civil war?”, I’ll tell you now, that won’t work. You will have to choose carefully how to approach these decisions, as you can’t go over 20 Total Support for the Revolution and no matter what, the other side will have Oslo.

Ok now, let’s go over the things you’ll be able to do once you’ve seized the means of production in Norway. If your senpai Stalin noticed you, there will be plenty of improvements to your industrial base, manpower and a close collaboration with the Soviet Union, and even help them invade Finland. Maybe the Arms Against Tyranny thing is just aspirational.


If instead, you decided to go with uncle trotskij, as I said before, you’ll get an extra advisor and general, and that will put you behind the wheel of your very own communist faction, the Norintern with the focus ‘The Permanentest Revolution’. That’s what it’s actually called, and nobody has complained about it so I guess the name is final? Defend Finland, bring the war to Stalin, Sweden, Norway and even Hitler, bringing about a new, Trotskyist world order.


To summarize, with Stalin you’ll get soldiers and industry. With Trotsky you’ll get easy wargoals and offensive bonuses. Your pick.

Now let’s move slightly to the right. To the allied democratic branch, which starts with a fictional Vote of No confidence that the Nygaardsvold government loses. This branch is what happens when militaristic industry tycoons take control of the government. It overlaps somewhat with the democratic branch, except you can skip the whole Broken Gun thing and go straight for rearmament, so you’ll have more time to get ready for what’s coming, but at the cost of a lot of civilian industry.



This path leads to a more centralized government, so all the local preparations are pooled together, letting you start nation-wide initiatives, both during peacetime and war time.



It also overlaps a little with the Trotskyist path, just not the commie parts, and you’ll be able to join the allies instead of forming your own faction.


Let’s keep going, I have actual work to do, so I’m gonna skip the historical path. A few things have changed, but not enough to care, and the dog is still there so onwards to the fascist path, which, of course there is one.


It starts with The Stumbling Storting, in this reality the labor party fails to secure political stability for Norway, leaving the door open to fascists, and other undesirables.


Let’s go with Undesirable Elements #1, fascists. In this scenario Quisling is somewhat good at making people think he’s competent and that fascism is reasonable. The Nasjonal Samling will lurk in the shadows and build support for their agenda state by state, seeking support from the Fatherland League (A proto-fascist nationalist movement), industrialists, conservatives and even fascists abroad.


Eventually, you’ll reach a familiar focus, ‘Quisling’s Coup’, except this time, you’re ready for it, you have built the support needed to make the takeover as easy as possible for you and the foreign fascist invaders, whom you invited! Yes, in this path you can invite the most suitable fascist regime to invade Norway so you can take over the government and help them on their fascist crusade. Don’t worry if they say no, that rejection will also allow you to start the coup without them, who needs Hitler anyway.


The coup, as expected, will trigger a civil war in which, unlike the communist one, you’ll only control Oslofjord. That’s alright though, you prepared for this, which means that you can take over states where you built support in. If you only prepared base level support, you’ll get the state, not too shabby! But if you built more support, you will be rewarded for your efforts with a brand new Military Factory, and maybe even a couple of militias too if you fully prepared it.


This should put you on the right footing to start your fascist campaign, have fun making the world a worse place! Eventually, you’ll make it to your outlandish viking theme claims around the North Atlantic. Classic.


Now onto the last branch: The monarchist branch. For some reason a lot of people who want nordic focus trees also want a monarchist path, I can understand why, but I still think they’re wrong. I still made a monarchist path for Norway, whose king was reluctant to become their king, and even when he took over, by all accounts had no intention of becoming anything more than a figurehead.



This reality starts much like the fascist one, with the Storting devolving into chaos, and the Royal Chamberlain, Anker Peder Wedel-Jarlsberg uses this opportunity to build support for a more involved monarchy, with his steady hand at the helm of course. Obviously, he is not part of the real Wedel-Jarlsberg noble family that lives in Norway, any similarities are purely coincidental, etc. He’s not Wedel-Jarlsberg with a ‘-’, his is a minus symbol. Just do me a favor and don’t tell the legal team, they don’t need to stress about it.



Peder Anker will travel all around Norway proselytizing his monarchist cause, giving you bonuses for building defensive buildings, and adding more building slots, which will of course reduce the available manpower in the state, because, you know, they’re all busy being monarchists so they don’t have time to be soldiers.



Except… If you go all the way with your monarchism you get 2 free militia divisions, and once you get the power as the Regent of Norway you can edit to your heart’s content. They’ve been so converted that they are now soldiers for monarchism.



Once the Absolutist Regency is the rule of the land you’ll recruit the crown prince, Olav to join either the Navy or Army staff, since he was indeed employed in both during the war. In this case you’ll probably want him dedicating all his efforts on one thing, so he can become either a General or an Admiral and will allow you to specialize your country further.



And of course you can get an extra set of outlandish claims. Faroe Islands, Iceland, Greenland, part of Russia, and even part of Sweden. At the end you’ll be able to consolidate your kingdom to make it easier for Peder Anker to rule over his king’s land.



And well that’s it. Obviously there’s tons more to unearth if you ask the right questions ;) and many more things I’ll either keep as a secret for release or haven’t implemented yet, like the new Trotskij portrait and the [Redacted] of [Redacted]. Also, don’t forget to stay tuned for the Sweden alt history Dev Diary, where you’ll see how wildly different the world would be if Sweden had privately managed vacation instead of state managed ones.

Arms Against Tyranny | Pre-Order

Esteemed Generals!

As the warmth of summer fades and the brisk embrace of winter draws near, we are thrilled to unveil the pre-order for the upcoming expansion, "Arms Against Tyranny." Mark your calendars for its grand release on the 10th of October.

[previewyoutube][/previewyoutube]
To add an extra touch of coziness to the impending chill, by securing your pre-order, you will unlock exclusive access to the captivating bonus track, "Säkkijärven Polka". Oh, and did we mention? Sweden's getting a communist focus tree. Because who doesn't love a cozy ideological makeover?

https://store.steampowered.com/app/2183930/Expansion__Hearts_of_Iron_IV_Arms_Against_Tyranny/


Arms Against Tyranny | Q&A

Generals!

The moment has arrived for us to orchestrate a magnificent Q&A livestream scheduled for the 17th of August at 16:00 CEST.

If you have any questions eager for answers, we kindly request you to submit them using this FORM

Developer Diary | Tech

Hey everyone! I’m Plankie and one of the programmers on Hearts of Iron. Large parts of my work consists of feature work, bug fixing, and general game improvements. My absolute favorite part of game development is working with the AI and trying to make it more fun and interesting and immersive to play with. So, in this week’s dev diary I’ll focus on showing how the AI interacts with one of our major new features: The International Market

On a very high level, there are a few things that the AI needs to be able to do in order to utilize the market:

  • Gain market access so that we can see what other countries have put up for sale
  • Sell equipment to others, i.e. putting equipment up for sale on the market
  • Buy equipment from others, i.e. decide what we want to buy and how much


It also needs a surplus of equipment to sell, but fortunately the AI already knows how to produce equipment, so that just needs a little bit of tweaking!

The basis of the AI’s behavior on the International Market is the surplus/deficit it has of different types of equipment on the production stockpile (you know that list of equipment you see under the logistics tab). In general, it will try to buy equipment it has a deficit of and will offer to sell equipment it has a surplus of. This base behavior is then modified by other factors, such as AI strategies.

The familiar logistics tab showing what equipment is available on the production stockpile. The right-most number showing surplus/deficit is an important component of how the AI interacts with the International Market.

[h3]Putting things up for sale[/h3]
Before anyone can buy equipment from the AI, it obviously needs to put equipment up for sale. Just like for a human player, it is only possible for the AI to add equipment to the market if it has a surplus of it. However, just because there is a surplus doesn’t mean that it’s a good idea to put all of that surplus up for sale. And if the surplus disappears and we start lacking equipment again, the AI should take the equipment off the market so it can use it itself instead. We basically want something like the following behavior:

  • If we need the equipment ourselves, don’t sell it
  • If we have a lot of surplus equipment, start selling some of it, but not all of it


The problem is that we need to define how much “a lot” is so we know when to start putting the things up for sale. This could depend a lot on what type of equipment it is and what situation our country is in. We could do something simple and say that “if we have a surplus larger than 200, then start selling”, but 200 infantry equipment and 200 strategic bombers are on completely different scales so using absolute numbers is not a good idea. But manually having to define the numbers for different equipment types and situations and countries also means a lot of work and balancing, so we at least want some good default behavior with a possibility of tweaking it.

In one of the first iterations of the market AI, we just made it put a certain ratio (say 20 %) of its surplus equipment up for sale. Despite the simple approach it worked pretty well, and since it’s simple it’s also easy to understand and debug. It had some shortcomings so we modified it a little bit, but it’s still the basis of how the AI puts things up for sale. Every market AI update, it calculates its total surplus of every equipment type (surplus on production stockpile + anything on the market stockpile) and makes sure that the ratio is correct.

This means that if the AI needs the equipment themselves, they have a total surplus of zero, so they put 0.2*0 = 0 equipment up for sale, i.e. they won’t sell it. They will also pull back anything already up for sale so they can use it themselves. And if they have a total surplus of 100 equipment, it will put 0.2*100 = 20 equipment up for sale (assuming a ratio of 20 %). So the more surplus it has the more it tries to sell, while still retaining a buffer in case things go sour and it starts needing the equipment itself. It also means that we don’t need to specify an absolute number for the threshold, it adapts itself to the situation.

But as mentioned, the approach had some shortcomings. The AI had a tendency to “trickle in” equipment on the market, trying to sell 1 rifle as soon as it had a surplus of 5 rifles, etc, and this felt very artificial and not very human-like. This led us to modify the algorithm so that the AI thinks about the equipment in batches instead of singular weapons. The size of a batch is roughly how much equipment can be delivered in one month using one factory for payment, so instead of seeing the AI try to sell 3 rifles, it now waits until it reaches around 350 rifles (one “batch” of surplus) before putting it up on the market.

At this point we had a reasonable default behavior for how the AI puts equipment up for sale, but we still needed the capability of tweaking it. This is done through scripted AI strategies! If you don’t know what AI strategies are in HoI4, it’s essentially a way that content designers and modders can tweak the AI behavior through script. With AI strategies, it’s possible to modify things like

  • how much equipment is needed before considering it as a surplus to sell on the market
  • the ratio of equipment the AI wants to put on the market
  • the min and max amount of equipment to put up for sale (overriding the default batch size)


With the AI strategies, it’s possible to for example prevent minor countries from selling all their trains (which aren’t used much before the war, so they are technically a surplus). It is possible to script Germany to not sell their huge surplus of weapons when preparing for war (fun fact: the German AI isn’t really aware that its going to end up in a big war until just a few months before the war breaks out, so without different scripted AI strategies they wouldn’t prepare enough for it). Needless to say, the AI strategies are a very useful tool for the designers!

[h3]Buying equipment[/h3]
If the AI is lacking some type of equipment, it will consider buying it from the International Market (assuming there is someone offering to sell it). First of all it decides how many civilian factories it is willing to spend on purchasing equipment. Second, it looks at all the available equipment up for sale and determines if there is anything there that matches what it needs. After that, if the AI has factories to spend and there is equipment it wants to buy, it’s just a matter of deciding what to buy first and how much of it. This is done by computing a score for each potential deal, a score which takes into account:

  • Construction cost of needed equipment - we prefer to fix our biggest needs first
  • How good the equipment is - we prefer newer equipment with better stats
  • How expensive the equipment is - we prefer cheaper stuff
  • Applicable subsidies - if we have any subsidies we prefer to use them
  • Scripted AI weight - we want to make the content designers and modders happy


Example of a debug info window for the market AI. Here, the US AI has a deficit of 294 tactical bombers and almost 19k infantry equipment. It would prefer to buy bombers since the value of the lacking bombers is higher than the value of the lacking infantry equipment, but for the moment only British infantry rifles are up for sale, so the Americans start buying that instead.

So, now we know WHAT we want to purchase, but what about HOW MUCH? If we asked to buy 19k infantry equipment but only were prepared to pay with one factory, we could end up with a deal that would go on for years. In order to circumvent problems like these, the AI tries to create contracts that are neither too small nor too large by tweaking the amount of equipment and assigned factories until the completion time is acceptable. At the time of writing (and subject to change), the AI avoids purchasing more equipment than what can be delivered in about 10 months. It also uses the aforementioned “batch size” as a minimum limit of how much equipment to buy.

Paying off 19k infantry equipment with just one civilian factory takes a couple of years. Long-term weapon deals sound better before you do the math…

Of course there are also AI strategies for affecting how the AI purchases equipment. These are values that either go into the scoring calculation (affecting what the AI prefers to buy and from whom if there are multiple alternatives), or that tweak things like the threshold of when it wants to buy equipment of a certain type.

[h3]Establishing market access[/h3]
Now we know how the AI puts equipment up for sale, and we know how they determine what they want to buy. But all that is for nothing unless the AI has access to another country’s market, so of course it needs some way of gaining market access.

This is a relatively simple process since market access is nothing more complicated than a normal diplomatic relation, like docking rights or a non-aggression pact. Naturally, the AI is able to respond to requests for market access if you ask them, but it would be a pretty boring feature if they never took the initiative themselves. The exact factors that go into the AI’s desire to have market access with another country are of course subject to change as we balance the game, but at the time of writing the most important factors are:

  • Diplomatic opinion - I really like this since I think opinion is underused in HoI4. It makes it possible for you to achieve market access with a country as long as you are prepared to spend some sweet PP to maintain it ;)
  • Trade influence
  • “Ideological” opinion - Some ideologies like other ideologies more or less
  • Competing factions - If the two countries are in different factions
The Soviet Union is really not interested in opening their market to those British capitalists.

The result of this is that you tend to see something similar to trade blocs, groups of countries that trade with each other (often along faction or ideological lines). The boundaries between the trade blocs are soft, however, and it’s often possible to convince countries to trade with you by raising their opinion of you.

[h3]Producing surplus equipment[/h3]
Finally, since the International Market revolves around surplus equipment, it wouldn’t be much fun if there was no equipment to trade with. This ties into some changes to how the AI produces equipment, especially when they have already fulfilled all their own needs.

As some of you may have noticed, since BBA a lot of smaller countries have been bad at fully utilizing their military factories. As soon as they have fulfilled all their equipment needs (including having a buffer for any armies in the field), they stop using their military factories. This behavior was not introduced with BBA, but because of some other changes to how the AI recruits armies the problem became much more visible. The reason they stop producing equipment is because they technically don’t need any more equipment, and if you don’t have any equipment you need to produce… well, they simply stop producing it. As human players, we know that a war is looming on the horizon and there is no reason to stop production just because “we have enough”. It’s better to be prepared with a larger stockpile. And with the International Market making its entry, we can suddenly satisfy our inner capitalists and earn something by selling our surplus equipment.

So, now, when the AI gets to the point where they have enough equipment to fulfill their own needs, they start transitioning into a “surplus production state”. In this state, they once again use AI strategies to determine what to produce. This makes it possible to script countries to produce different types of surplus equipment, which in turn would allow for more “equipment diversity” on the market place and a larger selection of equipment to choose from.

[h3]Summary[/h3]
We are nearing the end of this dev diary, so let’s quickly sum it up!

We did a little deep dive into the AI for the new International Market feature, and got to see the logic for how it puts surplus equipment up for sale and how it constructs purchase requests. In addition, we looked at the factors affecting how the AI opens up their market to other countries, and finally, how surplus equipment is produced when all other needs are fulfilled.

I hope you found it interesting to see some of the inner workings of the market AI, and I definitely hope you will enjoy playing the game with your new trade partners! In next week’s dev diary you will get to join some of our content designers for a closer look at how to mod Hearts of Iron! Stay tuned!