• 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.
Showing developer posts only. Show all posts in this thread.

Eladrin

Stellaris Game Director
Paradox Staff
Apr 4, 2019
1.059
37.472
www.paradoxplaza.com
Hi everyone!

This week, @Gruntsatwork will discuss the technical details of pop group scripting. This topic is likely to be of most interest to the modding community.

The systems we’re implementing now are just scratching the surface of where we want to go with them - we’re looking forward to some of the things we’ll be able to do with these tools over the next few years as well as seeing what you do with them.

As with all of these dev diaries, some of this is still subject to change during implementation and during the beta.

Pop Groups and Jobs​

Hello everyone, @Gruntsatwork here! Let us talk about some of the script changes that are coming with 4.0 when it comes to pops and jobs…

As Eladrin already mentioned in Dev Diary 370, we are changing the way we look at Pops by grouping them together into Pop Groups. These groups are defined by their species, traits, ethics, and factions but NOT their jobs. It is entirely possible and likely for a pop group to have pops working different jobs.

The goal is that for most purposes in the game, you will reference pop groups instead of pops, which should hopefully save us from iterating through every single pop in our empire whenever a modifier needs to be re-calculated.

This allows us to tone down or remove some of the most performance-intensive actions we used before and replace them with far more performance-friendly variations instead.

For example, that means that both “random_owned_pop” or “any_owned_pop” have been relegated to the dark corners of history and replaced with “random_owned_pop_group” and “any_owned_pop_group”.

The same holds true for many of the effects used on those pops, like create_pop or kill_pop, or move_pop. Going forward, we will now create, move and kill pop groups, either in their entirety or through percentages. And for the eagle-eyed among you, YES, that means you no longer have to loop through singular pops to do unspeakable things to them, you can nicely target their pop group and let it do the math for you.

Thanks to the tireless efforts of our programmers, who have given us some new functionality for scripted triggers like comparators, other old tools, like num_pops, will see a resurgence as a scripted trigger. We expect the modding folks to find a lot of use in that, even as we slightly dread what you will come up with.

As also mentioned by Eladrin, this means we no longer have a constant contact between pops and their job.

Instead, there is a single moment of assignment when the pop group briefly knows which job it is supplying and with how much workforce. From then on, the job only knows that it has been supplied with workforce and thus must produce the associated resource. As long as the assignment stands, we have no need to check on the pop again.

This brings us to one of our biggest changes: removing all production modifiers on species traits and replacing them with bonus workforce. Simply put, because the workforce assigned to a job does not know which species it came from during most checks, production bonuses from species (modifiers like +10% Research from Jobs from the Psionic trait) cannot be applied. Instead, species traits now provide modifiers like “+10% Bonus Workforce for Researcher Jobs”, which means 100 Psionic Pops working 100 Physicist jobs will have the job upkeep and output of 110 Physicist jobs. In other words, we only pay upkeep on 100 Pops, but we get the output of 110 Researchers! This also has the side effect of the modifiers for job output from species traits are now multiplicative with other modifiers.

As an example, in 3.14 if we had 1 Psionic (+10% Research from Jobs) Pop working a Researcher job in an empire with the Meritocracy civic (+10% Specialist Job Output) on a Relic world with a Central Spire (+15% Research from Jobs), the total output would be 3 × (1 + 0.1 + 0.1 + 0.15) = 3 × 1.35 = 4.05 of each type of research.

In 4.0 if we have 100 Psionic (+10% Bonus Workforce for Researcher Jobs) Pops working 100 Physics jobs in an empire with the Meritocracy civic (+10% Specialist Job Output) on a Relic world with a Central Spire (+15% Research from Jobs), the total output would be 3 × (1 + 0.1) × (1 + 0.1 + 0.15) = 3 × 1.1 × 1.25 = 4.125 physics research.

This brings us beautiful new script entries like this one from the Psionic trait:
A sample of a job that he really made as bad as possible.

It doesn’t have to be like this. But it can be. Grunts made his choice. - E
This is perfectly serviceable - G
I have hopes to refactor this - AS

As a side note, some checks can still query a pop’s job, but only indirectly, by scoping to a job and determining which pop group is filling it. This means we can still ensure functionality for Death Cults and similar targeted kill_pop effects.

In contrast, production bonuses on the planet or the empire are still available since they simply affect everyone.

So for species traits, we encourage the use of these new modifiers

pop_job_bonus_workforce_mult
To increase the bonus workforce a pop generates for a given job.

pop_job_workforce_mult
To increase the workforce a pop generates for a given job, this is not bonus workforce.

job_max_workforce_mult
To increase the maximum workforce a Job can accept

As a reminder, a job's workforce will fill to its maximum allowed but not beyond that. If a pop generates more workforce than usual, fewer pops will be required to fill the job to max, but it will not produce more than its maximum. If a pop generates a bonus workforce, it can go beyond the job's maximum and scale its production up.

