• 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 #149 - Technical improvements

Hi everyone, this is Moah. I’m the tech lead on Stellaris and today I’m here to talk about the free 2.3 "Wolfe" update that will be arriving together with Ancient Relics, and what it brings to the table in terms of tech.

Stellaris is going 64 bits.
People have been clamoring for this for a while now, and various factors have led us to finally do this for this patch. I should temper your expectations though: while many have claimed that this would be a miracle cure for all their issues with Stellaris, the reality is somewhat more tame.

What does it mean?
The one solid benefit is that Stellaris is no longer limited to 4gb of memory, and won’t crash anymore in situations where it was reaching that limit. For people who play on huge galaxies, with many empires, many mods or well into 3000s, this will be a boon.

In terms of performance, though, it doesn’t change much. Without drowning you in technical details, let’s just say that some things go faster because you handle more data at once, some things go slower because you have more data to handle. In the end, our measurements have shown no perceptible difference.

Finally, the last effect of switching to 64 bits is that the game will no longer playable on 32 bits computers or OSes. We don’t think this will affect many people, but there you have it.


What about Performance?
I know that’s everyone’s favourite question, so let’s do our best to talk about it. First, let me dispel some notions floating around in various forums: Stellaris does use multithreading, and we’re always on the lookout for new things to thread. In fact between 2.2.0 and 2.2.7, a huge effort was made to thread jobs and pops, and it’s one of the main drivers of performance improvement between these version.

Pops and jobs are indeed what’s consuming most of our CPU time nowadays. We’ve improved on that by reducing the amount of jobs each pop evaluate. We’ve also found other areas where we were doing too much work, and cut on:
  • Ships calculating their daily regeneration when they’re at full health
  • Off-screen icons being updated
  • Uninhabitable planets doing the same evaluations as populated planets
Why do these seemingly pointless things happen? Well, we generally focus on getting gameplay up and working quickly so that our content designers can iterate quickly, and sometimes things fall through the cracks. Some of these systems are also quite complex and the scale of the new code is not so easily apparent. Sometimes, not limiting the number of targets is good enough because you’re not doing much but then, months later, someone adds more calculations or the number of objects explodes for unrelated reasons, and suddenly you’ve got a performance issue.

Modifiers
One thing that sets Stellaris apart from other PDS title is how much we use (or abuse) modifiers. Everything is a modifier. Modifiers are modified by other modifiers themselves modified by other modifiers, and sometimes by themselves. It’s quite hard to follow, and leads to every value being able to change at any time without your noticing.

“Why don’t you just compute jobs when a new one appears?” has often been asked around these parts. Well, a short answer to that is it’s really hard to know when a new job appears. You can get jobs from any modifier to: country, planet, pops. Each of these can get modifiers from ethics, traditions, perks, events, buildings, jobs, country, planets, pop, technology, etc.

Until now we were trying to calculate modifiers manually, forced to follow the chain in its entirety: when you recompute a country modifier, you then calculate their planets modifiers, and then each planet would recalculate their pops modifiers. Some of our freezes were just that tangled ball of yarn trying to sort itself out.

NexRiPkna2utTqAzF9H0DEjOCwHVsI4EejYO-vMQMh6QwUB-_uP7dXmpjkwXzOOKoiwDqkSzd9tlLmN3DlFN2R06A62od6XxWm8xh99XRDfRFRP3vVj42GBIaDaXSK7jjyKdS39b

This is our modifier flow charts. It’s not quite up to date, but gives you an idea of the complexity of the system (Unpolished because it’s a dev tool, and not made for the article).

No More!
For 2.3 “Wolfe” we have switched to a system of modifier nodes, where each node register what node they follow, and is recalculated when used, following the chain itself. We have modifiers that are more up to date, and calculated only when needed. This also reduces the number of pointless recalculations.

This system has shown remarkable promise, and cut the number of “big freezes” happening around the game (notably after loading, for example). It has some issues, but as we continue working with it, it’ll get better and help both with performance and our programmers’ sanity.

So, what’s the verdict?
In our tests, 2.3 “Wolfe” is between 10% and 30% faster than 2.2.7 right now. Hopefully it’ll stay that way until release, but the nature of the beast is that some of these optimizations break things and fixing the issues negate them, so we can’t promise anything.

IuIGuQ4cXPvjCEMWG_AowiNIFXhzpsPIcphmCVJD79vQqVMqUeZCqCoVfDlWDNZ3YNkAScYAJh2ebft947YsqoOhG7A_4pNBWxjZ6L9se5lkEEImNYZ4uOpTMWj-amEiwSYdirpd


Measurements provided by @sabrenity , using detailed info from the beta build. It’s worth noting the “SHIPS_SERIAL” purple line has since been eliminated.

AI
Another forum favorite, we have done some improvements to the AI. First, with @Glavius ’s permission, we’ve used his job weights to improve general AI job distribution. We’ve also done the usual pass of polish and improvements, and of course taught the AI how to use all our new features.


What else is new?
We’re also getting a new crash reporter that will send your crash report as soon as they happen rather than next time you start the game. We’ve improved our non-steam network stack for connectivity issues, etc.


All right, enough of my yammering. This has turned into a GRRM length novel, and even though there are many more areas we could cover, we’ll just turn this for your perusal.
 
Last edited:
  • 1
Reactions:
@Guraan
Could you get a significant boost by ditching the necessity to calculate optimal routes for long distances? If we're sending fleets half across the galaxy most people won't even notice if the calculated routes was a couple jumps longer then an optimal one. To use a real world map as example, if you wanted to go from Stockholm to Berlin, according to google maps you're using a route through Jönköping. But if we came up with one through Göteborg instead it wouldn't be too bad. Only local routes, for example within a cluster would need to be optimal.
We have thought about doing "clusters" pathfinding, but haven't had time to look into them.
 
