Fractal Softworks Forum

Starsector => Bug Reports & Support => Bug Reports & Support (modded) => Topic started by: Surge on February 16, 2019, 08:38:22 PM

Title: Empty Cryovolcanic Worlds
Post by: Surge on February 16, 2019, 08:38:22 PM
Thus far in my current save several cryovolcanic worlds have had no features positive or negative. This seems pretty obviously unintended behavior so I'm curious how to go about finding the cause of and fixing the issue.
(https://i.imgur.com/u9Jc1fd.png)
Title: Re: Empty Cryovolcanic Worlds
Post by: Alex on February 18, 2019, 10:53:23 AM
(Just double-checked that this doesn't appear to be an issue in vanilla...)
Title: Re: Empty Cryovolcanic Worlds
Post by: Surge on February 19, 2019, 08:35:59 AM
Yeah I'm pretty sure it isn't a vanilla issue, but I'm unsure if it's caused by a mod or interaction between two mods, nevermind which one.
Title: Re: Empty Cryovolcanic Worlds
Post by: Harmful Mechanic on February 19, 2019, 08:47:35 AM
Yeah this is real weird. If DME is causing it, I'd like to know (and I know you're using DME because I recognize several names), but I can't imagine what it would be; my additions to procgen are pretty much just do-not-spawn entries.
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 19, 2019, 02:32:45 PM
This sounds very much like the problem that Tartiflette ran into with the Unknown Skies mod: http://fractalsoftworks.com/forum/index.php?topic=12041.msg231887#msg231887 (http://fractalsoftworks.com/forum/index.php?topic=12041.msg231887#msg231887). Unfortunately, he never revealed exactly what was going wrong, but after poking through the mod itself I've got a theory...

In \data\campaign\procgen\planet_gen_data.csv, it looks like he replaced the "category" of some of his custom planet types:
Code
#US_lava,PLANET,cat_lava,10,-100,-2,2,,-1,around_giant_at_any_offset,0,,,100,150,220 220 220,255 255 255,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
#US_volcanic,PLANET,cat_lava,10,-2,0,2,,-1,around_giant_at_any_offset,0,,,100,150,220 220 220,255 255 255,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
US_lava,PLANET,cat_toxic,10,-100,-2,2,,-1,around_giant_at_any_offset,0,,,100,150,220 220 220,255 255 255,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
US_volcanic,PLANET,cat_toxic,10,-2,0,2,,-1,around_giant_at_any_offset,0,,,100,150,220 220 220,255 255 255,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

My theory is that using the "cat_lava" category is what caused his custom US_lava/US_volcanic planets to generate without any planetary conditions. If that's true, then it's theoretically possible that other categories (say, "cat_cryovolcanic" for example) might cause a similar problem when used for custom planets...
Title: Re: Empty Cryovolcanic Worlds
Post by: Surge on February 19, 2019, 05:27:06 PM
and here I was ready to blame Kadur, I've been using Unknown Skies for some time and never had this issue.
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 19, 2019, 05:44:23 PM
Just to be clear - Unknown Skies doesn't have any custom cryovolcanic planets and is NOT causing this specific issue. I'm just saying that the root problem appears to be identical and since Tartiflette already has a workaround, that workaround could theoretically be applied to this issue too once the source mod is identified. Plus, if there is some sort of problem with certain planet categories and sector generation, then it's probably something Alex should know about.

With that being said, I just glanced at Kadur and it doesn't even have a custom planet_gen_data.csv file, so I'm pretty confident it isn't causing this problem either...  
Title: Re: Empty Cryovolcanic Worlds
Post by: Tartiflette on February 20, 2019, 12:16:56 AM
Yeah, it shouldn't be Unknown Skies since it only affect the custom planet types, and this one is a vanilla type.
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 20, 2019, 02:40:04 PM
I don't know if this is related to the problem, but it's one of those things that I look at and go "hmm, this looks odd...":

Code
id,group,rank,order,hazard,reqSurvey,xpMult,requiresAll,requiresAny,requiresNotAny,cat_giant,cat_barren,rocky_unstable,rocky_ice,barren-desert,lava,lava_minor,cat_frozen,cryovolcanic,irradiated,cat_toxic,toxic_cold,terran,cat_hab3,terran-eccentric,jungle,water,arid,tundra,cat_hab2,multipliers >>>,tectonic_activity,extreme_tectonic_activity,low_gravity,high_gravity,hot,very_hot,cold,very_cold,dense_atmosphere,water_surface,mild_climate,extreme_weather,poor_light,inimical_biosphere,pollution

This is the header row for Starsector's condition_gen_data.csv file. What looks odd to me is that there are several cat_XXX planet category entries (cat_giant, cat_barren, cat_frozen, etc.) but the "cryovolcanic" one is missing the "cat_" prefix. Now, this list also contains specific planet ids (jungle, water, etc.) for planet types that share the same category (like cat_hab3 for jungle, water, etc.), but in cryovolcanic's case there is only one cat_cryovolcanic entry in planet_gen_data.csv. Should that column header be "cat_cryovolcanic" instead? For that matter, should "lava" be "cat_lava"? I can't help but wonder if that would have avoided the original problem with the custom lava/volcanic planet types...

Title: Re: Empty Cryovolcanic Worlds
Post by: Surge on February 20, 2019, 05:27:03 PM
Just to be clear - Unknown Skies doesn't have any custom cryovolcanic planets and is NOT causing this specific issue. I'm just saying that the root problem appears to be identical and since Tartiflette already has a workaround, that workaround could theoretically be applied to this issue too once the source mod is identified. Plus, if there is some sort of problem with certain planet categories and sector generation, then it's probably something Alex should know about.

With that being said, I just glanced at Kadur and it doesn't even have a custom planet_gen_data.csv file, so I'm pretty confident it isn't causing this problem either...  
Decided to poke through my mod folder for any mods with a planet_gen_data.csv and... I found one in FDS
(https://i.gyazo.com/8793c57f3b235e90873de2a224261400.png)
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 20, 2019, 09:21:28 PM
Yep, I'd say that's almost certainly the culprit. From what I can tell, the code performs two look-ups when putting together its list of potential conditions for a particular planet.  First, it searches for a column matching the planet type (so "fds_cryovolcanic" in this case). If that fails, then it attempts to find a column matching the planet category (i.e. "cat_cryovolcanic"). Since neither of those are one of the column header names in vanilla's condition_gen_data.csv, it doesn't add anything to its list and generates the empty world as a result.

This also explains why, as Alex said earlier, the vanilla cryovolcanic worlds work fine. Their planet type is simply "cryovolcanic" so they pass the first check and correctly use the "cryovolcanic" column to generate their conditions without even checking for their "cat_cryovolcanic" planet category. It's really too bad that the column isn't named "cat_cryovolcanic" because it looks like that would have worked in both cases.
Title: Re: Empty Cryovolcanic Worlds
Post by: Surge on February 20, 2019, 10:11:52 PM
I'll pass this on to the FDS thread then.
Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on February 21, 2019, 01:24:11 AM
Surge and Meso already gave me a heads up, I will fix this ASAP.

I'm sorry for any inconvenience I have caused...
Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on February 21, 2019, 02:10:25 AM
I did some testing, and it appears that the game needs the planets to have the category "cat_cryovolcanic" and "cat_lava" (as my lava planet had the same issue as well) to be able to spawn, but won't have any conditions because the columns in the conditions gen file don't have the "cat_" prefix...
Is this a game bug then? Because the way I see it I can only have them spawn by code in my own systems and set their spawn probability to 0 so they don't spawn anywhere else, as if they do spawn in any random system they won't have and conditions...

EDIT:
Strangely enough, the issue with my custom lava planet only affects the planet I am adding, not the other lava planets, while the issue with the cryovolcanic planets is affecting ALL cryo planets, not only the one I'm adding.
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 21, 2019, 08:36:04 AM
I don't know if Alex would necessarily classify it as a game bug because vanilla works as designed. I was planning on putting something in the Suggestions forum about adding columns for all of the base planet categories to condition_gen_data.csv, but I haven't had the chance yet. It might even be possible to just simply replace the specific planet types (lava, cryovolcanic, terran, etc.) with their corresponding category types wherever there's only a single planet with that category (terran is the only cat_hab4, for example) and then both vanilla and custom mod planets would theoretically work. Something like this, for example:

Code
id,group,rank,order,hazard,reqSurvey,xpMult,requiresAll,requiresAny,requiresNotAny,cat_giant,cat_barren,rocky_unstable,rocky_ice,cat_hab1,cat_lava,lava_minor,cat_frozen,cat_cryovolcanic,cat_irradiated,cat_toxic,toxic_cold,cat_hab4,cat_hab3,terran-eccentric,jungle,water,arid,tundra,cat_hab2,multipliers >>>,tectonic_activity,extreme_tectonic_activity,low_gravity,high_gravity,hot,very_hot,cold,very_cold,dense_atmosphere,water_surface,mild_climate,extreme_weather,poor_light,inimical_biosphere,pollution

Meanwhile, as a workaround in FDS, I was going to recommend doing something like what was done in Unknown Skies (i.e. use "cat_toxic" for "fds_lava" planets and "cat_frozen" for "fds_cryovolcanic" planets). It wouldn't give you completely accurate conditions, but it should ensure that the planets aren't empty. However, adjusting the planets so they have zero chance to spawn during sector generation works too.
Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on February 21, 2019, 10:00:31 AM
Hummm, alright. I have set their ratio to 0 for the time being, I'll recheck that possibility eventually, thanks!
Title: Re: Empty Cryovolcanic Worlds
Post by: Alex on February 21, 2019, 10:12:33 AM
I think what you can do is modify the condition probability data once it's been loaded.

Something like this, called in your onApplicationLoad():

Code: java
for (Object o : Global.getSettings().getAllSpecs(CategoryGenDataSpec.class)) {
ConditionGenDataSpec spec = (ConditionGenDataSpec) o;
if (spec.getId().equals("ore_no_pick")) {
spec.getMultipliers().put("<your planet id>", 0f);
}
if (spec.getId().equals("ore_sparse")) {
spec.getMultipliers().put("<your planet id>", 4f);
}
if (spec.getId().equals("ore_moderate")) {
spec.getMultipliers().put("<your planet id>", 10f);
}
if (spec.getId().equals("ore_abundant")) {
spec.getMultipliers().put("<your planet id>", 5f);
}
if (spec.getId().equals("ore_rich")) {
spec.getMultipliers().put("<your planet id>", 2f);
}
if (spec.getId().equals("ore_ultrarich")) {
spec.getMultipliers().put("<your planet id>", 1f);
}
}

That *should* give a new planet that's not in any category the same chance to get Ore deposits as a barren world, for example. I haven't tested this, though. In theory you should also be able to add a new category this way. Basically, it's adding columns to the spreadsheet, but using code.

(Btw: can I ask you to change your last name? It's... against the forum rules.)
Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on February 22, 2019, 02:10:21 AM
Hummm, you've opened a pandora's box for me here...

I am still wondering why my planet was overriding all of the cryovolcanic planets though... The lava planet I added had the same issue but only my custom lava planet had no conditions, it didn't affect anything else like the cryo ones did  ???

Which leads me to another question... If I apply this method I'll still need to add the planets to the planet gen data file, correct? And if so, which category do I give them? I give them an unique category like the planet's ID?

And sorry for the name, heh.
Title: Re: Empty Cryovolcanic Worlds
Post by: Morathar on February 22, 2019, 06:56:10 AM
This definitely sounds like a much more powerful approach than simply changing the condition_gen_data.csv header row as I originally proposed. It would give modders the ability to truly customize the conditions of some of their more unique planet types.

As for the problematic custom lava/cryovolcanic planets, I believe this approach can be greatly simplified since all you're trying to do is give them the exact same conditions as the original lava/cryovolcanic worlds. If I'm understanding correctly, you would still use the cat_lava/cat_cryovolcanic category types in planet_gen_data.csv as you did originally, and then do something like this in onApplicationLoad():

Code
    float value = 0f;
    for (Object o : Global.getSettings().getAllSpecs(ConditionGenDataSpec.class)) {  
          ConditionGenDataSpec spec = (ConditionGenDataSpec) o;  
          if (spec.hasMultiplier("cryovolcanic"))
          {  
             value = spec.getMultiplier("cyrovolcanic");
             spec.getMultipliers().put("fds_cryovolcanic", value);  
          }  
          if (spec.hasMultiplier("lava"))
          {  
             value = spec.getMultiplier("lava");
             spec.getMultipliers().put("fds_lava", value);  
          }  
       }  

Theoretically, this should give your custom planets the exact same chance of getting a specific condition that their vanilla equivalent has.

Disclaimer - I am "coding" this in the forum post editor (which makes for a remarkably bad IDE), so it may require some tweaking before it will compile...   ;)
Title: Re: Empty Cryovolcanic Worlds
Post by: Alex on February 22, 2019, 09:41:55 AM
Hummm, you've opened a pandora's box for me here...

I am still wondering why my planet was overriding all of the cryovolcanic planets though... The lava planet I added had the same issue but only my custom lava planet had no conditions, it didn't affect anything else like the cryo ones did  ???

Yeah, this doesn't make sense for me either. The way it works (or doesn't work) for the lava planet is what I would expect to happen based on the conditions having a "lava" rather than a "cat_lava" column. What's happening with cryovolcanic is weird, really not sure what's happening there.

If you could package this as a minimod - i.e. I run the game with it, create a sector, and cryovolcaninc planets have no conditions - I'd be happy to check it out.

Which leads me to another question... If I apply this method I'll still need to add the planets to the planet gen data file, correct? And if so, which category do I give them? I give them an unique category like the planet's ID?

Right - you'd do the same thing vanilla does for cryovolcanic and lava. It adds "cat_cryovolcanic" and "cat_lava" categories - since categories have a "weight" that's actually used to pick stuff on star system generation. And then they only have one entry in each category.

And sorry for the name, heh.

No worries, thank you for being understanding!


Spoiler
This definitely sounds like a much more powerful approach than simply changing the condition_gen_data.csv header row as I originally proposed. It would give modders the ability to truly customize the conditions of some of their more unique planet types.

As for the problematic custom lava/cryovolcanic planets, I believe this approach can be greatly simplified since all you're trying to do is give them the exact same conditions as the original lava/cryovolcanic worlds. If I'm understanding correctly, you would still use the cat_lava/cat_cryovolcanic category types in planet_gen_data.csv as you did originally, and then do something like this in onApplicationLoad():

Code
    float value = 0f;
    for (Object o : Global.getSettings().getAllSpecs(CategoryGenDataSpec.class)) { 
          ConditionGenDataSpec spec = (ConditionGenDataSpec) o; 
          if (spec.hasMultiplier("cryovolcanic"))
          { 
             value = spec.getMultiplier("cyrovolcanic");
             spec.getMultipliers().put("fds_cryovolcanic", value); 
          } 
          if (spec.hasMultiplier("lava"))
          { 
             value = spec.getMultiplier("lava");
             spec.getMultipliers().put("fds_lava", value); 
          } 
       } 

Theoretically, this should give your custom planets the exact same chance of getting a specific condition that their vanilla equivalent has.

Disclaimer - I am "coding" this in the forum post editor (which makes for a remarkably bad IDE), so it may require some tweaking before it will compile...   ;)
[close]

Without commenting on the specifics of the code (it's been a bit since I've touched that part of the game, and if we're being honest, the various spreadsheets involved are a bit of a blur), the approach seems sound.
Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on February 23, 2019, 11:19:32 AM
I was compiling the custom cryo planet into a standalone mod and while testing to see if the problem still persisted it seems that only my custom cryo planet was being affected...
I reverted FDS back to 0.9.1 to test the issue again and, once more, only the cryovolcanic planets added by my mod were being affected... I did nothing at all, and now only the custom planets are being affected...

I have no idea what is happening, this is VERY strange...
Title: Re: Empty Cryovolcanic Worlds
Post by: Alex on February 23, 2019, 12:32:00 PM
I have no idea what is happening, this is VERY strange...

Hmm, yeah, that is indeed weird. Wonder what could've caused that...

Title: Re: Empty Cryovolcanic Worlds
Post by: Johnny Cocas on March 02, 2019, 02:23:56 PM
This is a late reply, and a shameless bump on a somewhat old thread, but I can confirm the java code thing works perfectly, my next patch will bring back two very sexy planets, procedurally generated  ;)

Thank you all for the feedback and suggestions!
Title: Re: Empty Cryovolcanic Worlds
Post by: Alex on March 02, 2019, 09:35:45 PM
(Nice!)