In addition, we have also split quite a few of our economic categories that depended on triggered checks of species traits. This also includes the use of triggers to fake an inheritance of economic classes, which we have removed in many cases and only left in the ones we deemed the most reliant on them.

For inheritance, we recommend the normal parent-child structure of economic categories OR, to use static_modifiers to grant the modifiers of any combination of economic_categories.

Most, if not all, of these changes were made to improve performance: reducing calls, loops, and modifier cascades that would otherwise trigger recalculations across every planet and pop in your empire, just in case a deficit check was needed at that moment.

Looking ahead, we see great potential in workforce mechanics, both for us and the modding community. We've hinted at automation – workforce decoupled from pops – and some of you may have already considered new applications for Virtuality. Who knows what other, more extreme variations in the type and number of pops empires require might now be possible?

Simply put, we now have the workforce to power Stellaris for years to come. Pun very much intended.

What’s Next?​

Our planned livestream is going to be delayed a bit, and will likely end up being alongside the Open Beta. Right now our primary focus is on implementation.

Next week we’ll have some more updates on how things have been going.
 
  • 65Like
  • 21
  • 10Love
  • 3
  • 2Haha
  • 2
Reactions:
It seems that population growth is simply removed from the game. You build a district, it provides jobs. You also create a district with housing. And out of thin air, within the amount of housing, population appears and takes up positions. If so, then it is very sad.

The current implementation of virtuality is now starting to look like a test for this future system.
No, as some have already pointed out pops still grow, workforce is supplied by pops which are grown as before.
Would like to ask for some more detail about pop jobs and species - I asked before if we will have micro control over which pops are even allowed to do certain jobs (Proles, get out of my damn labs and back in the coal mines). I got an answer that was basically "you won't have to do that". Are we going to be allowed to, though? Will I be able to make my planetary population segregated by job, so I can have a species that I "borrowed" and genemodded into absolute poindexters as the only ones (besides my main species) that's even allowed to fill Researcher jobs?
You will have as much control as before and tiny bit more with the new pop_category handling for unemployment and slavery.
You mention this difference between a pop generating more workforce and generating bonus workforce. You also say that all production modifiers from species traits are being replaced with bonus workforce. Do you have any examples for modifiers that grant more workforce?
None that I can tell you about.
Glad to hear you are all excited for what this new system can do. That's good - that's reassuring.

On the subject of modability questions, I didn't get an answer to my question(s) about Planet UI and Building Slot modability last week. I'm still very curious to know: will we still be able to easily add new Building Slots and/or Zone Slots to planets?


Emphasis mine. Does this count as a very slight nerf to the previously output-boosting traits (such as Psionic), as now we have to pay an additional upkeep cost for them which we didn't before?
(Don't get me wrong, though - I still think I prefer this new way, to the current/older one - and as your subsequent numbers demonstrate, it actually raises output even higher - but we as players WILL need to be aware of the upkeep implications)

This also seems to contradict "In other words, we only pay upkeep on 100 Pops". Are we paying upkeep on 100, or on 110?


Have you got any approximate numbers - be that in percentage, days/clicks, or system benchmarks for how much improved the new system is performance-wise over 3.xx?


I notice the DDs are now starting to be less about new features and more the technical side of things - which is less 'flashy', although still interesting, and understandably necessary.
At this point I'm nodding along thinking "Yep, great, all sounds fantastic. I'm sold. When can we start testing it?". I'm extremely keen for - and increasingly (politely) requesting - news on the Open Beta next. Thanks, dev team!
You will be able to adjust Building slots and zone slots numbers trivially easy, however, as always, the UI remains your final boss in that regard.
Regarding the traits, yes, since all species production bonuses basically become throughput bonuses, they become more powerful but also riskier.
As someone else pointed out just before this post, you pay the pop upkeep for 100, but the job upkeep for 110.
No numbers yet.
Psionic (= Non-cyborg Organic) Pops can't become calculators, possibly.
Oh please, we know the kind of mods you all are running.
Does this mean strata has been dropped as a consideration as that was mentioned before?



How will the game determine what pop to put in a job? Presumably it takes the pop with the best workflow bonus? And as a follow up will the game now displace pops at all? I.e if you have a sudden influx of intelligent pops will they displace the other researchers, or will we need to do a manual step of shutting down the jobs and reopening them?
That traits was meant to be strata, thanks for catching that. They are indeed split by strata as well.
 
  • 22
  • 5Like
  • 2
Reactions:
I hope this will not appear so cluttered on player facing UI.

From dev diary #370 we have

Will job filling prioritize bonus providing pop_group, or are we forced to accept under-optimized randomness?
I mean given current gameplay experience, it appears far more likely to have more than enough workforce for any specific job category.
I also feel like there are tons of cool design choices here that could really amp up the gameplay vibe for players. Make it policy dependent, perhaps.

For the 4.0 release we're planning on having it show as something like "Workforce for Researcher jobs: +10%", where Researcher is a concept with a tooltip that lists all valid jobs. For the open beta, expect a mess.
 
  • 28Like
  • 9Haha
  • 4
  • 3Love
  • 3
Reactions:
Any plans on giving Megastructures like the Dyson Sphere habitable areas?

We do not plan on adding habitable areas to general Megastructures.

So which one is it? If we have available 100 Physics Jobs position available, will 100 Psionics work them, providing 110 Researchers? Or will it be 91 Psionics working them providing 100 Researchers?

If it's +bonus workforce, then you have 100 pops filling the 100 jobs, but with 110 jobs worth of throughput.

So you'll pay the upkeep for 100 pops, but the upkeep and production of 110 jobs. (My 100 Blorg get +10% bonus workforce so are more efficient than those lazy Humans, but they still need 10% more minerals in order to produce 10% more alloys.)
 
  • 19
  • 13Like
Reactions:
Okay, so if I'm understanding this correctly, species traits no longer directly increase resource production but instead increase the workforce into jobs that are relevant to that resource.

The biggest implication from this change that I can see is that food-based economies/Agrarian is gonna be quite a powerful species trait/playstyle after this change if the Baol and Bio-reactors buildings and several civics remain the same.

For example, currently in Stellaris PI version we have this:
Farmers can potentially produce:
Food -> Can be boosted by Agrarians
Consumer Goods (with Baol Organic Plant) -> Can be boosted by Natural Machinists trait
Energy Credits (with Bio-Reactors) -> Can be boosted by Ingenious trait
Exotic Gas (With Advanced Bio-Reactors)
Trade Value (with Anglers civic) -> Can be boosted by Thrifty trait
Amenities (with Agrarian Idyll civic) -> Can be boosted by Charismatic trait
+ Any other ascension/origin traits that do the same i.e. Overtuned and Cybernetics

In 4.0, it looks like:
Agrarians and/or Farm Appendages and/or Proles Pre-Sapient trait and/or Harvesters -> Extra Farmers Workforce -> Increases
Food
Consumer Goods
Energy Credits
Exotic Gas
Trade Value
Amenities

I mean, in terms of narrative flavor it makes sense since it's all stuff that's coming out of the "farmer" job in the first place but it's a little crazy that it's reduced multiple selections of traits down to basically just 3 or 4 to retain all the bonuses of PI version plus the multiplicative bonus from the change. Of course all of this is assuming the buildings and civic bonuses remain the same.

Just some food for thought.
That is technically correct and yes, that is only IF buildings and civics remain as they are.
So like... Does that mean - in theory* - that the +10% job output modifiers are better, because they don't rise the upkeep necessary for the workeep (so you pay upkeep for 100 pops, paying for 100 scientists, but getting output of 110 scientists), while the +10% workforce bonus increase both output and the upkeep of a job, while keeping the general pop upkeep the same (as in you pay upkeep for 100 pops and upkeep 110 scientists, while getting output of 110 scientists)?

*Of course not counting situation with two bonuses at once etc etc.

I just want to clarify, cause the "Bonus Workforce" got me a little confused, since they more or less employ the same number of workforce. Maybe some other term for that would make it clearer? "Workforce specialty"? "Workforce efficiency"?
Better in the sense of the increase being cheaper? Yes. Better in the sense of total output once everything is multiplied? No. Hopefully more interesting when combined with potential upkeep reductions/production bonuses/automation options from other sources? Perhaps.
 
  • 9Like
  • 3
  • 1
Reactions:
The important question.Does it actually run better late game.

Currently - not really. Right now we're still keeping it mostly single threaded and haven't gotten to many of the other possible optimizations yet, because it's a lot easier to understand what it's up to and debug this way.

Like I mentioned in another thread, we're likely to keep it this way during the early open beta so it's easier to fix any issues you guys hit, but I'm pretty confident about the new architecture being fundamentally better once we actually let it loose.
 
  • 41
  • 5Like
  • 1
Reactions:
Though I admit I am now confused again as to what the difference is between workforce multiplier and bonus workforce. Bonus workforce I get. If you have 100 jobs and 100 pops with +10% they'll fill those jobs and you'll get 110 jobs worth of output. Makes sense, worded a bit weirdly sure but it essentially means these people do the work of 1.1 people.

But I don't get why there's an entirely separate system that can't go over the cap. If I'm understanding it right a +10% non bonus workforce means that 90 pops could fill 100 jobs with a total output of 99, but no other pop could get a job since it can't carry over?

We mostly plan on using the non-bonus workforce modifiers for negative stuff, but for my example I'll also include a positive modifier. Imagine if there was a pair of traits Lazy (-50% Workforce) and Overachiever (+100% Workforce), and we have three species, Lazy Humans, Blorg, and Overachiever Starfish.

To fill 100 Miner jobs with each of the three species you would need:
  • 100 Blorg, they have no workforce modifiers so each Blorg contributes 1 Workforce.
  • 200 Lazy Humans, as each Lazy Human pop contributes 0.5 Workforce.
  • 50 Overachiever Starfish, as each Overachiever Starfish contributes 2 Workforce.
 
  • 35
  • 1Like
Reactions: