• 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.

HoI4 Dev Diary - A Tech Lead's Life

Hello everyone, it's your favourite (and only) tech lead, The French Paradox!

In this diary I'll tell you more about our tech, give some insights into the programmer's job, what we've been up to for the past year (and some change) and offer you a chance to ask any question you may have about tech.

Saying old platforms goodbye

First, with the upcoming 1.11 patch we will be retiring some old Linux and Mac platforms that aren't maintained by their own developers anymore.
This means that starting next update the minimum OS version to run HoI will be Ubuntu 18.04 (on Linux) and macOS 10.11 (El Capitan) on Mac.
There shouldn't be much to worry about though, as the previous versions are older than HoI itself at this point and our telemetry shows almost all of you have upgraded long ago.
For those on Windows who look anxiously at their aging Windows 7, keep calm and carry on, we have no plans to drop support for it (although as a friendly tech person I'd still suggest you consider upgrading ;)).

Why do we make those decisions you may wonder? Two reasons: one maintaining old tech comes with a cost that we would rather spend on improving the game for 99% of the users, and two sometimes it blocks the adoption of new tech that would make our programmers job easier and more efficient.
Without going too much into details, the general idea is that we can only use tech that is supported on all platforms, so basically we're only as modern as the oldest thing we support. If you take the case of Linux for example, the previous Ubuntu release was from 2016, meaning HoI could not use anything released since then (and probably a bit before, as Ubuntu LTS releases usually don't ship with the latest shiny goodies). Some time we can work our way around it, but not always.
Speaking of new tech...

Renderers.PNG


DirectX 11

That's right, the next HoI4 release will join Stellaris and the other more recent PDS games by adding DirectX 11 support.
DirectX 9 will still be the default for now, but you will be able to select another renderer in the launcher settings.

There shouldn't be any visual difference between DX9 and DX11 (and OpenGL for that matter), we have been working on making sure the experience will be the same.
The game should load a bit faster however, especially if you use a lot of mods that bring extra textures and models.
Working remotely for more than a year, we also noticed less issues playing with remote desktop and the like, which might not be a big deal for most of you but was quite appreciable for our devs during development.
Finally it did help us tweaking & fixing the new railways & trains graphics (as most graphics debugging tools have dropped support for DX9).


Performance

We know that performance is always at the heart of every discussion about our games and as a Tech Lead I have been keeping a close eye on it.
So far it looks like our release candidate is roughly on par with the current 1.10 patch, performance wise.

Why not better, I can already hear you typing? The main reason is that the game on 1.11 is a different beast 1.10 (which itself is quite different from the original 1.0 release).
Namely, the supply simulation is now much more deep and complex, and needs to account for all those railways across the world and the fact that now allies can supply each other.
While I am writing those words, our compatibility lab is working hard at running the game on various hardware configurations to give us a more complete picture and perhaps a few suggestions for an updated recommended configuration, as the one you can see on Steam right now dates back from the original release.


20211103_120703.jpg

Toying with a 11th generation i9 and a RTX 3090. Will it take off?

On the topic of measuring performance, the Barbarossa update will include an in-game profiler that you can use to measure how your machine performs.
You should be able to spawn it from the console using the magic line imgui show profiler.

For example here is the current release candidate on my home i7-10700 with a RTX 2080 SUPER:

hoi4_1936_RC.PNG

1936 fresh start, speed 5, Direct 11, vsync off

hoi4_1943_RC.PNG

1943 test save, speed 5, Direct 11, vsync off

As you can see this offers a few metrics that can be collected by toggling the Enable/Disable Collection button at the top.
A few things you can get from it:
  • Render time: the average time to render one frame over the last second
  • Render time excluding present: same as previous but excludes the time spent waiting on the GPU to actually present the frame on screen. The difference is usually due to vsync.
  • Frames per second: the FPS count, you know this one
  • Ticks per second: how many in-game hours were simulated over the course of the last second
  • Last tick: the time it took to simulate the last hour or new day/week/month
  • Last 24 ticks average: same as previous but averaged from the last 24 (or less depending on how much time was spent collecting data)
Next you have a nice graph representation of where (in which system) that time was spent. We use it to quickly eyeball a performance report, especially when external programmer tools are not available (for example when it happens on a non-dev machine).

Final tip: if the profiler doesn't show up with the magic console command, try turning it off and on again using imgui off then imgui on.


A personal pet peeve

Programmers at PDS are rarely just that. Most of us get involved in the game development by offering insights on design, balance or content, and I am no exception.
So now is the time to talk about French Communism.

If you remember the French focus tree from La Résistance, if you go communist you get this guy:

Momo.PNG


Maurice Thorez was historically the leader of the Parti Communiste Français (PCF).
If you walk through some cities in France you can even find streets bearing his name still today.
But he had one characteristic trait: he was a die-hard Stalinist who followed the Moscow line until his death in 1964. He had a city and an institute named after him in the USSR.
On the day the Molotov-Ribbentrop Pact was signed, he is in vacation in the Alps and the PCF changes its stance on Germany and Poland overnight following Moscow's instructions without asking him. When he comes back, he just shrugs and goes along with it.

With that in mind, I felt that it was weird you would keep him as a leader if you do not go for the "Loyalty To Moscow" sub-tree.
I did some research in French sources and found a better candidate to replace him. Behold:

1635946239203.png


René Nicod was a member of the PCF in 1939, but when the party decided to realign itself following the Pact, he and a couple other MPs quit the party and founded the Union Populaire Française (UPF) or French Popular Union in English. They denounced the Pact and supported the government's decision to stand with Poland.
In Barbarossa if you own La Résistance and go either Anti-Fascist Coalition or Loyalty to the cause you will get a new party and leader:

Tree.PNG
Tree2.PNG


Each branch will give a different flavour of Nicod inspired by his published opinions pieces during the Great War (he both supported in the French Army and lost his hand in the trenches but also denounced the war on ideological grounds and hoped the French and German workers would unite in a common cause).

Finally, it turned out to be a bit difficult to find a good portrait for our artists. My initial research in the French National Assembly online database only yielded a low-res blurry picture.
But luckily a small French shop decided to sell its stock of old photos on eBay and his mayor portrait was one of the articles.
We could have stopped there and used the ad's preview picture as a source, but of course we had to buy and ship to Sweden.

So here he is, looking over the HOI corner in our Stockholm office!


IMG_20211102_203447.jpg

IMG_20211102_203534.jpg
And with that, I'll happily take your questions :cool:

PS: a few back we talked about Modding Changes. @Aurelien Delay looked at your feedback and has more insights to share that should help you convert your mod to the new character system.
 
  • 130Like
  • 26Love
  • 12
  • 4
  • 3
Reactions:
I have noticed that when I open the production menu, my fps often drops. Do you know why this happens?
Can't say I have noticed it. What's your machine spec? Does it happen even when paused?
I think the best way to improve late-game performance, is to tell the AI to stop creating a new unit template every time they want to add a brigade. Right now, every nation has over a dozen different templates in use at a given time, never updating and deleting them.
Templates aren't a big deal. The main issue is the sheer number of units and combats, and the fact that for historical reasons those 2 sub-sytems cannot use multithreading.
... in what order should I upgrade my hardware?

:Newer/faster CPU; More memory; Faster memory; Better graphics; More graphic memory; Newer/faster SSD?
Get a more recent CPU. Anything like i7 6th or 7th gen (or more recent) should give you decent performance.
For RAM, the main concern is how many chrome tabs do you keep open while playing ;) , so 8+ GB is always good.
SSD will help the game start faster, but shouldn't run much faster once started.
GPU is a least concerned, most nVidia/AMD GPUs from the past decade or so should be good enough.
I am by no means a hardware guy, so if this question sounds stupid, please forgive me.

