Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Stellaris - Paradox new sci-fi grand strategy game

thesecret1

Arcane
Joined
Jun 30, 2019
Messages
6,703
it helps to make it so it doesn't slow down to a crawl as the game goes on.
In EU4, the longer you play, the better it gets, since there end up being far less nations as the game progresses :lol:

Honestly though, there's no excuse for how shittily Stellaris runs. It's not really that complex a game, with far, far less shit than CK2. It should run smoothly even with just an average single core, but the programming is just too shit. I suspect the engine is just part of the problem – the main issue is the implementation being retarded. Most likely due to them basically redoing the entire game since release (do you remember what Stellaris was on release? Entirely different game. Basically every mechanic got either a massive overhaul or was downright scrapped and written again), which is bound to leave the code in tatters unless done properly. The rewrites were needed, in turn, by shit design, where many mechanics were half-baked or entirely unbalanced, coupled with terrible AI. There was obvious effort to copy shit from other successful games, most obviously the pop system (which is the main source of bad performance). The pop system is shit. It's awful. It's always been awful and doesn't get much better no matter the iteration. It's ridiculous micro in a game supposed to be about macro (cue in sectors mechanics as a bandaid solution, except the AI is shit so it doesn't work anyway) that fails to even try to pretend to be simulationist (for one, growth is independent on number of pops on the planet, so it grows at the same speed whether you have one pop there or fifty. Also, only one species at a time gets to grow, while every other species holds off from fucking until it's their turn. Ridiculous. For two, it presents you with some USSR-tier planned economy. This comrade will work in the mines, this one will be a clerk... Just more fucking micro with no simulationism whatsoever).
 

Norfleet

Moderator
Joined
Jun 3, 2005
Messages
12,250
Honestly, I think that when you have an engine for immensely complex strategy games, it helps to make it so it doesn't slow down to a crawl as the game goes on. Which Paradox seems to often forget.

That said, CKII does prove Paradox can make a game that doesn't run like crap... eventually. Then again, CKII is old.
CK2 does run like crap eventually as the character count explodes...unless you're like me, and kill thousands of people every generation.

The main reason Stellaris runs like crap, though, is due to one singular algorithmic defect which doesn't manifest itself until late game. It's not really intrinsic to the entire game as a whole, it's just that one singular cause.
 

Jimmious

Arcane
Patron
Joined
May 18, 2015
Messages
5,132
Steve gets a Kidney but I don't even get a tag.
Stellaris Dev Diary #170 - Performance and other technical issues

Hallelujah?
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.
 

thesecret1

Arcane
Joined
Jun 30, 2019
Messages
6,703
Holy shit, what the fuck.
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.
Why would you do that? Why would anyone ever think this is a good idea? This is some undergrad programming shit right there, it SCREAMS that it'll kill the performance.
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.”
YOU THINK?

I knew Paradox was incompetent, but I thought it was mostly the designers. This is just... really sad. This is literally something a college student rushing a thesis would do. If this is the quality of code Paradox has, no wonder their games run like shit. That instead of immediately rewriting it to something sane upon hearing the complaints, he went and was "pigheaded" about it just says volumes about what arrogant twats work at Paradox.
 
Joined
May 11, 2007
Messages
1,854,431
Location
Belém do Pará, Império do Brasil
Huh, 15-30% average performance enhancement.

I suspect a 20-25% performance improvement is the most we can expect with this patch, given the time/resources/will. Unless someone in their code team strikes it golden and finds out how to give it a massive boost, and they are actually cagey about it because they are actually immensely giddy about the new performance and will use it to overhype Federations and the new patch.

Expectations: Surpassed.

Not bad, Paradox. Not bad.

That video showed more like x3 speed difference, it was brutal. It was in late-game with a load of pops.

Yeah, my interest got piqued now. I do hope they don't rest on their laurels and optimize every new patch.

We shall see, when it releases.

CK2 does run like crap eventually as the character count explodes...unless you're like me, and kill thousands of people every generation

Yes, but its also simulating thousands of titles. Remember that every little baronate is a title. So its simulating thousands and thousands of titles within titles within titles and thousands of characters with relations to other characters. Who are all at once doing all sorts of things.

CKII is far more complex than Stellaris, at least that's how I see it.
 
Joined
Jan 7, 2012
Messages
15,269
The youtube video performance comparison is unplayable on both versions. If mid-game performance is only sped up by 30% then its too little IMO.

Holy shit, what the fuck.
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.
Why would you do that? Why would anyone ever think this is a good idea? This is some undergrad programming shit right there, it SCREAMS that it'll kill the performance.
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.”
YOU THINK?

I knew Paradox was incompetent, but I thought it was mostly the designers. This is just... really sad. This is literally something a college student rushing a thesis would do. If this is the quality of code Paradox has, no wonder their games run like shit. That instead of immediately rewriting it to something sane upon hearing the complaints, he went and was "pigheaded" about it just says volumes about what arrogant twats work at Paradox.

Its even more incompetent because literally every Paradox game running on this engine specifically sets a tickrate at which most strategic elements need to be processed. This rate is once per day for the HoI games and once per month for all of the other games. The exact result of decisions and computations SHOULDN'T MATTER FOR OOS as long as they happen within a month since its only at the end of the month that the changes are tallied up and start to affect the gamestate. The fact that they can OOS shows that whoever is programming their games badly misunderstands their own engine. Of course I predicted all of this on the Paradox forums but was shouted down by the resident fanboys telling me that programming games properly is so hard to do and that they were stackoverflow experts who shouldn't be questioned.
 

thesecret1

Arcane
Joined
Jun 30, 2019
Messages
6,703
Yeah, I found that strange too. Also that some things get evaluated on second day of the month instead of the first in Stellaris – they likely evaluated one thing on the first day, then allowed for one more tick before evaluating another thing that depended on the first, basically leaving the update to call it for them instead of calling it manually. Lazy.
 
Joined
Jan 7, 2012
Messages
15,269
Yeah, I found that strange too. Also that some things get evaluated on second day of the month instead of the first in Stellaris – they likely evaluated one thing on the first day, then allowed for one more tick before evaluating another thing that depended on the first, basically leaving the update to call it for them instead of calling it manually. Lazy.
No, that makes sense. It helps smooth out the lag in the month rather than having a hard pause in the middle. It's also a good way to multithread (e.g. core 1 says "I'll continue processing day 2" while core 2 says "I'll do something else and have it updated before you're on day 3"). Ideally you would spread everything out like this as much as possible, as long as the end result didn't change to the player. Generally you'd cache results and if something changed before the end of the month due to the player doing something unexpected with the pops then you'd have to re-do the calculations. The issue is that they was they designed and coded the game apparently makes it very hard to keep MP in sync because these operations that should be independent are instead co-dependent, meaning entire sections of the game code have to be re-synced up (meaning total recalculation of everything) every so often for the simulation to proceed, and this ends up being way more often than the once per 30 days that is intended.
 

Norfleet

Moderator
Joined
Jun 3, 2005
Messages
12,250
Huh, 15-30% average performance enhancement.

I suspect a 20-25% performance improvement is the most we can expect with this patch, given the time/resources/will. Unless someone in their code team strikes it golden and finds out how to give it a massive boost, and they are actually cagey about it because they are actually immensely giddy about the new performance and will use it to overhype Federations and the new patch.

Expectations: Surpassed.
Surpassed? I wouldn't call that surpassed. 15% < 25%.

CKII is far more complex than Stellaris, at least that's how I see it.
It is not. In CK2, you have only a few thousand independent actors. Most of those act independently unless they have to consider who to castrate in their entire empire, and pick their actions without doing any deep thought, purely at random. In Stellaris, pops have to take into account a ton of conditional logic and cannot simply take entirely random actions.
 

Norfleet

Moderator
Joined
Jun 3, 2005
Messages
12,250
30% as upper bound is certainly surpassing my expectations.
That's not how expectations or performance works, though. To surpass an expectation, the binding worst case performance (a thing is only as good as it performs in it worst case) must surpass the highest level of expectation. Otherwise the expectation is merely satisfied.
 

lightbane

Arcane
Joined
Dec 27, 2008
Messages
10,562
Soo, how many DLCs do you think will be made? I was thinking giving this a try once the performance issues are somewhat solved, but as usual, it seems there's no end to the DLC line. I was interested in playing as a robot species, but I read mods are a must to make it less boring if you want to do that.
 

Jimmious

Arcane
Patron
Joined
May 18, 2015
Messages
5,132
Steve gets a Kidney but I don't even get a tag.
No one ever knows how many DLCs are going to be made for a Paradox game. Can be anywhere between 20 and 300 I guess
 

thesecret1

Arcane
Joined
Jun 30, 2019
Messages
6,703
No, that makes sense. It helps smooth out the lag in the month rather than having a hard pause in the middle. It's also a good way to multithread (e.g. core 1 says "I'll continue processing day 2" while core 2 says "I'll do something else and have it updated before you're on day 3"). Ideally you would spread everything out like this as much as possible, as long as the end result didn't change to the player.
While the sentiment can be agreed with, the implementation is terrible. You absolutely do not want to give out results at random – the player expects everything to be updated at precisely the first of the month, and when you start updating different things at different days, you are bound to leave the whole thing a mess. It is already quite messy how some things get updated once per several months, some weekly (or so was the case), some monthly, etc. Ideally, there should be exactly three types of updates – daily (for army movements, ship construction, etc.), monthly (income, pop growth, etc.) and possibly yearly, should the need arise for it (though I think daily and monthly should suffice for Stellaris). The optimal way to achieve this would be to precalculate the month's results during the days of the previous month, and forcing recalculation on demand, when the player does something that would change the result (for example, if he decides to change the research two days before the month finishes). That way, you would neatly stagger the vast majority of the calculations throughout the month. What Paradox appears to be doing, however, is make most of the calculations when the new month starts, and then stagger some more during said month, thus also staggering the displayed results. This is wrong. I bet Paradox even has it listed somewhere as a low priority bug that they ought to fix.
 

Hellion

Arcane
Joined
Feb 5, 2013
Messages
1,691
Federations Expansion launches March 17th, St Paddy's day.



Funny trailer, too. That grumpy blue guy from last year's Federations trailer seems to be quitting the treaty they signed back then.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom