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 ... 611 612 [613] 614 615 ... 706

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

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9180 on: September 25, 2022, 07:38:33 PM »

Random thing that doesn't involve anything I'm working on but is bothering me:

How often do tooltips in general refresh? The ones in the character skills screen seem to do it every frame the button is moused over, which seems, uh, less than ideal.
I've heard of an issue where looking at a cargo screen with too many blueprint items in it causes a framerate drop, and was wondering if that could be related in any way.

Either once when created or every frame, depends on the tooltip. Some need to be dynamic, but a bunch that don't strictly need to do it are still recreated every frame. It super doesn't matter performance-wise unless the tooltip creation code is doing something bad. And if it were, it'd still be an issue even if the tooltip was only created once, in that it would cause a frame drop when the tooltip is first shown.

It can't be the issue you're describing, since the tooltips aren't being created/recreated/etc unless they're actually being shown. So how many items there are in the cargo doesn't matter for this at all. At most one tooltip would be created at a time.

So, hmm. That issue might be caused by blueprint item rendering being a little heavier than for normal items? Or, perhaps, a modded item of a similar sort, that does something even more performance-heavy in its custom rendering? Really hard to say, though. It *could* also be tooltip-related, if an item's tooltip is doing something performance-heavy in whatever plugin method adds stuff to the tooltip, but in that case it would show up regardless of what other items might be in the cargo, and only when the tooltip is being shown.
So I finally bothered to investigate after someone complained about Nex's new game blueprint picker. JVisualVM very quickly found the surprising cause:
Spoiler
Code: java
for (SpecialItemSpecAPI spec : Global.getSettings().getAllSpecialItemSpecs()) {
if (!spec.hasTag("package_bp")) continue;
Global.getSector().getPlayerFleet().getCargo().addSpecial(new SpecialItemData(spec.getId(), ""), 1);
}


Help my FPS is now 8


