Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 402 403 [404] 405 406 ... 706

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1699881 times)

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6045 on: February 05, 2020, 08:32:11 AM »

So I checked the autoresolve plugin results for those ships, and my super fast, super fragile, no-dissipation-all-vent ships come around one third of the ship strength of vanilla hulls for the getMemberStrength() calculation... Pretty bad.

But did you figure out *why*? It's still fundamentally based on fleet points multiplied by fraction of OP used (0.2 + 0.8 * op/max op), and also modified by any officer, and ship quality. The latter is either grabbed from the inflater, or, if that's not available, based on the d-mods the hull has. It's also modified by the hull. And by the current CR. I don't think just blanketly adding a multiplier would be a good solution, if their FP value is high, there's some other issue here.

(The "super fast, super fragile" etc really shouldn't factor in here at all.)


How can I check from inside a hullmod if a ship belongs to the player? I've tried checking the owner, but it seems all ships in the campaign map have an owner of 0. I tried getting the fleet member, but ship.getFleetMember() always returns false, even for AI ships in the campaign. Finally, I tried removing the mod directly off the player's fleet list:

Code
for(FleetMemberAPI member: Global.getSector().getPlayerFleet().getFleetData().getMembersListCopy()) {
   
    log.info("Removing mod from player fleet " + this.spec.getId());
member.getVariant().removeMod(this.spec.getId());
    }

...but it doesn't seem to remove the mod at all.

My only goal is to make a hullmod that only applies to AI ships and will be auto-removed if the player ever lays their hands on the ship.

Hmm, I'm not sure. There may be a way to do it, and what you're doing in the pasted code seems like it should work, so it's hard to say why it wouldn't unless the mod is built into the hull, in which case removeMod() won't work, and you need to addSuppressedMod() instead.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6046 on: February 05, 2020, 11:00:53 AM »

I want to prohibit installation of an AI core in an industry.

Is there a way to disable the menu option to install AI cores?
With special items this is possible by returning an empty list for getInstallableItems(), but I don't seem to have that option for AI cores.

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6047 on: February 05, 2020, 11:56:04 AM »

Not sure if it's in the currently-released version or if it's a more recent addition, but, you can (or will be able to) override:

public boolean canInstallAICores() {
   return true;
}

In BaseIndustry.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6048 on: February 05, 2020, 12:26:34 PM »

that's definitely an upcoming feature.
I take it there is no option for that in the current version then.

I'll just make it display a lot of red, angry messages if the player installs a core in the interim.
thanks!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6049 on: February 05, 2020, 12:31:44 PM »

Yeah, I probably wouldn't have added it if it was already possible, so "angry red messages" sounds like the way to go for the moment :)
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6050 on: February 05, 2020, 01:01:46 PM »

But did you figure out *why*?
Those ships have very crappy dissipation (like, REALLY small) 2.0 efficiency shields, weak armor, weak hull, but very deep flux capacity and high top speed. All in all, bad for all the stats that matter to the autoresolve hull strength except for one. They end up around one third of a vanilla ship "hull strength" multiplier for the autoresolve plugin.
« Last Edit: February 05, 2020, 01:09:16 PM by Tartiflette »
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6051 on: February 05, 2020, 01:03:39 PM »

Are we looking at something different? None of those stats matter for autoresolve. They used to way back, but now it's all based on FP. Unless I'm way, way mistaken about this somehow?

Edit: some of these *do* matter in terms of how much damage the ships suffer from autoreslove (good shields = less damage taken), but they don't affect the *strength* of the ships, or who wins a given engagement.
« Last Edit: February 05, 2020, 01:05:47 PM by Alex »
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6052 on: February 05, 2020, 04:07:47 PM »

Hmm, I'm not sure. There may be a way to do it, and what you're doing in the pasted code seems like it should work, so it's hard to say why it wouldn't unless the mod is built into the hull, in which case removeMod() won't work, and you need to addSuppressedMod() instead.
Actually, after some testing, it seems that the hullmod seems to get removed from my other ships when I deploy them in battle (simulation), with a strange exception: when I pull them up on the fleet viewer, the hullmods are still present and visible, even after repeated refresh of that page.

In addition, running a simulation on a ship (that shows the hullmods still present), shows that the mods still take effect (but only on that ship, strangely enough, when I deploy allied ships, they do not appear to have the mod in-simulation, but when I take a look at their page in [F] Fleet Viewer, the hullmods are still present on their page as well.)


EDIT: Ah, I should add, in case it might actually be relevant - these mods were added to the ship via its .variant file. So while designing these ships, I give them these hullmods by default (which strengthens them in AI hands), but when they are bought/salvaged by the player, the idea is to remove these buffs.

EDIT 2: I should mention that there is ONE instance where I was able to actually remove the mod from the ships, even the viewer - and that was via ShipAPI's getVariant (whereas the method I am using above is FleetMemberAPI.getVariant)

   
Code
 public void applyEffectsAfterShipCreation(ShipAPI ship, String id){    
    ship.getVariant().removeMod(this.spec.getId());
}

However, using this method, I am unable to verify if the ship is in the player's fleet because as mentioned earlier ship.getFleetMember() always returns null
« Last Edit: February 05, 2020, 04:18:14 PM by creature »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6053 on: February 05, 2020, 09:24:38 PM »

What you probably want is to do it in:
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id);

And use stats.getFleetMember(). That will also in some cases return null - so check for it - but should return the fleet member for the fleet screen update etc.
Logged

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6054 on: February 05, 2020, 09:30:21 PM »

What you probably want is to do it in:
void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id);

And use stats.getFleetMember(). That will also in some cases return null - so check for it - but should return the fleet member for the fleet screen update etc.
Hmm, it seems "MutableShipStatsAPI stats" doesn't have getFleetMember(), though. It does seem to have .getVariant(), but then I don't have a way to check if the ship belongs in the player's fleet...
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6055 on: February 05, 2020, 11:39:51 PM »

Are we looking at something different? None of those stats matter for autoresolve. They used to way back, but now it's all based on FP. Unless I'm way, way mistaken about this somehow?

Edit: some of these *do* matter in terms of how much damage the ships suffer from autoreslove (good shields = less damage taken), but they don't affect the *strength* of the ships, or who wins a given engagement.

I have been looking at
Code
protected FleetAutoresolveData computeDataForFleet(CampaignFleetAPI fleet)
and
Code
protected FleetMemberAutoresolveData computeDataForMember(FleetMemberAPI member)
and at least that part of the autoresolve has a "shield ratio" that looks at hull and shield, that result in a ratio around 0.5 for ships that have fragile hulls due to their reliance on boosted venting instead of passive dissipation.

I also have been looking at
Code
public static float getMemberStrength(FleetMemberAPI member, boolean withHull, boolean withQuality, boolean withCaptain)
output, and it is also very weak for those ships.

Here are some example.
My faction's best capital ship (that in part relies on modules though):


My faction's mainline cruiser:


My faction's typical 200FP fleet:


Compared to an Onslaught:


A Dominator:


or a Mora:


Makes a typical 200FP Hegemony fleet come at:


And even cheating in the fleet doctrine as such
Code
    "factionDoctrine":{
        "warships":4,
        "carriers":3,
        "phaseShips":0,

        "officerQuality":5,
        "shipQuality":5,
        "numShips":5,

        "shipSize":4,
        "aggression":2,

Still produces weaker fleets, albeit less so: between 500 to 750 fleet strength versus 1000-1300 for the enemy, both 200FP fleets.

[edit] Boosting the fleetpoints a bit and setting the fleet doctrine to 10/10/10 does seems to put them in a right spot for the auto-resolve, but I don't like how it will affect the player battles with so many high level officers.

[edit2] It occurred to me that fleets that have a low "quality" multiplier get de-buffed twice because their ships usually have Dmods that also reduce the fleet strength. Maybe that's something worth checking out if it is working as intended.
« Last Edit: February 06, 2020, 08:27:13 AM by Tartiflette »
Logged
 

Alexzzz

  • Ensign
  • *
  • Posts: 14
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6056 on: February 06, 2020, 12:53:06 AM »

Is there a way to render models outside of the game? I'm trying to get the rings for Saturn in my mod to look right, and having to open the game and start a new game every change is making it quite the effort.

You could try editing the save file.  That way you would just have to quit game -> edit save -> load game instead of starting a new game every time.  Haven't tried myself but it might work.

Just search for n="Saturn's Belt".  Its not too hard to see where all the parameters of the system.addRingBand are in the save file data.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6057 on: February 06, 2020, 09:01:28 AM »

I have been looking at
Code
protected FleetAutoresolveData computeDataForFleet(CampaignFleetAPI fleet)
and
Code
protected FleetMemberAutoresolveData computeDataForMember(FleetMemberAPI member)
and at least that part of the autoresolve has a "shield ratio" that looks at hull and shield, that result in a ratio around 0.5 for ships that have fragile hulls due to their reliance on boosted venting instead of passive dissipation.

Ok, we're looking at the same thing, so that's good. shieldRatio is just used to determine damage suffered, not the actual autoresolve combat strength. It's not a factor here and doesn't need to be looked at for this.

I also have been looking at
Code
public static float getMemberStrength(FleetMemberAPI member, boolean withHull, boolean withQuality, boolean withCaptain)
output, and it is also very weak for those ships.

I feel like we're talking past each other a bit here. What I've been trying to ask, all along, is: "Have you figured out why getMemberStrength() returns a lower value for your ships?" I've mentioned the various reasons why it might do so. Fundamentally its return value is based on the ship's fleet points and has nothing whatsoever to do with e.g. flux stats or speed or whatever. If it's returning a lower value than for another faction's ship with an equivalent FP value, then one of these reasons must be coming into play.

To reiterate, the possible things affecting the strength returned are:

- hull damage taken
- CR level
- Quality from inflater OR d-mods
- Officer level
- Unspent OP
- The ship being mothballed (0 strength no matter what else)
- The hull being a civilian hull (FleetMemberAPI.isCivilian() returns true; should always be false for SHIP_WITH_MODULES)

One of these things is dinging (or just not boosting) your ships' autoresolve strength compared to the stuff you're comparing them with.


[edit2] It occurred to me that fleets that have a low "quality" multiplier get de-buffed twice because their ships usually have Dmods that also reduce the fleet strength. Maybe that's something worth checking out if it is working as intended.

How so? getMemberStrength() only counts dmods if the quality multiplier is not available from an inflater, as kind of a proxy. Am I missing something?
Logged

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6058 on: February 06, 2020, 09:59:40 AM »

Is there an easy way to find the radius of a ship's death explosion? Are they flat numbers based on hull size?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6059 on: February 06, 2020, 10:03:19 AM »

Code
public static float getShipExplosionRadius(ShipAPI ship) {
float mult = ship.getMutableStats().getDynamic().getValue(Stats.EXPLOSION_RADIUS_MUT);
float radius = ship.getCollisionRadius() + Math.min(200f, ship.getCollisionRadius()) * mult;
return radius;
}

... let me actually add "float getShipExplosionRadius();" to ShipAPI.
Logged
Pages: 1 ... 402 403 [404] 405 406 ... 706