Technically, you can use 64-bit datatypes on a 32-bit CPU/OS, though at a performance hit
It's not dependent on the CPU at all. Even 8-bit microprocessors can do work with 64-bit datatypes. Though in that case that's rare and 32-bit is usually the maximum. It's the compiler that has to support it and break down the instructions into smaller steps
 
Last edited:
Might be off topic, but are there any plans to make Ring Worlds 1 whole ring stead of 4 selectable separate segments?

On one hand it would be more handy easier to manage. Though on the other hand it takes away variation.

I started thinking about it when I moved my capital to 1 of the segments, I thought it would feel better if the entire ring was the capital, both have advantages and disadvantages too.
 
AI
Another forum favorite, we have done some improvements to the AI. First, with @Glavius ’s permission, we’ve used his job weights to improve general AI job distribution. We’ve also done the usual pass of polish and improvements, and of course taught the AI how to use all our new features.
I just hope that doesn't mean I have to manually move clerks to other worker jobs because they wouldn't move themselves, that is actually my biggest gripe with the mod, small I know but it becomes a large annoyance the more planets you get.
 
I never said anything about more districts, I was talking about the Ring World being 1 selectable object, rather than 4 separate segments.
The devs have talked about it in the past, but I don't think it's a priority, and other players like the 4 segments (like myself). Besides, what about extra buildings? That would get pretty long unless you gave Ringworlds really strong buildings.
 
The devs have talked about it in the past, but I don't think it's a priority, and other players like the 4 segments (like myself). Besides, what about extra buildings? That would get pretty long unless you gave Ringworlds really strong buildings.
Aye, like I mentioned there are both pros and cons to either, maybe something interesting will happen later down the line.
 
well rip mods
 
I mean, maybe? Depending on what the Modifier Rework means for them, some could get absolutely thrashed.

More than likely though, mods will be fine - from what little I understand they're just reworking the order in which the game resolves modifiers. But that alone might be enough to cause some breaks.
 
I mean, maybe? Depending on what the Modifier Rework means for them, some could get absolutely thrashed.

No. The modifier re-work is a back-end overhaul, with no change to the scripting interface. It will have little to no impact on pretty much all mods.
 
hopefully the Servant jobs are no problem anymore, the last time i had droids with domestic protocols, all of them joined servant jobs and let every other jop unworked... i fixed that by my own with an override, but thats not what i prefere, don't like overriding stuff xD
so well, hopefully it will go the way, that droids first take normal worker jobs, second some specialist jobs, and at last, if no other job is free (or if there is a need of ameneties), join servant jobs

Code:
servant = {
    category = worker
    is_capped_by_modifier = no
    building_icon = building_luxury_residence
    clothes_texture_index = 2
       
    possible = {
        can_take_servant_job = yes
        NOR = {
            free_jobs > 0
            planet_amenities > 0
        }
    }
   
    resources = {}

    triggered_pop_modifier = {
        potential = {
            is_organic_species = yes
        }
        pop_housing_usage_add = -0.5
    }
   
    planet_modifier = {
        planet_amenities_add = 4
    }  
   
    triggered_planet_modifier = {
        potential = {
            OR = {
                has_trait = trait_robot_domestic_protocols
                has_trait = trait_charismatic
            }
        }
        modifier = {
            planet_amenities_add = 1
        }
    }
    triggered_planet_modifier = {
        potential = {
            has_trait = trait_repugnant
        }
        modifier = {
            planet_amenities_add = -1
        }
    }  
       
    weight = {
        weight = 0.001
        modifier = {
            factor = 0
            free_jobs > 0
            planet_amenities > 0
        }
    }
}

thats how i "fixed" my problem, not sure what was the clue, but it works for me. hopefully i don't need such override anymore with Wolfe
 
With 32 bit no longer being supported in future versions, will the steam workshop be updated to allow mod authors to set what 'version' their mod is designed for? This is already almost a required feature with how many very popular mods are no longer supported, but with some players simply unable to play newer versions it feels like it may finally be time to give us that.
 
We have thought about doing "clusters" pathfinding, but haven't had time to look into them.
It's not a radical change - you can use all the same algorithms you have. Essentially, you are factorizing a problem of high dimension and solving 2 problems of much smaller dimensions instead. Usually the hard part is to partition the graph to "identify" clusters, but in Stellaris maps it seems fairly easy and, perhaps, you already have it from the map generator - I understand that it generates system clusters intentionally so those clusters could be used.
 
Tnanks for reply and telling me that my computer is capable of using 64-bit programs, except it's not... I don't know the reason, but i can't play games like EU 4 (i had the ability to play it earlier) or Cities Skylines. Maybe it is due to the fact that my pc claims to be from 2009 (despite the fact that we bought it in 2011?)

I'm not really into computers from technician view, but my computer constantly crashes every time after playing a game for around 10 minutes. Is there something that can help me? (when crashing, the monitors creates thin lines.)
You've got bad system RAM, bad video RAM, insufficient cooling, insufficient power supply, or some combination of them all. The video corruption when it crashes suggests unreliable video RAM or overheated GPU, but that could happen from system RAM or insufficient power, too. Fans getting clogged with dust, bearings failing, and the computer being moved to an area with worse ventilation are all reasons that a computer (especially one so old! Yikes) could develop cooling problems. Bad system RAM can be checked for using the "memcheck" utility available on most bootable CDs/DVDs, including modern Windows install disks, and is the most likely culprit in my opinion (you could also just try swapping out the RAM modules for some "new" ones, though you may have to check PC recycle stores to find RAM for a system that old). Bad video RAM will require replacing your video card.