Oh no! It's getting every ship contained in the blueprint, and checking whether the player knows each of them! In each of the package blueprints, every frame!
Maybe it should cache the results or something?
[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9181 on: September 25, 2022, 08:01:16 PM »

Oof, thanks for digging into it! Definitely a case of "the special item plugin doing something ill-advised". Added caching there.
Logged

BigBrainEnergy

  • Admiral
  • *****
  • Posts: 680
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9182 on: September 25, 2022, 09:30:07 PM »

I have a question and this seems like the right place for it - I'm making my first mod and I want parts of the ship to be on top of the weapons. How do I do that?
Logged
TL;DR deez nuts

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9183 on: September 25, 2022, 09:39:17 PM »

I think Niko means one NPC fleet interrupting another. I don't think there is any way to do that.

By the way;

This is actually halfway wrong! reportFleetReachedEntity SOMETIMES reports when a fleet reaches its entity (ive found that fleets reaching their target fleet that they want to kill, e.g. interceptions, dont report). I've been using this to spawn fleets onto hostile fleets and engaging them in battles.

And so far, it actually kinda seems like the action is interrupted. It seems like I've delayed both satbombs and raids doing this.
Logged

Stormy Fairweather

  • Commander
  • ***
  • Posts: 193
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9184 on: September 25, 2022, 09:44:45 PM »

Is there a way to have a faction use random portraits from all available ones? or at least the ones available from the players.faction that is kind abashed together from all your installed mods?
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9185 on: September 26, 2022, 04:30:47 AM »

I have a question and this seems like the right place for it - I'm making my first mod and I want parts of the ship to be on top of the weapons. How do I do that?

Deco weapons. Look at Iron Shell or Volkov Industrial Conglomerate ships. They use lots of deco covers.
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9186 on: September 26, 2022, 07:02:55 AM »

How do I 100% prevent a fleet from disengaging, ever, in both 1. Interaction dialog and 2. autoresolve?

My fleets are basically psuedo-stations that I always want to hold. However, since the interaction plugin uses a combined fleet with a standard modular AI rather than their custom AI, they often try to disengage. A interaction plugin only goes so far, because I found that retreating from a battle doesnt return my pluginpick for the next interaction (which btw has one condition: The battle is not null, and the battle has satellites involved). I have FIGHT_TO_THE_LAST set on them, btw.

And in autoresolve, they seem to enjoy disengaging, which sucks, because the second their battle ends, they immediately despawn.

Setting their station status to true is impossible, because this prevents them from joining station battles, which is an important part of my mod.
« Last Edit: September 26, 2022, 07:07:12 AM by NikoTheGuyDude »
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9187 on: September 26, 2022, 07:04:50 AM »

On that topic, is there any way, precluding everyframe scripts and hijacking the autoresolve pluginpick to detect when a battle between 2 AI fleets has been created, or at least, inject ships into one side of the battle before autoresolve runs? Everyframes are gross and not performant, and the autoresolve plugin pick doesnt seem to inject ships fast enough, becauaes my satellites seem unscathed in the first round of every AI engagement. Plus they only spawn when autoresolvepluginpick is called, which is weird.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9188 on: September 26, 2022, 08:54:36 AM »

By the way;

This is actually halfway wrong! reportFleetReachedEntity SOMETIMES reports when a fleet reaches its entity (ive found that fleets reaching their target fleet that they want to kill, e.g. interceptions, dont report). I've been using this to spawn fleets onto hostile fleets and engaging them in battles.

And so far, it actually kinda seems like the action is interrupted. It seems like I've delayed both satbombs and raids doing this.

Oh, interesting! I'd completely forgotten this was a thing. Taking a brief look, this appears to be based on the fleet AI assignment-handling module, hmm. I guess if it works it works?

Is there a way to have a faction use random portraits from all available ones? or at least the ones available from the players.faction that is kind abashed together from all your installed mods?

Aside from manually bashing them all together into a .faction file, I don't think so.

How do I 100% prevent a fleet from disengaging, ever, in both 1. Interaction dialog and 2. autoresolve?

My fleets are basically psuedo-stations that I always want to hold. However, since the interaction plugin uses a combined fleet with a standard modular AI rather than their custom AI, they often try to disengage. A interaction plugin only goes so far, because I found that retreating from a battle doesnt return my pluginpick for the next interaction (which btw has one condition: The battle is not null, and the battle has satellites involved). I have FIGHT_TO_THE_LAST set on them, btw.

And in autoresolve, they seem to enjoy disengaging, which sucks, because the second their battle ends, they immediately despawn.

Setting their station status to true is impossible, because this prevents them from joining station battles, which is an important part of my mod.

Hmm, you might try creating a custom AI module for the fleet - if it's AI is instanceof ModularFleetAIAPI, you can call ModularFleetAIAPI.setTacticalModule() to provide a custom implementation of the tactical module. Then you can have its pickEncounterOption() method always return ENGAGE or whatever the enum is. That should prevent it from retreating.

I don't know what you mean by "retreating from a battle doesnt return my pluginpick for the next interaction". In general, it would help if you could be a little more clear - I find myself having to read between the lines quite a bit.

On that topic, is there any way, precluding everyframe scripts and hijacking the autoresolve pluginpick to detect when a battle between 2 AI fleets has been created, or at least, inject ships into one side of the battle before autoresolve runs? Everyframes are gross and not performant, and the autoresolve plugin pick doesnt seem to inject ships fast enough, becauaes my satellites seem unscathed in the first round of every AI engagement. Plus they only spawn when autoresolvepluginpick is called, which is weird.

Honestly, it sounds like you have some bugs in there, the things you're describing don't make a lot of sense. How can it be not "fast enough"? And the spawning thing...
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9189 on: September 26, 2022, 09:11:09 AM »



How do I 100% prevent a fleet from disengaging, ever, in both 1. Interaction dialog and 2. autoresolve?

My fleets are basically psuedo-stations that I always want to hold. However, since the interaction plugin uses a combined fleet with a standard modular AI rather than their custom AI, they often try to disengage. A interaction plugin only goes so far, because I found that retreating from a battle doesnt return my pluginpick for the next interaction (which btw has one condition: The battle is not null, and the battle has satellites involved). I have FIGHT_TO_THE_LAST set on them, btw.

And in autoresolve, they seem to enjoy disengaging, which sucks, because the second their battle ends, they immediately despawn.

Setting their station status to true is impossible, because this prevents them from joining station battles, which is an important part of my mod.

Hmm, you might try creating a custom AI module for the fleet - if it's AI is instanceof ModularFleetAIAPI, you can call ModularFleetAIAPI.setTacticalModule() to provide a custom implementation of the tactical module. Then you can have its pickEncounterOption() method always return ENGAGE or whatever the enum is. That should prevent it from retreating.

I don't know what you mean by "retreating from a battle doesnt return my pluginpick for the next interaction". In general, it would help if you could be a little more clear - I find myself having to read between the lines quite a bit.

On that topic, is there any way, precluding everyframe scripts and hijacking the autoresolve pluginpick to detect when a battle between 2 AI fleets has been created, or at least, inject ships into one side of the battle before autoresolve runs? Everyframes are gross and not performant, and the autoresolve plugin pick doesnt seem to inject ships fast enough, becauaes my satellites seem unscathed in the first round of every AI engagement. Plus they only spawn when autoresolvepluginpick is called, which is weird.

Honestly, it sounds like you have some bugs in there, the things you're describing don't make a lot of sense. How can it be not "fast enough"? And the spawning thing...

Sorry about being unclear, I admit I kinda just... post, things. Without thinking. I'll try to be more clear in the future.

Anyway! My fleets DO have a custom AI, that always returns either HOLD or HOLD_VS_STRONGER.
For the first thing-fleetInteractionPluginImpl uses battle.getCombinedFleetFor(allies) on whatever method it uses for determining the goal of the fleets engaged, I think it's pickEncounterOption? Whatever the case, the combinedfleet, despite being called on a battleside with only one fleet (my satellites with a custom ai), generates a fleet with the same name as the fleet, but with a standard vanilla AI. I looked into getCombinedFleet and it seems it should be getting the primary, which is again, the satellite fleet, but it's getting something else, which is weird.

It also seems that autoresolve uses getCombinedFleet(), which I'm pretty sure also won't use my custom AI, leading to autoresolve rounds with satellites resulting in a disengagement, at times.

The for the 2nd, I use a CampaignPlugin and a getInteractionDialogPlugin override to return a custom interaction dialog plugin that overrides the fleetWantsToDisengage, fleetWantsToEngage/Fight (I forgot the name), and fleetIsHoldingVsStronger, but this method is only returned if the provided interactionTarget is a fleet, who has a battle that has satellites involved in it. In these overrides, it gets the battleside that the provided fleet (the combined fleet) is in, and scans for any fleets with my satellite fleet memkey. If I find one, I get it, and then call super.method(foundFleet) so my custom AI is actually used. This doesn't seem to be called, though, when the player side retreats and is forced into a second round of combat, leading to a disengage attempt at times.

For the 3rd, I should clarify; I use a getAutoresolvePlugin method in my campaignplugin, that always returns null. It runs a method that returns a list of sectorentitytokens that have defense satellites that want to join the battle. I get the side they want to join, then spawn fleets onto the battle with battle.join(newSatelliteFleet, side), then return null. It seems that these satellite fleets that are spawned don't engage in the autoresolve round that this method is called in, as they don't take any damage in this "round", when the other ships do.
« Last Edit: September 26, 2022, 09:14:18 AM by NikoTheGuyDude »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9190 on: September 26, 2022, 09:17:05 AM »

Thank you for elaborating! Taking a step back, hmm. Might you not have an easier time if you keep the satellites for the visuals, use some kind of combat plugin to spawn them in player-facing battles, and provide a custom autoresolve plugin that counts them for autoresolves? Trying to handle them as "fleets" when they're not, not really, doesn't seem like a viable way to go.

E.G. the core game does this with stations but there are *a ton* of hacks to make that work and you don't have the benefit of being able to make those kinds of hacks in core code.
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 229
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9191 on: September 26, 2022, 09:36:48 AM »

Thank you for elaborating! Taking a step back, hmm. Might you not have an easier time if you keep the satellites for the visuals, use some kind of combat plugin to spawn them in player-facing battles, and provide a custom autoresolve plugin that counts them for autoresolves? Trying to handle them as "fleets" when they're not, not really, doesn't seem like a viable way to go.

E.G. the core game does this with stations but there are *a ton* of hacks to make that work and you don't have the benefit of being able to make those kinds of hacks in core code.

While I agree that it's a headache to handle things this way, it's also, in my eyes, essential for a lot of functionality of it.
For example, it's almost entirely impossible to have the behavior where fleets are interrupted apon interacting with the planet without having a fleet spawning and interrupting them, although I /guess/ I could give them an alternate assignment? But even then, it will remove a lot of expected functioality. Examples: Fleets moving into assist the battle against the satellites, the battle contributing to debris fields, the satellites spawning as derelicts (they dont, but I want them to), them contributing to a fleet's decision to disengage or engage, battle difficulty. It's also important to note that fleets moving to assist the battle is, in my eyes, pretty important behavior, since when a battle ends, all ships on the opposite side of a satellite fleet will be given a "grace" period where they can freely interact with the market. This is pretty important for stuff like raids.
It's also really nice to have them there, just to know whos currently fighting satellites. The player also won't be able to visually see the satellites and their variants as they move to engage, so it removes a little bit of decision making, there.

I'd argue trying to emulate most of the behavior of a fleet battle would be even more of a headache.
It also may surprise you to know that this system actually works very well, except for the autoresolve and disengagement. It doesn't actually have that many bugs as far as I can tell, with the exception of a bunch I invariably haven't discovered.

Also, I'm trying to minimize my use of plugins as much as I can, as they're incompatability hell (hence why I want to remove my interactiondialog plugin). But honestly, an autoresolve plugin might be the best bet, since the only other option is an everyframescript, and I like those even less due to the performance cost. Although I guess I could just slow down the execution of the everyframe, maybe? That'd help, I suppose.

Logged

Wisdomcube2000

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9192 on: September 29, 2022, 04:08:31 PM »

Forgive the likely dumb noobish question, but I was making strikecraft for that AA mod and trying to equip some missiles/torpedoes to them. Problem is that setting the weapon mount to hidden doesn't hide those weapons (so they appear on top and obscure a good portion of the craft in a really ugly way), so is there a way to hide them? Or perhaps make them render below the hull? I wouldn't mind that with just the tips sticking out from under the wing.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9193 on: September 29, 2022, 04:41:24 PM »

Deco weapons can cover missiles. Look at the Iron Shell or Volkov Industrial Conglomerate mods for examples.
Logged

Liral

  • Admiral
  • *****
  • Posts: 717
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9194 on: September 29, 2022, 04:54:12 PM »

How did you manage to make Starsector so free of bugs as it is?  It is remarkably stable and even tolerates some modding mistakes.  Do you have some monster test suite? :O
Pages: 1 ... 611 612 [613] 614 615 ... 706