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: Anubis-class Cruiser (12/20/24)

Pages: 1 ... 720 721 [722] 723 724 ... 748

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

NeoLemon

  • Lieutenant
  • **
  • Posts: 52
  • Y E S
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10815 on: June 22, 2024, 03:20:30 PM »

I don't think it's possible and implementing MarketAPI yourself is not an option - a lot of core code expects a MarketAPI to be a specific implementation under the hood. Generally if something is named *API it's just exposing a core implementation, and only if it's named *Plugin is it intended that a different implementation could be swapped in.

The pirate bases handle supplying commodities in the PirateBaseIntel class; search for "Brought in by raiders" there to see how it works.

OOh thanks!, i always wonder how generated pirates base supply themselves
Logged

creature

  • Captain
  • ****
  • Posts: 415
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10816 on: June 22, 2024, 07:05:02 PM »

I think the Xyphos and Sarissa do what you want, based on what you're describing - I'd suggest looking at their entry in wing_data.csv to see what's different. I think the SUPPORT role might do it.
Ah, sorry, by that, I didn't mean that I wanted them to orbit around their mothership, which is indeed what drones do when set to idle - what I do mean is the behavior of the drones when set to free roam or attack - they maintain a certain distance to the enemy ship while firing. From what I understand, SUPPORT fighters only did the former, right? They will only ever hover around their mothership and never go on the attack.
Logged

Cryovolcanic

  • Captain
  • ****
  • Posts: 341
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10817 on: June 22, 2024, 08:05:12 PM »

Where can I find information about how NPC fleets are spawned? I see some information in the faction files but I don't know what file contains information about how a fleet is populated and launched.

The tutorial guide on this is from 2013 and I didn't want to bump it to ask the question there :/
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24928
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10818 on: June 23, 2024, 08:10:19 AM »

Ah, sorry, by that, I didn't mean that I wanted them to orbit around their mothership, which is indeed what drones do when set to idle - what I do mean is the behavior of the drones when set to free roam or attack - they maintain a certain distance to the enemy ship while firing. From what I understand, SUPPORT fighters only did the former, right? They will only ever hover around their mothership and never go on the attack.

I don't remember, but you could trying setting a SUPPORT wing's range to non-zero to see what that does.

Where can I find information about how NPC fleets are spawned? I see some information in the faction files but I don't know what file contains information about how a fleet is populated and launched.

The tutorial guide on this is from 2013 and I didn't want to bump it to ask the question there :/

See: the FleetFactoryV3 class, and where that's used from. Hopefully you have an IDE set up, that would make this sort of digging around much easier!
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 480
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10819 on: June 23, 2024, 10:30:56 AM »

I think the Xyphos and Sarissa do what you want, based on what you're describing - I'd suggest looking at their entry in wing_data.csv to see what's different. I think the SUPPORT role might do it.
Ah, sorry, by that, I didn't mean that I wanted them to orbit around their mothership, which is indeed what drones do when set to idle - what I do mean is the behavior of the drones when set to free roam or attack - they maintain a certain distance to the enemy ship while firing. From what I understand, SUPPORT fighters only did the former, right? They will only ever hover around their mothership and never go on the attack.
I think you might be looking for some of the tags that Omega fighter wings use (probably either "leader_no_swarm" and "wingmen_no_swarm" or "attack_at_an_angle"? Not 100% on what the tags do exactly but I believe Omega fighters circle their target and attack from a distance rather than closing in like normal fighters)
Logged

creature

  • Captain
  • ****
  • Posts: 415
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10820 on: June 23, 2024, 05:12:06 PM »

I don't remember, but you could trying setting a SUPPORT wing's range to non-zero to see what that does.
I think you might be looking for some of the tags that Omega fighter wings use (probably either "leader_no_swarm" and "wingmen_no_swarm" or "attack_at_an_angle"? Not 100% on what the tags do exactly but I believe Omega fighters circle their target and attack from a distance rather than closing in like normal fighters)

I'm afraid both of these don't quite do the trick. Giving non-zero range to SUPPORT doesn't seem to do anything as the fighters don't move away from the ship even after being set to Engage.

I also tried each of the omega fighter tags and while it's aesthetically pleasing to see the fighters maintain formation while fighting, it seems the wing as a whole kind of still follows the usual routine of flying past the target ship. There are also some unexpected side effects to it like, while maintaining formation, some fighters in larger wings (4+, CLAW or V formation) get assigned really far away from the target ship and results in them being out of range of their own weapons.
Logged

Kaysaar

  • Admiral
  • *****
  • Posts: 536
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10821 on: June 23, 2024, 10:04:16 PM »

Spoiler
[close]
Spoiler
[close]
On first image is my implementation on second its vanilla one
My question is , how Accuracy turn rate, Speed and tracking strings are generated when they are not specified in weaponSpec?
What i mean by this question is : what decides, that accuracy is perfect or turn rate to be slow.
Spoiler
Code
 public static ArrayList<StatNumberUIPackage> getInfoRowBasedOnWeaponType(TooltipMakerAPI tooltip, WeaponSpecAPI spec, float padding) {
        ArrayList<StatNumberUIPackage> packages = new ArrayList<>();
        String text1 = spec.getTrackingStr();
        if (text1 != null && !text1.isEmpty()) {
            packages.add(new StatNumberUIPackage(tooltip.addPara("Tracking", padding), text1, null, Color.ORANGE, null));
        }
        text1 = spec.getAccuracyStr();
        if (text1 != null && !text1.isEmpty()) {
            packages.add(new StatNumberUIPackage(tooltip.addPara("Accuracy", padding), text1, null, Color.ORANGE, null));
        }

        text1 = spec.getTurnRateStr();
        if (text1 != null && !text1.isEmpty()) {
            packages.add(new StatNumberUIPackage(tooltip.addPara("Turn rate", padding), text1, null, Color.ORANGE, null));
        }

        text1 = spec.getSpeedStr();
        if (text1 != null && !text1.isEmpty()) {
            packages.add(new StatNumberUIPackage(tooltip.addPara("Speed", padding), text1, null, Color.ORANGE, null));
        }
        ;

        return packages;

    }
[close]
This is code i am basically using
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24928
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10822 on: June 24, 2024, 04:59:04 PM »

Here you go! Hopefully enough to sort it out.

Spoiler
public String getAccuracyDisplayName() {
   float spreadRating = maxSpread;
         
   if (spreadRating <= 0) return "Perfect";
   if (spreadRating <= 2) return "Excellent";
   if (spreadRating <= 5)return "Good";
   if (spreadRating <= 10) return "Medium";
   if (spreadRating <= 15) return "Poor";
   if (spreadRating <= 20) return "Very Poor";
   return "Terrible";
}
      
public String getTurnRateDisplayName() {
      if (turnRate <= 0) return "Can't turn";
      if (turnRate <= 5) return "Very Slow";
      if (turnRate <= 15)return "Slow";
      if (turnRate <= 25) return "Medium";
      if (turnRate <= 35) return "Fast";
      if (turnRate <= 50) return "Very Fast";
      return "Excellent";
   }      
      
public String getSpeedDisplayName() {
      float speed = hullSpec.getEngineSpec().getMaxSpeed();
      
      if (speed <= 125) return "Very Slow";
      if (speed <= 175) return "Slow";
      if (speed <= 225) return "Medium";
      if (speed <= 275) return "Fast";
      return "Very Fast";
   }
   
   public String getManeuverabilityDisplayName() {
      if (type == MissileType.BOMB || type == MissileType.ROCKET || type == MissileType.NO_AI || type == MissileType.TORPEDO) {
         return "None";
      }

      EngineSpecAPI es = hullSpec.getEngineSpec();
      float accelTime = es.getMaxSpeed() / es.getAcceleration();
      float turnTime = 180f / es.getMaxTurnRate();
      
      float testValue = accelTime + turnTime;
      
      if (testValue <= 0) return "None";
      if (testValue <= 2) return "Excellent";
      if (testValue <= 4) return "Good";
      if (testValue <= 6) return "Medium";
      if (testValue <= 8) return "Poor";
      return "Very Poor";
   }      
[close]
Logged

sinani210

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10823 on: June 24, 2024, 09:18:51 PM »

Maybe this was a better place to post this, but I'm trying to make some edits to the Sentinel PK defense fleet. I have a post on it here, but basically I'm trying to juice it up by removing the D-Mods, adding more ships, and upgrading everything to an Alpha Core. I've been editing PKDefenderPluginImpl.java, but nothing seems to change in game.
Logged

Blaze

  • Commander
  • ***
  • Posts: 238
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10824 on: June 25, 2024, 12:29:14 AM »

Is there a way to limit the number of ships that appear on the overworld map? I mean, the blob of ships that represents my fleet. For some reason, once the number of ships hits 15, doesn't seem to matter what kind, traveling drops to single frames.

Combat works fine, all other menus are normal. I'm using Miko's JRE upgrade and given it 12GB Ram, and there's no change in the GPU usage.
« Last Edit: June 25, 2024, 12:30:53 AM by Blaze »
Logged

Kaysaar

  • Admiral
  • *****
  • Posts: 536
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10825 on: June 25, 2024, 06:31:01 AM »

Here you go! Hopefully enough to sort it out.

Spoiler
public String getAccuracyDisplayName() {
   float spreadRating = maxSpread;
         
   if (spreadRating <= 0) return "Perfect";
   if (spreadRating <= 2) return "Excellent";
   if (spreadRating <= 5)return "Good";
   if (spreadRating <= 10) return "Medium";
   if (spreadRating <= 15) return "Poor";
   if (spreadRating <= 20) return "Very Poor";
   return "Terrible";
}
      
public String getTurnRateDisplayName() {
      if (turnRate <= 0) return "Can't turn";
      if (turnRate <= 5) return "Very Slow";
      if (turnRate <= 15)return "Slow";
      if (turnRate <= 25) return "Medium";
      if (turnRate <= 35) return "Fast";
      if (turnRate <= 50) return "Very Fast";
      return "Excellent";
   }      
      
public String getSpeedDisplayName() {
      float speed = hullSpec.getEngineSpec().getMaxSpeed();
      
      if (speed <= 125) return "Very Slow";
      if (speed <= 175) return "Slow";
      if (speed <= 225) return "Medium";
      if (speed <= 275) return "Fast";
      return "Very Fast";
   }
   
   public String getManeuverabilityDisplayName() {
      if (type == MissileType.BOMB || type == MissileType.ROCKET || type == MissileType.NO_AI || type == MissileType.TORPEDO) {
         return "None";
      }

      EngineSpecAPI es = hullSpec.getEngineSpec();
      float accelTime = es.getMaxSpeed() / es.getAcceleration();
      float turnTime = 180f / es.getMaxTurnRate();
      
      float testValue = accelTime + turnTime;
      
      if (testValue <= 0) return "None";
      if (testValue <= 2) return "Excellent";
      if (testValue <= 4) return "Good";
      if (testValue <= 6) return "Medium";
      if (testValue <= 8) return "Poor";
      return "Very Poor";
   }      
[close]
Thank you alex this snippet has been very useful and i have managed to recreate all tooltips sofar
But now i had come to real problem in terms of UI making
Spoiler
[close]
Context : I wanted to do my own Custom Production mechanics where resources are more important than money but i have huge lag issues generating more than 200 entires (buttons ) for each ship

How did you solved this problem with your UI? Like i was thinking about creating UI and storing copy of it , but then again if i would wanna sort entries by name etc, i would need to recreate UI, thus introducing lag spike.

update :1 Narrowed it down to issue is not amount of buttons themself but rather info on buttons (A lot of customPanels and tooltips)
« Last Edit: June 25, 2024, 08:13:15 AM by Kaysaar »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24928
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10826 on: June 25, 2024, 09:13:00 AM »

Maybe this was a better place to post this, but I'm trying to make some edits to the Sentinel PK defense fleet. I have a post on it here, but basically I'm trying to juice it up by removing the D-Mods, adding more ships, and upgrading everything to an Alpha Core. I've been editing PKDefenderPluginImpl.java, but nothing seems to change in game.

In brief - the code you're changing is only provided for reference, changing it won't actually do anything. You'd need to set up an IDE and make a "proper" mod - seeing how PKDefenderPluginImpl is used and providing your own implementation instead. I'd suggest looking at the wiki to get started, I understand it has a pretty good section on modding, though I'm not directly familiar with that.

Is there a way to limit the number of ships that appear on the overworld map? I mean, the blob of ships that represents my fleet. For some reason, once the number of ships hits 15, doesn't seem to matter what kind, traveling drops to single frames.

Combat works fine, all other menus are normal. I'm using Miko's JRE upgrade and given it 12GB Ram, and there's no change in the GPU usage.

Replied to your post in bug reports.

But now i had come to real problem in terms of UI making
Spoiler
[close]
Context : I wanted to do my own Custom Production mechanics where resources are more important than money but i have huge lag issues generating more than 200 entires (buttons ) for each ship

How did you solved this problem with your UI? Like i was thinking about creating UI and storing copy of it , but then again if i would wanna sort entries by name etc, i would need to recreate UI, thus introducing lag spike.

update :1 Narrowed it down to issue is not amount of buttons themself but rather info on buttons (A lot of customPanels and tooltips)

Two main things. One is an (unfortunately unexposed) method the Position class - .setSuspendRecompute(). Basically it stops recomputing position data whenever anything is added, which can help when building large lists. Added it to PositionAPI just now.

The other part is not creating the entire list right away but only when it actually needs to be rendered. So for example you might create a basic "holder" component for each list item and only create the rest of the UI in it render() method, once that's called for the first time. That way more of the list gets seamlessly created as you scroll through it. The core game generally uses both methods for long lists.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 480
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10827 on: June 25, 2024, 10:06:21 AM »

Because I'm curious - how does the RemoveAICoreAdmin interaction get fired? Does core UI code just check for an instance of the hidden AI admin condition that returns true for canRemove(), and does core UI code similarly add this condition when specifically an alpha core is installed?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24928
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10828 on: June 25, 2024, 10:24:10 AM »

Because I'm curious - how does the RemoveAICoreAdmin interaction get fired? Does core UI code just check for an instance of the hidden AI admin condition that returns true for canRemove(), and does core UI code similarly add this condition when specifically an alpha core is installed?

Yep, on both counts.
Logged

NikoTheGuyDude

  • Captain
  • ****
  • Posts: 426
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10829 on: June 25, 2024, 03:58:35 PM »

Is there a way to force fleets to spawn near a star system, or at least detect them if theyre despawend? Im aware fleets like to despawn if the player is far away, which is good and all, but I have a planetary condition that scans a systems fleets every few days or so and spawns a fleet to escort them. This is impossible if system.fleets is empty, which it is if the player is too far away for fleets to exist.

Would a fleetspawned/fleetjumped listener combo work?
Logged
Pages: 1 ... 720 721 [722] 723 724 ... 748