Stellaris

Stellaris

Extragalactic Cluster Start
 This topic has been pinned, so it's probably important
Draconas  [developer] Apr 2, 2020 @ 4:27am
What actually happens?
Also known as "why adding your favourite mod is more trouble than it appears"

Day 1: Player start: You spawn in whatever home system you have specified, in the galaxy. We pop up a menu for you to pick options. The options you select set a bunch of country flags and trigger the next event

Day 2:
Cluster generation event happens.
This is one of 5 massive events, one for each of the constellations.
This event creates the constellation and all the hyperlinks inside it.
Because I have to specify the system initaliser when I create the system these events have a huge amount of duplicated if then else code.
For example, spawning your start system looks like this:
if (SOL_START) - spawn the sol system at these co-ordinates.
else if (DENEB_START) - spawn the deneb system at these co-ordinates.
else if (TRINARY_START) - spawn a random trinary system at these co-ordinates.
else if (BINARY_START) - spawn a random binary system at these co-ordinates.
else if (RINGWORLD_START) - spawn the ringworld system at these co-ordinates.
else spawn a random system start

That code is repeated for each and every constellation.
The same thing happens for kerbals, and for gigastructural engineering stars.

All of these events then call the colony event chain - this is a shared set of events that setup the planets and move you.

Planet Habitability Setup
Problem: On galaxy spawn a special variable is set for your preferred planet type, that is no longer set, so when the above events spawned your homeworld and your guaranteed habitable colonies, they spawned as uninhabitable barren worlds.
First thing I need to do is go find them, and switch them to be your preferred planet class.
Guess what, there is no way to find out what your preferred planet class is in scripting language, and definitely not one that can be passed into the set_planet_class scripted event.

Thus the only way to do this, used by both me and Isolated Cluster Start, is to have an enormous if/then/else statement based on the planet class of your original home planet.

if (original home planet is continental) - set new planet to be continental
elseif (original home planet is arid) - set new home planet to be arid
...
...
...

When you include the base game + planetary diversity that statement is 300 lines long.

This is also what causes the "died on day 1" issue - if your planet class is not in that statement, it never gets set.
I'm not at all bitter about having to implement and maintain that, no sireee

This is why the game ignored a PD change guaranteed neighbour types. That has already executed long before we generate our planet and guarenteed neighbours.

I re parse your starting system with the resource generator to make sure that it has appropriate starting resources and mining stations.

Now you at least have a cluster capable of supporting life, now it comes to the moving you part.

Creating a new homeworld

Most important thing: I don't actually move your colony, there is no way to do that in stellaris.

What I do is generate a new homeworld for you, by calling exactly the same scripts as the vanilla game does. The only difference is I have a load of if/else so that I generate the correct things for planets or for the starting ringworld.

You now have a new planet, complete with blockers, districts and buildings. I set this as your capital, set it as the home planet of your species, then I move your pops to it and delete your old capital planet from the game.

I also build a new starbase for you. Again, I can't move it, so I have to build a new one.

Crucially if you have any startup mechanics that are not part of vanilla, they are lost here, because I am not moving, I am creating new. This means custom buildings, deposits, districts, solar system setup, it's gone.

Lastly I move your ships, these I actually can move, those were your original ships, they teleport.

Lastly Lastly, if you have planetary diversity installed I have a copy of a load of PD code that I run over your homeworld to set special PD deposits. This is PD code that I have copied and edited so it runs properly for EGS.
Similarly if you have GPM installed it triggers GPM events to put modifiers on all EGS planets

Linking
This event generates the link between the EGS cluster and the rest of the galaxy depending on your settings.

It then fires off the events to ensure strategic resources (if asked) and triggers the countdown on the first additional cluster spawn.


Done, and why this matters to you
So mod compatibility wise, there are a nubmer of issues:
1. This all happens after galaxy generation and game start, so any day 0 stuff that modifies the galaxy (like PD or GPM) has already finished.

2. I build a new system, because i cannot move or copy the original one, so anything that modifies the original system on game start is lost (see starborn and dyson swarm origin, both make extensive changes to the starting system in game-start events)

3. Why I can't just have an option to use extra origins like ringworld or mechanist or life seeded: All the vanilla code that handles the setup for those checks to see has_origin = origin_mechanist so won't execute for EGS as you don't have the right origin. My only option would be to copy and modify all the relevant vanilla code for every origin I was going to include. Just having my own ringworld implementation is a huge pain in the backside and I am not going through that pain again.
Last edited by Draconas; Dec 14, 2021 @ 1:06am
< >
Showing 1-4 of 4 comments
Vrishnak92™ Apr 5, 2020 @ 3:14am 
I will say this, i appreciate the effort you have put into this.
Renvira Dec 5, 2021 @ 1:51am 
I WAS going to ask if you could add say, something like the Necrophage origin, but reading that line at the end, I'm just going to say never mind and thank you for whats already there.
Draconas  [developer] Dec 6, 2021 @ 1:05am 
Yeah I'm afraid Necrophages are absolutely super out as they would be about the most complicated implementation for me to bodge together sorry.
Kitsune_yandere Jan 4, 2024 @ 8:55am 
Originally posted by Renvira:
I WAS going to ask if you could add say, something like the Necrophage origin, but reading that line at the end, I'm just going to say never mind and thank you for whats already there.
https://steamcommunity.com/sharedfiles/filedetails/?id=3042831569&searchtext=decision+origins
this might help you in your persuits
< >
Showing 1-4 of 4 comments
Per page: 1530 50