1. Stellaris
  2. News

Stellaris News

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…




[h2]Pops.[/h2]
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.


[h2]OK, but what did we actually do about it?[/h2]
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:

https://www.youtube.com/watch?v=9SFE89Wj8go&feature=emb_title

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.

You wanna find out more about the performance improvements? Have a read here !

Stellaris Dev Diary #169 - Origins QA

Today we're continuing the Q&A series we're doing, answering questions related to different topics. Last week we asked you to post your questions related to Origins, which were previously revealed in Dev Diary #160.
Here we go!


General Origins Questions


How will randomly created AI empires choose an origin? Will it be completely random, or are some more likely to show up than others? If the latter, which logic does it follow?
The weightings are scriptable. The default currently has a weight of 100, others that are available to the AI (which is most of them) have between 2 and 10, so statistically you are likely to have a few of them once you have 10+ AI nations. Some origins like Doomsday are also blocked for advanced AIs as that wouldn't fit the narrative.

Many are also restricted so they will only randomly generate if that origin is not already represented in the galaxy.

Are there any events related to each Origin? (And many similar questions.)
Yes. Some origins, such as the Galactic Doorstep, are primarily narrative-based and thus have many events. Others, like the Shattered Ring, are primarily changes to an empire's starting conditions and have few, if any (other than custom start text).

Will the preset empires have different origins? Will they have new civics picked to substitute those that become origins? (What will happen with the Xanid Suzerainty for example?)
Yes, preset empires have origins. Most of them have Prosperous Unification, but some have others.

Empires that previously had civics that have been turned into origins will have new civics given to them. As examples, the Xanid Suzerainty now has Corvée System and Cutthroat Politics, and the Lokken Mechanists have Technocracy and Meritocracy.

Can you change your origins through events?
No, that would involve timeline alterations and the potential destruction of the space-time continuum.

Will there be origins that allow for special tech, that is otherwise unobtainable? For example, could a Fallen Empire share tech for Fallen empire buildings with you if you choose the Scion start?
We do not currently have any origins that have unobtainable tech, but this would be possible.

I believe you mentioned before that each origin had special events. Will we still have the special start events of say Mass Extinction, Habitable planet survey, and Radical Cult events? Will they still happen even if we pick say Doomsday or Remnants or Void Dwellers?
Some event chains have been disabled for certain Origins, when they no longer made sense.

Do Fallen Empires have origins?

Yes, for flavor they have been given a unique "Elder Race" Origin.

If you want to find out more about Origins, check out the full post here . PS. Next week, our Tech Lead Moah will be posting a dev diary giving an update on performance improvements planned for the 2.6 "Verne" update... Stay tuned!

Dev Diary #168 Diplomacy QA

Greetings!

As a part of the Q&A series we're doing, we will be answering your questions related to different topics. Last week we asked you to post your questions related to diplomacy, and we want to thank you for all the questions we've gotten.

Before we jump into the questions, I'll take the opportunity to mention that the Q&A series will continue next week as well, and you can already post your questions about Origins.

General Diplomatic Questions
Q: Will Diplomatic deals get a similar treatment to Federations, in that they require higher “levels” before unlocking all mechanics?
A: Not specifically, but diplomatic actions now require certain Relations levels before being able to be proposed. (Envoys can be used to relax these restrictions.)

Q: Will the interstellar assembly megastructure mechanics be changed for the update
?
A: Yes. The immigration bonus has been replaced with a Diplomatic Weight bonus, and at stages II and IV the Interstellar Assembly grants additional envoys.



Q: Will you be expanding ways to improve relations with another empire beyond the current resource bribes?
A: Yes, there is a new diplomatic action called Improve Relations which allows you to increase an empire’s opinion of you.

Q: Will AI empires that covet my territory try to sabotage relations? In other situations, will the AI try to modify relations to where it thinks they should be?
A: AI empires will use the Improve Relations envoy action if they are interested in pursuing other deals, or Harm Relations if they dislike you and either want you as a rival or want to insult you.

Q: Will we be able to get custom settings to choose which diplomatic notifications we are interested in receiving, and perhaps nuance to such a system such as "nations of interest" and "nations of total irrelevance".
A: No, but you can disable certain types of alerts by shift-right clicking on them. (You can re-enable disabled alert types by toggling that section on in the Outliner and right clicking on them.)

Q: Will having any diplomatic relationship bigger than Open Borders still generate Xenophile attraction?
A: If you are in a federation, defensive pact, or commercial pact with an empire that is a different species, then yes, the xenophiles gain a bonus to ethics attraction. (And contact with an empire that has enslaved or genocided pops of your species provides a xenophile attraction penalty.)