Would the Paradox loader be able to detect hardware (just as an example: NVIDA GTX vs RTX technology) and adjust performance according to present hardware? I am aware that yet oldest to newest technology would have to be included in the files (and probably increase overall folder sizes). Nevertheless, it would make it possible to adapt performance to present hardware. To what extent is this implemented?
We are capable of detecting your hardware specs (that how we keep statistics on what's the average machine for our players), but there isn't much we can tweak to help.
Unless you are running on a integrated GPU, or a very old mobile dedicated GPU, you could toggle all graphics settings to max and not really feel the difference.
HoI is mostly bounded by how fast it can update the world simulation and that's entirely done on your CPU. Running a more "simplistic" simulation on older hardware would also break MP compatibility so that's not really an option for us either.
 
  • 16
  • 2Like
  • 1Love
Reactions:
The main issue is the sheer number of units

This might sound naive, but isn't there a way to get to AI to limit the number units late, to start to condense the units to the most effective template and deleting/converting the templates that don't work, so there is less work. Also the sheer numbers is the main reason I don't play past 1944 on most games, because at that point its just AI spam to fight. It becomes less about strategy, and more of grind.
 
  • 3
Reactions:
Maybe I'm missing something. But why not just implement a system that can help with the game performance in the long run? Such as giving the AI of nations without focus trees a program to follow? So a small nation like Ecuador will only be allowed to build a minimum of 1K guns and supplies. But afterwards will stop all production and pretty much turn the AI off. A bigger nation like Brazil with a cap of 5k.

This way we can prevent AI number spam. Maybe also implement a system where a Nations AI will reactivate if it ends up bordering a human player due to the expansion of the player. When you think of it. Nations without focus trees tend to matter little. If you are playing as Mexico then you might end up having a fight in Central and South America. But do we really need nations just building a stockpile of soldiers and supplies? Could also give the ability to disable and enable at the start of the game for those that don't like the idea.

An even easier fix would be to have an option at the start menu. That will remove all nations in Central and South America. There are mods that do this already. But this would give players on lower-end PC's the ability to do this legit. While being able to enjoy the game at a better performance.

Very possible I'm not understanding anything about ways to improve performance here.
 
  • 1
Reactions:
This might sound naive, but isn't there a way to get to AI to limit the number units late, to start to condense the units to the most effective template and deleting/converting the templates that don't work, so there is less work. Also the sheer numbers is the main reason I don't play past 1944 on most games, because at that point its just AI spam to fight. It becomes less about strategy, and more of grind.

You can have a hundred distinct templates or one total and it won't matter. Only limiting the number of divisions will. Converting templates to the most recent one does not affect that number significantly, because the differences between distinct templates that are kept in use is minor. The ai does not keep around token divisons, once it has a desired template it sticks to it and does not spam out legacy ones.
 
Interesting choice in regards to switching communist leaders for France - given how the French focus tree is laid out, I would've guessed that it would be Destroy the Counter-Revolution that would've switched leaders, but given that you'd need to switch the locations of Anti-Fascist Coalition and Loyalty to Moscow, I can kind of understand going with the choice you went with.

Is there any chance you guys could be talked into doing something similar with the United States and giving them an alternate communist leader to Earl Browder? Asking because, much like Thorez, Earl Browder was a Stalinist, so it does kind of feel odd that the US only has an option to go Stalinist. Maybe make it so that if the US does the focus that puts them in the research group with the USSR BEFORE they flip to communism and the USSR has someone other than Stalin in charge, they get a different leader when they flip ideologies? I'm fine if we only have one alternative to Browder (although it would be awesome if you could have an alternate leader for the US if Trotsky was in charge and a third alternate leader if the USSR puts Bukharin in charge), it's just that it feels odd to see Browder be able to ally with a Trotsky-led or Bukharin-led USSR.
 
  • 1Like
Reactions:
This might sound naive, but isn't there a way to get to AI to limit the number units late, to start to condense the units to the most effective template and deleting/converting the templates that don't work, so there is less work. Also the sheer numbers is the main reason I don't play past 1944 on most games, because at that point its just AI spam to fight. It becomes less about strategy, and more of grind.
That's what I hate about PDX games: by the time all my preparations are done and the real game is finally underway, it becomes unplayable due to the game choking.
 
  • 2Like
  • 1Haha
  • 1
Reactions:
Laval was technically the PM of France on Jan 1st, 1936 (although not for long, as the failure of the Laval-Hoare plan made him unpopular). As a Frenchman I do understand that it feels weird at first to see his face on the starting screen, as today we remember him much for his role in the Vichy government than for his political career in the interwar period.
As for Daladier, to follow history you would need to have France go for the Front Populaire but fail to keep popular support and have Blum ousted.
And then fail to resolve the Winter War in a satisfactory way, leading to Reynaud becoming PM.

There might be a place somewhere for content mechanics that simulate the French Third Republic's infamous instability, but as you can see it would require more thought and a much more substantial change than just changing a leader when doing a focus.
I believe one of the great errors of the French rework at the time was that it did not have in some way its own decision-making mechanisms in the North American parliamentary style or the Soviet purges in NSB that reflected in some way the fall of the French leaders mutilpes at the end of the Third Republic French where through decisions or events the Blum fall, the Daladier return or the Reynaud rise could be simulated in some way

I also believe a bicephaly system should be inserted in some way in power in some states, especially the democratic states or the Japanese particularity between the binomial between the emperor and the prime minister. I believe it could be advised through a special minister that could not be changed at will but through a system of decisions or events.

I also think a new one should be inserted or unlocked for France on the French foreign legion that could give a small recruitment bonus in non-core territory and a small acclimatization bonus for French troops in extreme terrain
 
  • 1Like
  • 1
Reactions:
Cheers for the DD Mat, and the extra flavour commentary from Arheo and Cranium Muppet :) It's great to hear that performance has held steady even with the addition of new features (as always, more performance is better, but it's very good that we get more for no reduction) and thank you very much for providing the profiling tool - I expect that over time the modding community will find that incredibly useful :)

But luckily a small French shop decided to sell its stock of old photos on eBay and his mayor portrait was one of the articles.

Love your research/work :)

There was a really bad performance spikes with mines. The worst has been fixed in Barbarossa.

Normally a performance spike would be a bad thing, but it was going to be quite the stretch to link something naval back to this post without the mine spike - thanks for helping resolve it :)

Here are a whole bunch of (old, for WW2) mines, just waiting to cause some bad performance in an enemy's navigation lane:

Mines cropped.jpg
 
  • 3
  • 2Like
Reactions:
  • Ticks per second: how many in-game hours were simulated over the course of the last second
  • Last tick: the time it took to simulate the last hour or new day/week/month
  • Last 24 ticks average: same as previous but averaged from the last 24 (or less depending on how much time was spent collecting data)

Is "Ticks per second" calculated from the last 24 ticks average? Does is include the longer daily ticks? What about weekly and monthly ticks?

If we have 31 ticks per second like in the image is it correct to assume that 59 days (1.1.1936 12:00 - 1.3.1936 12:00) will take 59*24= 1416 ticks and thus 1416/31 = 45 seconds.

And in your 1943 scenario with 17 ticks per second the 59 days would take 59*24/17 = 83 seconds.

Or is it more complicated?


  • Frames per second: the FPS count, you know this one

It seems I can't get more than 70 FPS with the game paused. (CPU load and GPU load low) Is there some kind of FPS limit in the game?

1636019393155.png

If I go from paused to speed 5 the FPS drops to 30-40 FPS without the GPU beeing at high load. Is there an ingame mechanic that reduces FPS on the higher speeds?
 
İs that a Turkish flag back there?
I love paradox more now as a turk
Once upon a time we ordered flags to decorate the HoI corner, with one for each nationality on the team.
The Turkish flag is in the honor of one ex-programmer, the same one who originally made the railways and trains for Barbarossa.
Is "Ticks per second" calculated from the last 24 ticks average? Does is include the longer daily ticks? What about weekly and monthly ticks?

If we have 31 ticks per second like in the image is it correct to assume that 59 days (1.1.1936 12:00 - 1.3.1936 12:00) will take 59*24= 1416 ticks and thus 1416/31 = 45 seconds.

And in your 1943 scenario with 17 ticks per second the 59 days would take 59*24/17 = 83 seconds.

Or is it more complicated?
There is some Paradox math involved ;)
The ticks per second is how many ticks were processed over the last second of real time. This is indeed affected by other stuff such as rendering and daily if there was any.
Also, if your ticks per second go under 24, then the average last 24 ticks will include data outside the last second that were not counted, hence the difference.
Is there any chance to get an engine upgrade in the future, to make better use of multithreads, etc.?
The new engine would not help that much in that regads, this is mostly tied to game code and how the simulation is computed.
The biggest gains would be to rework army/combat updates to be able to use multithreading but that's not an easy task as the combat and movement mechanics you've been experiencing since release have constraints that make that impossible (for ex all movement in processed in sequence: germany moves, then UK, then USSR, etc...).
 
  • 10
  • 1Love
Reactions:
Hello everyone, it's your favourite (and only) tech lead, The French Paradox!

In this diary I'll tell you more about our tech, give some insights into the programmer's job, what we've been up to for the past year (and some change) and offer you a chance to ask any question you may have about tech.

Saying old platforms goodbye

First, with the upcoming 1.11 patch we will be retiring some old Linux and Mac platforms that aren't maintained by their own developers anymore.
This means that starting next update the minimum OS version to run HoI will be Ubuntu 18.04 (on Linux) and macOS 10.11 (El Capitan) on Mac.
There shouldn't be much to worry about though, as the previous versions are older than HoI itself at this point and our telemetry shows almost all of you have upgraded long ago.
For those on Windows who look anxiously at their aging Windows 7, keep calm and carry on, we have no plans to drop support for it (although as a friendly tech person I'd still suggest you consider upgrading ;)).

Why do we make those decisions you may wonder? Two reasons: one maintaining old tech comes with a cost that we would rather spend on improving the game for 99% of the users, and two sometimes it blocks the adoption of new tech that would make our programmers job easier and more efficient.
Without going too much into details, the general idea is that we can only use tech that is supported on all platforms, so basically we're only as modern as the oldest thing we support. If you take the case of Linux for example, the previous Ubuntu release was from 2016, meaning HoI could not use anything released since then (and probably a bit before, as Ubuntu LTS releases usually don't ship with the latest shiny goodies). Some time we can work our way around it, but not always.
Speaking of new tech...

View attachment 770294

DirectX 11

That's right, the next HoI4 release will join Stellaris and the other more recent PDS games by adding DirectX 11 support.
DirectX 9 will still be the default for now, but you will be able to select another renderer in the launcher settings.

There shouldn't be any visual difference between DX9 and DX11 (and OpenGL for that matter), we have been working on making sure the experience will be the same.
The game should load a bit faster however, especially if you use a lot of mods that bring extra textures and models.
Working remotely for more than a year, we also noticed less issues playing with remote desktop and the like, which might not be a big deal for most of you but was quite appreciable for our devs during development.
Finally it did help us tweaking & fixing the new railways & trains graphics (as most graphics debugging tools have dropped support for DX9).


Performance

We know that performance is always at the heart of every discussion about our games and as a Tech Lead I have been keeping a close eye on it.
So far it looks like our release candidate is roughly on par with the current 1.10 patch, performance wise.

Why not better, I can already hear you typing? The main reason is that the game on 1.11 is a different beast 1.10 (which itself is quite different from the original 1.0 release).
Namely, the supply simulation is now much more deep and complex, and needs to account for all those railways across the world and the fact that now allies can supply each other.
While I am writing those words, our compatibility lab is working hard at running the game on various hardware configurations to give us a more complete picture and perhaps a few suggestions for an updated recommended configuration, as the one you can see on Steam right now dates back from the original release.


View attachment 770295
Toying with a 11th generation i9 and a RTX 3090. Will it take off?

On the topic of measuring performance, the Barbarossa update will include an in-game profiler that you can use to measure how your machine performs.
You should be able to spawn it from the console using the magic line imgui show profiler.

For example here is the current release candidate on my home i7-10700 with a RTX 2080 SUPER:

View attachment 770297
1936 fresh start, speed 5, Direct 11, vsync off

View attachment 770299
1943 test save, speed 5, Direct 11, vsync off

As you can see this offers a few metrics that can be collected by toggling the Enable/Disable Collection button at the top.
A few things you can get from it:
  • Render time: the average time to render one frame over the last second
  • Render time excluding present: same as previous but excludes the time spent waiting on the GPU to actually present the frame on screen. The difference is usually due to vsync.
  • Frames per second: the FPS count, you know this one
  • Ticks per second: how many in-game hours were simulated over the course of the last second
  • Last tick: the time it took to simulate the last hour or new day/week/month
  • Last 24 ticks average: same as previous but averaged from the last 24 (or less depending on how much time was spent collecting data)
Next you have a nice graph representation of where (in which system) that time was spent. We use it to quickly eyeball a performance report, especially when external programmer tools are not available (for example when it happens on a non-dev machine).

Final tip: if the profiler doesn't show up with the magic console command, try turning it off and on again using imgui off then imgui on.


A personal pet peeve

Programmers at PDS are rarely just that. Most of us get involved in the game development by offering insights on design, balance or content, and I am no exception.
So now is the time to talk about French Communism.

If you remember the French focus tree from La Résistance, if you go communist you get this guy:

View attachment 770303

Maurice Thorez was historically the leader of the Parti Communiste Français (PCF).
If you walk through some cities in France you can even find streets bearing his name still today.
But he had one characteristic trait: he was a die-hard Stalinist who followed the Moscow line until his death in 1964. He had a city and an institute named after him in the USSR.
On the day the Molotov-Ribbentrop Pact was signed, he is in vacation in the Alps and the PCF changes its stance on Germany and Poland overnight following Moscow's instructions without asking him. When he comes back, he just shrugs and goes along with it.

With that in mind, I felt that it was weird you would keep him as a leader if you do not go for the "Loyalty To Moscow" sub-tree.
I did some research in French sources and found a better candidate to replace him. Behold:

View attachment 770305

René Nicod was a member of the PCF in 1939, but when the party decided to realign itself following the Pact, he and a couple other MPs quit the party and founded the Union Populaire Française (UPF) or French Popular Union in English. They denounced the Pact and supported the government's decision to stand with Poland.
In Barbarossa if you own La Résistance and go either Anti-Fascist Coalition or Loyalty to the cause you will get a new party and leader:

View attachment 770307View attachment 770308

Each branch will give a different flavour of Nicod inspired by his published opinions pieces during the Great War (he both supported in the French Army and lost his hand in the trenches but also denounced the war on ideological grounds and hoped the French and German workers would unite in a common cause).

Finally, it turned out to be a bit difficult to find a good portrait for our artists. My initial research in the French National Assembly online database only yielded a low-res blurry picture.
But luckily a small French shop decided to sell its stock of old photos on eBay and his mayor portrait was one of the articles.
We could have stopped there and used the ad's preview picture as a source, but of course we had to buy and ship to Sweden.

So here he is, looking over the HOI corner in our Stockholm office!


View attachment 770318
View attachment 770319And with that, I'll happily take your questions :cool:

PS: a few back we talked about Modding Changes. @Aurelien Delay looked at your feedback and has more insights to share that should help you convert your mod to the new character system.
can haz fixes to operatives and operations?
 
  • 1
Reactions: