Average Manatee
Arcane
- Joined
- Jan 7, 2012
- Messages
- 14,374
As the saying goes, what paradox programmers giveth, paradox content creators taketh away
And I was just beggining to itch for a replay...Yeah baby, talk Performance to me.Performance
- Parallelised batch modifier updates (large reduction of lag spike potential in the late game).
- Fixed a problem with multithreading that meant that sometimes all threads would just wait a while for each other for up to 20 milliseconds.
- Cached colonies in system so that the game can iterate through colonized planets instead of going through all the planets in the system and working out if they were colonized.
- Cached updating of starbase type, which was previously calculated on the fly when needed - slowing down e.g. outliner updates.
- Cached wars list instead of recalculating it repeatedly whenever a country had to see if it was in a certain (or any) war.
- Fixed a lag spike that could happen when the AI considered where to build megastructures.
- Improved performance of checking whether a country can use a certain hyper relay or gateway.
- Improved performance of the game checking if a planet is a colony, slightly (it does this a lot, so this speeds up e.g. intel updating non-negligibly).
- Multithreaded working out trade value and resources for systems' map icon displays on the galaxy map.
- Now AI finds the best potential office branch 4x faster. Reduced number of the systems used to calculate the distance to the target planet by using only border systems of the current empire.
- Optimized a few events frequently called via on_planet_surveyed (since planets can be surveyed and unsurveyed via the intel system).
- Parallelised calculations for how much a Situations should progress on the monthly tick (i.e. reduced Situations' potential impact on monthly ticks).
- Parallelised strike craft movement.
- Reduced the performance cost of auto migration on the monthly tick (by about half).
- Shifted country migration caching from serial to parallel.
- Shifted most of spynetworks' daily updates from serial to threaded.
- Shifted ship jump drive and experience calculations to parallel.
- Shifted some parts of planets' handling of monthly pop growth to parallel to speed up the monthly tick a little bit.
- Sped up monthly tick a bit by multithreading country opinion caching that is done then.
- Threaded daily checks of policies' validity.
Holy shit, look at what a performance mess their code was (likely still is).Performance
Now, I shall turn to performance: myself and a few others weren’t really happy with the late game performance in Stellaris. So we tried, with various methods, to make it better. And, to be honest, the results are quite promising.
In general, there are three ways of making performance better: fix cumbersome logic, use caching, and multithread. It’s not so easy, though, because the latter two solutions have some unpleasant friends: caches like to hang out with Out Of Syncs and miscalculations, while multithreading likes both CTDs and OOSes. But we managed to make headway on various issues.
First and foremost, modifier updates were quite expensive. For instance, if you enabled an edict in your country, it would trigger a recalculation of the modifiers in every planet, fleet, ship and pop owned by this country. This ends up being a lot of recalculations, which could take a while, since updating modifiers was not exactly trivial - basically, the nice tooltips in pop details which show where all the effects they have come from take a fair bit of processing power to achieve.
There are two improvements on this front in 3.5. Firstly, we multithreaded the modifier updates. It was all done in serial before, and could lead to lengthy freezes and some daily ticks taking far longer than others. For good reason - there were a lot of interdependencies to untangle, and crashes to prevent. Still, this had a pretty big effect.
Additionally, I noticed that pops were getting modifiers added to them that were irrelevant, like megastructure cost modifiers. So an additional parameter was added to economic categories to specify where the modifiers in them were expected to go, which ended up saving a further 20% of time while recalculating modifiers.
Aside from this, a fairly big improvement came when we noticed that our multithreading system would occasionally bug out and have all threads waiting for each other for several milliseconds. This made multithreading relatively fast operations actually end up being slower on average, and even where it was still worth it, it’d be slower than it needed to be. Luckily, our Tech Director was able to save the day and stop this madness, improving our player experience immeasurably.
This is just a taste of the things we did. Basically, a lot of time was spent analysing a deliberately absurd save game - it was set to maximum pop growth, tech progress, galaxy size and habitable planets, and then run without crises or fallen empires until 2730. The game chugged a fair bit (with which I mean, it took 11 minutes for a year), but it turned out the main culprit was strike craft movement. I was unable to replicate this on any normal save - it probably only occurs during battle, and there were presumably some extremely large battles going on - but anyway by multithreading that it actually became somewhat more reasonable to play.
From there, there were a lot of incremental fixes that were possible. For instance, the game spent quite a bit of time working out whether a system had colonies in it, several times a day - something which could be cached quite easily. (Well, so I thought. Two OOS fixes later, I was regretting this). Another big offender was wars: a country didn’t have a cached set of wars it was fighting in, but would instead recalculate all the wars it was fighting in whenever it needed to know information about any of the wars it was fighting in. Needless to say, this was quite inefficient, and fortunately quite cachable. Then, whenever the game was working out which type of starbase a starbase was (e.g. “Bastion”) - including every few frames on the outliner - it would look through every different type of starbase and decide which one was most appropriate here - the answer? Cache, cache, cache.
We also sped up the time it took for the AI to decide where to establish branch offices. Then we noticed that most of the time spent updating countries in serial was spent assessing the validity of their policies - something which we could thread. (Ok, it’s not so easy: we could thread the calculation, cache the result, and then implement the result in the next serial update, which would be basically straight afterwards). Finally, monthly ticks should be a bit quicker, since we used a similar logic on the calculations for which pops should assemble, grow and decline, and also removed about 50% of the job cache recalculations during auto migrations.
It wasn’t all plain sailing - aside from at least three OOSes and two crashes introduced and fixed with this work, we noticed after a while that the game wasn’t quite as fast as we were expecting. In fact, it was temporarily freezing every few days. This, it turned out, was because - thanks to some logic fixes with unintended consequences - the AI was thinking extremely hard about where to place its megastructures. So some changes to put the more expensive checks there were needed.
How much impact will all this have? Well, I can’t promise any particular number, for various reasons. For one thing, most of these improvements were made in July, and it’s always possible we added new inefficiencies in the meantime (e.g. the megastructures thing). Also, in particular due to AI games, a 3.4 save is not very comparable with a 3.5 save, since the AI will have behaved rather differently in creating that save (but on the other hand, you cannot load a 3.5 save in 3.4, because it will almost certainly crash). Besides that, a particular save may have a particular thing going on causing it to lag (e.g. the strike craft issue alluded to before, which had otherwise seemed a non-issue). And sometimes computers are just temperamental and allocate their resources to doing things other than playing the game. Nevertheless, last time I did tests based on 3.4 saves, it was more than 30% faster. In my latest late game campaign, it’s not precisely fast (the late game will never be as fast as the early game - there’s so little going on in the early game that performance is primarily determined by how fast it takes to render frames), but it definitely feels less slow. But I look forward to seeing what people think, and whether people feel that more effort is needed.
But this is good progress.
Now THIS is what I'm talking about when it comes to performance fixes.
Custodians fucking deliver. All other pdox team should learn from this.
Right? I got a game to like 200 years, but the performance gave me soulpain.Fucking finally. Late game performance keeps me from playing the game entirely.
Yeah, but that's the thing with programming: You have to be careful or your project gets technical debt. Legacy Code is a bitch.As the saying goes, what paradox programmers giveth, paradox content creators taketh away
Sigh Right?And I was just beggining to itch for a replay...
Good points overall, but please let Brian go. The poor dude needs fresh air.What are you talking about, I love it when each day takes 2 seconds to pass and FASTEST is exactly as fast as NORMAL
The Star Trek mod is hurting my BRIAN. It's possibly the best Star Trek game ever (who would have guessed, fans make better shit than megacorps staffed with Harry Potter-watching millennials), but by the time you even get to Kirk's era it's crawling. By the time you get Galaxy Class ships, it's basically unplayable. And that's on the normal galaxy, not the MEGA HUEG one with 4000 stars.
Stellaris is still being handled much better than most other Paradox games, if not all of them. I get the impression some Paradox executives actually play Stellaris and want it to be good. So who knows, maybe Stellaris 2 will be alright.Finally, after six years, ten thousand revampation of the base mechanics and 200$ of dlcs. And this is just Stellaris 1, right now I'm scared for Stellaris 2
Yeah, the price / dlc model for Stellaris isn't as egregious as CK2 and EU4.Stellaris is still being handled much better than most other Paradox games, if not all of them. I get the impression some Paradox executives actually play Stellaris and want it to be good. So who knows, maybe Stellaris 2 will be alright.Finally, after six years, ten thousand revampation of the base mechanics and 200$ of dlcs. And this is just Stellaris 1, right now I'm scared for Stellaris 2
Of all the paradox games to play...Stellaris is still being handled much better than most other Paradox games, if not all of them. I get the impression some Paradox executives actually play Stellaris and want it to be good. So who knows, maybe Stellaris 2 will be alright.Finally, after six years, ten thousand revampation of the base mechanics and 200$ of dlcs. And this is just Stellaris 1, right now I'm scared for Stellaris 2
Paradox Exec A: The fanbase is revolting!The fanbase revolted some time ago
Full price, about 200+I have the original game.
How much money do I need to spend more if I want to have all the addons?
Why comrade? If you want to play MP only the host needs to have DLC, if you want to play SP its trivial getting the DLC activated...I have the original game.
How much money do I need to spend more if I want to have all the addons?
You need to do your homework for each add-on. Some of them are purely cosmetic and bring absolutely nothing to the game. And you might need to do your homework on some of the gameplay ones as well. Some are just bad.I have the original game.
How much money do I need to spend more if I want to have all the addons?
Stellaris is still being handled much better than most other Paradox games, if not all of them. I get the impression some Paradox executives actually play Stellaris and want it to be good. So who knows, maybe Stellaris 2 will be alright.Finally, after six years, ten thousand revampation of the base mechanics and 200$ of dlcs. And this is just Stellaris 1, right now I'm scared for Stellaris 2
Yeah, but it's been rewritten for reddit, not hardcore sci fi simulationists.Not that this has stopped them before, the basic concepts of the game have been torn out and rewritten multiple times already. If it weren't for the fact that the graphics haven't changed, the game is functionally unrecognizable from its release version.
Not that this has stopped them before, the basic concepts of the game have been torn out and rewritten multiple times already. If it weren't for the fact that the graphics haven't changed, the game is functionally unrecognizable from its release version.
Supposedly there are those internal factions, but they are usually very easy to please, from the few games I played.At the same time the game does not even try to simulate any internal affairs of each empire.
Yeah, it's sad that there is next to nothing to distinguish empires now besides +/-% bonuses (which quickly get weaker over time as tech gives bonuses to everything, so it's just a race to get tech).There are a lot of QoL additions they made to the game that make it easier to play, and a lot of bugs they've fixed, but it's a far less ambitious, less interesting game at its core now that it was at release. Rather than getting rid of the unbalanced propulsion mechanics, they should have doubled down on them and made even more asymmetrical mechanics.
The problem is "balance". Toxoids would inevitably become unbalanced if there are more toxic worlds than habitable.Yeah, it's sad that there is next to nothing to distinguish empires now besides +/-% bonuses (which quickly get weaker over time as tech gives bonuses to everything, so it's just a race to get tech).There are a lot of QoL additions they made to the game that make it easier to play, and a lot of bugs they've fixed, but it's a far less ambitious, less interesting game at its core now that it was at release. Rather than getting rid of the unbalanced propulsion mechanics, they should have doubled down on them and made even more asymmetrical mechanics.
You would have thought that "toxoids" would be an expansion introducing a race that could inhabit some of those "toxic" worlds that other races literally can't colonize. Maybe even a race that could only inhabit toxic worlds. No, they are just a regular race with funny pictures and some slightly different traits.