Q: Will there be some new (diplomacy related) Ascension Perks?

A: There are no new Ascension Perks, but Galactic Contender now also grants a Diplomatic Weight bonus.




If you want to read more about Diplomatic Questions and start asking questions about Origins, have a read here!

Dev Diary #167 - Galactic Community QA

Hello again!

As part of our Q&A series, this week we're going through the questions you've asked about the Galactic Community. As expected, there were a lot of them, so we condensed a few similar questions together.

While some of the Diplomacy related questions are answered here, we're compiling questions for the next Q&A in this thread.

[h2]Membership in the Galactic Community[/h2]
Q: Will founding the galactic community be based on a bit more that just meeting half of the players? The real UN was very, very simply put the result of two world wars. It wouldn't make a lot of sense if there immediately was the diplomatic will to form this forum just by meeting a bunch of people.
A: The event chain that initially attempts to form the Galactic Community begins once a non-genocial and non-gestalt empire has encountered at least half the galaxy, and at least three non-genocial empires agree to form the Community. If it fails to form, there will be additional opportunities later.



Q:Are we 'in' by default, or does we get a choice to join when GC is formed?
A: You are given a choice whether or not you wish to join the Community. (This is also the case for empires that were not part of the initial founding but gain communications with a galactic community member.)

Q: How do we get out? / Is leaving the galactic community a permanent decision?

A: You can leave at any time by paying an Influence cost that scales with your Empire Sprawl.



As noted, you cannot rejoin for a period of twenty years, during which you have reduced Diplomatic Weight and an opinion penalty with Galactic Community Members.

Q: If an empire leaves the galactic community to escape sanctions will other members get some casus belli against them?
A: It depends on what Resolutions have passed. Usually, no.

So this was a sneak peek from our Galactic Community Q&A, if you want to find out more have a read here!

Dev Diary #166 - Federation QA

Hello everyone!

In last week's dev diary we talked about the new Q&A format that we will be doing for the next couple of dev diaries. We asked you to post your questions regarding the federation rework, and we're glad to see so many questions!

Next week's topic will be the Galactic Community, and you can already post your questions here!

Anyway, let's begin with the Q&A:

[h2]Subjects:[/h2]
Q: Are subjects forced to join some federation types (or all?) if you ask them to?
A: It’s up to your federation whether or not subjects are allowed in. If they are permitted, they will automatically follow their overlord in or out.

Q: Can you make/start a federation with your subjects?
A: Federations are (theoretically) alliances between equals, so independent diplomacy is required to initially form one. As noted elsewhere, vassals may be brought into federations (whether they like it or not) depending on federation law.

Q: Can you form a trade-league with a 1-planet sector you released as a vassal for just that purpose?
A: No and yes. Yes, you can release a 1-planet sector with the intention of starting a federation, but they would need to be independent for you to be able form it.

[h2]Federation Laws:[/h2]
Q: Will there be any tools (laws, for instance) to combat ethics drift within a Federation? It would be nice to have a way to deal with an incompatible empire other than expelling them (then reabsorbing via a liberation war).
A: No, there is no way for you to influence the ethics of other empires. The cohesion penalty is meant to be offset by having to assign more envoys to the federation.

Q: Can you pass federation laws regulating member policies? For instance, decree that all primary species must have full citizenship throughout all federation empires? Or just outlaw slavery altogether? Because I hate seeing my own species enslaved by allies I have a migration treaty with.
A: There are currently no laws to influence other empires like that within the federation, but we’re certainly open to the idea. Once Federations is released we’ll be gathering your feedback as always

Q: Will we be able to pass laws that affect specific pop types? For example, I want to have all empires in my Hegemony, or all my vassal empires be forced to set Starfish pops to purge status (after all everyone seems to think that Starfish portrait represents fanatic purifiers the best).
A: Same as the answer above.

Q: How many federation laws are there?
A: There are currently 14 categories of laws, with each category having 2-5 laws.

Q: Can we get an Academic Debate succession type for Research Cooperatives?
A: There is in fact a Challenge Type called Thesis, which very much mimics what we think you are looking for. It’s available to all federation types.

Q: Could we get an example of more federation laws?
A: Yes we can! In dev diary #158 you could see most of the laws, but there are some things that have been changed or added since then. We now have the Strongest Succession Type, which is split up into different categories like Economy, Fleet, Tech or Diplomatic Weight. We have also added two new Challenge Types: one which is a bidding process where you spend ECs to become the president, and another one which is an academic thesis. We will definitely show off all these things in more detail on a stream sometime in the future.

These are not all of the questions that we answered, there are a ton more on our forums, which you can check out here!