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

Stellaris Dev Diary #170 - Performance and other technical issues

Hello, my friends! This is Moah, Tech Lead of Stellaris typing. I can finally talk about what you’ve all been waiting for: How many new platypi will there be in Federations? After weeks of…

Well, apparently, I should be "more technical." But before we jump into the mysteries of the Stellaris code, I want to take the time to talk a little about the balance between adding new features, improving performance and stability – especially in terms of multiplayer and the dreaded out-of-syncs (dreaded at least by me).

The Delicate Balance
Stellaris, like most decently sized code bases, is like a complex game of Mikado or Jenga: every part is connected in some way to every other part. When you add a feature, you add more connections. If you’re careful, you add only a few, if you’re in a rush you add a bit too many. This generally leads to Unplanned Features (aka bugs). In addition, once we see them perform in the actual game, we tend to expand features in new, unexpected ways, leading to more Unplanned Features(tm).

Once we realize what is happening, we start being more careful. Maybe too careful. Checking too many things, too often, ensuring that this interaction that is supposed to never actually happen is actually not happening. Not now, not later. Not ever.

So you have removed the unplanned features, but the game is a bit, ah… too careful. Some would say slow.

So you remove some of these checks. You realize that you don’t need to loop around the galaxy, you can just loop around this one tiny planet. Then you go one step further, and think “well I can maybe do that check only every three weeks, and this calculation needed by all these checks, I could store it in here and reuse it until the next time it changes.”

So now the game isn’t so careful anymore, we’re back in unplanned feature territory. But if the caching (storing/reusing calculations) happens at different times on different machines, you get slightly different results (like asking a developer for something before and after they had coffee).

Slightly different results are what OOS thrives on! Clients and servers have 0.0001 cost difference, compounded over time, that corvette is bought on the server but not on the client.

So you remove your “smart” algorithm. You replace it with the correct algorithm. You lose half of what you gained in step 2 and reintroduce some bugs. Probably.
Rinse and repeat.

But enough about my morning routine! Let’s talk about…

Performance
Stellaris fans are like C++ programmers: performance is always on their mind. To be fair, it has also been on ours a lot lately. We know that it’s not all that it could be, especially in late game and with the bigger galaxies. With that in mind, we’ve taken time to improve performance in a bit more depth than we usually can. We looked at what was taking the most time, and as everyone knows that is…

G3Zg2ENmwufWgqUXGFjTEebkxlbQzYRGI0diuSOCrFfUcSl9Xn8EkYCyzAUtWAyCdVXt5biT3vv65T4n-EnA5YmHZXb_Gpp9ydvqh28lj_Oa7py3yU3MHETwURjuo1QD4sFZiZNB


Pops.

There are many reasons why pops consume a lot of time in Stellaris, but the main one is that by endgame we have SO MANY of them. SO So so so so many. And they do so much! Pops have to calculate how good they’d be at every job (they do so every 7 days). Then they have to fight every other pop on the planet to get the job they’re best at. They also have to check if they could have a specific ethic. If they could join a specific faction. How happy they are. How happy they could be. How happy they would be on that planet over there.
All these things trigger modifiers calculations. If you remember my last dev diary, you know that modifiers are the only thing more numerous than Pops in Stellaris. And they all depend on each other. Calculating them is like pulling on a thread and getting the whole sweater.


OK, but what did we actually do about it?
Well first, I’ll admit I may have been a bit pigheaded on the whole “we need to do the jobs distribution every day because we don’t know when new jobs are added.” We reexamined this assumption, and jobs distribution is now only done on demand. It was also rewritten to iterate over a lot fewer things.

We also noticed a few triggers going through every pop of an empire to check if one or more are enslaved, decadent, or other things that can be tested at the species level. So we made new triggers to test these things at the species levels. In the same spirit, we had events going through every ship to find a fleet, so we added triggers at the fleet level.

Second, We’ve also reworked the approach to checking if pops can change ethics (and also made it work again), or if they can join factions.

Finally, we’ve looked for (and found) opportunities to use more multi threading.

But enough talk! What’s the result? Well, if a picture is worth a thousand words, here’s the answer at 30000 words a second:


The video compares the performance of 2.5.1 “Shelley” to 2.6 “Verne'' when running a save game from the community, which can be found attached to this post, with over 20000 pops. It was recorded on my work computer (Intel Core7-7900X @ 3.30Ghz, 10 cores and 20 threads, and AMD R9 Fury). You won’t necessarily get the same results, the exact difference in performance will vary with your computer, and the exact situation in your own save games, of course. On average, we’ve found something between 15% and 30% improvement in late game situations.
This save is just ideal to showcase the impact of the pops improvement.

DYxcPB_pqZfHKxxtAj0sh_Y3nx7zXM4OMcUHTkgNsDK9csuQgEECkgc6jVmUEgWpoa6lD2e9kfYdssD61j2I57mhM0XcyT20wfu8fFIZbP-Usqnw2PShuEAD0_-n-ZTNFcH0NJR6


What is this average anyway? How do you know?
Well, we have synths playing the game all night, every night. In the morning, we check how far they were able to go. We also ask them how many errors they encountered, what their endgame looked like, whether they got any OOS and then put all of that in tables and graphs, with many colors. Then we wipe the synths, so they don’t ask pesky questions about souls and whatnot.

EwNw1Mhvr5FLcwYQYuZClsoMxr8qHs3nF3VPqExEcAJrWCvISTEc2fcl3fNLWzQlWKdxuDLAGHEagL9FXOrtio6XazmKpx_rsR7Ri58Ts2tFbq7OcWPdsIG_ayumIutkMGm2VnD_


In conclusion
Although we keep performance in mind and do our best to keep it reasonable, we’re happy we had a chance to take a deeper dive into the issue. Hopefully the changes will spark as much joy for you as it did for us, and we’re looking forward to your feedback!

Next week will feature another dev diary about the other thing you’ve all been waiting for… MORE PLATYPI!

PS: The save file we're using is from the community, one of the performance threads. We are however unsure where we originally got it from. So if you recognize it, or if it's yours please tell us so we can credit you properly.
 

Attachments

  • perf_massive.sav
    4 MB · Views: 289
Last edited:
  • 1Like
Reactions:
I am probably more excited about the performance improvements than anything in federations tbh... not that it looks like a bad dlc or anything it’s just that the late game performance has been that much of an issue.

Hopefully they’ll have a release date announcement within the next week or so!
 
Performance improvements look great.


Now what about AI improvements?
They said the stream next week will address that.
 
I think up-to 50% performance increase in lategame as shown above is not enough for this game to be playable lategame for me =/

I have 930 hours playtime and running a pretty high-end pc with 16cores and 32 threads-> my R20 Cinebech scores a 545 singlethread and 9.8k mulithread.
Normally i reach 1k pops around year 2300, and its around this time i have to stop playing because of the lag. (unmodded)

Lets say i can now get 50% more "pop performance", that means i can have around 1.5k pops before the game become unplayable again for me.
That will take me around 30 more years ingame i would guesstimate ? So with this soon to be released patch i can maybe play a few hours more before i have to call it quits again (?)

That's doesn't seem good enough to me.

Will include a screenshot from my latest playthrough with the "stellaris reloaded mod" where i really was pushing it and to almost got to 1.8k pops in year 2287 before i had to quit. (1 ingame year took 4 mins and 4 seconds)

stellaris 1.png


Will also include a screenshot of my task manager after that 1 year ingame
stellaris 3.png


What there is to play for after this stage with this AI is a other question..
 
Last edited:
puzzling choice of cpu, not because of the clock speeds or ipc of skylake-x, but i feel like Intel sees its best performance in games on 4-6 core chips, where the additional latency introduced per additional core due to the ring bus architecture is less of a bottleneck.

I would genuinely expect even better performance on a i7-6700k running at the same clocks, in spite of the disadvantage in thread count.
 
Normally i reach 1k pops around year 2300, and its around this time i have to stop playing because of the lag. (unmodded)
.

How many real-time-seconds-per-game-month is unplayable for you??

On a not particularly high end system 1K stars, 20K POPs in 2580 or so only took 10 seconds per month once the game was running a little while. That SEEMS reasonable enough to me. Is that the performance you're referring to or is there a different metric you have in mind??
 
How many real-time-seconds-per-game-month is unplayable for you??

On a not particularly high end system 1K stars, 20K POPs in 2580 or so only took 10 seconds per month once the game was running a little while. That SEEMS reasonable enough to me. Is that the performance you're referring to or is there a different metric you have in mind??

4min and 4 seconds = 244 seconds.
244 / 12 month = 20 seconds per month
That's normally where i draw the line and quit the playthrough
 
4min and 4 seconds = 244 seconds.
244 / 12 month = 20 seconds per month
That's normally where i draw the line and quit the playthrough

20 real-time-seconds-per-game-month sounds like a reasonable personal standard to me. I don't know what type of system you have BUT if it's fairly modern it may be worthwhile for you to wait until the FREE 2.6 patch is released and do an automated performance test to see where you are at.

Some of us on the "Performance Thread" were exchanging save games to compare performance on different systems. I'm sure you can find someone's game to load up if you don't want to do any automated tests ....
 
I have 930 hours playtime and running a pretty high-end pc with 16cores and 32 threads
The game needs a strong SINGLE core. 14 of your cores are useless and taking them away would not change the performance of stellaris at all (2 improve it a bit over just one because other work (like windows) and a small amount of multicore support do exist).
 
