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 ... 453 454 [455] 456 457 ... 706

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

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6810 on: October 07, 2020, 05:27:18 PM »

Oh, hey, that's a good idea! I thought that wouldn't work (it wouldn't if that's only computed once when the ship is created), but it should work, since it's not doing that.

If you .umodify() it it'll give it back the peak time that was subtracted. So you actually wouldn't just do -10 every time - you'd want to keep track of how long and modify by the *total* time every time, if that makes sense.
So i could make it so the player loses 10 seconds every time the system is used, but if the player fulfill some sort of objective i could do the .unmodify and recover the lost time right?
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6811 on: October 07, 2020, 05:36:25 PM »

Yep!
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6812 on: October 07, 2020, 05:46:37 PM »

Noice! Thanks Alex!
Logged
Check out my ships

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6813 on: October 08, 2020, 06:58:23 AM »

Do fleets without the Officer Management skill have their officer count pruned? If so, where is this happening in the code?

tl;dr version of the post
Is there some hidden factor controlling the number of officers a fleet can have, that I'm failing to notice in FleetFactoryV3?

I set the doctrines of the major factions to 5-1-1 (same as Hegemony), started a new game, and ran the following code:

Spoiler
Code: java
	public static void run(String factionId) {
final FactionAPI faction = Global.getSector().getFaction(factionId);

int numOfficers = 0, numShips = 0, sumLevel = 0, sumFP = 0;
int numFleets = 100;
for (int i=0; i<numFleets; i++) {
CampaignFleetAPI fleet = createFleet(faction, 100);
sumFP += fleet.getFleetPoints();
for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy())
{
numShips++;

if (member.getCaptain().isDefault())
continue;

numOfficers++;
sumLevel += member.getCaptain().getStats().getLevel();
}
}
FactionDoctrineAPI doctrine = faction.getDoctrine();
String str = String.format("Generated %s fleets for faction %s, doctrine %s-%s-%s", numFleets,
faction.getDisplayName(), doctrine.getOfficerQuality(), doctrine.getShipQuality(),
doctrine.getNumShips());

Console.showMessage(str);
Console.showMessage("  Number of officers: " + numOfficers);
Console.showMessage("  FP sum: " + sumFP);
Console.showMessage("  Avg. officers per fleet: " + String.format("%.2f", (float)numOfficers/numFleets));
Console.showMessage("  Officers per ship: " + String.format("%.2f", (float)numOfficers/numShips));
Console.showMessage("  Average officer level: " + String.format("%.2f", (float)sumLevel/numOfficers));
}

public static CampaignFleetAPI createFleet(FactionAPI faction, int fp)
{
final int totalFP = (int)(fp * InvasionFleetManager.getFactionDoctrineFleetSizeMult(faction));
final FleetParamsV3 params = new FleetParamsV3(
Global.getSector().getPlayerFleet().getLocationInHyperspace(),
faction.getId(), // Faction ID
null, // Quality override (null disables)
FleetTypes.PATROL_LARGE, // Fleet type
totalFP, // Combat FP
0, // Freighter FP
0, // Tanker FP
0, // Transport FP
0, // Liner FP
0, // Utility FP
0f); // Quality bonus
params.ignoreMarketFleetSizeMult = true;

final CampaignFleetAPI fleet = FleetFactoryV3.createFleet(params);

// Update combat readiness
fleet.getFleetData().sort();
fleet.forceSync();
for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy())
{
final RepairTrackerAPI repairs = member.getRepairTracker();
repairs.setCR(repairs.getMaxCR());
}
return fleet;
}
[close]

Result:
Code
Generated 100 fleets for faction Hegemony, doctrine 5-1-1
  Number of officers: 847
  FP sum: 9888
  Avg. officers per fleet: 8.47
  Officers per ship: 0.82
  Average officer level: 15.00
Generated 100 fleets for faction Luddic Church, doctrine 5-1-1
  Number of officers: 404
  FP sum: 9921
  Avg. officers per fleet: 4.04
  Officers per ship: 0.32
  Average officer level: 15.00
Generated 100 fleets for faction Persean League, doctrine 5-1-1
  Number of officers: 910
  FP sum: 9922
  Avg. officers per fleet: 9.10
  Officers per ship: 0.76
  Average officer level: 14.95
Generated 100 fleets for faction Sindrian Diktat, doctrine 5-1-1
  Number of officers: 876
  FP sum: 9844
  Avg. officers per fleet: 8.76
  Officers per ship: 0.87
  Average officer level: 15.01
Generated 100 fleets for faction Tri-Tachyon, doctrine 5-1-1
  Number of officers: 310
  FP sum: 9845
  Avg. officers per fleet: 3.10
  Officers per ship: 0.39
  Average officer level: 15.01
Why are Luddic Church and TT getting less than half as many officers as the other factions, but at the same level?

...wait, I see something. The other factions have Officer Management as the first skill in their doctrine commanderSkills array, while Church and TT have something else. Is that what's causing it?
[close]

EDIT: Also, NPC fleet commanders can only have 2 fully leveled fleetwide skills at the most, and usually closer to 1 or less (especially for the factions that only have 1 commander skill defined)?
- That seems to be going pretty easy on the player.
- With most factions having zero shuffle chance on their commander skills, a lot of factions have commander skills defined that they never actually use.
« Last Edit: October 08, 2020, 07:10:39 AM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6814 on: October 08, 2020, 08:42:26 AM »

When it adds the commander, it updates the number of officers, from inside the loop. See:
int officerNumLimit = person.getStats().getOfficerNumber().getModifiedInt();
And some lines after that.

So fleets w/o OM don't have officers *pruned* - they just obey the same max number of officer rules.

EDIT: Also, NPC fleet commanders can only have 2 fully leveled fleetwide skills at the most, and usually closer to 1 or less (especially for the factions that only have 1 commander skill defined)?
- With most factions having zero shuffle chance on their commander skills, a lot of factions have commander skills defined that they never actually use.

Correct-ish. There may be a flag that randomizes commander skill picks, though, which may make any of the skills get used.

Ah - it's "commanderSkillsShuffleProbability".

- That seems to be going pretty easy on the player.

It's a hidden bonus and I'd rather generally keep it consistent based on what the faction is than randomly sprinkle a ton of bonuses to try to increase the difficulty. I think there are better options for doing that that are more apparent to the player.  It's just one possible knob (of many) to turn regarding difficulty, right?

(There are a few cases in the next releases where fleets get a bunch of leadership skills, but they're special cases...)
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6815 on: October 08, 2020, 09:44:30 AM »

When I put weapons into custom submarket that extends StoragePlugin they no longer are seen as "owned". If I put a weapon to vanilla storage, they are "seen", e.g. tooltip on that weapon shows "You own a total of x...". My class extends StoragePlugin, and submarkets.csv has "player" as faction.

Is there a way to make custom submarkets count towards player-owned weapons? Because an image is worth 1000 words: https://imgur.com/a/MZu9vd5
I think this got lost among other questions that day, could you shed some light on this please?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6816 on: October 08, 2020, 09:47:56 AM »

Ah, yeah, apologies!

Only stuff in a submarket with id == Submarkets.SUBMARKET_STORAGE gets counted for this, so you might be out of luck there, unfortunately.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6817 on: October 08, 2020, 10:46:59 AM »

- That seems to be going pretty easy on the player.

It's a hidden bonus and I'd rather generally keep it consistent based on what the faction is than randomly sprinkle a ton of bonuses to try to increase the difficulty. I think there are better options for doing that that are more apparent to the player.  It's just one possible knob (of many) to turn regarding difficulty, right?

(There are a few cases in the next releases where fleets get a bunch of leadership skills, but they're special cases...)

Seems like that would be pretty easy to show using the officer skills display you added when hiring an officer.
Logged

Alex

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

Yeah, had been thinking of doing that some time ago! Not entirely clear how to smoothly fit it into the interaction flow, though.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6819 on: October 09, 2020, 09:10:08 AM »

I have a class that implements BaseIntelPlugin and uses large description only (hasSmallDescription -> false, createSmallDescription() not overridden). When I call `IntelUIAPI.recreateIntelUI()` the first intel on the list gets automatically selected and displayed. This all is fine if the intel uses small description. If the intel uses large description it still displays small one (empty in this case) even though `hasSmallDescription()` returns false. If I change it to true (so intel has BOTH small and large descriptions) the small one will be displayed (or in my case complains to override it).
Is there a way to force recreateIntelUI() to display large description instead of small after the call?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6820 on: October 09, 2020, 09:27:31 AM »

Hmm, doesn't look like it. Is there a reason you're calling recreateIntelUI() instead of updateUIForItem(this)? The latter wouldn't hide the current intel, so that may be an option. Let me also make it so that the updateUIForItem() call will show the item's large description if it has one...
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6821 on: October 09, 2020, 11:16:41 AM »

Is there a reason you're calling recreateIntelUI() instead of updateUIForItem(this)?
My large intel is managing collections of small intel - the number of those changes as buttons are pressed:

Need to test if it would work if I was calling updateUIForItem() for each small intel that changed + large intel. I feel like it should work for adding new intel, not sure about removing intel from IntelManager and then calling updateUIForItem() on item that was removed?
« Last Edit: October 09, 2020, 11:20:30 AM by Jaghaimo »
Logged

Alex

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

Ah - yeah, it wouldn't work for adding/removing intel items, unfortunately.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6823 on: October 09, 2020, 12:50:02 PM »

Ah - yeah, it wouldn't work for adding/removing intel items, unfortunately.
Let's try and hack around it. Is there a way to bring intel screen programmatically? I just noticed if I do my changes without UI update call and then press E I end up with the correct refresh logic. So I hacked this working solution:
Code
        try {
            new Robot().keyPress(KeyEvent.VK_E);
        } catch (AWTException exception) {
        }
But obviously would prefer something more native to Starsector...

Robot, KeyEvent, AWTException all lives in java.awt.
Logged

Alex

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

<holds nose, gives thumbs up>
Logged
Pages: 1 ... 453 454 [455] 456 457 ... 706