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

TheBloke

Field Marshal
30 Badges
Sep 18, 2010
3.872
15
  • Crusader Kings II
  • Semper Fi
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Cities in Motion
  • Cities: Skylines - Campus
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
  • 500k Club
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III
  • Europa Universalis III: Chronicles
I think what gris was meaning is that threads and cores and parallelism are distinct ideas and have to be discussed as such.

Absolutely they are yes. But what I was saying is that they don't have to be discussed as such; it's audience and context dependent. So the reason why we have a thread that happily conflates these terms is because the audience is assumed to be non-technical, and certainly the OP - and he/they who bumped later - are non-technical, based on how they phrased the question.

So while of course a proper discussion of this would deal with it correctly, in a thread like this layman's terms are used. We, and Paradox, know what someone means when they say "is multi-core supported": they mean, has the game been designed so as to use multiple threads in a non-locking, parallel way such as to make use of more than one CPU core at once when the game requires it. Or, to put it another way, will a user get a smoother experience running this on a computer with "multi-core" versus one with a single core. We can answer that untechnical question in a similary untechnical way by saying "yes it's multi-core supported"; knowing of course that this hides a lot of technical detail, but which isn't of interest to the OP.

Multiple threads do not even have to even run on multiple cores.

Indeed; the same mutli-threaded application runs just fine on hardware with a single CPU. One of the points I was raising was that this part of it is not down to the application/game developer at all. It's the OS that balances threads across available CPU cores. The developer creates multiple threads, or multiple single-threaded processes, or multiple processes each with multiple threads. The OS parallelises them according to their relative requirements as per its scheduling configuration. What the app developer has to ensure, as we said, is that his threads can actually run in parallel and that there isn't unnecessary locking between them.

So yes the thread counts are not hugely accurate metrics. I did think it fairly likely that if EU4 uses 25 threads and EU3-DW uses 22 threads, it suggested that EU3 was at least making some use of parallelism. I was expecting to see more like 3 - 8 threads if EU3 was not parallelising anything besides the UI.

Well as we're going down that path, let's do the full comparison. Which will prove me completely wrong on the question of EU3-DW's thread count and what it suggests :) Next post...
 
Last edited:

TheBloke

Field Marshal
30 Badges
Sep 18, 2010
3.872
15
  • Crusader Kings II
  • Semper Fi
  • Heir to the Throne
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Cities in Motion
  • Cities: Skylines - Campus
  • Cities: Skylines Industries
  • Cities: Skylines - Parklife
  • Cities: Skylines - Green Cities
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
  • 500k Club
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis III
  • Europa Universalis III: Chronicles
My hardware is Quad-Core Core i7 920 with hyper-threading running at 2.9ghz. Chrome was running in the background with a few idle tabs, and Task Manager of course. Baseline CPU usage was 1-2% with no game running.

EU4, in my game at 1535.

- 1920x1080 windowed fullscreen/borderless mode
- I launched a coalition war with about 10 nations on either side, then set the game at speed 5.
- I left the UI fairly zoomed in, close enough for ships and armies to be moving about:

C41PKIw.png


EU3, loaded the 1701 bookmark.
- 1920x1060 windowed (I dropped 20 pixels off the resolution so it didn't get clipped.)
- Played as France, putting me at war with 4 or 5 nations with 3 or 4 allies. Game speed 5.
- UI zoomed in again.

3950nd4.png


So, yeah. EU3-DW is not really "multi-core", as they say :) I think we can assume the maxed out CPU core is one thread for AI/game calculations, and then there's another main thread for the UI which shows as the 20ish % usage CPU. It might be that there's also a second active thread for the UI, showing as the 10%-ish core usage (polling for user input maybe?) Or that could just be Task Manager (seems a bit high for that, though.)

Note that coincidentally we see 25% total usage in both shots. Actually the EU3 usage was averaging more like 15%, I just happened to capture it at a higher spike. EU4 was very consistent around 25%.

It is still note-worthy that EU4 pretty much maxed out one CPU while others were no more than 50% (even taking into account the fact that there are only 4 real cores between these 8 graphs.) I suspect there's still not the ideal level of parallelism in its AI operations and general housekeeping operations. But clearly it's vastly better. And I expect EU4 is doing a lot more work than EU3 had to do overall.

And of course the key question is not "how does the game balance across cores", but simply "does the game run smoothly." And yes it definitely does on my system. So while there might be technically and optimally more balancing/parallelising to be done, it's not actually impacting the game; at least on my hardware. So any further work would quite likely be premature optimisation, and I think they've optimised it very well for the requirements.

Maybe EU5 will spawn one thread per AI nation ;) Or a thread pool of 10-15 so that AI nations can be swapped in and out when they're at war or otherwise doing more work, giving them a dedicated thread when they need it and a shared thread when not. Hopefully by then the AI will be so sophisticated, it will warrant that! :)

There you go! :)
 
Last edited:
Nov 28, 2007
685
7
Why are people talking about threads and cores like they're the same thing?

Because in programming terms they are. Concurrency is implemented through threads. The programmer isn't concerned about whether there are actually multiple cores or not, only that the operating system supports parallelism through context (thread) switching (aka preemptive multitasking). It's not necessary for a CPU to have multiple cores in order for the OS to multitask. It just divides its time between multiple processes / threads. If the CPU does have multiple cores, then all the better because processes and even threads from the same app can potentially run on different cores.
 

Tom013

Field Marshal
90 Badges
Sep 10, 2012
3.275
790
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Res Publica
  • Semper Fi
  • Crusader Kings II
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines Deluxe Edition
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Cossacks
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Crusader Kings II: Jade Dragon
  • Stellaris: Galaxy Edition
  • Hearts of Iron III Collection
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III: Chronicles
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • March of the Eagles
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Europa Universalis 4: Emperor
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • 500k Club
But what I was saying is that they don't have to be discussed as such; it's audience and context dependent.

Agreeing that describing technical detail does not benefit the person with a simple practical interest, still, I think that those of us who understand the technical detail would do better to keep our language precise. It helps those that don't understand (nor want to) the "why" to at least know that when someone says "multi-core support" they mean it is designed to take advantage of their quad core i5 while "multi-threaded" may not mean that at all.

Anyway, interesting to see that the results bear out the suspicion that EU3 was not multi-core but EU4 does take some advantage. It's probably not as parallel as possible... maximum parallelism isn't easy (thus it is a very active computer engineering/computer science research area). And then you run into that cursed Amdahl and his law anyway.
 

Smartcom5

Professional analyser
38 Badges
Oct 3, 2011
106
5
  • Cities in Motion
  • Victoria: Revolutions
  • Semper Fi
  • Supreme Ruler 2020
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Common Sense
  • Magicka: Wizard Wars Founder Wizard
  • Steel Division: Normand 44 - Second Wave
  • Victoria 2
  • Warlock: Master of the Arcane
  • Europa Universalis IV: El Dorado
  • Age of Wonders III
  • Humble Paradox Bundle
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Steel Division: Normandy 44
  • Crusader Kings Complete
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV
  • Europa Universalis IV: Res Publica
  • March of the Eagles
  • East India Company
  • Crusader Kings II
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Magicka
  • Europa Universalis IV: Pre-order
Core affinity …

Just in case some wouldn't knew it …

Europa Universalis III at least hugely benefits if it runs on just one core, even Devine Winds.
I use to hardcode games on single-core which doesn't support more than one.

There's a tool for it called 'Imagecfg' – as always, from Microsoft – which perfectly does the job.
It lets you permanently set the core-affinity of a binary executable, in contrast to the task-manager which only works temporary as long as the binary stays open.

All you have to do is, download the tool, place it into the same place as the binary you want to manipulate, open up a command line and write the respective arguments.

Where -a stands for the core-affinity in a hex-decimal value, so;
Code:
0x01 = 1 = CPU0 (first core)
0x02 = 2 = CPU1 (second core)
0x04 = 4 = CPU2 (etc …)
0x08 = 8 = CPU3
0x10 = 16 = CPU4
0x20 = 32 = CPU5
0x40 = 64 = CPU6
0x80 = 128 = CPU7

We got:
Code:
imagecfg -a 0X01 eugame.exe
The binary is now set to only run on the given core.
Remember that many old games won't run if you set it to any other than the core 0 and that other problems may occur (like PunkBuster crashes) if the binary runs on every other than the first one.

You can also set up multiple specified cores:
Code:
0x0f = 15 = CPU0, CPU1, CPU2, and CPU3 (1+2+4+8 = 15)

Multi-Core isn't that great at all if it comes to complex and heavily single-threaded programs like the one we're talking about.
In fact, the scheduling and relocation of a splitted, on multiple cores at once paralleled thread often eats up way more processing time than it does to compute the thread on a single core.

So, a excessive complex sequential thread in practice is mostly faster processed as a yet significant faster multi-core cpu is even able to computed and re-scheduled the same code splitted into multiple parts while benefit of its higher clock-rate.
This symptom actually still shows up on titles which are dual- or quad core optimized while running splittet on an hexa- or (hyperthreaded/native) octa-core.

Anyway, you got the idea? ;)

Oh, and in case you want to undo the changes – if an multi-core update for your favourite app comes out;
Just type the following, which resets the affinity mask to its previous state.
Code:
imagecfg -u binary.exe


Here you are …
robpol86.com ImageCfg



In this sense

Smartcom
 
Last edited:

highsis

Field Marshal
29 Badges
Jan 9, 2011
2.970
769
  • Crusader Kings II: Charlemagne
  • Heir to the Throne
  • Hearts of Iron III
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III
  • Crusader Kings II: Sword of Islam
  • 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
  • Crusader Kings II
  • Crusader Kings II: Sunset Invasion
  • Hearts of Iron IV: No Step Back
  • Hearts of Iron IV: By Blood Alone
  • Battle for Bosporus
  • Crusader Kings III
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Way of Life
  • 500k Club
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
Sorry for Necroing, but I have a question. I'm running 2660k I7 quad core CPU. out of 8 CPU cores, only 1 is fully occupied and other CPUs only show 10~20% usage when task maanger when I run Meiou. (normal EU4 is fast enough I don't concern myself with CPU usage) Is EU4 using multi-core efficiently? My total CPU usage is only about 25% at max. How could I utilize other 75% besides overclocking?
 

oblio-

Wallachian Warlord
16 Badges
Dec 4, 2013
3.603
1.089
oblio360.com
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Europa Universalis IV: Rights of Man
  • BATTLETECH
  • Age of Wonders III
  • Prison Architect
Without a reply from the developers it would be hard to say.
My (somewhat) educated guess is that the AI thread is on that CPU and it is probably pounding it hard.
 

208

General
95 Badges
Jan 4, 2004
1.918
1.447
  • Europa Universalis IV: El Dorado
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Warlock: Master of the Arcane
  • Warlock 2: The Exiled
  • 500k Club
  • Cities: Skylines
  • Elven Legacy Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Knights of Pen and Paper 2
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: No Step Back
  • Europa Universalis IV
  • Hearts of Iron II: Armageddon
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Deus Vult
  • Europa Universalis III
  • Divine Wind
  • A Game of Dwarves
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Lead and Gold
  • Magicka
Without a reply from the developers it would be hard to say.
My (somewhat) educated guess is that the AI thread is on that CPU and it is probably pounding it hard.

Actually I believe each country AI has its own thread. The most cpu-intensive thread is probably calculating global values which change daily, like trade node data (does MEIOU add more trade nodes?).