20 real-time-seconds-per-game-month sounds like a reasonable personal standard to me. I don't know what type of system you have BUT if it's fairly modern it may be worthwhile for you to wait until the FREE 2.6 patch is released and do an automated performance test to see where you are at.

Some of us on the "Performance Thread" were exchanging save games to compare performance on different systems. I'm sure you can find someone's game to load up if you don't want to do any automated tests ....

I'm pretty sure the performance of this system is right where it should be (atleast in other real benchmarks), but thanks for the tip :)
1 month ago i upgraded my whole pc from a Core i7-5960X Extreme Edition @ 4.4ghz to my current 3950x, while the performance is better, its still not enough for Stellaris it seems
 
I think up-to 50% performance increase in lategame as shown above is not enough for this game to be playable lategame for me =/

I have 930 hours playtime and running a pretty high-end pc with 16cores and 32 threads-> my R20 Cinebech scores a 545 singlethread and 9.8k mulithread.
Normally i reach 1k pops around year 2300, and its around this time i have to stop playing because of the lag. (unmodded)

Lets say i can now get 50% more "pop performance", that means i can have around 1.5k pops before the game become unplayable again for me.
That will take me around 30 more years ingame i would guesstimate ? So with this soon to be released patch i can maybe play a few hours more before i have to call it quits again (?)

That's doesn't seem good enough to me.

.
On average what is your day to second ratio?
 
I'm sorry, but this is just entitled behaviour and it sucks. You haven't even played the updated game and you're already decided it's unacceptable? Come on, if you've had performance issues in Stellaris, I would have thought this post would be exactly what you were waiting for!

15% more than the current state is still a long way from acceptable.

Are there plans to continue focussing on performance to the same extent, or will we return to the status quo of "we are always working on performance"?
 
Do you mean the average time per day ingame ?
I wrote in my first post 1 ingame year took 4min and 4seconds on that particule playthrough before i stopped playing, that means on average each day took ~ 0.67 seconds.
244 sec / 365 ingame-days = ~0.67 (real) seconds per ingame-day
And that's too slow for you?

15% - 30% improvement minimum would reduce that by a rather significant margin, wouldn't you say?
 
I'm sorry, but this is just entitled behaviour and it sucks. You haven't even played the updated game and you're already decided it's unacceptable? Come on, if you've had performance issues in Stellaris, I would have thought this post would be exactly what you were waiting for!

Devil's advocate: I assume that some people may not understand the 15% number. I reached out to one of the people on the stream this morning and they confirmed the 15% boost is for the game as a whole with the majority of the boost coming in when POPs really start to swell. One graph was showing a 50% late game improvement. Some videos [I assume cherry picked] show 200% late game improvement.

If the late game performance improvement was only 15% then I'd also be quite unhappy and would want a lot more work done.
 
And that's too slow for you?

15% - 30% improvement minimum would reduce that by a rather significant margin, wouldn't you say?

Think this will be my last post on this thread as i don't want it to even more offtopic, but did you read what i wrote in post #144 ? https://forum.paradoxplaza.com/foru...technical-issues.1335134/page-8#post-26275950

I'm expecting a 50% improvement and i explained my thoughts around it.
Guess i will hope to get the same 200% improvement as shown in the videos because 50% simply wont cut it i fear.
 
I love how there are some who just respond to this with "Oh, this is horrible! Only 15% late-game performance increase no matter what in exchange for early-game lag, only on super-computer hardware, vanilla-only, Fox only, Final Destination, only if I'm wearing green socks and it's Thursday! Oh, the platypi!" while completely missing the over 300% increase video on pop-heavy games. Sure, the overall results will probably be less dramatic, but the devs have specifically showcased that this targets a lot of the late-game lag very effectively. Tempering expectations is generally very smart, but this looks more like specifically rejecting the evidence in order to complain more.

Kudos to Moah and the rest of the programmer team. Those performance numbers look great.
 
Think this will be my last post on this thread as i don't want it to even more offtopic, but did you read what i wrote in post #144 ? https://forum.paradoxplaza.com/foru...technical-issues.1335134/page-8#post-26275950

I'm expecting a 50% improvement and i explained my thoughts around it.
Guess i will hope to get the same 200% improvement as shown in the videos because 50% simply wont cut it i fear.


I tend to play with VERY LOW numbers of stars & habitable planets mostly due to not wanting to Micro "a million planets". It just so happens that smaller-game performance is easier on my 7-8 year old rig :) While I stand a VERY good chance of benefiting I'm not nearly as confident as your game & mod settings seem to be the opposite of where I'm playing at.

Hopefully you'll benefit even more than the 200% numbers we're throwing around. Good luck!!