Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Blog post: Skills and Story Points (07/08/19)

Pages: 1 [2]

Author Topic: Empty Cryovolcanic Worlds  (Read 1521 times)

Johnny Cocas

  • Commander
  • ***
  • Posts: 135
  • Murder Wedges!!
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #15 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!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 14918
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #16 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.)
Logged

Johnny Cocas

  • Commander
  • ***
  • Posts: 135
  • Murder Wedges!!
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #17 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.
« Last Edit: February 22, 2019, 02:13:51 AM by Johnny The Wedge Guy »
Logged

Morathar

  • Lieutenant
  • **
  • Posts: 52
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #18 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...   ;)
« Last Edit: March 02, 2019, 03:49:58 PM by Morathar »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 14918
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #19 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.
Logged

Johnny Cocas

  • Commander
  • ***
  • Posts: 135
  • Murder Wedges!!
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #20 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...
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 14918
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #21 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...

Logged

Johnny Cocas

  • Commander
  • ***
  • Posts: 135
  • Murder Wedges!!
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #22 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!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 14918
    • View Profile
Re: Empty Cryovolcanic Worlds
« Reply #23 on: March 02, 2019, 09:35:45 PM »

(Nice!)
Logged
Pages: 1 [2]