Fractal Softworks Forum

Starsector => Mods => Topic started by: DesperatePeter on April 25, 2021, 06:01:33 AM

Title: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on April 25, 2021, 06:01:33 AM
AdvancedGunneryControl 0.13.0
Adds additional auto-fire modes to weapon groups

Download AdvancedGunneryControl (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases)
Code Repository (https://github.com/DesperatePeter/starsector-advanced-weapon-control)
(Requires LazyLib (https://fractalsoftworks.com/forum/index.php?topic=5444.0))
(Requires MagicLib (https://fractalsoftworks.com/forum/index.php?topic=13718.0))

Have you ever been frustrated with your Burst PDs firing all their charges at the enemy shield right before a salvo of Harpoons hits you?
Have you ever wondered why your Devastator Cannon deems it necessary to fire at a single Frigate at max range?
Ever got into an argument with your gunnery officer, because they insisted that they could hit a Broadsword with a Hellbore Cannon?
Then AdvancedGunneryControl is just the mod for you!


AdvancedGunneryControl is a utility mod that allows you to customize how your weapon groups behave on auto-fire mode.
Select from many different modes (and a few suffixes) per weapon group, configurable during battle or on the campaign map (mini-GUI).

Latest changes:Help hotkey (? by default), variant loading, GUI polish, Rework Target/AvoidShields modes to include shield facing/angle. Lots of fixes for custom AI.

Quick instructions:

For details, please refer to the:

Readme (https://github.com/DesperatePeter/starsector-advanced-weapon-control/blob/master/README.md)

I made a video where I explain how the mod works. Update: New video that's not 50 versions behind!
Spoiler
video (https://youtu.be/S6Lfi9LiycU)
Note that the "PD(Flux>50%)" explanation is a bit misleading. It should say "behaves like a vanilla PD weapon below 50% flux"
[close]

If you have any feature requests or bug reports, please let me know! If you do request a feature, please check back occasionally to provide feedback/clarification!
Also, please do let me know if you are using the mod and it works well =)

As this is a utility mod, it's safe to add/remove to/from an ongoing campaign.

Happy modding & gaming together!
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: ModdedLaharl on April 25, 2021, 10:42:13 AM
Is this only for pilots or could it be used for the AI as well? If the latter I would kiss you. If not, still, good job.
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: Harpuea on April 25, 2021, 01:25:52 PM
More control over ship systems and weapons is always welcomed. I bid you add one more mode: Ignore fighters. I am really tired of some ships with huge built in spinal cannon trying to hit a fighter while in middle of a battlestation siege. I am going to add this to my modlist and try it out. Thanks for sharing
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: DesperatePeter on April 25, 2021, 10:39:21 PM
First of all, thanks for your replies!
I'm currently working on a new version and will probably release it in a couple of days.
The main thing I am working on right now is introducing a setting file where you can customize the behaviour.
Mainly, I want the user to be able to customize the cycle-order of the modes (so that e.g. someone who only wants Default and PD Modes can simply remove all other modes from the cycle-order). Additionally, I am working on implementing a more customizable AI behaviour.
To give an example:
Currently, if you set a weapon group to "fighter-only", the vanilla AI will still pick the target and if that target is not a fighter, the weapon simply won't fire. I want to provide an option (enableCustomAI) where, if enabled, if the vanilla AI doesn't choose a fighter as the target, my custom AI will kick in and try to see if there is a targetable fighter in range and target that instead.

More control over ship systems and weapons is always welcomed. I bid you add one more mode: Ignore fighters. I am really tired of some ships with huge built in spinal cannon trying to hit a fighter while in middle of a battlestation siege. I am going to add this to my modlist and try it out. Thanks for sharing

Awesome, glad to hear! An "Ignore Fighters" mode is a great idea and should be easy enough to implement, I will definitely include this in the next version!
If you have any feedback, please let me know!

Is this only for pilots or could it be used for the AI as well? If the latter I would kiss you. If not, still, good job.

Thanks! =)
To be honest, I'm not sure... I think it should be possible, but I'm afraid that the controls for that wouldn't be super helpful.
I believe that controlling the fire-mode of AI-controlled ships on a per-weapon-group basis wouldn't be very user-friendly.
What might be possible though is to simply introduce a hotkey that toggles PD-Mode for all weapons with the "PD-Only"*-Tag for a) all allied ships or b) the selected ship (in the TAB-screen in combat).
Alternatively, I could maybe include an option "Automatically set all AI-controlled PD-Only weapons to PD Mode" in the settings file.
But I'll have to do some testing for that first, so this might take a little bit longer. I'll definitely let you know when I made progress on this topic!
* If my understanding is correct, PD-Only refers to weapons such as PD-Lasers and Vulcans, whereas the PD-Tag also includes weapons like light machine guns. I believe that setting weapons such as light machine guns to PD-Mode for all allied ships would probably not be desirable^^
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: MesoTroniK on April 26, 2021, 01:51:13 AM
Hello DesperatePeter, this is a really cool mod you got here! But I got a request for it :)

If you could please add a blacklist system, so that other mods can throw a .json or .csv in their config folder to make this not apply to specific weapons? It would be really appreciated. 99% of the time this overwriting the weapon behavior is fine. But in a few cases? It really is not. A couple of low hanging fruit examples would be flare launcher weapons in some mods so if you could do this it would be really appreciated.
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: DesperatePeter on April 26, 2021, 04:05:36 AM
Hello DesperatePeter, this is a really cool mod you got here! But I got a request for it :)

If you could please add a blacklist system, so that other mods can throw a .json or .csv in their config folder to make this not apply to specific weapons? It would be really appreciated. 99% of the time this overwriting the weapon behavior is fine. But in a few cases? It really is not. A couple of low hanging fruit examples would be flare launcher weapons in some mods so if you could do this it would be really appreciated.
First of all, thank you! =)
About your suggestion:
That is a very valid point!
The mod should already conserve the weapon behaviour in the "Default"-fireMode.
However, it might very well break weapons such as the flare launcher in other fire modes...

I'm wondering what the best solution to this problem would be.
So far, I can see three solutions:

If possible, I think I would prefer the third option. But I'm not sure if, for instance, "do not aim" covers all weapons that would interact unfavorably with my mod^^
Please let me know what you think^^
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: Sundog on April 26, 2021, 07:52:44 AM
So far, I can see three solutions:
  • A blacklist in the folder of other mods (your suggestion)
  • A blacklist in my mod (that I will prefill with anything from popular mods I can think of and other mod creators can add stuff that I missed to via PRs)
  • Using Weapon AIHints for this (for instance, there is an AI Hint called "do not aim" that people can add to their weapons)
My personal favorite solution to problems like this is to combine all three solutions. First, by creating a blacklist that is automatically generated based on tags and other information accessible through the API. Then by adding everything from blacklist files in my own mod and any other mod that wants to add to it (see Global.getSettings().getMergedSpreadsheetDataForMod)
Title: Re: [0.95a] AdvancedGunneryControl 0.1.0
Post by: Dark.Revenant on April 26, 2021, 11:20:00 AM
Might I suggest using MagicSettings (from MagicLib) for this task: https://starsector.fandom.com/wiki/MagicLib#MagicSettings
Title: Re: [0.95a] AdvancedGunneryControl 0.2.0
Post by: DesperatePeter on April 26, 2021, 01:26:37 PM
Update: I just released version 0.2.0.
Most notably, that update contains:
1. Implemented NoFighters mode, as requested
More control over ship systems and weapons is always welcomed. I bid you add one more mode: Ignore fighters. I am really tired of some ships with huge built in spinal cannon trying to hit a fighter while in middle of a battlestation siege. I am going to add this to my modlist and try it out. Thanks for sharing
2. Added custom AI that picks suitable targets if the base AI doesn't
3. Added a settings file, that allows you to choose which fire modes you want to use and to disable 2. if you don't like it
(4. code cleanup, refactoring, testing, more polish, a more extensive readme)
Overall, the mod should be in a much better state now.

About the blacklist feature:
I will look into that next! Thank you Dark.Revenant and Sundog for the suggestions, that will definitely make this task less daunting!

Is this only for pilots or could it be used for the AI as well? If the latter I would kiss you. If not, still, good job.
I promise I will look into this in the near future too! But first I wanted to polish up the core features of the mod

And as always, thanks everyone for the feedback! I'm always happy about positive and (constructive) negative feedback, feature requests and suggestions!
Title: Re: [0.95a] AdvancedGunneryControl 0.2.0
Post by: DesperatePeter on April 28, 2021, 11:41:17 AM
Update:

Version 0.2.1 is out. This version focuses mostly on improvements to the custom AI* (for missile-only and fighter-only only; other modes use exclusively vanilla AI). While in 0.2.0 the custom AI felt pretty janky, turned around erratically and fired shots into the vast nothingness of space a lot, the current AI actually seems pretty competent. Also, you can now define in the settings how trigger-happy the custom AI should be.

I am planning to do a 0.2.2 release in the near future that will focus mainly on polish, code cleanup, further AI improvements etc.

After that I will work on a 0.3.0 release that will aim to include the requested features of a weapon-blacklist and the option to set fire modes for AI ships (in some capacity).

Might I suggest using MagicSettings (from MagicLib) for this task: https://starsector.fandom.com/wiki/MagicLib#MagicSettings
Just a quick question about this.
Do I understand correctly that I would simply call e.g.:
Code
blacklist = MagicSettings.getList("swp", "weaponBlacklist")
and then l could let people know in my readme that they can include a list of weapons they want to blacklist into their settings.json under the tag "weaponBlacklist"?
Also, is there a way to essentially do
Code
blacklist = MagicSettings.getList("*", "weaponBlacklist")
(get from all mods)? Or would I have to include something like a "modsToGetBlacklistFrom"-field in my settings?

Update: Figured the "all mods" part out: Global.getSettings().modManager.enabledModsCopy is a list that also contains the ids.
Title: Re: [0.95a] AdvancedGunneryControl 0.3.0
Post by: DesperatePeter on April 29, 2021, 02:09:30 PM
Update: Version 0.3.0 released! It includes the requested blacklist feature. It also includes some more extensive settings and adds consideration for target leading accuracy and friendly fire to the custom AI.
Title: Re: [0.95a] AdvancedGunneryControl 0.4.1
Post by: DesperatePeter on April 30, 2021, 01:23:11 PM
Update: Version 0.4.1 released! It includes the requested "modify allies' weapon fire modes" feature and several quality of life improvements.
Title: Re: [0.95a] AdvancedGunneryControl 0.4.1
Post by: Harpuea on April 30, 2021, 06:17:24 PM
Wow. That was fast. I'll test it out as I play.
Title: Re: [0.95a] AdvancedGunneryControl 0.4.1
Post by: Vulpis on May 01, 2021, 05:19:53 AM
This looks amazing! Is there any way to save what you set each weapon group to or do you have to reset it each time you go into combat?
Title: Re: [0.95a] AdvancedGunneryControl 0.4.1
Post by: DesperatePeter on May 01, 2021, 12:32:09 PM
This looks amazing! Is there any way to save what you set each weapon group to or do you have to reset it each time you go into combat?

Glad you like it! =)

You will like to hear that that is exactly what I'm currently working on xD
If you'd like, you can get the latest pre-release version, that already contains this feature.
However, I still have to fix a couple of bugs (most prominently: If you refit your ship things get weird^^) and do some more testing before releasing it.
But I'd estimate that it will be ready soon (always hard to say with bugs whether finding the issue will take 10 minutes or 10 hours...), maybe tomorrow.

Update: I think I fixed the bug. I released a new pre-release version. I think that version should work fine. But I'll do some more testing tommorrow.
Anyone who wants to try it out and report back if they see anything funky would be much appreciated!
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: DesperatePeter on May 02, 2021, 06:40:30 AM
Update:
Version 0.6.0 is out!
0.5.x only made it to pre-release state, as testing revealed many issues with that version.
Most notable improvements of 0.6.0:

This looks amazing! Is there any way to save what you set each weapon group to or do you have to reset it each time you go into combat?
Done!
And looks to be stable.
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: IonDragonX on May 02, 2021, 05:03:32 PM
@DesperatePeter
Is it possible to do what SafariJohn is suggesting below?

There are quite a few ships, like Odyssey and many mod ships, that perform less than ideally with many builds because the AI sets their fighters to engage, losing the zero flux boost. It would be nice to have a 0 OP "leash" hullmod that sets fighter engagement range to 0 so the AI wouldn't do that (AI never sets 0 range fighters to engage).
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: ModdedLaharl on May 02, 2021, 11:50:19 PM
@DesperatePeter
Is it possible to do what SafariJohn is suggesting below?

There are quite a few ships, like Odyssey and many mod ships, that perform less than ideally with many builds because the AI sets their fighters to engage, losing the zero flux boost. It would be nice to have a 0 OP "leash" hullmod that sets fighter engagement range to 0 so the AI wouldn't do that (AI never sets 0 range fighters to engage).

Another mod, called Disable Action Hullmods, already does this. However, on the subject of 0-cost 'tactical' hullmods, I would ask of Peter if it is possible to create hullmods that reflect AdvancedGunneryControl's functionality. So I could, for example, put a hullmod on my shiny new cruiser that sets weapon group 1 to avoid shooting at fighters, for instance. I do think that dynamic switching in-combat probably has more uses, but I generally command large fleets and can't be everywhere at once. For example, I get a lot of use out of Automatic Orders to at least partially modify behavior on a ship-by-ship basis. If I had hullmods that I could use to tell my ships how to prioritize their point defense that'd be lovely.

The current state of the mod is pretty good though. I appreciate the extra control all the same, even if it tends to get away from me in larger battles.
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: DesperatePeter on May 03, 2021, 03:35:42 AM

Another mod, called Disable Action Hullmods, already does this. However, on the subject of 0-cost 'tactical' hullmods, I would ask of Peter if it is possible to create hullmods that reflect AdvancedGunneryControl's functionality. So I could, for example, put a hullmod on my shiny new cruiser that sets weapon group 1 to avoid shooting at fighters, for instance. I do think that dynamic switching in-combat probably has more uses, but I generally command large fleets and can't be everywhere at once. For example, I get a lot of use out of Automatic Orders to at least partially modify behavior on a ship-by-ship basis. If I had hullmods that I could use to tell my ships how to prioritize their point defense that'd be lovely.

The current state of the mod is pretty good though. I appreciate the extra control all the same, even if it tends to get away from me in larger battles.

Thanks for the feedback!
Yeah, I agree, if another mod already does that I shouldn't encroach on that mod's territory.

Also, I like your second suggestion. When chatting with folks on the Starsector Discord, the idea of making some kind of GUI for the mod came up. I think that using hullmods for this might actually be a far easier (and potentially better) way to do this than what I had in mind xD So thanks for that suggestion!

Update: When thinking about how I would implement this, I encountered a problem: Currently there are 7 fire modes and 7 weapon groups. That would be...49 hullmods =/
Also, as of now, it's easily possible to add/remove the mod during an ongoing campaign. I'm not sure, but maybe a hullmod-based approach would endanger that...

That being said, I feel like that might take a while to implement. So, in the meantime, I'll provide a "autoload/save fire modes" option.
That way, when loading out a ship, you can enter simulation mode and set up your firing modes. The next time that ship enters a battle, it will automatically load and apply the previously used firing modes.

I think I'll also remove the restriction that you have to be in the CommandUI to alter allies' firing modes (and introduce a setting to re-enable that).

This short-term-solution should be pretty simple to put together, so I hope I'll be able release a new version including that in a couple days.

@DesperatePeter
Is it possible to do what SafariJohn is suggesting below?
It's a cool idea, so thanks for suggesting it! Please refer to Laharl's comment however^^
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: ModdedLaharl on May 03, 2021, 02:54:50 PM
"
Update: When thinking about how I would implement this, I encountered a problem: Currently there are 7 fire modes and 7 weapon groups. That would be...49 hullmods =/
Also, as of now, it's easily possible to add/remove the mod during an ongoing campaign. I'm not sure, but maybe a hullmod-based approach would endanger that..."

The easy solution is to have all the hullmods in question fall under their own design type, so that at the press of a single button, a player can have them all show up or go away again. Also, the idea that removing a mod endangers the stuff it adds is a pretty commonly accepted thing, assuming I understand what you're saying right. Nevertheless, I agree that 49 hullmods is still quite a lot; some sort of specific GUI on the loadout screen, or sim screen if needed, isn't a bad idea.
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: IonDragonX on May 03, 2021, 03:09:47 PM
Nevertheless, I agree that 49 hullmods is still quite a lot; some sort of specific GUI on the loadout screen, or sim screen if needed, isn't a bad idea.
Why not a check box added to the vanilla Weapon Groups UI? Is it impossible to modify vanilla UI? The check box would display an open padlock when 0 and a locked padlock when 1.
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: DesperatePeter on May 03, 2021, 10:53:47 PM
Nevertheless, I agree that 49 hullmods is still quite a lot; some sort of specific GUI on the loadout screen, or sim screen if needed, isn't a bad idea.
Why not a check box added to the vanilla Weapon Groups UI? Is it impossible to modify vanilla UI? The check box would display an open padlock when 0 and a locked padlock when 1.

Yeah, I was thinking of something similar. My idea was to put it where it says Linked/Alternating on the weapon group screen and to let right-clicking modify the firing mode.
I have to agree, your idea sounds more user friendly. But I'll have to take a look what's possible (within reason) within the modding framework provided by starsector^^
I think it is possible to modify the GUI in mods, as seen by mods like Stellar Networks (https://fractalsoftworks.com/forum/index.php?topic=20836), but I'm not sure whether the game will let me modify the loadout screen in any reasonable capacity.

Worst case, I'll have to stick to keyboard controls and displaying text in the loadout screen or a hullmod-based solution. But I haven't had that much time to look into it yet^^

Anyhow, thanks for shooting me ideas and feedback, I do appreciate it!
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: ROFLMAN on May 04, 2021, 07:15:48 AM
I'm currently not playing SS because I'm waiting for a few more mods to release, but I will tell you this is the most intriguing mod I've seen in a long time and I check in often to see what progress you make. I'm looking forward to see your developments and hopefully test this out soon firsthand. Keep up the great work!
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: Exempt on May 04, 2021, 07:23:25 PM
Mandatory mod, thank you for making this. An improved, UI Integrated and Refit-screen selectable version of this needs to be vanilla.
Title: Re: [0.95a] AdvancedGunneryControl 0.6.0
Post by: DesperatePeter on May 04, 2021, 11:09:49 PM
A 0.7.0 pre-release is out. Main feature: automatically save/load firing modes.

Mandatory mod, thank you for making this. An improved, UI Integrated and Refit-screen selectable version of this needs to be vanilla.
I'm currently not playing SS because I'm waiting for a few more mods to release, but I will tell you this is the most intriguing mod I've seen in a long time and I check in often to see what progress you make. I'm looking forward to see your developments and hopefully test this out soon firsthand. Keep up the great work!
Thanks a lot for the kind words, that means a lot to me =)

Why not a check box added to the vanilla Weapon Groups UI? Is it impossible to modify vanilla UI? The check box would display an open padlock when 0 and a locked padlock when 1.
I jus spent like 3-4 hours yesterday experimenting with ways to somehow interact with the loadout screen and came up with...nothing.
As far as I can tell, the API doesn't offer any entry point for that.
I tried out some hacky solutions (such as constantly polling the game state), but even that didn't even get me to the point where I could figure out when the weapon group settings screen was open, much less be able to interact with it...
I'll try asking in the misc mod questions thread, but currently I'm rather pessimistic about being able to offer GUI integration.

The easy solution is to have all the hullmods in question fall under their own design type, so that at the press of a single button, a player can have them all show up or go away again. Also, the idea that removing a mod endangers the stuff it adds is a pretty commonly accepted thing, assuming I understand what you're saying right. Nevertheless, I agree that 49 hullmods is still quite a lot; some sort of specific GUI on the loadout screen, or sim screen if needed, isn't a bad idea.
I think this might be the only realistic solution left to me. But I think I will make it so this is an optional part of the mod (e.g. a separate mod within the main mod that you have to manually unzip or something like that), in order to keep the main mod hot-swappable without breaking saves.
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: Lprsti99 on May 05, 2021, 12:44:13 PM
Oughta hop in the discord, I'll bet someone can assist with the gui stuff (new nex version has a nice game setup gui)
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: DesperatePeter on May 05, 2021, 12:52:40 PM
Update: 0.7.1 is out!

Oughta hop in the discord, I'll bet someone can assist with the gui stuff (new nex version has a nice game setup gui)
I'll definitely try asking there, thanks! However, the issue is less that I'm unable to display GUI elements. The issue is more, that there seems to be no entry point to the refit screen. There's no "refit screen entered"-event that I can listen for. And even if there was, I can't find a way to find out which is the currently selected ship.
So, unless I am missing something big, it seems to be fairly difficult to create a GUI for this that improves the UX in a meaningful way...
The last option I want to look into are hullmods. Maybe I can somehow make a GUI pop up when a hullmod has been installed. We'll see...

Update: I just got an answer from Alex (https://fractalsoftworks.com/forum/index.php?topic=5061.msg325036#msg325036). Doesn't sound good =/
I'll spend a little bit more time trying to figure it out, but in the end, I'm not sure if it's worth the time & frustration that would go into this for just a slight improvement to usability.
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: Lprsti99 on May 06, 2021, 02:29:35 PM
I'm not sure if it's worth the time & frustration that would go into this for just a slight improvement to usability.

Unless you stumble over a silver bullet, I'm sure it won't be anywhere near worth, lol.  On a different tack: how about preventing autofire of non-pd weapons at flux >= 80% (or whatever).  ship AI usually does a decent job of doing so, but just having the weapons on autofire will happily flux you out (I know you can just toggle weapon groups, but seems like a nice qol feature, so long as the effort:payoff ratio is there)
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: DesperatePeter on May 06, 2021, 10:50:08 PM
On a different tack: how about preventing autofire of non-pd weapons at flux >= 80% (or whatever).  ship AI usually does a decent job of doing so, but just having the weapons on autofire will happily flux you out (I know you can just toggle weapon groups, but seems like a nice qol feature, so long as the effort:payoff ratio is there)

Yeah, that should definitely be possible! It would be simple enough to simply add a ConserveFlux or HoldFireAtHighFlux mode that expands on the weapon's base AI.
But I've actually been toying with the idea of "mode suffixes". That way, you could add a suffix such as "Flux<75%", "Flux<50%", "HE-Mode" (priorizite enemies with high flux or no shields), "Kinetic-Mode" (prioritize enemies with low flux/shields up) etc. to an existing fire mode. That way, you don't have to decide whether you want your Devastator Cannon to hold fire at high flux or target fighters, you can have both.

The control scheme I though of would be something like this: After you use NUMPAD# to cycle weapon group #, you can press the suffix-hotkey (e.g. "+") to cycle through suffixes for that mode.

Let me know what you think =)

Also, 0.7.2 just came out. IPDAI is now properly considered and fire modes that require PD weapons are skipped if there are no PD weapons in that weapon group.
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: Lprsti99 on May 07, 2021, 07:46:49 AM
On a different tack: how about preventing autofire of non-pd weapons at flux >= 80% (or whatever).  ship AI usually does a decent job of doing so, but just having the weapons on autofire will happily flux you out (I know you can just toggle weapon groups, but seems like a nice qol feature, so long as the effort:payoff ratio is there)

Yeah, that should definitely be possible! It would be simple enough to simply add a ConserveFlux or HoldFireAtHighFlux mode that expands on the weapon's base AI.
But I've actually been toying with the idea of "mode suffixes". That way, you could add a suffix such as "Flux<75%", "Flux<50%", "HE-Mode" (priorizite enemies with high flux or no shields), "Kinetic-Mode" (prioritize enemies with low flux/shields up) etc. to an existing fire mode. That way, you don't have to decide whether you want your Devastator Cannon to hold fire at high flux or target fighters, you can have both.

The control scheme I though of would be something like this: After you use NUMPAD# to cycle weapon group #, you can press the suffix-hotkey (e.g. "+") to cycle through suffixes for that mode.

Let me know what you think =)

Also, 0.7.2 just came out. IPDAI is now properly considered and fire modes that require PD weapons are skipped if there are no PD weapons in that weapon group.

Sounds good to me!
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: DesperatePeter on May 08, 2021, 01:36:24 PM
Unless you stumble over a silver bullet, I'm sure it won't be anywhere near worth, lol.  On a different tack: how about preventing autofire of non-pd weapons at flux >= 80% (or whatever).  ship AI usually does a decent job of doing so, but just having the weapons on autofire will happily flux you out (I know you can just toggle weapon groups, but seems like a nice qol feature, so long as the effort:payoff ratio is there)

I just released a pre-release: 0.8.0-ALPHA (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.8.0-ALPHA)
Despite my expectations I actually managed to implement a GUI. However...I think it's indeed (nigh) impossible to create a custom GUI in the refit screen. So this is a standalone GUI that you have to open from the campaign map by pressing "G". And I added fire mode suffixes. Currently, there's only flux-limiters, but probably I'll do some targeting-priority-changers as well.
From some initial testing everything seems to work, but there's still a bit of polishing to do.
Title: Re: [0.95a] AdvancedGunneryControl 0.7.1
Post by: DesperatePeter on May 10, 2021, 09:37:00 AM
Update: 0.8.3 (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/download/0.8.3/AdvancedGunneryControl-0.8.3.zip) is officially released. It comes with a GUI (ableit not integrated into the refit screen, as that seems to be pretty much impossible...) and fire mode suffixes!
Title: Re: [0.95a] AdvancedGunneryControl 0.8.3
Post by: Farlarzia on May 11, 2021, 03:26:03 PM
Hiya.

First off this mod is a godsend, I've been wishing for a way to make burst PD actually PD only for years. Must have from now on :D


Secondly, a request:
Would it be possible to add another toggle to make carriers keep their fighters on regroup, and not issue engage commands?

Keeping fighters on regroup instead of engage can be very powerful on battlecarriers, as the bombers on frontline carriers are often in range to be able to immediately fire their payload from the regroup position and then rearm immediately, outputting a constant stream of missiles from safety.

Also very useful for escort fighters that you explictitly want to protect only the host ship, but have a roam range. I've often seen the AI putting the escorts onto other friendly ships that don't need the escort, while the host ship itself badly needs them - even if it does recall them, its often too late.


Edit: The custom firemodes are saved correctly between combats, and from the campaign layer.
However, the custom AI is not actually applied in combat until you change a weapon groups firing mode in combat. Doing so will then make the custom AI apply to each group correctly.

Double Edit: Did a bit more testing - this only seems to be the case when ships are already spawned in battle without having to go through the deployment menu - I.E your ship(s) already being deployed when starting a simulation, or in disgengage scenarios where your entire fleet is instantly deployed without prompt.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.3
Post by: DesperatePeter on May 11, 2021, 10:26:43 PM
Hiya.

First off this mod is a godsend, I've been wishing for a way to make burst PD actually PD only for years. Must have from now on :D


Secondly, a request:
Would it be possible to add another toggle to make carriers keep their fighters on regroup, and not issue engage commands?

Keeping fighters on regroup instead of engage can be very powerful on battlecarriers, as the bombers on frontline carriers are often in range to be able to immediately fire their payload from the regroup position and then rearm immediately, outputting a constant stream of missiles from safety.

Also very useful for escort fighters that you explictitly want to protect only the host ship, but have a roam range. I've often seen the AI putting the escorts onto other friendly ships that don't need the escort, while the host ship itself badly needs them - even if it does recall them, its often too late.


Edit: The custom firemodes are saved correctly between combats, and from the campaign layer.
However, the custom AI is not actually applied in combat until you change a weapon groups firing mode in combat. Doing so will then make the custom AI apply to each group correctly.

Double Edit: Did a bit more testing - this only seems to be the case when ships are already spawned in battle without having to go through the deployment menu - I.E your ship(s) already being deployed when starting a simulation, or in disgengage scenarios where your entire fleet is instantly deployed without prompt.

First of all, thank you very much for the feedback, I'm glad that you like the mod =)

Oh yeah, that's a good point. Currently, the mod only checks for newly deployed ships. I think I actually noticed that ships in a simulation aren't "deployed" at some point and wanted to look into it...but then forgot about it. But I never actually thought about/tested disengage scenarios.

I'll look into this! I'm assuming that fixing this won't be too difficult, so expect an update soon-ish =).

In the meantime, you can use the "*"-Key to manually load all fire modes for all allied ships. (Or the "J"-Key to load them for only the player ship/targeted allied ship)


About the whole idea about fighters: Laharl mentioned that there is a mod called Disable Action Hullmods (https://fractalsoftworks.com/forum/index.php?topic=18435.msg307946#msg307946). I haven't personally tried it out, but it sounds like it could solve the issues you are describing.

If not, let me know and I'll try to work something out =)
Title: Re: [0.95a] AdvancedGunneryControl 0.8.3
Post by: DesperatePeter on May 12, 2021, 08:52:27 AM
Edit: The custom firemodes are saved correctly between combats, and from the campaign layer.
However, the custom AI is not actually applied in combat until you change a weapon groups firing mode in combat. Doing so will then make the custom AI apply to each group correctly.

Double Edit: Did a bit more testing - this only seems to be the case when ships are already spawned in battle without having to go through the deployment menu - I.E your ship(s) already being deployed when starting a simulation, or in disgengage scenarios where your entire fleet is instantly deployed without prompt.

Update: 0.8.4 is out and solves this issue =)
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: Hellya on May 12, 2021, 02:15:05 PM
Wanted to pop in and say thanks! This mod is a game changer and should be implemented into the game. Love the flux limiter on large power hungry weapons.

Also wanted to make a suggestion. If I read it right, there is complications with making the AI follow the presets, is there are way to make them follow your flux presets though. That might make them leave the engaged target early though. I am not a modder by any means, I have zero idea if it can be done or is too complex.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: DesperatePeter on May 12, 2021, 11:19:21 PM
Wanted to pop in and say thanks! This mod is a game changer and should be implemented into the game. Love the flux limiter on large power hungry weapons.

Also wanted to make a suggestion. If I read it right, there is complications with making the AI follow the presets, is there are way to make them follow your flux presets though. That might make them leave the engaged target early though. I am not a modder by any means, I have zero idea if it can be done or is too complex.

First of all, thanks for the feedback!

About your idea: I was playing around a bit with actively disabling the weapons when they are on AI ships and not supposed to fire. That more or less got the job done, but was super messy (you had those "weapon X disabled" texts floating around everywhere and there was the issue that, when the AI turned autofire off for a weapon, it wouldn't get re-enabled properly).

The issue is that my mod only affects the behaviour of weapons on auto-fire, but the AI doesn't always use autofire to fire its weapons. Currently, the only plausible solution I can think of is implementing a custom ship AI Plugin*, but I'm not sure how well that will work (and how much effort that is)
But I'll take some more time to look into whether I can find a solution for this.
If anyone has a good suggestion how to solve this, I'm all ears!


*potentially it might be possible to write a wrapper for the existing ship AI, which essentially just set's weapons to "don't fire" if the fire mode settings prohibit firing.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: Rararara on May 13, 2021, 07:56:27 AM
This mod looks great! Is there a way to toggle between the custom AI and default AI?

i.e. There are no more carrier enemy ships and all the fighters have been swatted, so I want the fighter-only weapon groups (of the entire fleet) to resume default behaviour. If this could happen automatically that'd be even better.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: GreeM on May 13, 2021, 10:23:40 AM
Is there a way of changing the G key on starmap? Every time i exit a window with the G key the window for this mods setting pops up. Looked through the options and didn't find something there to change the G key only disabling it. If that is the case, could you make it so it doesn't pop up when exiting a window(like salvage screen and so on)?



Other than that great mod that helps the somewhat dumb ai :D
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: Thana on May 13, 2021, 10:26:35 AM
Is there a way of changing the G key on starmap? Every time i exit a window with the G key the window for this mods setting pops up. Looked through the options and didn't find something there to change the G key only disabling it. If that is the case, could you make it so it doesn't pop up when exiting a window(like salvage screen and so on)?



Other than that great mod that helps the somewhat dumb ai :D

Yeah, that's pretty annoying. Every time I leave the looting window I get hit with the gunnery AI choices window unless I break the normal workflow and use the mouse to close the looting window instead - which I would normally never, ever bother doing. It was irritating enough to make me disable the mod.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: Farlarzia on May 13, 2021, 09:03:31 PM
This might be asking for a little to much customization, but it would great to be able to set a weapon for freefire use below a flux threshold, and then switch to its specified weapon role after.
For example, I  have a continuous fire PD weapon that uses a lot of flux, that I wouldn't mind being used for additional DPS while the ship is at low flux, but as the ships flux rises I'd only want it to be used for PD

Another thing I'd love to see is for magazine based PD weapons to have an option to fire at enemy ships like normal, but only the top shot of their magazine if they're already full on ammo, allowing them to keep an ammo reserve for missiles, but also contribute in the battle as well.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: Lprsti99 on May 14, 2021, 11:53:13 AM
This might be asking for a little to much customization, but it would great to be able to set a weapon for freefire use below a flux threshold, and then switch to its specified weapon role after.
For example, I  have a continuous fire PD weapon that uses a lot of flux, that I wouldn't mind being used for additional DPS while the ship is at low flux, but as the ships flux rises I'd only want it to be used for PD

Heh, I had the same thought (hi, scy hacking commlinks), but I generally make do with putting a few in a different weapon group with default targeting, and the rest on pd.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: DesperatePeter on May 14, 2021, 12:10:19 PM
Update: 0.8.5 is out!
Is there a way of changing the G key on starmap? Every time i exit a window with the G key the window for this mods setting pops up. Looked through the options and didn't find something there to change the G key only disabling it. If that is the case, could you make it so it doesn't pop up when exiting a window(like salvage screen and so on)?



Other than that great mod that helps the somewhat dumb ai :D

Yeah, that's pretty annoying. Every time I leave the looting window I get hit with the gunnery AI choices window unless I break the normal workflow and use the mouse to close the looting window instead - which I would normally never, ever bother doing. It was irritating enough to make me disable the mod.

That's a very valid point, thanks for pointing that out. G certainly was not the best choice for a hotkey, especially when making it non-rebindable...
I fixed both those issues in the new patch (0.8.5). The new default hotkey is "J" and it's rebindable.

This mod looks great! Is there a way to toggle between the custom AI and default AI?

i.e. There are no more carrier enemy ships and all the fighters have been swatted, so I want the fighter-only weapon groups (of the entire fleet) to resume default behaviour. If this could happen automatically that'd be even better.

This might be asking for a little to much customization, but it would great to be able to set a weapon for freefire use below a flux threshold, and then switch to its specified weapon role after.
For example, I  have a continuous fire PD weapon that uses a lot of flux, that I wouldn't mind being used for additional DPS while the ship is at low flux, but as the ships flux rises I'd only want it to be used for PD

Another thing I'd love to see is for magazine based PD weapons to have an option to fire at enemy ships like normal, but only the top shot of their magazine if they're already full on ammo, allowing them to keep an ammo reserve for missiles, but also contribute in the battle as well.

I have given both these suggestions a bit of thought and I think I came up with a solution how I can kill both birds with one stone: Fire mode prefixes :P
Prefixes or (pre)conditions would essentially disable the custom AI unless the condition is met.

To return all fighter-mode weapon groups back to normal, I'd add a "toggle" prefix, where you can toggle (via hotkey) between default mode and the set mode (e.g. Fighter) for all weapon modes marked with this prefix (sorry, I feel like automating this would be fairly messy =/) for all ships.

To only activate the custom fire mode when below max ammo or above 50% flux, I'd add a "Ammo<75%" and a "Flux>50%" prefix.

My only concern is: The controls of the mod might become a little bit overloaded. So I might limit prefixes management to the GUI.

Let me know what you think!
Title: Re: [0.95a] AdvancedGunneryControl 0.8.4
Post by: GreeM on May 14, 2021, 02:25:41 PM
Update: 0.8.5 is out!
Is there a way of changing the G key on starmap? Every time i exit a window with the G key the window for this mods setting pops up. Looked through the options and didn't find something there to change the G key only disabling it. If that is the case, could you make it so it doesn't pop up when exiting a window(like salvage screen and so on)?



Other than that great mod that helps the somewhat dumb ai :D

Yeah, that's pretty annoying. Every time I leave the looting window I get hit with the gunnery AI choices window unless I break the normal workflow and use the mouse to close the looting window instead - which I would normally never, ever bother doing. It was irritating enough to make me disable the mod.

That's a very valid point, thanks for pointing that out. G certainly was not the best choice for a hotkey, especially when making it non-rebindable...
I fixed both those issues in the new patch (0.8.5). The new default hotkey is "J" and it's rebindable.



Hotkey G werent a bad choice it was the weird interaction that the window popped up after you exited with the g key.
Anyhow great change and thank you :D
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: writeru on May 14, 2021, 04:14:35 PM
Could you do a config that will make the ship fire all it's missles at the nearest viable target if only a certain % of the hull remain? Could be really useful to frigates that are dying but die without firing the missles. If they are gonna explode anyway it's better to shoot the missles even at a shield than not firing it at all.





Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: Hellya on May 14, 2021, 04:17:11 PM
Could you do a config that will make the ship fire all it's missles at the nearest viable target if only a certain % of the hull remain? Could be really useful to frigates that are dying but die without firing the missles. If they are gonna explode anyway it's better to shoot the missles even at a shield than not firing it at all.

I second the Blow Your Load protocol.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: DesperatePeter on May 14, 2021, 11:31:24 PM
Could you do a config that will make the ship fire all it's missles at the nearest viable target if only a certain % of the hull remain? Could be really useful to frigates that are dying but die without firing the missles. If they are gonna explode anyway it's better to shoot the missles even at a shield than not firing it at all.

I second the Blow Your Load protocol.

Hey folks, thanks for the suggestion, I like the idea.
However, I can see a couple issues where I am unsure as to how a satisfactory solution for this could look like.

a) My mod only interacts with auto-fire. I think AI-controlled ships will usually not put limited-ammo missiles on auto-fire, therefore this mode would probably not accomplish much on AI-ships.
b) What should that mode do, when the ship is at full hull? Should it just not fire (i.e. only fire when manually fired)? Should it use default auto-fire behavior (which would essentially just fire the missiles at will, anyways)?
c) Maybe this would work better as a mode suffix? Maybe alongside an "Opportunistic"/"ConserveAmmo" mode, that only fires when it thinks the shot will be effective (e.g. only at overloaded targets for finisher missiles etc.). Then you could  e.g. put your flagships harpoons on "Opportunistic" with the "BombsAwayAtLowHull" suffix.

I think that if I were to dabble in ShipAI, there might be a possibility to make this work better for AI-controlled ships, but I still have to look into ShipAI Plugins and evaluate how doable that is.
Maybe, just maybe, there will be ship modes in an update at some point in the future^^

Update: I looked into ShipAI Plugins a little bit. I think that making a custom plugin that e.g. essentially just deselects all weapon groups and sets all weapon groups to autofire every frame would be doable. But I have to try it out and see if it works as intended, how much performance that would eat, whether it has any weird side effects, ...
If this works, that might open the door to more customization options.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: DesperatePeter on May 17, 2021, 03:57:45 AM
Update: 0.9.0 (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.9.1) is out as a pre-release. It comes with ship modes, multiple mode loadouts and additional modes/suffixes. From initial testing, most stuff seems to work, but I have not yet tested all features properly.
Readme for this version (https://github.com/DesperatePeter/starsector-advanced-weapon-control/blob/feature/ship-ai/README.md)

@ Farlarzia, Lprsti99, writeru, Hellya, Rararara:
This update should include all features requested by you guys (except for the fighter regroup stuff). I'd much appreciate it if you could try the pre-release version and report back whether your requested feature works as intended.

Here are the solutions:

Note: If the solution isn't exactly what you imagined, please keep in mind that I tried to a) work within the existing framework as much as possible (rather than rewriting the whole mod) and b) tried to keep solutions as generic as possible. E.g. a "switch all fighter mode groups to default mode"-feature would be very specific compared to loadouts, and inevitably lead to people requesting "can't I switch my BigShip modes to default when there are no big ships?" etc.

Note: I opted against adding prefixes, which I had previously intended, because prefixes would need to be checked every frame. I.e. the mod would have to check prefixes for every weapon (group) for every deployed ship every frame. I found that the performance cost this generates didn't outweigh the benefits.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: Lprsti99 on May 17, 2021, 09:19:09 AM
Checking it out now, looks great so far! Also, update the readme to reference J instead of G for the gui  :P

E: Crash on getting in range of a pursuit target:

Code
2590849 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IllegalStateException: weapon.spec.primaryRoleStr must not be null
java.lang.IllegalStateException: weapon.spec.primaryRoleStr must not be null
at com.dp.advancedgunnerycontrol.weaponais.AGCUitlsKt.isOpportuneType(AGCUitls.kt:82)
at com.dp.advancedgunnerycontrol.weaponais.AGCUitlsKt.isOpportuneTarget(AGCUitls.kt:64)
at com.dp.advancedgunnerycontrol.weaponais.suffixes.ConserveAmmoSuffix.shouldFire(ConserveAmmoSuffix.kt:10)
at com.dp.advancedgunnerycontrol.weaponais.AdjustableAIPlugin.shouldFire(AdjustableAIPlugin.kt:37)
at com.fs.starfarer.combat.systems.G.o00000(Unknown Source)
at com.fs.starfarer.combat.systems.G.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Other than that, works a charm!
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: DesperatePeter on May 17, 2021, 10:44:08 PM
Checking it out now, looks great so far! Also, update the readme to reference J instead of G for the gui  :P

E: Crash on getting in range of a pursuit target:

Code
2590849 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.IllegalStateException: weapon.spec.primaryRoleStr must not be null
java.lang.IllegalStateException: weapon.spec.primaryRoleStr must not be null
at com.dp.advancedgunnerycontrol.weaponais.AGCUitlsKt.isOpportuneType(AGCUitls.kt:82)
at com.dp.advancedgunnerycontrol.weaponais.AGCUitlsKt.isOpportuneTarget(AGCUitls.kt:64)
at com.dp.advancedgunnerycontrol.weaponais.suffixes.ConserveAmmoSuffix.shouldFire(ConserveAmmoSuffix.kt:10)
at com.dp.advancedgunnerycontrol.weaponais.AdjustableAIPlugin.shouldFire(AdjustableAIPlugin.kt:37)
at com.fs.starfarer.combat.systems.G.o00000(Unknown Source)
at com.fs.starfarer.combat.systems.G.advance(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Other than that, works a charm!

Hi Lprsti99,

thanks a lot for the input, much appreciated!

Ahh, yeah, looks like I forgot a nullptr check (wasn't aware that weapon.spec.primaryRoleStr could be null xD).

I fixed the readme and the nullptr issue and pushed a new pre-release (0.9.1).
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: Farlarzia on May 18, 2021, 08:59:06 PM
@ Farlarzia, Lprsti99, writeru, Hellya, Rararara:
This update should include all features requested by you guys (except for the fighter regroup stuff). I'd much appreciate it if you could try the pre-release version and report back whether your requested feature works as intended.

Here are the solutions:
  • To make the AI strictly adhere to firing modes, set the ship mode to ForceAutofire in the GUI
  • To use a weapon as PD when it's below max Ammo, set the fire mode to default with the PD(Ammo<90%) suffix. Same for flux threshold
  • To fire remaining missiles before dying, set the weapon group mode to Opportunist and suffix to PanicFire (enable ForceAutofire ship mode for best results)
  • To make all fighter weapons switch back to default mode, go to the GUI for the ship, switch to loadout 2, copy the last loadout and change fighter mode to default. Repeat for all ships. In combat, press the "+"-Key to cycle loadouts for all ships. Alternatively, if you don't mind putting everything to default, simply leave loadout 2 or 3 blank for all ships and use it as a "default everything" loadout.

Wow, I really wasn't sure if my request was even feasible, and yet you've delivered completely on it already.
I did some testing with the new PD settings, and they're working great as far as I can tell.
Honestly incredible work  ;D ;D ;D

As a side note, if you're on discord I'd suggest dropping by the unofficial starsector discord (https://discord.gg/Sp28tYfQ (https://discord.gg/Sp28tYfQ)) - They'll be able to give you the modder role, and you'll be able announce updates in the mod updates channel - a lot of people haven't heard of this mod yet that I'm sure would be interested.
Title: Re: [0.95a] AdvancedGunneryControl 0.8.5
Post by: DesperatePeter on May 19, 2021, 09:17:50 PM
Wow, I really wasn't sure if my request was even feasible, and yet you've delivered completely on it already.
I did some testing with the new PD settings, and they're working great as far as I can tell.
Honestly incredible work  ;D ;D ;D

As a side note, if you're on discord I'd suggest dropping by the unofficial starsector discord (https://discord.gg/Sp28tYfQ (https://discord.gg/Sp28tYfQ)) - They'll be able to give you the modder role, and you'll be able announce updates in the mod updates channel - a lot of people haven't heard of this mod yet that I'm sure would be interested.

Thanks for the feedback! =) Glad to hear that it seems to work well!

I already am on the discord somewhat frequently, but I'll make sure to ask to be given the modder role =)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.2
Post by: DesperatePeter on May 22, 2021, 09:20:32 AM
Update: release 0.9.2 is out!
Compared to 0.9.1, it comes with a couple fixes, additional ship modes and GUI Button tooltips.
As the ship modes are a pretty new feature, any feedback on how well they work is much appreciated!
Title: Re: [0.95a] AdvancedGunneryControl 0.9.2
Post by: Harpuea on May 22, 2021, 09:40:58 AM
Quote
ShieldsOff(Flux>50%)   Force turn off shield at ship flux > 50%   Only recommended for high armor ships with good PD

Very nice feature. I absolutely needed this for a very long time.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.2
Post by: Lprsti99 on May 22, 2021, 10:34:05 AM
Neat! Sidenote, update the versionchecker file to point to this thread instead of the old one next time you update :)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.2
Post by: DesperatePeter on May 22, 2021, 10:54:35 AM
Neat! Sidenote, update the versionchecker file to point to this thread instead of the old one next time you update :)

Oh, right, good catch, will do! =)

Quote
ShieldsOff(Flux>50%)   Force turn off shield at ship flux > 50%   Only recommended for high armor ships with good PD

Very nice feature. I absolutely needed this for a very long time.

Glad you like it =)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.2
Post by: DesperatePeter on May 24, 2021, 01:04:44 AM
Update: 0.9.3 is out!
It mainly features the correct forum thread id and improved GUI tooltips, alongside some minor fixes/cleanup
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on May 25, 2021, 11:34:30 PM
I like what at least someone is trying ti improve AI :)

About suggestions, I have some, I think for ships with heavy armor, but not very great flux stats is good idea make force flush option, for example if its Flux reach 85% its enable vent no matter what happens, another idea is option to exclude some weapons from being considered as threat, low example weak anti fighter missiles, PD laser, and tactical and gravitron beams, so NPC will chase enemy, or vent even if its attacked by these weapons.

Also good idea for modded ships with modules, modules technically its another ship attached to the main ship, and they attack any vessels at their own discretion, I think is good idea is to make option what makes it prioritize main ship target.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on May 27, 2021, 09:07:38 AM
I like what at least someone is trying ti improve AI :)
Thanks :)

Quote
About suggestions, I have some, I think for ships with heavy armor, but not very great flux stats is good idea make force flush option, for example if its Flux reach 85% its enable vent no matter what happens, another idea is option to exclude some weapons from being considered as threat, low example weak anti fighter missiles, PD laser, and tactical and gravitron beams, so NPC will chase enemy, or vent even if its attacked by these weapons.
There already is a ship mode called Vent(Flux>50%) that kind of does this, however it doesn't check if there's enemies with dangerous weapons nearby, it simply vents. I could absolutely see adding a "safety-check" to this mode (e.g. checking if current armor is high and if enemies nearby have weapons that deal high amounts of HE damage). So thanks for the suggestion!

Quote
Also good idea for modded ships with modules, modules technically its another ship attached to the main ship, and they attack any vessels at their own discretion, I think is good idea is to make option what makes it prioritize main ship target.

Hmm, I'm unsure how well this feature fits the scope of this mod. I was thinking about adding features for better control of how fighter wings behave (and I think ship-system based fighters would fit the theme of fighters) to this mod, but I'm afraid the mod would become too big & complicated if I did this. It's called advanced gunnery control after all^^

But once I feel like this mod is mostly finished (which should be soon-ish), if I have the time and motivation, I might consider making a second mod that focusses more on fighters (Advanced Wing Commander maybe?).
I already had ideas like being able to assign different tasks/targets/roles to different wings.

Roles would be more generalized (e.g. "Defend allies in need", "Escort Carrier", "Hunt isolated targets", "Aggressive", ...) and could be assigned for any carrier in the fleet.
Tasks/targets would allow you to (temporarily) overwrite the roles assigned to single wings for the player controlled ship only.

No promises though. That sounds like quite a bit of work^^
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: beyondfubar on May 27, 2021, 02:00:09 PM
This sounds amazing. I would have downloaded it earlier but someone said "Null pointer" in a message and I ran out my door screaming in an imagined language and had to be tranquilized with a dart gun by animal control. 

I'm good now I will try this out. Can only be a good thing, aside from truly, primal, and horrific mental trauma.

Onomatophobia aside I'm excited!
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: EvilPineapple on May 30, 2021, 11:50:02 AM
Opportunist says it's mainly for limited ammo missiles. How well does it work with ammo weapons like Ion Pulser/Autopulse or burst beams like Phase/Tachyon Lances? How does it work on beams with High Scatter Amplifier?
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: qwerty4429 on May 30, 2021, 12:51:14 PM
Hello! This is a great mod, registered just for this post.
I really like it, and I have several suggestions.

Note: ForceAi is enabled, last mod version

1. It seems like Opportunist doesn't work - for test I used onslaught, with ARP rockets (HE), Hephaestus (HE) and Autocannon IX (K). Both set to opportunist, and forced autofire, no suffixes - both never shoot. Double checked that enemy (Onslaught) is in range and autofire is on. It is theoretically a great feature, and I would like to see it in action!
2. I think it could be great if we had separate logic for anti-shield and anti-armor. As opportunist doesn't do anything for energy (at least it seems so for me), I think it is twice as great. My paragon uses long-range blasters at front, and two tachs at sides. Both are flux-hungry, so I prefer one used at a time. For shields - blaster (hard flux). For armor - tach (soft flux). So I believe that direct setting when a weapon group shoots shield/armor is great.
3. Venting when flux is low is good as well, IMHO, so I would be happy to see ship mode like "vent when >15% flux". This way, no flux is accumulated but also not too long downtime for reapers to kill you.
4. Force Autofire should probably be joined with other modes, or set as a separate mode which could work with conjunction with others. Maybe same with Vent when flux>x%.

And what is mining fire mode? It would be great if it would explain it in the readme. And all non-obvious fire modes, such as Opportunist, might use a more detailed explanation.

Lastly - thank you for your mod! It is great, and its even better to see that a version I downloaded like 2 weeks ago is totally obsolete already 8)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on May 31, 2021, 12:03:29 AM
This sounds amazing. I would have downloaded it earlier but someone said "Null pointer" in a message and I ran out my door screaming in an imagined language and had to be tranquilized with a dart gun by animal control. 

I'm good now I will try this out. Can only be a good thing, aside from truly, primal, and horrific mental trauma.

Onomatophobia aside I'm excited!

Hahaha xD

To be fair, that issue was in a pre-release version. But let me know if you find any additional nullptr exceptions in the release :P

Opportunist says it's mainly for limited ammo missiles. How well does it work with ammo weapons like Ion Pulser/Autopulse or burst beams like Phase/Tachyon Lances? How does it work on beams with High Scatter Amplifier?

Hmm, I'm not sure if you'd like the results very much. Opportunist is pretty conservative when choosing whether to fire or not (it only fires if the target is within 75% of the max weapon range, moving relatively slowly compared to the projectile speed/tracking (always true for beams) and has high flux when the weapon deals HE damage). So I think, personally, I would just stick to default mode for these weapons. Especially for high scatter amplifier.

For Ion Pulser/Autopulse, you could consider slapping the ConserveAmmo-Suffix onto default mode. That way, it would fire the first 10% of it's ammo relatively liberally and the remaining 90% only if it thinks its chances of hitting are pretty good.

Hello! This is a great mod, registered just for this post.
I really like it, and I have several suggestions.

Note: ForceAi is enabled, last mod version

Hi!
Thanks for the feedback, this is exactly the kind of feedback I need to improve the mod =)

Quote
1. It seems like Opportunist doesn't work - for test I used onslaught, with ARP rockets (HE), Hephaestus (HE) and Autocannon IX (K). Both set to opportunist, and forced autofire, no suffixes - both never shoot. Double checked that enemy (Onslaught) is in range and autofire is on. It is theoretically a great feature, and I would like to see it in action!

1. Hmm, that's weird. The HE weapons should fire once the enemy flux gets high-ish and the enemy is within 75% of the weapon range. I'll try to test your setup and see if I can find the issue!
Also, I think I'll update the tooltip for opportunist, as it probably doesn't explain in enough detail what the mode does.


Quote
2. I think it could be great if we had separate logic for anti-shield and anti-armor. As opportunist doesn't do anything for energy (at least it seems so for me), I think it is twice as great. My paragon uses long-range blasters at front, and two tachs at sides. Both are flux-hungry, so I prefer one used at a time. For shields - blaster (hard flux). For armor - tach (soft flux). So I believe that direct setting when a weapon group shoots shield/armor is great.

2. Yeah, that probably is a good idea^^ I actually started working on antiShield/avoidShield modes a while back, but didn't get them to work well (I think I messed up the geometric calculations on shield angles/turn rates etc. somehow). But I didn't put too much effort into trying to get them to work, so I can definitely have another look!

Quote
3. Venting when flux is low is good as well, IMHO, so I would be happy to see ship mode like "vent when >15% flux". This way, no flux is accumulated but also not too long downtime for reapers to kill you.

3. In the current dev version (unreleased), I actually did split the venting mode into two separate modes (currently, Vent (Flux > 75%) and VentAggressive (Flux > 50%), where the first mode only vents if it thinks it's safe-ish for the ship to vent, whereas the second one doesn't care much about the ships safety, similar to the current Vent-mode and in addition prevents the AI from backing off while venting). I could definitely see changing VentAggressive (Flux > 50%) to VentAggressive (Flux > 20%) though^^

Quote
4. Force Autofire should probably be joined with other modes, or set as a separate mode which could work with conjunction with others. Maybe same with Vent when flux>x%.
4. Yeah, also a good point. I should probably simply make it so that ship modes aren't mutually exclusive and you can enable as many as you want (with the exception of default). That would require reworking the whole logic how ship AIs work and how to select them (currently I simply use the same logic that I used for weapon modes/suffixes), but should be doable.

Quote
And what is mining fire mode? It would be great if it would explain it in the readme. And all non-obvious fire modes, such as Opportunist, might use a more detailed explanation.
Mining mode is a bit of a joke/easter egg. It shoots asteroids exclusively :P It does appear in the fire modes (https://github.com/DesperatePeter/starsector-advanced-weapon-control/blob/master/README.md#fire-modes) section of the readme, but I just realized that I didn't add a tooltip for it. Will do!

Quote
Lastly - thank you for your mod! It is great, and its even better to see that a version I downloaded like 2 weeks ago is totally obsolete already 8)

Glad you like it and thanks for the feedback/suggestions!

Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: qwerty4429 on May 31, 2021, 12:45:42 AM
I think there is a large potential in this mod, and I haven't seen anything like it before so I'll stick around to help you to the extent of my abilities  :D

Quote
Opportunist
I again emphasize that both kinetic and HE weapons didn't fire, so that probably a bug.

Quote
I actually started working on antiShield/avoidShield
Neat! I'm pretty sure best strategy is to make a proof of concept. Suggestion: mode which fires only before/after 85% flux on enemy. It is not ideal, not even true for shield/no shield separation as Mora or Onslaught which can literally chill with shields off in middle of field, but it is a testable feature, and I'm sure fellas from community will gladly help you with that.

Quote
I actually did split the venting mode into two separate modes
Cool! If you have access to weapon flux stats and shields, you may be able to create better logic for venting. As of now, I see ships sometimes vent on first shot of 2500+ range weapons, which is cool. I dont know if it is vanilla or mod, but something I definitely didnt see before. And it makes a kinda big deal in combat, giving my 2 siege paragons a headstart and sometimes even kills a frigate free-of-charge. So, potentially very cool stuff.

Also, check your Discord)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on June 04, 2021, 01:17:02 AM
Interesting, how to set ship to force flux? Stupid ship dies when its have alot of flux, when he refuses to flush when he can't escape. I found how with numpad change firemodes, but can't find at all how to open GUI. I press J but it only shows weapon groups with green text.

EDIT: I figured out how to open it, I miss what hitkey need to be pressed on campaign map, not in combat.

EDIT2: menu for some reason doesn't save ship modes, I configure PD groups as PD, and select vent flux after 75% then save and open menu again, ship mode switches to default, weapon groups remain as I selected as PD. I use 0.10.0 version from GitHub. I backed to 0.93 version, its remembers mode in GUI.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on June 04, 2021, 01:40:20 AM
Tried that mode in simulation, ship didn't flushed when he was surrounded and got over 50 flux, strange. Its was just stand eating all damage by enabling-disabling shield as by vanilla behavior. Also I tested more, its seems like ships completely ignore ship models in combat, when I selected disable shield after flux > 50% its doesn't drop shield.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on June 04, 2021, 04:58:29 AM
Tried that mode in simulation, ship didn't flushed when he was surrounded and got over 50 flux, strange. Its was just stand eating all damage by enabling-disabling shield as by vanilla behavior. Also I tested more, its seems like ships completely ignore ship models in combat, when I selected disable shield after flux > 50% its doesn't drop shield.

Hey!

First of all, thanks for the feedback!
Just to make sure: You were using an AI-controlled ship to test the ship AI modes, right? (As the name suggests, ship AI modes don't work for the player-controlled ship. They technically do work when you set the ship to autopilot, but you will have to manually load the new ship AI by pressing the "J"-Key, as I don't want the mod to have to check every frame if the player-controlled ship somehow got an AI.).

Interesting, how to set ship to force flux? Stupid ship dies when its have alot of flux, when he refuses to flush when he can't escape. I found how with numpad change firemodes, but can't find at all how to open GUI. I press J but it only shows weapon groups with green text.

EDIT: I figured out how to open it, I miss what hitkey need to be pressed on campaign map, not in combat.

EDIT2: menu for some reason doesn't save ship modes, I configure PD groups as PD, and select vent flux after 75% then save and open menu again, ship mode switches to default, weapon groups remain as I selected as PD. I use 0.10.0 version from GitHub. I backed to 0.93 version, its remembers mode in GUI.

Hmm, I was actually encountering issues with this during testing, but I was pretty sure that I fixed them before putting out the pre-release. I'll have another look and make sure everything works as intended!
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on June 06, 2021, 05:20:16 AM
Interesting, how progress of fixing that problem?
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on June 07, 2021, 10:34:01 AM
Interesting, how progress of fixing that problem?

Unfortunately, I've been kind of busy the last few days and didn't have much time.
Also, I was unable to reproduce the issues you described with the most recent in-dev build (currently unreleased). So either I coincidentally fixed the issues or they only appear under certain circumstances. Could you describe to me in detail how to reproduce these issues? Thanks!
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Phoenixheart on June 07, 2021, 10:58:53 AM
There does not seem to be a way to set gunnery AI on ships with modules (such as the Gown from Scalartech), are there any plans to address this?
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on June 07, 2021, 11:10:58 AM
Well, there not much too add, I simply tried to set ship mode in campaign and noticed that bug what it doesn't save ship modes, in 093 version it saves these models but they seems not working in combat.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on June 09, 2021, 09:28:04 AM
Well, there not much too add, I simply tried to set ship mode in campaign and noticed that bug what it doesn't save ship modes, in 093 version it saves these models but they seems not working in combat.

I just created a new pre-release, version 0.10.1. I hope it will fix the first issue (ship AI modes not being stored properly) for you. As that bug didn't occur for me, I'm unable to say if it actually will. Though some of the code for persistent mode storage was a bit messy and I refactored it a bit.

Has anyone else tried 0.10.x? If so, have you encountered these issues too?

Regarding the second issue (ship AI modes not working properly): I couldn't find any reason as to why that might happen. I asked this before, but since you didn't answer: You are saying that ship AI modes aren't working for AI-CONTROLLED ships, right? Because, for obvious reasons, ship AI modes won't work for the player controlled ship (as the player ship doesn't use a ship AI).

I now did like 3 hours of testing (specifically setting ship AI modes, double checking that they stay set and then testing that ships actually obey them in real and simulated combat) and never encountered the issues you described, so I hope it works now.

There does not seem to be a way to set gunnery AI on ships with modules (such as the Gown from Scalartech), are there any plans to address this?

Hmm, I never played with Scalartech before, so I wasn't even aware this was a thing xD
Sounds like a good idea =)  I assume you mean weapon modules such as on orbital stations, right? Though I'll have to look into how exactly that ship works before saying if it's possible. If the weapon modules use an autofire AI plugin, it should be possible to work with it. I'll get back to you once I figured out more.

Opportunist says it's mainly for limited ammo missiles. How well does it work with ammo weapons like Ion Pulser/Autopulse or burst beams like Phase/Tachyon Lances? How does it work on beams with High Scatter Amplifier?

The new pre-release includes target/avoid shield modes and a reworked Opportunist mode, so that should give you better options. Though I still don't think I'd recommend opportunist for beam weapons^^
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Ioulaum on June 10, 2021, 05:54:16 AM
keep seeing AI firing reaper towards fighters no matter what fire mode is....

But is a great mod nonetheless

Can PD mode use custom AI as well? So devastator can shoot both missile and fighters
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: BreenBB on June 10, 2021, 09:32:55 AM
I tested a bit, seems like now modes are working.

Also about firemodes, I think is good idea is enable autofire for missiles, I suppose force autofire option affects all weapons, this will be useful for mods like HullMod Specialization and other missile weapons which NPC's rarely use.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on June 13, 2021, 12:25:48 AM
keep seeing AI firing reaper towards fighters no matter what fire mode is....

Hmm, that doesn't sound right...
Did you turn on force-autofire? If so, Opportunist mode is probably what you want for reapers, as most other modes don't really care about conserving ammo. IgnoreFighters mode shouldn't fire them at fighters, but will probably still waste most of the shots against frigates that can easily dodge them etc.^^

If you don't turn on force-autofire, the base ship AI usually decides to control reapers manually. But even the base ship AI shouldn't really fire them at fighters, I think...
Can you give me some more details about the exact mode(s) you tried? This sounds like something that shouldn't happen. I assume the weapon group with the reapers didn't contain any other types of weapons?

Quote
But is a great mod nonetheless

Can PD mode use custom AI as well? So devastator can shoot both missile and fighters

Thanks =)
Weird, devastator cannons should work with PD-mode and should still prioritize fighters over missiles but also target missiles. Making PD-mode be able to use custom AI would be easy enough, but I kind of didn't want this mod to turn non-PD weapons into PD-weapons. That being said, the devastator cannon has the PD tag and can target missiles, so it should work as is.

Can you let me know if this clarification already helps? If it doesn't, I'll have to test it again and see if there's maybe some bug that makes things not work as intended.

I tested a bit, seems like now modes are working.

Awesome =)

Quote
Also about firemodes, I think is good idea is enable autofire for missiles, I suppose force autofire option affects all weapons, this will be useful for mods like HullMod Specialization and other missile weapons which NPC's rarely use.
I'm not 100% sure I understand what you're trying to say, but yes, force autofire will also put all missile weapons on autofire. If you leave them on default mode, that means they will pretty much just fire them at any target. You can use Opportunist mode to make them fire WAY more conservatively. Or you can use target shields/avoid shields modes to at least prevent firing harpoons against 0% flux enemies etc.

If you mean that it would be nice to be able to only activate force-autofire for some weapon groups but not for others: I think that would be...difficult. That mode essentially sets all modes to autofire, selects an empty weapon group and prevents the AI from selecting a different weapon group. That logic wouldn't work if only some modes are on force-autofire.


Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Ioulaum on June 13, 2021, 06:22:45 AM
keep seeing AI firing reaper towards fighters no matter what fire mode is....

Hmm, that doesn't sound right...
Did you turn on force-autofire? If so, Opportunist mode is probably what you want for reapers, as most other modes don't really care about conserving ammo. IgnoreFighters mode shouldn't fire them at fighters, but will probably still waste most of the shots against frigates that can easily dodge them etc.^^

If you don't turn on force-autofire, the base ship AI usually decides to control reapers manually. But even the base ship AI shouldn't really fire them at fighters, I think...
Can you give me some more details about the exact mode(s) you tried? This sounds like something that shouldn't happen. I assume the weapon group with the reapers didn't contain any other types of weapons?

Quote
But is a great mod nonetheless

Can PD mode use custom AI as well? So devastator can shoot both missile and fighters

Thanks =)
Weird, devastator cannons should work with PD-mode and should still prioritize fighters over missiles but also target missiles. Making PD-mode be able to use custom AI would be easy enough, but I kind of didn't want this mod to turn non-PD weapons into PD-weapons. That being said, the devastator cannon has the PD tag and can target missiles, so it should work as is.

Can you let me know if this clarification already helps? If it doesn't, I'll have to test it again and see if there's maybe some bug that makes things not work as intended.

Correction, tested without mods and AI still fire reapers at fighters, bug reported at https://fractalsoftworks.com/forum/index.php?topic=22013.0

This bug is strange and annoying, don't think I saw it in 0.91 before...

BTW, the notification on discord saying there's a release of 0.10.2 but I haven't been able to locate it XD
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on June 14, 2021, 11:47:44 PM

Correction, tested without mods and AI still fire reapers at fighters, bug reported at https://fractalsoftworks.com/forum/index.php?topic=22013.0

This bug is strange and annoying, don't think I saw it in 0.91 before...

BTW, the notification on discord saying there's a release of 0.10.2 but I haven't been able to locate it XD

That's kind of what I expected^^ Good to know, thanks for confirming =)
About the 0.10.2: Ooops, I just mistyped. That was supposed to be 0.10.1
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Topkack on July 08, 2021, 03:17:30 AM
could you make a "lock weapons until % of phase cloak cooldown" so my afflictors stop blowing themselves up with antimatter blasters? lol
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Klokinator on July 10, 2021, 12:15:31 PM
I'd like to see the settings for this mod change a bit, so that instead of the current system, you can change weapons to shoot or not-shoot at specific things.

For example, I love the Heavy Arc Emitter. It shreds anything in PD range, and tears through ships with downed shields.

But... there is no setting for "PD and if enemy has downed shields"

So, how about a system where, for each weapon, you can click boxes twice, once to highlight them green, once for red, or set them to off as in 'it doesn't matter'.

Prefixes:
Fighter
Missile
Shields
Armor
Hull

Suffixes:
Holdfire 90%
Holdfire 75%
Holdfire 50%
Conserve Ammo
PanicFire
PD Flux > 50%
PD Ammo < 90%

...

So, in the case of my Heavy Arc Emitter, I'd do the following:

Prefixes:
Fighter
Missile
Shields
Armor
Hull

I highlight the bolded options in green, and cross out shields, meaning this weapons acts as PD, but can also target unshielded enemies too. As for the options below, the ability to set them as positive or negative, for the inverse, would be cool.

Maybe I want a PD weapon that only fires if flux is above or below a certain level.
Maybe I want it to never conserve ammo, or to always conserve ammo.
Etc

By switching to a Yes/Whatever/No system, you'll add a lot more versatility to what I consider a mandatory mod. Thanks for listening to my TED talk.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Farlarzia on July 10, 2021, 12:58:41 PM
Hello again!

I've really been enjoying a lot of the new options you've been adding, but I've found the <90% ammo one sometimes a bit frustrating - for weapons that reload an individual shot at a time this works well, but for weapons that have large magazines, where a reload can be half the total capacity, it really doesn't work so well.

For example, the Victorys has a pair of built in guns (https://i.imgur.com/PG3QQA8.png). 90% ammo pool on this means it'll only fire 3 shots out of the 15 given per reload, until the opporuntist AI kicks in and it fires everything.
So for weapons like this, having another weapon AI option that can read a weapons reload size, and fire an entire reloads worth of ammunition before conserving would be ideal.

Expanding on the opportunist AI - I think the additional constraints for when the AI decides to fire (enemy movement speed compared to projectile speed, likely to be in range after travelling etc), can make the AI too hesitant to fire.
Projectile weapons already have a fadeout distance past max range, which means even if the enemy moves out of range, the projectile still has a grace period where it will connect for reduced damage.
I'd often just want the weapon to fire at the target, at the off chance it'll connect and deal a chunk of damage, than not firing at all because it thinks its not likely enough, and dealing no damage at all - especially considering the limitations the opportunist mode already places upon when it will fire (high flux etc), means the windows for when the weapons will consider firing at all are already small.

Ideally I'd like there to be two seperate conserve AI types.
The first being the current, overly cautious opporunist AI kicks in past the ammo threshold
And a second, where the opportunist AI only checks the ships flux level, without the other firing constrictions past the ammo threshold.

Edit: Another suggestion would be an option to  force AI ships to select an empty weapon group, if possible - this is a niche scenario, but a scenario I have come across nonetheless, where if a ship has only PD weaponry, the AI by default is assigned to group 1, which in this case would always be a PD group - however AI in manual control of a PD weapon group, cannot actually use it as PD!
However, selecting an empty weapon group for that ship instead, allows all the groups to function as intended.
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on July 11, 2021, 01:32:29 AM
First of all, sorry that updates have been very slow lately, I didn't really have much time to work on the mod recently. I hope that I'll have more time in the future, but probably the next update will still take a couple weeks.

could you make a "lock weapons until % of phase cloak cooldown" so my afflictors stop blowing themselves up with antimatter blasters? lol

Thanks for the suggestion, that's a funny little idea. That should be easy enough to implement, but I'm afraid it would be very difficult to implement well. I could implement it as a ship mode, but then it won't affect weapons on auto-fire. I could implement it as a weapon mode, but then it would only work (reliably) if you set the ship AI to force-autofire. And then there will be situations, where you would really much prefer for your afflictor to come out of phase and immediately fire and kill e.g. smaller ships rather than unphasing and then eating fire for 3 seconds before firing^^
Also, I'm trying to not include too too many "confusing" modes, where the name doesn't immediately tell the user what the mode does. E.g. Opportunist mode seems to be fairly confusing to people at times.
So unless you can think of a good/clean/universal solution for this, I think I'll have to say no, unfortunately.

I'd like to see the settings for this mod change a bit, so that instead of the current system, you can change weapons to shoot or not-shoot at specific things.

For example, I love the Heavy Arc Emitter. It shreds anything in PD range, and tears through ships with downed shields.

But... there is no setting for "PD and if enemy has downed shields"

So, how about a system where, for each weapon, you can click boxes twice, once to highlight them green, once for red, or set them to off as in 'it doesn't matter'.

Prefixes:
Fighter
Missile
Shields
Armor
Hull

Suffixes:
Holdfire 90%
Holdfire 75%
Holdfire 50%
Conserve Ammo
PanicFire
PD Flux > 50%
PD Ammo < 90%

...

So, in the case of my Heavy Arc Emitter, I'd do the following:

Prefixes:
Fighter
Missile
Shields
Armor
Hull

I highlight the bolded options in green, and cross out shields, meaning this weapons acts as PD, but can also target unshielded enemies too. As for the options below, the ability to set them as positive or negative, for the inverse, would be cool.

Maybe I want a PD weapon that only fires if flux is above or below a certain level.
Maybe I want it to never conserve ammo, or to always conserve ammo.
Etc

By switching to a Yes/Whatever/No system, you'll add a lot more versatility to what I consider a mandatory mod. Thanks for listening to my TED talk.

Hmm, I like that idea, thanks for the suggestion. I think that might be an effective way of keeping "mode inflation" in check (which has become a bit of a problem, as more and more people request somewhat specific modes xD). However, it would make it harder to adjust weapon modes during combat. Also, this would require some major reworking of how modes work. I already explored a similar concept for ship modes, so I know how one could do this. I'll keep the idea in mind and if I find the time to do a big rework of the mod, I'll definitely consider this option.

Hello again!

I've really been enjoying a lot of the new options you've been adding, but I've found the <90% ammo one sometimes a bit frustrating - for weapons that reload an individual shot at a time this works well, but for weapons that have large magazines, where a reload can be half the total capacity, it really doesn't work so well.

For example, the Victorys has a pair of built in guns (https://i.imgur.com/PG3QQA8.png). 90% ammo pool on this means it'll only fire 3 shots out of the 15 given per reload, until the opporuntist AI kicks in and it fires everything.
So for weapons like this, having another weapon AI option that can read a weapons reload size, and fire an entire reloads worth of ammunition before conserving would be ideal.

Hi there and thanks for the suggestions =)
Yeah, I can see changing the "PD/ConseverAmmo (ammo <90%)" modes to "PD/ConseverAmmo (first magazine empty)". Probably that still won't be perfect for every weapon in existence (as some weapons do a full reload), but might be better than 90%.

Quote
Expanding on the opportunist AI - I think the additional constraints for when the AI decides to fire (enemy movement speed compared to projectile speed, likely to be in range after travelling etc), can make the AI too hesitant to fire.
Projectile weapons already have a fadeout distance past max range, which means even if the enemy moves out of range, the projectile still has a grace period where it will connect for reduced damage.
I'd often just want the weapon to fire at the target, at the off chance it'll connect and deal a chunk of damage, than not firing at all because it thinks its not likely enough, and dealing no damage at all - especially considering the limitations the opportunist mode already places upon when it will fire (high flux etc), means the windows for when the weapons will consider firing at all are already small.

Ideally I'd like there to be two seperate conserve AI types.
The first being the current, overly cautious opporunist AI kicks in past the ammo threshold
And a second, where the opportunist AI only checks the ships flux level, without the other firing constrictions past the ammo threshold.

Haha, yeah, the opportunist mode has been a pretty big headache for me so far xD
I originally intended it mainly for limited ammo big boom missiles (reapers etc.), where you really want to make sure that shots have a good chance of hitting.
From my perspective, opportunist is pretty much working as intended (i.e. pretty conservative). But I also see, that a lot of people want to use opportunist for other types of weapons and it's not great for projectile weapons...
So, in the end, I kind of think that I might to have to add a check if the weapon that's using this mode is a limited ammo missile weapon or something else. Then I could make the mode less conservative for weapons that don't have limited ammo (or reload their ammo automatically).

Quote
Edit: Another suggestion would be an option to  force AI ships to select an empty weapon group, if possible - this is a niche scenario, but a scenario I have come across nonetheless, where if a ship has only PD weaponry, the AI by default is assigned to group 1, which in this case would always be a PD group - however AI in manual control of a PD weapon group, cannot actually use it as PD!
However, selecting an empty weapon group for that ship instead, allows all the groups to function as intended.

The force-autofire ship mode actually does exactly this. In addition, it sets all weapon groups to auto-fire (i.e. they are forced to obey the fire mode).
I think that might already be a good solution for this problem?


So, thanks for all the feedback guys, I'll try to work on these suggestions sometime in the near-ish future =)
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Farlarzia on July 11, 2021, 01:37:10 PM
Quote
Edit: Another suggestion would be an option to  force AI ships to select an empty weapon group, if possible - this is a niche scenario, but a scenario I have come across nonetheless, where if a ship has only PD weaponry, the AI by default is assigned to group 1, which in this case would always be a PD group - however AI in manual control of a PD weapon group, cannot actually use it as PD!
However, selecting an empty weapon group for that ship instead, allows all the groups to function as intended.

The force-autofire ship mode actually does exactly this. In addition, it sets all weapon groups to auto-fire (i.e. they are forced to obey the fire mode).
I think that might already be a good solution for this problem?

Hmm - I was doing some more testing last night regarding this, and it looks like its just a quirk of player piloted ships being on autopilot for those niche situations, and regular AI controlled ships don't suffer from the "can't use selected group as PD option", even in vanilla. So while this could potentially still be an extremely niche problem that occurs, practically it should never matter
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: Helldiver on July 14, 2021, 07:30:08 AM
This mod is a godsend for essential things like setting target priorities or making ships actually use certain weapons in all situations. It's one of these mods where there's no excuse that its functions aren't in the base game and it alleviates massive sources of frustration.
Huge thanks for making and sharing it :D
Title: Re: [0.95a] AdvancedGunneryControl 0.9.3
Post by: DesperatePeter on July 25, 2021, 05:48:25 AM
So, this weekend I finally had some time to work on the mod =)

I just released a new version, 0.10.2. It mainly addresses issues with the opportunist mode.
Opportunist mode will now behave less conservatively when the weapon doesn't use ammo and there is a new setting which you can use to make it less/more conservative (opportunist_triggerHappinessModifier).

Spoiler
  • For weapons that don't use ammo, the closest point (rather than the center) of the target will be used for range calculations and the mode won't assume that the enemy will try to move out of range
  • For limited ammo weapons that don't reload, the behavior is the same as before
  • For limited ammo weapons that can reload ammo, a mix of the aforementioned behaviors is used
[close]

This mod is a godsend for essential things like setting target priorities or making ships actually use certain weapons in all situations. It's one of these mods where there's no excuse that its functions aren't in the base game and it alleviates massive sources of frustration.
Huge thanks for making and sharing it :D
Thanks man, I'm really glad you like it!

I've really been enjoying a lot of the new options you've been adding, but I've found the <90% ammo one sometimes a bit frustrating - for weapons that reload an individual shot at a time this works well, but for weapons that have large magazines, where a reload can be half the total capacity, it really doesn't work so well.

For example, the Victorys has a pair of built in guns (https://i.imgur.com/PG3QQA8.png). 90% ammo pool on this means it'll only fire 3 shots out of the 15 given per reload, until the opporuntist AI kicks in and it fires everything.
So for weapons like this, having another weapon AI option that can read a weapons reload size, and fire an entire reloads worth of ammunition before conserving would be ideal.
I implemented a prototypical version of this idea and did some testing and...I hated it xD
The idea sounded really cool and I though it would solve many problems, but I found that in reality it didn't really work all that well, especially for weapons with large reload sizes...
But, on the bright side, I found that simply tweaking the settings pd90_ammo and conserveAmmo_ammo works pretty well to address the issues you mentioned.
So, if you don't mind, please try setting them to e.g. 0.5 or 0.75 and see how it goes. I could also see setting them to e.g 0.75 by default.
Additionally, the new opportunist rework (which also affects the ConserveAmmo suffix) should also help alleviate the problem with the built-in hephaestus guns of the victory class, as opportunist will be slightly less conservative for weapons that can reload ammo.

Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: 2467861266 on July 29, 2021, 09:25:11 AM
This mod is amazing. But I think it is better to set fire mode for each weapon so no need to set each ship specifically anymore. Most of the time we just need to specify each weapon's behavior instead of a weapon group. for example, I just don't want tri-tachyon lance to fire at fighters but I don't wanna set every ship that equips tri-tachyon lance.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: CrashToDesktop on July 30, 2021, 10:45:30 PM
After playing around with the mod, I've noticed there's a couple issues. PD_ALSO weapons don't function correctly using the PD (Flux>50%) suffix - they work fine until reaching 50% flux, but they don't target anything once you go over 50% flux - neither ships nor missiles.

Also, weapons set to Opportunist (and by extension Conserve Ammo) seem to ignore both the ship's set Target as well as line of sight to whatever other target they have in mind - I've seen very often seen weapon groups set to this fire directly into destroyed ships trying to get at another ship, or more specifically the Vast Bulk central area of a station in attempts to hit another module, while weapon groups set to normal don't fire until they do have LoS. Most obvious with missiles.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: DesperatePeter on July 31, 2021, 02:15:15 PM
This mod is amazing. But I think it is better to set fire mode for each weapon so no need to set each ship specifically anymore. Most of the time we just need to specify each weapon's behavior instead of a weapon group. for example, I just don't want tri-tachyon lance to fire at fighters but I don't wanna set every ship that equips tri-tachyon lance.

Thanks for the feedback! =)
This is a cool idea. However, I'm kind of unsure how I could implement this in a way that's user-friendly. Creating a usable GUI that includes all available weapons, especially when using multiple faction/content extension mods, would be nigh-impossible given how GUIs in the game work, I think...
Also, I wouldn't want to replace the ability to manually set/change firing modes per weapon group, as this mod is all about customization. And I can definitely envision cases, where you want the same weapon to behave differently on different ships (e.g. on a Scatter Amplified Sunder I might want phase lances to fire at everything, while on big ships I like using them as an anti-fighter weapon).
So I think this would have to work as an override for the default mode or something like that.
Off the top of my head, I could think of two possible ways of doing this: Adding an additional settings file where you can map weapon ids to default modes/suffixes or implementing a Web GUI that you would have to access via web browser. Both solutions don't really seem ideal (and a lot of work) and probably very few people would actually use them.
Let me know if you have a better idea.

After playing around with the mod, I've noticed there's a couple issues. PD_ALSO weapons don't function correctly using the PD (Flux>50%) suffix - they work fine until reaching 50% flux, but they don't target anything once you go over 50% flux - neither ships nor missiles.

Also, weapons set to Opportunist (and by extension Conserve Ammo) seem to ignore both the ship's set Target line of sight to whatever other target they have in mind - I've seen very often seen weapon groups set to this fire directly into destroyed ships trying to get at another ship, or more specifically the Vast Bulk central area of a station in attempts to hit another module, while weapon groups set to normal don't fire until they do have LoS. Most obvious with missiles.

Thanks for letting me know about these issue, I will look into fixing them! I'll keep you updated.

Update: I just did some testing regarding the first issue (PD_ALSO) and unfortunately I can't reproduce the issue described by you. As far as I'm aware, the only PD_ALSO weapon in vanilla is the devastator cannon, so I used that one for testing. I put two of them onto an Onslaught, gave them the DEFAULT weapon mode with the PD (Flux > 50%) suffix. They targeted anything when flux < 50% and started to only target fighters/missiles at flux > 50%.

I have two possible explanations as to why it didn't work for you:
1. You were using a weapon from a mod that behaves in a way (different from the devastator cannon) I didn't anticipate when writing the mod.
2. You were using a weapon mode that prevents targeting fighters/missiles (such as e.g. Opportunist).

If it's the second case: Unfortunately, that's just how suffixes work =/ They don't override the way the weapon mode works, they only modify it. So they are unable to change what the weapon mode considers valid targets. (It would, in theory, be possible to change how suffixes work for them to be able to do that. But that would mean doing most of the calculations twice, which would have a really bad effect on performance.)  The tooltip does state "only use with [...] modes that can target missiles/fighters!", but maybe I should consider adding an additional safeguard (such as greying out the suffix button) to prevent this.

If it's the first case: Which weapon from which mod were you using? Does that weapon AI do anything special?

If it's neither: I'd be grateful for any additional info you might be able to provide to shed light onto this behaviour.

Update 2:

I believe I fixed the issues regarding weapons firing into ships that are blocked by husks/debris. As this is kind of hard to test, I'm not 100% sure if this fix works perfectly, but from my limited testing it seems to be working. Now, weapons that are set to opportunist and weapons that use ammo should be much more hesitant to fire if the path is blocked. Due to insufficient testing, I marked this as a pre-release (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.10.3).

 I also identified what causes weapons on Opportunist to ignore the ship's target: Internally, I use target priorities to decide which target to shoot at (low number == high priority). Marking an enemy as the target will significantly (factor 100) lower the priority number (i.e. make it a much more likely target). However, if opportunist would refuse to fire at an enemy, it sets that target's priority to infinity. I.e. if the marked ship target is not opportune, but there is an opportune target nearby, opportunist will fire at that other target instead. I could change that behaviour, but I'm afraid that would just cause other issues.

But overall I have to admit that, despite having reworked it multiple times already, Opportunist still doesn't always do the thing that feels right. Opportunist isn't really intended as a "catch-all" mode. It's intended for weapons where you'd prefer not shooting if it's uncertain if the shot will be impactful. I think in order for opportunist to always do what the player wants, I'd essentially have to implement a full weapon AI that's significantly better than the built-in starsector AI and that's probably not that realistic. So, while I will ofc keep trying to improve Opportunist (and other weapon modes), don't expect it to always do the most sensible thing  ;D Please don't take this the wrong way, I am grateful for any feedback and will try to fix issues that are brought to my intention! Especially the issue with Opportunist firing into husks is, imho, very valid and needed to be fixed.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Raitaki on August 25, 2021, 01:59:48 PM
I recently updated my mods en masse, and ever since I've been seeing some instances of ships in my fleet making ruthless friendly-fire barrages--I'm talking about "relentlessly unload into friendly destroyer/cruiser-sized ships at point-blank without trying to maneuver out from behind them". Since I updated quite a few mods at once, I can't say for sure that this mod was the culprit, but none of the other mods are supposed to alter combat AI. I also haven't messed with this mod's settings either. Has this happened to anyone else using this mod?
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Helldiver on August 25, 2021, 02:18:00 PM
I recently updated my mods en masse, and ever since I've been seeing some instances of ships in my fleet making ruthless friendly-fire barrages--I'm talking about "relentlessly unload into friendly destroyer/cruiser-sized ships at point-blank without trying to maneuver out from behind them". Since I updated quite a few mods at once, I can't say for sure that this mod was the culprit, but none of the other mods are supposed to alter combat AI. I also haven't messed with this mod's settings either. Has this happened to anyone else using this mod?

I'm not seeing this issue but am on v0.10.1. Are you on v0.10.2/0.10.3?
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Raitaki on August 25, 2021, 05:10:16 PM
I recently updated my mods en masse, and ever since I've been seeing some instances of ships in my fleet making ruthless friendly-fire barrages--I'm talking about "relentlessly unload into friendly destroyer/cruiser-sized ships at point-blank without trying to maneuver out from behind them". Since I updated quite a few mods at once, I can't say for sure that this mod was the culprit, but none of the other mods are supposed to alter combat AI. I also haven't messed with this mod's settings either. Has this happened to anyone else using this mod?

I'm not seeing this issue but am on v0.10.1. Are you on v0.10.2/0.10.3?
0.10.3, yes. Before mass-updating my mods I was on 0.10.2 and didn't spot AI ever doing that back then.

Edit: Also some of my two cents now that I've used this mod for a while in the lategame:
- Would it be possible to make "TargetShields/AvoidShields" behave more closely than their name suggests? With the default Settings.editme values, they do behave as labeled if you took two weapon groups of the same weapon and set one to TargetShields and the other to AvoidShields (which, of course, is kind of pointless in practice). Meanwhile, with one kinetic weapon and one HE, they largely ignore these 2 modes and instead simply pursue damage efficiency, which IS still fine, but...kinetic + energy weapon combos result in a loadout that overwhelmingly prefers the kinetic weapons while its usage of the energy weapon can be described at best as "whenever it feels like it", regardless of which EITHER is set to or the flux level (or overload status!) of the enemy ship. Big problem for hybrid ships, since unless you got yourself a decent energy weapon that does kinetic/HE damage (probably modded...), whichever fares worse against shields will probably be ignored by the AI most of the time.
- This mod seems to override the vanilla AI behaviour of automatically turning turrets forward (or at least in SOME intentional direction) when not in the middle of the firefight; add the fact it apparently doesn't check the turret's current facing before firing, and we get an AI that makes a habit of completely whiffing the first few shots on any low-turn-rate weapons it doesn't manually aim that face the sides by default (e.g. Legion, Dominator class). Especially on missile ships, well, AI loves aiming missiles for whatever reason, so those two examples given are very frequent victims to this little flaw.
- Speaking of missiles, this is probably my biggest sore point regarding odd AI behaviours, both with and without this mod. Both AI versions love manually aim missile weapon groups, even missiles with great tracking and DO_NOT_AIM tags and does this at basically every opportunity, usually with a dps loss for every other weapon group whenever it launches missiles since apparently they also make it forget that autofiring exists. This is vanilla behaviour, so I know the mod can't be blamed for this, but it would be wonderful if you could find a way to fix it somehow.
- On top of that missiles also completely ignore every AI mode from this mod that tells it not to do something--which is to say, Fighters, NoFighters, AvoidShields, so on. Swarmer launchers don't care that they're anti-smallcraft, AvoidShields missiles of any type get happily launched as soon as refire delay ends even on 0-flux targets, etc. Pretty big bummer for low-tech lovers like me, this basically made me give up on the idea of autofiring most missiles on my flagships and only equip ok-to-spam missiles like sabots and salamanders on most my ships, or even leaving slots empty. Definitely an issue I'd be delighted to see a fix for.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: JamesBai03 on August 26, 2021, 09:00:06 AM
amazing mod, one problem I have is that when I do missions, i dont have access to the campaign map. Incidentally, my keyboard doesnt have numpad either so I cant access the GUI either way.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Raitaki on August 27, 2021, 04:54:52 PM
Update on the friendly fire problem: After some more playtime, I'm starting to think only the player-controlled ship is being "unseen" to AI ships. And before anyone asks: no, I'm not talking about me simply wandering into friendly AI's projectiles. I mean I'm flying in a forward straight line, AI comes up directly behind me also in a forward straight line, then proceeds to fire non-shop directly into my engines until I give it an order to btfo and go elsewhere entirely.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: JamesBai03 on August 28, 2021, 10:08:45 PM
Another problem, while using the dominator class and mounting two high explosive weapon in the large frontal slots, the opportunist auto firing mod does not work most of the time, prob because the hitscan setting prevents it from ascertaining a hit (since the weapon arcs are narrow for the 2 slots). Mostly its only 1 of  the 2 weapons firing, although both could land shots.

ps: after some hours of testing, it appears that the hitbox scan is off. This becomes especially problematic when the weapon slot arcs narrow. Vanilla AI seems to be working fine tho.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: DesperatePeter on August 29, 2021, 02:56:35 AM
I recently updated my mods en masse, and ever since I've been seeing some instances of ships in my fleet making ruthless friendly-fire barrages--I'm talking about "relentlessly unload into friendly destroyer/cruiser-sized ships at point-blank without trying to maneuver out from behind them". Since I updated quite a few mods at once, I can't say for sure that this mod was the culprit, but none of the other mods are supposed to alter combat AI. I also haven't messed with this mod's settings either. Has this happened to anyone else using this mod?

I'm not seeing this issue but am on v0.10.1. Are you on v0.10.2/0.10.3?
0.10.3, yes. Before mass-updating my mods I was on 0.10.2 and didn't spot AI ever doing that back then.

Edit: Also some of my two cents now that I've used this mod for a while in the lategame:
- Would it be possible to make "TargetShields/AvoidShields" behave more closely than their name suggests? With the default Settings.editme values, they do behave as labeled if you took two weapon groups of the same weapon and set one to TargetShields and the other to AvoidShields (which, of course, is kind of pointless in practice). Meanwhile, with one kinetic weapon and one HE, they largely ignore these 2 modes and instead simply pursue damage efficiency, which IS still fine, but...kinetic + energy weapon combos result in a loadout that overwhelmingly prefers the kinetic weapons while its usage of the energy weapon can be described at best as "whenever it feels like it", regardless of which EITHER is set to or the flux level (or overload status!) of the enemy ship. Big problem for hybrid ships, since unless you got yourself a decent energy weapon that does kinetic/HE damage (probably modded...), whichever fares worse against shields will probably be ignored by the AI most of the time.
- This mod seems to override the vanilla AI behaviour of automatically turning turrets forward (or at least in SOME intentional direction) when not in the middle of the firefight; add the fact it apparently doesn't check the turret's current facing before firing, and we get an AI that makes a habit of completely whiffing the first few shots on any low-turn-rate weapons it doesn't manually aim that face the sides by default (e.g. Legion, Dominator class). Especially on missile ships, well, AI loves aiming missiles for whatever reason, so those two examples given are very frequent victims to this little flaw.
- Speaking of missiles, this is probably my biggest sore point regarding odd AI behaviours, both with and without this mod. Both AI versions love manually aim missile weapon groups, even missiles with great tracking and DO_NOT_AIM tags and does this at basically every opportunity, usually with a dps loss for every other weapon group whenever it launches missiles since apparently they also make it forget that autofiring exists. This is vanilla behaviour, so I know the mod can't be blamed for this, but it would be wonderful if you could find a way to fix it somehow.
- On top of that missiles also completely ignore every AI mode from this mod that tells it not to do something--which is to say, Fighters, NoFighters, AvoidShields, so on. Swarmer launchers don't care that they're anti-smallcraft, AvoidShields missiles of any type get happily launched as soon as refire delay ends even on 0-flux targets, etc. Pretty big bummer for low-tech lovers like me, this basically made me give up on the idea of autofiring most missiles on my flagships and only equip ok-to-spam missiles like sabots and salamanders on most my ships, or even leaving slots empty. Definitely an issue I'd be delighted to see a fix for.

Thanks for the detailed feedback!

On the "friendly fire" issue:
I'm kinda assuming that I messed up the fix (0.10.3 pre-release) that was supposed to stop firing weapons into husks/debris. I did this by modifying the "avoid friendly fire"-logic, so it's definitely plausible that those modifications introduced new problems, as they tend to do =/ During my testing I never encountered that issue, but then again, I didn't do a ton of testing... As this sounds like a pretty serious issue I will definitely look into fixing this!

Update on the friendly fire problem: After some more playtime, I'm starting to think only the player-controlled ship is being "unseen" to AI ships. And before anyone asks: no, I'm not talking about me simply wandering into friendly AI's projectiles. I mean I'm flying in a forward straight line, AI comes up directly behind me also in a forward straight line, then proceeds to fire non-shop directly into my engines until I give it an order to btfo and go elsewhere entirely.

That's super strange... In the code, ships have an "owner" flag which identifies whether the ship belongs to the player side, is allied, an enemy, or neutral (husks). Maybe, for some reason, your player controlled ship isn't properly flagged for some reason?

Were you in between your allied ship and an enemy? (In that case, it's probably an issue with the "do not fire at friendlies"-logic)
Or did the ship simply fire at your ship? (In that case, it's probably an issue with your ship being identified as a hostile for some weird reason)

Edit: After doing a little bit more testing, I can't reproduce the issue. Also, I double-checked all the changes to the code and I can't seem to find a change that could realistically be responsible for this. In essence, the change I did, boils down to this (+ means line added, - means line removed. 0 means player faction, 1 means enemy faction and 100 means neutral):

Quote
protected fun getFriendlies(): List<Pair<CombatEntityAPI, Vector2f>> {
         return addPredictedLocationToTargets(
             CombatUtils.getShipsWithinRange(weapon.location, weapon.range).filter {
-                (it.isAlly || (it.owner == 0)) && isWithinArc(it) && !it.isFighter
+                (it.isAlly || (it.owner == 0) || (it.owner == 100 && shouldConsiderNeutralsAsFriendlies())) &&
+                        isWithinArc(it) && !it.isFighter
             }).filter { isInRange(it.second) }
     }


So I don't really know how that could cause friendly fire to happen.
If you have any ideas/additional info (weapon types/modes etc.), or if someone else can reproduce the issue, please let me know!
This sounds like a very serious issue, but I have no idea how to reproduce or fix it =(

On the TargetShields/AvoidShields issue:
To be perfectly honest, I'm not really sure if I understand what the issue is. Weapons set to AvoidShields should only fire at targets that have a) high flux, b) high-ish flux and shields turned off or c) no shields. TargetShields does the inverse. If you have a kinetic weapon set to TargetShields and a non-beam Energy weapon, wouldn't it make more sense to simply set the Energy weapon to default mode? Other weapon groups set to Target/Avoid shields shouldn't really have any impact on how the weapon group in question behaves. If you could rephrase this issue that would be much appreciated!

On the turning turrets issue:
That's a good point, I never really considered this. I think i simply give no turning directions at all if there are no (valid) targets nearby. Probably it would make the most sense to make turrets return to the center of their cone if there are no targets nearby?

Edit: This was easy enough to implement. When there are no (valid) targets available, weapons will now try to face in the same direction as the ship.

On the DO_NOT_AIM-issue:
That's odd, I thought my targeting logic looked for that flag and didn't do any targeting if that flag is set. But tbh I never payed much attention to that detail during testing, so I will have another look!

Edit: Ok, so I actually did have logic for this, it just turned out that the logic wasn't very sound xD
In the current version, the logic goes like this: "If a weapon is not aimable, simply aim it at the current position of the enemy (rather than the predicted position) and don't consider the current weapon angle when deciding whether to fire or not".
In the new version, it will be like this: "If a weapon is not aimable, simply always leave it in default position and don't consider its angle when deciding whether to fire or not".

On the missiles ignoring targeting restrictions:
That's super weird, I don't think I ever encountered that issue. I'll try to look into it!

amazing mod, one problem I have is that when I do missions, i dont have access to the campaign map. Incidentally, my keyboard doesnt have numpad either so I cant access the GUI either way.
Yeah, unfortunately there is no way for me to open a GUI in the middle of combat (the game doesn't allow that), so unfortunately the GUI won't be available for missions...
Wow, I didn't know there were keyboards without a numpad, today I learned... xD
My mod doesn't actually specifically require you to use the numpad, it requires you to use number keys that aren't used by the base game.
So, in theory, you could rebind your weapon groups to e.g. F1..F6 and then use the normal number keys to cycle weapon modes...
But that, obviously, isn't a very good solution =/
I could, in theory, make the number keys rebindable, but to be perfectly honest, I don't really want to, as that would be a lot of work and include lots of ugly code xD
So, unfortunately, I'm afraid there isn't much that I can reasonably do for you here-

Another problem, while using the dominator class and mounting two high explosive weapon in the large frontal slots, the opportunist auto firing mod does not work most of the time, prob because the hitscan setting prevents it from ascertaining a hit (since the weapon arcs are narrow for the 2 slots). Mostly its only 1 of  the 2 weapons firing, although both could land shots.

ps: after some hours of testing, it appears that the hitbox scan is off. This becomes especially problematic when the weapon slot arcs narrow. Vanilla AI seems to be working fine tho.
Hmm, the easy solution for this would be to simply not use opportunist mode for this kind of weapon xD Opportunist mode is intended for weapons with (very) limited ammo, where you prefer the weapon not to fire, if in doubt. Putting your "main guns" to Opportunist is probably not a great idea. Opportunist essentially walks through a list of questions and only if the answer to all of them is Yes, it will fire.

These questions are, in no particular order:
Is the damage type of the weapon effective against the target?
Is the target slow/close enough that it can't simply fly out of range while the projectile is traveling?
Is the target slow enough and/or the weapon tracking good enough that it can't easily dodge the shot laterally?
Can the weapon actually aim at the center of the enemy, rather than just any point within the hitbox?

You can make the Opportunist mode more "liberal" by adjusting the value of opportunist_triggerHappinessModifier in settings.editme. If you set this to e.g. 1.5, there will be a much greater chance that the answers to these questions will be yes, but I still wouldn't really recommend Opportunist for your main guns.

On the "weapons don't wait for the turret to turn properly before firing" issue (I can't find the post that mentioned this, but I'm pretty sure I read this somewhere):
That's a good point, I'm afraid I never really considered this. I actually noticed during testing that weapons very occasionally fire "into the void", but I always assumed that that was caused by the enemy abruptly changing its course (and therefore producing a mismatch between the predicted position and the actual position). But now I'm starting to think that this was the issue.
I'll look into it!
Edit: Ooops, nevermind. I think this issues wasn't brought up and when checking my code base I realized that, when deciding whether to fire or not, I am already using the current weapon angle rather than the target point. So yeah, don't know what kind of tricks my brain was playing on me here...



Thanks for bringing all these issues to my attention, I will do my best to try and fix them in the near-ish future. I have a little bit of time today, but given the amount of issues it will probably take me a little while to come up with fixes for all of them.
Since (rigorous) testing is actually the most time-consuming part of developing the mod (and I'm not really actively playing Starsector atm), I will probably put out a pre-release with these fixes again in hopes of crowd-sourcing some of the testing :P

PS: I think I might also rename Opportunist mode xD Maybe something like "Conservative" would be a better name.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: JamesBai03 on August 29, 2021, 06:15:39 AM
Thanks for your reply. I have tried both a hammerhead and a dominator as enemy targets, and have used both the avoid shield and opportunist firing mod. the weapon I fielded was HE weapons so I made sure to overload the targets with Kinect weapons so both target ships' shields were downed, but they just wont fire unless I pointed it directly toward the centre of enemy hull. It seems that the hitscan focus solely at the centre? This forces me to use only one of my two large slot weapon cuz Dominator weapon arc dont converge (but sufficiently accurate enough to hit any destroyer). The vanilla autofire AI seems to work just fine tho.
For the questions, the enemy's speeds fairly slow so neither the enemy speed or my weapon speed was the problem. It maybe because the enemy hull's centre is out of the weapon arc

Ive tried to change the triggerhappy setting in the setting file to 1.5, but that didnt help either.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: DesperatePeter on August 29, 2021, 10:00:56 AM
Thanks for your reply. I have tried both a hammerhead and a dominator as enemy targets, and have used both the avoid shield and opportunist firing mod. the weapon I fielded was HE weapons so I made sure to overload the targets with Kinect weapons so both target ships' shields were downed, but they just wont fire unless I pointed it directly toward the centre of enemy hull. It seems that the hitscan focus solely at the centre? This forces me to use only one of my two large slot weapon cuz Dominator weapon arc dont converge (but sufficiently accurate enough to hit any destroyer). The vanilla autofire AI seems to work just fine tho.
For the questions, the enemy's speeds fairly slow so neither the enemy speed or my weapon speed was the problem. It maybe because the enemy hull's centre is out of the weapon arc

Ive tried to change the triggerhappy setting in the setting file to 1.5, but that didnt help either.

Thanks for the update!

Here are some updates on my current progress (0.10.4 pre-release).

I looked through the code and I think I actually found the issue!
When determining whether to fire or not, my logic properly considered the enemy "radius". However, when scanning for valid targets, it only considered ships whose center point was within the weapon's arc. Therefore, while the weapon probably would have fired at the enemy if it was considered a valid target, it never considered it to be a valid target. A very similar thing happened for weapon ranges. All weapon modes should now consider the enemy to be within range if part of the enemy is within range, i.e. all weapon modes should start firing slightly sooner.
Additionally, 25% of the projectile fadeout range is now considered for determining whether an enemy is in range or not.

I also discovered another issue:
When scanning for friendlies for friendly fire considerations, the code actually included the ship itself. Therefore, if a weapon was located near the center of the ship, the AI wouldn't fire because it was scared of hitting itself, which might explain why weapons would sometimes refuse to fire for no apparent reason. I also fixed that xD

Weapons should now assume a neutral position (facing as close to forward as the hardpoint allows) when there are no valid targets nearby.

Non-aimable weapons and weapons with tracking should now remain in neutral position and not try to aim at the enemy.

Regarding the friendly-fire issue and the missiles not respecting targeting restrictions issue, I haven't made any progress yet.
Hopefully I'll have some time for that next week.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Raitaki on August 29, 2021, 10:34:03 AM
Were you in between your allied ship and an enemy? (In that case, it's probably an issue with the "do not fire at friendlies"-logic)
Or did the ship simply fire at your ship? (In that case, it's probably an issue with your ship being identified as a hostile for some weird reason)
This happens only when I'm in the way; friendlies don't start just firing at me for no reason, thank god. For what it's worth, the few times I've noticed this happen the offending friendly firers basically get close enough to ram me in the rear before lighting me up, so maybe it's some issue with friendlies being too close to the weapons being fired to be "seen"?

On the TargetShields/AvoidShields issue:
To be perfectly honest, I'm not really sure if I understand what the issue is. Weapons set to AvoidShields should only fire at targets that have a) high flux, b) high-ish flux and shields turned off or c) no shields. TargetShields does the inverse. If you have a kinetic weapon set to TargetShields and a non-beam Energy weapon, wouldn't it make more sense to simply set the Energy weapon to default mode? Other weapon groups set to Target/Avoid shields shouldn't really have any impact on how the weapon group in question behaves. If you could rephrase this issue that would be much appreciated!
Basically the problem is that with kinetic + energy damage pairings, the energy weapon is pretty much shelved. Unless the latter outranges the former, AI simply sticks to using the kinetic weapon instead even if the target is >95% flux or overloaded; it's extremely shy about using the energy weapon, only fires it for like 1-2s at a time and there's no rhyme or reason about when it decides to do so (I've seen a ship in 1v1 battle sim decide to fire an AvoidShield energy salvo at a 50% flux shield once).
I guess this isn't much of a problem in vanilla, but my array of mods does provide some energy-damage ballistic weapons and some kinetic-damage energy weapons, so the two damage types wind up occasionally coexisting sometimes--and on ships with too many/too big mounts for their flux stats to handle firing at will, I try to get them to pursue flux efficiency per damage via weapon groups, though as above success is limited when the pairing isn't kinetic-he.

Anyways, thank you for the hard work--I can only imagine how hard it is to herd AI behaviour in a many-entities environment like Starsector combat, especially with an unpredictable player in there running amok.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: JamesBai03 on August 29, 2021, 12:14:01 PM
glad I could help. Another problem I encountered during using the custom AI is that it seems to disregard my lockon(r) and prioritize targets randomly, making concentrated fire difficult when there are multiple enemies present within range. Nonetheless, this mod is easily one of my favorites for its practicality. Thank you!
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: DesperatePeter on September 04, 2021, 03:34:30 AM
This happens only when I'm in the way; friendlies don't start just firing at me for no reason, thank god. For what it's worth, the few times I've noticed this happen the offending friendly firers basically get close enough to ram me in the rear before lighting me up, so maybe it's some issue with friendlies being too close to the weapons being fired to be "seen"?

So, I did a little bit more testing/theorizing and I think I came up with an explanation. I think what mislead me at first was that I was focused so much on the changes I did in 0.10.3 that I didn't give enough thought to the possibility that this issue may have already existed before that. If my current theory is right, the problem was pretty much the same issue that JamesBai03 pointed out: The friendly ship was never considered as a viable "target" for friendly fire considerations, because the center of the friendly ship was not in the weapon's cone of fire. While the friendly fire prevention algorithm does correctly take the ship's radius into consideration, the algorithm that scans for friendlies did not. So, if my theory is correct, the last pre-release (0.10.4) should have "inadvertently" fixed the friendly fire issue. If you still encounter the issue using the latest pre-release version, please let me know. In that case, this theory is probably wrong :P

Basically the problem is that with kinetic + energy damage pairings, the energy weapon is pretty much shelved. Unless the latter outranges the former, AI simply sticks to using the kinetic weapon instead even if the target is >95% flux or overloaded; it's extremely shy about using the energy weapon, only fires it for like 1-2s at a time and there's no rhyme or reason about when it decides to do so (I've seen a ship in 1v1 battle sim decide to fire an AvoidShield energy salvo at a 50% flux shield once).
I guess this isn't much of a problem in vanilla, but my array of mods does provide some energy-damage ballistic weapons and some kinetic-damage energy weapons, so the two damage types wind up occasionally coexisting sometimes--and on ships with too many/too big mounts for their flux stats to handle firing at will, I try to get them to pursue flux efficiency per damage via weapon groups, though as above success is limited when the pairing isn't kinetic-he.

Hmm, that is very odd indeed. The thing is: While e.g. Opportunist does factor the damage type of the weapon into its calculations, Target/AvoidShields doesn't. That makes me fear that there is some deeper, more elusive, reason for that behavior. If we're super lucky, one of the issues I fixed in the last pre-release (friendly fire occasionally erroneously considering the firing ship's hitbox if the weapon is mounted near the center/rear of the ship or the erroneous target scanning) was actually the reason for this behavior and has already been fixed. If not, there's probably some weird glitch with the Target/AvoidShields modes that has escaped me so far.
So, again, if you could try using the newest version and let me know if the issues still persists, that would help me narrow down the cause of the problem!

Anyways, thank you for the hard work--I can only imagine how hard it is to herd AI behaviour in a many-entities environment like Starsector combat, especially with an unpredictable player in there running amok.

Thanks =) Yeah, unfortunately writing good AI* for complex games is very challenging. There's always stuff/situations you don't think about, things that actually behave differently than assumed, players/ships/mods doing unforeseen things etc. xD That's probably also the reason why most games don't have great AI^^
But as long as you guys keep giving me feedback on things that don't work, I might be able to improve things!

glad I could help. Another problem I encountered during using the custom AI is that it seems to disregard my lockon(r) and prioritize targets randomly, making concentrated fire difficult when there are multiple enemies present within range. Nonetheless, this mod is easily one of my favorites for its practicality. Thank you!

=) Glad to hear that you like it!

Yeah, this is a known issue. The funny thing is: It would be pretty easy to fix, but I'm not sure if that fix would actually make things better. I think I already tried to explain why this happens a while ago, but I'll try to do so again in a little more detail:
When a weapon is assigned a certain mode, that mode essentially does three things:

I believe what is happening here is the following:
You select an enemy as the ship target. However, the weapon in question is set to a mode that doesn't consider that target to be "attractive" for some reason. Therefore, that target's priority value is inf/very high (divided by 100, which is still inf/fairly high) and the weapon will instead fire at another target.
The obvious fix for this would be to simply set the priority to 0.0 (rather than dividing by 100) when you mark an enemy as ship target. But that would usually just lead to the weapon not firing at all (because the selected target is probably not valid for the selected mode). In some cases, that might be what you want. In other cases (such as e.g. a Devastator Cannon which has been set to SmallShips mode), it might lead to the weapon not doing its job (i.e. killing fighters/frigates) as soon as you set a ship target.

If you have reason to believe that this is not what's happening or have an idea on how to solve this issue sensibly within the given frame, please do let me know!
Edit: I could absolutely add a setting for this, that way people could choose which behavior they prefer.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: renegade_sock on September 16, 2021, 06:43:46 PM
I made an account just to thank you for making this amazing mod!

You inspired me to load up Intellij and see if I'd be able to make some additions to your mod, but I think this is all a bit above my skill level unfortunately.

I was hoping to add an option to customise values for individual ships, e.g.:

- Vent(Flux > ___) where (safetyFactor = ___)
- PD(Flux > ___)
- ConserveAmmo where (ammo < ___)
- TargetShields where (shields > ___) or (flux > ___)
- etc

I was also hoping to add a mode that forced a weapon group to only fire simultaneously (e.g. for salamanders, tachyon beams, etc)

I understand this would be a substantial task though and would involve a significant change to the UI.

I look forward to your possible addition of geometric analysis of shield facing!

EDIT: I just noticed that the big and small ships options needed to be enabled manually. It looks very cool but I was hoping it would allow targeting of all ships and just prioritise based on size. Would it be possible to add this as an alternative mode that is disabled by default?

EDIT2: Actually if you'd be cool with it, I could probably add the following in a PR:

- BigShipAIAlternative mode that is the same as your BigShipAI mode except that it doesn't disable targeting of smaller ships. Disabled by default
- SmallShipAIAlternative mode that is the same as your SmalShipAI mode except that it doesn't disable targeting of larger ships. Disabled by default
- SimultaneousFire mode (not sure if it would be a mode or suffix yet) that would only allow a weapon group to fire if all weapons can fire simultaneously. Disabled by default.

I think your mod has so much potential for all kinds of really cool things!

Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: DesperatePeter on September 20, 2021, 08:24:52 AM
I made an account just to thank you for making this amazing mod!

You inspired me to load up Intellij and see if I'd be able to make some additions to your mod, but I think this is all a bit above my skill level unfortunately.

I was hoping to add an option to customise values for individual ships, e.g.:

- Vent(Flux > ___) where (safetyFactor = ___)
- PD(Flux > ___)
- ConserveAmmo where (ammo < ___)
- TargetShields where (shields > ___) or (flux > ___)
- etc

I was also hoping to add a mode that forced a weapon group to only fire simultaneously (e.g. for salamanders, tachyon beams, etc)

I understand this would be a substantial task though and would involve a significant change to the UI.

I look forward to your possible addition of geometric analysis of shield facing!

EDIT: I just noticed that the big and small ships options needed to be enabled manually. It looks very cool but I was hoping it would allow targeting of all ships and just prioritise based on size. Would it be possible to add this as an alternative mode that is disabled by default?

EDIT2: Actually if you'd be cool with it, I could probably add the following in a PR:

- BigShipAIAlternative mode that is the same as your BigShipAI mode except that it doesn't disable targeting of smaller ships. Disabled by default
- SmallShipAIAlternative mode that is the same as your SmalShipAI mode except that it doesn't disable targeting of larger ships. Disabled by default
- SimultaneousFire mode (not sure if it would be a mode or suffix yet) that would only allow a weapon group to fire if all weapons can fire simultaneously. Disabled by default.

I think your mod has so much potential for all kinds of really cool things!

Thanks, I appreciate the nice feedback! =)

About your suggestions:

Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Nalesh on January 02, 2022, 04:32:02 PM
Any chance of adding a thing for the ship to act like it has a specific type of missile on board? Like you know how ships get real aggressive when they have annihilator pods, or when they get annoyingly timid when they have strike range missiles like pilums? Probably not that big of a problem in vanilla but in modded I've often felt annoyed at how some ships just don't wanna get in range of their main weapons as much.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Stargazer86 on January 08, 2022, 03:46:42 PM
Hey, logged in to post my thanks for this mod! But I was also wondering whether there could be an option to, say, target shields AND ignore fighters? When I target an enemy ship often times my anti-shield guns ignore my targeting orders and instead shoot at the various annoying fighters flying around. The guns on my ship also spread fire a lot, again ignoring my R targeting orders and instead fire and whatever ship they want to.
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: grinningsphinx on January 11, 2022, 01:35:24 PM
Hiya sir!!! Any update to the mod yet?:) Thank you very much in advance!
Title: Re: [0.95a] AdvancedGunneryControl 0.10.2
Post by: Stargazer86 on January 13, 2022, 02:37:51 PM
I've also been noticing issues with AI targeting choice. The AI seems to wholly ignore when I R select a target and, instead of concentrating fire on it, will instead pick whatever targets it believes is "best" for the chosen firing mode.

For example, I just had a Conquest rushing me down. I turn to face it, use R to select it, but my anti-shield guns instead turn to fire at other ships around me. It was really starting to trigger me something fierce until I just put every single gun back to its default state. THEN the autofire AI finally obeyed my target selection.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 16, 2022, 12:46:46 PM
TL;DR-Version: Target/AvoidShields now consider shield facing, bugs with aiming, respecting selected target (R-Key) and friendly fire considerations.

Hi everyone!

Sorry for the long period without updates, but my interest for Starsector finally got rekindled by the 0.95.1a release =)

After playing 2-3 campaigns with forced custom AI, debugging whenever I noticed something wird, I feel like I was finally able to iron out many of the issues that the custom AI still hard. I also finally managed to get the geometrical shield facing considerations for the target/avoid shield modes to work properly.

This ofc doesn't mean that there aren't any bugs left, but overall it feels a lot smoother now.

Here's the list of bugs I fixed:

Any chance of adding a thing for the ship to act like it has a specific type of missile on board? Like you know how ships get real aggressive when they have annihilator pods, or when they get annoyingly timid when they have strike range missiles like pilums? Probably not that big of a problem in vanilla but in modded I've often felt annoyed at how some ships just don't wanna get in range of their main weapons as much.

This is an interesting suggestion, but to be honest I kind of feel like this should be solvable via officer aggression level. Also, to be perfectly honest, I don't really want to add more features to the mod. When I was playing I realized that I only used about half the features (I rarely used ship modes, the GUI and most suffixes) and adding more features might just make the mod more confusing to use. So sorry, probably not gonna happen =/

Hiya sir!!! Any update to the mod yet?:) Thank you very much in advance!

Yup, just released 0.11.0 =)

Hey, logged in to post my thanks for this mod! But I was also wondering whether there could be an option to, say, target shields AND ignore fighters? When I target an enemy ship often times my anti-shield guns ignore my targeting orders and instead shoot at the various annoying fighters flying around. The guns on my ship also spread fire a lot, again ignoring my R targeting orders and instead fire and whatever ship they want to.

Thank you! =)
This is a great suggestion, I believe someone else already posted this idea a while ago. While playing, I also often times wanted to set a weapon to that exact combination xD
Unfortunately, the way I originally implemented weapon modes doesn't really support that. I.e. adding this functionality would require me to rewrite large parts of the mod, which I am currently unwilling to do xD I already explored the concept with ship modes (where you can select multiple).
This is something I definitely want to do at some point, but probably not in the near future. Ideally, I would like to replace weapon modes and suffixes with a list of options where you can select multiple. What makes this more challenging than ship modes is that some weapon options would be incompatible (e.g. IgnoreFighters and TargetFighters) and I'd have to find some way to ensure that only compatible options are selected. Also, I'd have to find a control scheme that works for changing options during combat...

I've also been noticing issues with AI targeting choice. The AI seems to wholly ignore when I R select a target and, instead of concentrating fire on it, will instead pick whatever targets it believes is "best" for the chosen firing mode.

For example, I just had a Conquest rushing me down. I turn to face it, use R to select it, but my anti-shield guns instead turn to fire at other ships around me. It was really starting to trigger me something fierce until I just put every single gun back to its default state. THEN the autofire AI finally obeyed my target selection.

Yeah, I noticed that issue too. Should hopefully be fixed now =)
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 23, 2022, 06:34:09 AM
New pre-release (version 0.12.0, https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.12.0) is out. Note that it has not yet been tested properly, so I appreciate any feedback on whether stuff works as intended or not.

Main features are some improvements to the GUI and suggested weapon modes: The GUI now offers an option to load suggested weapon modes for weapons, defined in data/config/modSettings.json. Other mods may also include suggested weapon modes, if their authors so desire. The actual suggestions are just a first draft, feedback on the suggestions is also appreciated!

Other than that, I converted the PD(Flux>X) and PD(Ammo<X) (disabled by default, re-enable in settings.editme) suffixes into weapon modes, as these suffixes really only worked well when combined with the Default-fire-mode.

EDIT: I just noticed that the big and small ships options needed to be enabled manually. It looks very cool but I was hoping it would allow targeting of all ships and just prioritise based on size. Would it be possible to add this as an alternative mode that is disabled by default?
While I didn't want to add more modes, I did include an option in the settings (at the bottom, called strictBigSmallShipMode). If set to false, those modes will essentially do what you described^^

Looking forward to any kind of feedback =) Do note that "I've played a couple hours and everything seems to work fine" is also valuable feedback!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: Dal on January 23, 2022, 07:04:24 AM
In the interest of persistent setting, configuration for allies, etc, have you considered creating a hullmod set for applying your settings? If they were sorted to the end of the alphabet I think the menu bloat would be manageable and it would allow much more convenient use. You could even have AGC settings saved in custom variants. Apologies if it's been discussed before.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 24, 2022, 12:24:34 AM
In the interest of persistent setting, configuration for allies, etc, have you considered creating a hullmod set for applying your settings? If they were sorted to the end of the alphabet I think the menu bloat would be manageable and it would allow much more convenient use. You could even have AGC settings saved in custom variants. Apologies if it's been discussed before.

Hiya and thanks for the suggestion!
I believe someone already suggested that way back and I actually had already built a working prototype of that idea before, but decided to scrap it.
The way I tried to implement it was: For each weapon group, there would have been a hullmod for each suffix and for each firing mode.
Imho, there's a couple issues with that idea, though (which is why I decided to scrap it):

My next idea was to instead have a couple of "templates". Essentially, you'd have a hullmod called something like "AGC_SetAsTemplate1" and "AGC_ApplyTemplate1". So you would outfit your ship and set up weapon groups, go into the GUI to set up firing modes, go back into the refit screen, add the AGC_SetAsTemplate1 hullmod, remove it again and add AGC_ApplyTemplate1. Now you could save it as an autofit template and apply it to other ships. Unfortunately, that idea didn't really seem to work intuitively either (not being able to see what a template does without switching to the GUI, how many templates should be available? Changing that number might break saves...).

But if you have a good idea of how to implement this in a way that is both intuitive and works well, I might be willing to bite the "save-compatibility"-bullet (I might split it into a secondary mod AGC_Hullmods, that requires AGC, though).

There might be other ways to do this that don't use hullmods, though.
If I'm not mistaken, your main concern is that you want to be able to autofit multiple ships of the same type and have them all have the same ship/firing-modes and suffixes (without having to manually set up each individual ship), right?

Maybe an option in the GUI called something like "Apply modes set for current ship to all ships with the same type and variant name" would be an option?
Or maybe simply a single hullmod called something like "AGC_CopyModesFromSameVariant" that, when applied to a ship, searches your fleet for ships with the same type and variant name and, if it finds one with non-null modes, applies them to the ship, would be possible.

One cool thing about the very first option (having ~120 different hullmods) would be, that - in theory at least - it could be used for tournament play. But until I know that the tournament folk would be interested in that, I don't really consider that a valid argument.

I'm interested to hear what your thoughts on this matter are and if you maybe have some better ideas! Is there maybe some obvious solution that I simply haven't thought of?

Edit: I just re-read your comment and noticed that you mentioned saving AGC settings in custom variants. That might indeed be a cool idea. Unfortunately, as far as I can tell, there is no "AutofitListener", but I could simply check when a new ship is deployed, if its modes are null, if there are modes stored in the variant.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: lyravega on January 24, 2022, 01:38:12 AM
I'm not that educated on the subject, but some mods utilize dynamic hullmods. As each ship has an individual ID, the mod stores relevant information somewhere (I believe), and apply the effects based on this thing.

In the firing mode GUI, there can be 3 save options: per-ship, per-variant, per-hull. You open the GUI, select a ship, and change your stuff, then you save it in one of the ways. And on the ship refit screen, just one hullmod can control them all. If the hullmod is installed, your mod will check for the ship ID, if it doesn't find anything for that ID, it can check the variant, if it cannot find anything for the variant, it can check the hull type.

Of course, as you've said, the GUI can also have an option to apply the firing mode selections for the similar types; it already does it per-ship, the other options could be per-variant and per-hull like the hullmod suggestion above.

Anyhow, just spit-balling here. Thank you for the mod =)
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 24, 2022, 11:10:23 AM
TL;DR: Given that adding hullmods would break the utility-mod status of the mod and that a "apply to all ships of the same variant" button in the GUI seems to accomplish the goal almost as well, I'm currently favoring that approach. Feel free to try to convince me otherwise.

I'm not that educated on the subject, but some mods utilize dynamic hullmods. As each ship has an individual ID, the mod stores relevant information somewhere (I believe), and apply the effects based on this thing.
If I understand your suggestion correctly, that's pretty much what I meant by:
Quote
Or maybe simply a single hullmod called something like "AGC_CopyModesFromSameVariant" that, when applied to a ship, searches your fleet for ships with the same type and variant name and, if it finds one with non-null modes, applies them to the ship, would be possible.
If you meant something different, would you mind elaborating further?

Quote
In the firing mode GUI, there can be 3 save options: per-ship, per-variant, per-hull. You open the GUI, select a ship, and change your stuff, then you save it in one of the ways. And on the ship refit screen, just one hullmod can control them all. If the hullmod is installed, your mod will check for the ship ID, if it doesn't find anything for that ID, it can check the variant, if it cannot find anything for the variant, it can check the hull type.
That's an interesting idea, however, I feel like, for non-autofitting use this would just be an additional required step. If you, let's say, have a single Hammerhead in your fleet it seems like an unnecessary step to first have to go to the GUI to set the weapon modes up and then go back to the refitting screen to apply them by adding the hullmod. Additionally, saving per-hull seems kind of risky, since different variants are likely to have different weapons. So if you e.g. have 2 hammerheads, one is an SO hammerhead with reapers in group 1 (and assault chainguns in group 2) and the other is a long range Hammerhead with 2 HVDs in group 1, it seems unlikely that you would want the same modes per weapon group for both. Correct me if I'm wrong, but I feel like this idea wouldn't work all too well in practice =/

Quote
Of course, as you've said, the GUI can also have an option to apply the firing mode selections for the similar types; it already does it per-ship, the other options could be per-variant and per-hull like the hullmod suggestion above.
I think this is currently my preferred option. I don't really see enough benefit in a hullmod-based approach to justify breaking mid-campaign updatability and removability. But I think I'll just implement the per-variant option, as I don't see much use in a per-hull variant. Doing a per-hull variant would probably be super easy to implement once a per-variant version is finished, so if you can give me a convincing argument why a per-hull option would be beneficial, I'm open to change my mind, though =)

Quote
Anyhow, just spit-balling here. Thank you for the mod =)
You're very welcome and thanks for the suggestions!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 25, 2022, 11:58:14 PM
New pre-release (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.12.1) is out.

It includes the "copy modes to all ships of the same variant" feature in the GUI as well as adding a help hotkey (?-key by default) that will print current key bindings when pressed in combat.

In the interest of persistent setting, configuration for allies, etc, have you considered creating a hullmod set for applying your settings? If they were sorted to the end of the alphabet I think the menu bloat would be manageable and it would allow much more convenient use. You could even have AGC settings saved in custom variants. Apologies if it's been discussed before.
Please let me know if this works for you. As mentioned before, it's a tiny bit more work than having modes directly applied when autofitting, but imho should still do the trick and be a lot easier than having to manually set up modes for every ship.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: grinningsphinx on January 26, 2022, 08:15:44 AM
ty for the update!

When i press J, im only seeing six groups in the interface, however there are seven weapon groups when i assigned via the refit fleet interface. Am i missing something here?

EDIT: Getting rid of all old instances of mods and then reinstalling all of them fixed...Chalked up to user error!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: DesperatePeter on January 28, 2022, 07:35:31 AM
After some more testing, I feel like stuff seems to be working fine, so it's time to crowd-source the testing. I just released 0.13.0 (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.13.0) as a full release.
It's mostly the same as 0.12.1, I just added a noPD mode, which turns PD-weapons into regular weapons and is disabled by default, and some minor polish.
Also, I recorded a new video showcase for the mod, albeit I still suck at making videos =/

Let me know if you experience any issues.

ty for the update!
You're very welcome! =)

Quote
When i press J, im only seeing six groups in the interface, however there are seven weapon groups when i assigned via the refit fleet interface. Am i missing something here?
Unfortunately, I was unable to reproduce this problem =/
Has anyone else experienced this issue?
Title: Re: [0.95.1a] AdvancedGunneryControl 0.11.0
Post by: lyravega on January 28, 2022, 11:15:18 AM
Unfortunately, I was unable to reproduce this problem =/
Has anyone else experienced this issue?
Could it be some scaling issue or something like that? No problems with the 7th group on my end. My only problem is I cannot read the last option (#10, I can read the top of it, but if there's anything below that, I cannot see it).

By the way, is it possible to add a ForceAutofire suffix command for individual groups? It's for missiles mostly; with some missiles AI tends to be extremely conservative, when it can just spam them and be done with the battle. ForceAutofire works like a charm for those missile groups, and not having to set a do-not-fire suffix for all the other groups seems not only more logical, but also safer in my opinion. As missiles (well, most missiles) don't generate flux, it can be a suffix option for missile groups instead of 'Holdfire<Flux'. (bonus for "retreat after unloading all missiles" command, heheh :D)

Also, if I may request/suggest another thing, is it possible to have an option somewhere that makes changes in-battle temporary? Or is there a way to restore them to pre-combat values after one? Actually, is there an option for that already?!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: grinningsphinx on January 28, 2022, 07:01:18 PM
I just ran into the conservative missile issue recently with large low ammo count torps...But the ship has inbuilt missile forges constantly restoring ammo. The way the game sees it though is you have 7 non-regen torps, and will be frustratingly conservative about firing them off.



Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on January 29, 2022, 01:06:09 AM
EDIT: Getting rid of all old instances of mods and then reinstalling all of them fixed...Chalked up to user error!
Awesome, thanks for letting me know!

My only problem is I cannot read the last option (#10, I can read the top of it, but if there's anything below that, I cannot see it).
I should probably try to reduce the number of options xD I think it would be possible to e.g. combine ship/fleet-wide options into a single option, where, if you e.g. hold down ctrl it affects the whole fleet, otherwise only the current ship.

Quote
By the way, is it possible to add a ForceAutofire suffix command for individual groups? It's for missiles mostly; with some missiles AI tends to be extremely conservative, when it can just spam them and be done with the battle. ForceAutofire works like a charm for those missile groups, and not having to set a do-not-fire suffix for all the other groups seems not only more logical, but also safer in my opinion. As missiles (well, most missiles) don't generate flux, it can be a suffix option for missile groups instead of 'Holdfire<Flux'. (bonus for "retreat after unloading all missiles" command, heheh :D)
I think a ForceAutofire suffix is a nice idea, since full ForceAutofire is often a bit too much. It would have to be coupled to a ShipMode such as e.g. "ForceAutofire(SuffixOnly)" though, as a weapon AI plugin doesn't have the necessary permissions to do this. It would be even cooler if you could set this AND a flux-suffix, but the only way I can think off that would allow this would be modular modes (which is something I am considering but would be a lot of work) or prefixes (and I don't wanna go down that route^^).

I had originally planned to add more command ship modes (such as "RetreatWhenCRLow" etc.), but someone informed me that the mod Automated Commands (https://fractalsoftworks.com/forum/index.php?topic=21576.0) exists and I don't want to have too much overlap between the two mods. I might actually remove the Retreat(Hull<50%) mode in the future for that reason.

Quote
Also, if I may request/suggest another thing, is it possible to have an option somewhere that makes changes in-battle temporary? Or is there a way to restore them to pre-combat values after one? Actually, is there an option for that already?!
Also a good idea!

The easiest (and potentially cleanest) way to implement this would to simply have a setting in settings.editme for this. If set to true, changes made during combat are temporary, otherwise they stick around.

Another option would be to have this option be toggle-able via hotkey (with maybe a default-setting defined in settings.editme). In theory, that sounds better, but personally I would probably constantly forget to toggle this and get frustrated xD

Lastly, adding "double-bookkeeping" would also be an option. I.e. modes set in the GUI would get applied to both books (let's call them A and B), changes made in combat only get applied to book A and when loading modes, they also get loaded from book A. Then there would be an option (in the GUI and/or via hotkey) to reset book A to the state of book B.

From an ease of implementation and usage standpoint, the first option sounds the best to me.

From a flexibility standpoint, the last option seems preferable. Though it does run the risk of making the usage of the GUI less intuitive (should book A or B be displayed in the GUI? If book B gets displayed, there would probably need to be an option like "write book A into book B" to persist changes made in combat. Otherwise, there would need to be an option like "reset book A to book B". Also, this would be another concept that people would need to understand to successfully use the mod. It's probably very intuitive to understand if you've run into this issue before, but less so when you are using the mod for the first time).

Thanks for the feedback, let me know what you think!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: lyravega on January 30, 2022, 12:24:15 AM
I should probably try to reduce the number of options xD I think it would be possible to e.g. combine ship/fleet-wide options into a single option, where, if you e.g. hold down ctrl it affects the whole fleet, otherwise only the current ship.
Whole fleet options kinda seems dangerous to me, if you are using lots of different ship types - never used it to not mess up with individual ship settings to be honest. Copy to variant is great, though =) There is a separator that seems to be doing nothing, and save/load options could be combined under one setting if you want to cram everything in one.

I think a ForceAutofire suffix is a nice idea, since full ForceAutofire is often a bit too much. It would have to be coupled to a ShipMode such as e.g. "ForceAutofire(SuffixOnly)" though, as a weapon AI plugin doesn't have the necessary permissions to do this. It would be even cooler if you could set this AND a flux-suffix, but the only way I can think off that would allow this would be modular modes (which is something I am considering but would be a lot of work) or prefixes (and I don't wanna go down that route^^).
Multiple suffixes that you can use would be nice to be honest, and that's exactly what I asked for - a suffix for ForceAutofire, not an AI (one of the bottom options, not the top one as it doesn't make sense in the top area anyway). For now, I believe you can only allow it for missile-only groups where flux isn't a concern - even though there are a few missiles that generate flux, it should be a safe option I think. Just like how you cannot set some AI PD-related stuff on non-PD weapons, perhaps?
I had originally planned to add more command ship modes (such as "RetreatWhenCRLow" etc.), but someone informed me that the mod Automated Commands (https://fractalsoftworks.com/forum/index.php?topic=21576.0) exists and I don't want to have too much overlap between the two mods. I might actually remove the Retreat(Hull<50%) mode in the future for that reason.
To be honest, yours' is doing it without a hullmod; it's doing the same thing in a different way. It's up to you of course!

The easiest (and potentially cleanest) way to implement this would to simply have a setting in settings.editme for this. If set to true, changes made during combat are temporary, otherwise they stick around.

Another option would be to have this option be toggle-able via hotkey (with maybe a default-setting defined in settings.editme). In theory, that sounds better, but personally I would probably constantly forget to toggle this and get frustrated xD

Lastly, adding "double-bookkeeping" would also be an option. I.e. modes set in the GUI would get applied to both books (let's call them A and B), changes made in combat only get applied to book A and when loading modes, they also get loaded from book A. Then there would be an option (in the GUI and/or via hotkey) to reset book A to the state of book B.

From an ease of implementation and usage standpoint, the first option sounds the best to me.

From a flexibility standpoint, the last option seems preferable. Though it does run the risk of making the usage of the GUI less intuitive (should book A or B be displayed in the GUI? If book B gets displayed, there would probably need to be an option like "write book A into book B" to persist changes made in combat. Otherwise, there would need to be an option like "reset book A to book B". Also, this would be another concept that people would need to understand to successfully use the mod. It's probably very intuitive to understand if you've run into this issue before, but less so when you are using the mod for the first time).
The second option could also work in reverse. Book A could display your persistent settings, and Book B appears only if you made a change during combat, so that you can revise them and apply them to persistent book. Book A, the persistent settings are always loaded, Book B is only there for you to check the changes. When checking out a ship's options, an option could be used to toggle between A and B so that you can see what exactly you've changed. Unless you apply the changes to A yourself, B will vanish on the next battle, something like that. I apologize if this is what you meant by the whole thing, and I misunderstood it in reverse.

That said though, the whole Book A & B thing would make the UI even more cluttered in my opinion. Cluttered is maybe the wrong word, confusing perhaps is the right word. As you've said, what will the user be looking at when they open the GUI? Where will it say that which settings are permanent, and which were temporary; used in your previous battle/test? Unless you can create a completely custom UI, you might not have the necessary tools to deliver that information as cleanly as possible I think. And as far as modding in Starsector goes, I've seen an over-reliance on dialogue and intel panels - either it's easier, or the rest are somewhat hardcoded an inaccessible. To be honest, seeing your 'excel-sheet' for the options was a surprise to me, no other mod I've seen has a menu like that (outside the intel screen).

The first option seems preferable. A setting in the file that's set to false by default; that I need to change in order to make combat changes temporary seems to be exactly what I'm asking for, and thus I'm biased :D If you can detect simulations, the option can be split into two; changes in combat being temporary, and changes in simulations being persistent for example. Though that's another thing. A button to use in-combat to save the temporary changes would go alongside this nicely.

Using the GUI to apply/revert combat changes could also be an option in the GUI; it'd go alongside the persistent/temporary in-combat change setting in the options file. The separator option (is it used for something, by the way?) on 4 for example, if the ship in question had an in-combat change, it can say 'Apply settings from last combat' and when you press it, it can turn into 'Revert changes from last combat'. It is grayed out otherwise. It's a simplified version of Book A/B, per ship, and only appears (not grayed-out) if there's a change.

Anyway, all in all, I'd say the easiest solution might be the best. You can use that time to enjoy the game / do other things instead of making something that might be used by just a handful. I mean I can always try to remember changing stuff back after a battle =)
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on January 30, 2022, 11:42:43 PM
Whole fleet options kinda seems dangerous to me, if you are using lots of different ship types - never used it to not mess up with individual ship settings to be honest. Copy to variant is great, though =) There is a separator that seems to be doing nothing, and save/load options could be combined under one setting if you want to cram everything in one.
I think I found a decent solution for this one. The whole code for the GUI was getting a bit messy, since I just kept on slapping on more options, so I did a lot of refactoring. Now, by default, only the current ship is affected. If you hold shift, the whole fleet is affected and if you hold control, all loadouts are affected. I might try to add a confirmation dialogue to whole-fleet options, though. I'll put out a new pre-release soon (TM) to get some feedback on this.

Quote
Multiple suffixes that you can use would be nice to be honest, and that's exactly what I asked for - a suffix for ForceAutofire, not an AI (one of the bottom options, not the top one as it doesn't make sense in the top area anyway). For now, I believe you can only allow it for missile-only groups where flux isn't a concern - even though there are a few missiles that generate flux, it should be a safe option I think. Just like how you cannot set some AI PD-related stuff on non-PD weapons, perhaps?
Yeah, I understand that you would like a suffix that does this^^ Unfortunately, that's technically not possible. Suffixes are part of the AutofireAIPlugin, which gets loaded into the weapon. When something that isn't the active ShipAI, such as an AutofireAIPlugin, gives a command to the ship, the game will throw an exception, meaning the game will crash. That's why I said that both a suffix and a ShipMode would be required. That way, the suffix would essentially do nothing and the ShipMode would simply check if a group contains that suffix.

I could, in theory, simply implement the "force autofire for all weapon groups that have a ForceAutofireSuffix" ShipAI and apply it to every ship, even when set to default. But to be completely honest, I don't really want to. So far, when you set something to default, it will keep its original AI. If I did this, all ships would end up with a custom ShipAI, even if set to default, which seems risky/unclean. I'm the kind of person that gets really annoyed when software does stuff like that, so I don't really want my software to do stuff like that... xD

Also, I don't think it's really necessary to restrict it to missile weapons. There are some missile weapons (e.g. the [REDACTED] antimatter missiles) that generate lots of flux and some non-missile weapons that barely generate any flux.

Would you still be interested in this suffix, even if it only works if you also enable the ForceAutofire(SuffixOnly) ShipMode?

Quote
To be honest, yours' is doing it without a hullmod; it's doing the same thing in a different way. It's up to you of course!

I'll think about it. I would at the very least want to talk to the author of automated commands first.

Quote
The second option could also work in reverse. Book A could display your persistent settings, and Book B appears only if you made a change during combat, so that you can revise them and apply them to persistent book. Book A, the persistent settings are always loaded, Book B is only there for you to check the changes. When checking out a ship's options, an option could be used to toggle between A and B so that you can see what exactly you've changed. Unless you apply the changes to A yourself, B will vanish on the next battle, something like that. I apologize if this is what you meant by the whole thing, and I misunderstood it in reverse.

That said though, the whole Book A & B thing would make the UI even more cluttered in my opinion. Cluttered is maybe the wrong word, confusing perhaps is the right word. As you've said, what will the user be looking at when they open the GUI? Where will it say that which settings are permanent, and which were temporary; used in your previous battle/test? Unless you can create a completely custom UI, you might not have the necessary tools to deliver that information as cleanly as possible I think. And as far as modding in Starsector goes, I've seen an over-reliance on dialogue and intel panels - either it's easier, or the rest are somewhat hardcoded an inaccessible. To be honest, seeing your 'excel-sheet' for the options was a surprise to me, no other mod I've seen has a menu like that (outside the intel screen).

The first option seems preferable. A setting in the file that's set to false by default; that I need to change in order to make combat changes temporary seems to be exactly what I'm asking for, and thus I'm biased :D If you can detect simulations, the option can be split into two; changes in combat being temporary, and changes in simulations being persistent for example. Though that's another thing. A button to use in-combat to save the temporary changes would go alongside this nicely.

Using the GUI to apply/revert combat changes could also be an option in the GUI; it'd go alongside the persistent/temporary in-combat change setting in the options file. The separator option (is it used for something, by the way?) on 4 for example, if the ship in question had an in-combat change, it can say 'Apply settings from last combat' and when you press it, it can turn into 'Revert changes from last combat'. It is grayed out otherwise. It's a simplified version of Book A/B, per ship, and only appears (not grayed-out) if there's a change.

Anyway, all in all, I'd say the easiest solution might be the best. You can use that time to enjoy the game / do other things instead of making something that might be used by just a handful. I mean I can always try to remember changing stuff back after a battle =)
In theory, you can pretty much build a custom GUI in whichever way you want. As soon as you deviate too much from what Starsector intended, you are firmly in manual OpenGL-territory, which gets very messy & complicated very quickly xD My custom GUI is mostly default Starsector with just a sprinkling of custom OpenGL stuff. Implementing the kind of GUI that conveniently & intuitively displays the content of two different books would put it into 90% custom OpenGL mode, which is probably a bad idea^^

So I think I agree with your assessment, that the first option alongside a "persist changes"-hotkey is probably the cleanest way to do things (and should be easy enough to implement). I don't even think it's necessary to differentiate between simulation/combat, since you can always press the "persist changes"-hotkey when you want to set stuff up in simulation.

Update:
If anyone is interested, my current roadmap looks something like this:
First, I want to implement a couple QoL-improvements and requested features, such as the ones discussed in this post and maybe the option to apply suggested modes to enemy ships (disabled by default, as this is a bit gimmicky, but has been requested via Discord) and playtest a little more.

After that, I want to start working on a 1.0-version, which will probably change quite a few things. Currently, my plans for 1.0 are roughly:

As this will require re-writing large parts of the mod, don't get your hopes up that this will happen anytime soon, though...
I might occasionally put out a work-in-progress build in case anyone wants to help with testing, but I most likely won't be paying much attention to feature-requests etc. until I'm done.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: lyravega on January 31, 2022, 05:27:34 AM
I think I found a decent solution for this one. The whole code for the GUI was getting a bit messy, since I just kept on slapping on more options, so I did a lot of refactoring. Now, by default, only the current ship is affected. If you hold shift, the whole fleet is affected and if you hold control, all loadouts are affected. I might try to add a confirmation dialogue to whole-fleet options, though. I'll put out a new pre-release soon (TM) to get some feedback on this.
Seems pretty straightforward, and will reduce the clutter I'm sure.

Also, I don't think it's really necessary to restrict it to missile weapons. There are some missile weapons (e.g. the [REDACTED] antimatter missiles) that generate lots of flux and some non-missile weapons that barely generate any flux.

Would you still be interested in this suffix, even if it only works if you also enable the ForceAutofire(SuffixOnly) ShipMode?
It's not much of a big deal to be honest. I thought forcing autofire per weapon group could be possible, if it's crashing the game, not really necessary :D

In theory, you can pretty much build a custom GUI in whichever way you want. As soon as you deviate too much from what Starsector intended, you are firmly in manual OpenGL-territory, which gets very messy & complicated very quickly xD My custom GUI is mostly default Starsector with just a sprinkling of custom OpenGL stuff. Implementing the kind of GUI that conveniently & intuitively displays the content of two different books would put it into 90% custom OpenGL mode, which is probably a bad idea^^

So I think I agree with your assessment, that the first option alongside a "persist changes"-hotkey is probably the cleanest way to do things (and should be easy enough to implement). I don't even think it's necessary to differentiate between simulation/combat, since you can always press the "persist changes"-hotkey when you want to set stuff up in simulation.

Update:
If anyone is interested, my current roadmap looks something like this:
First, I want to implement a couple QoL-improvements and requested features, such as the ones discussed in this post and maybe the option to apply suggested modes to enemy ships (disabled by default, as this is a bit gimmicky, but has been requested via Discord) and playtest a little more.

After that, I want to start working on a 1.0-version, which will probably change quite a few things. Currently, my plans for 1.0 are roughly:
  • Replace the GUI with a refit-screen integration. Not yet 100% sure how/if this will work.
  • Replace weapon group modes and suffixes with modular tags. So, rather than e.g. setting a group (with HE weapons) to Opportunist with a HoldFire(Flux>75%) suffix, you'd e.g. assign the AvoidShields, Conservative, HoldFire(Flux>Threshold) and Threshold=75% tags or so. I still need to come up with a good control scheme to make this work in combat, though. My current best idea is: You can (either in settings.editme or in a special GUI) define presets (i.e. collections of tags) which you can cycle through in combat the same way you can currently cycle weapon groups. Alternatively, since 0.95 it might actually be possible to make a GUI show up in combat? Not sure though^^

As this will require re-writing large parts of the mod, don't get your hopes up that this will happen anytime soon, though...
I might occasionally put out a work-in-progress build in case anyone wants to help with testing, but I most likely won't be paying much attention to feature-requests etc. until I'm done.

Yeah, the manual OpenGL territory is the scary part; it'll look out of game for the most part, and if you can make it look a part of the game, you should release it as a GUI library instead for all to benefit to be honest :D The roadmap looks nice. I'm not sure what you mean by making a GUI showing up in combat though. A GUI to adjust stuff in-combat, or a redesigned info-box of some sorts?
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: lyravega on February 04, 2022, 11:13:19 AM
Heh, while going through some modding stuff myself, I noticed this for the Breach SRM: "CONSERVE_ALL, CONSERVE_FOR_ANTI_ARMOR". These two tags kinda makes the AI never use these I think! :D Wanted to mention it due to the latest chatter about forceAutofire
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on February 05, 2022, 04:25:33 AM
0.13.1 is out (https://github.com/DesperatePeter/starsector-advanced-weapon-control/releases/tag/0.13.1)!
It refactors the GUI dialogue options such that you can control whether a single ship or the whole fleet as well as the current loadout or all loadouts shall be affected by holding shift/ctrl when choosing an option. It also adds the requested setting to disable persistence of changes made in combat (alongside a hotkey to manually save the modes for the current ship).

Heh, while going through some modding stuff myself, I noticed this for the Breach SRM: "CONSERVE_ALL, CONSERVE_FOR_ANTI_ARMOR". These two tags kinda makes the AI never use these I think! :D Wanted to mention it due to the latest chatter about forceAutofire
Ahh, that probably explains why the AI is so conservative in using them^^ So probably all you need to do to fix this is remove these tags from weapon_data.csv for breach SRM pods?
That seems like a much cleaner way of solving this issue indeed.

It's not much of a big deal to be honest. I thought forcing autofire per weapon group could be possible, if it's crashing the game, not really necessary :D
I still think the idea is nice, I'll try to keep it in mind when doing the big refactoring I'm planning^^ It just doesn't make sense to try to "hack" it into the code in its current state.

Quote
Yeah, the manual OpenGL territory is the scary part; it'll look out of game for the most part, and if you can make it look a part of the game, you should release it as a GUI library instead for all to benefit to be honest :D The roadmap looks nice. I'm not sure what you mean by making a GUI showing up in combat though. A GUI to adjust stuff in-combat, or a redesigned info-box of some sorts?
To be perfectly honest, I don't know for sure, either. I'll have to have a look into what's possible. In a perfect world, I'd be able to simply open a GUI letting you configure everything while in combat. But I'm not really sure if it's possible at all to open a GUI in combat without being a major hassle. =/

I'll probably have to do quite a bit of experimentation, in general, to see what is reasonably possible and what isn't. Also, due to "historical" reasons, the way things work in the GUI and in combat are entirely different. If possible, I want to also unify things to work the same way in both layers, at which time implementing the "load suggested modes for enemies"-feature should become nigh-trivial.

All this will probably be a lot of work with relatively little to show for, but when looking through my code base it seems to be desperately needed in order to facilitate future development of the mod.

Anyhow, as always, thanks for all the suggestions and feedback. As mentioned before, there probably won't be any new releases (except for hotfixes) within the next couple weeks/months, but I might try to keep you guys updated on my current progress.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: BreenBB on February 05, 2022, 06:04:43 AM
Intersting, its possible to add option to override ships aggressiveness for ships with AI cores? This will useful for using SWP Remnant Carrier things and Blade Breaker recoverable ships, since that "Fearless" makes them not retreat at all when they have maxed hard flux, I'd liked to have option to change their personality to aggressive or steady instead. That guy who updated automated commands refused to make Personality Override hullmods affect AI cores which counts as officers but you can't change their personality.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on February 06, 2022, 08:13:42 AM
Intersting, its possible to add option to override ships aggressiveness for ships with AI cores? This will useful for using SWP Remnant Carrier things and Blade Breaker recoverable ships, since that "Fearless" makes them not retreat at all when they have maxed hard flux, I'd liked to have option to change their personality to aggressive or steady instead. That guy who updated automated commands refused to make Personality Override hullmods affect AI cores which counts as officers but you can't change their personality.
Hi!
Sorry to disappoint you, but I'm afraid I'm also not really interested in adding that feature, at least not currently =/

First of all, I feel like the fact that automated ships are always fearless/reckless is very much a design choice and kind of important for game balance. If you could have your Radiants be aggressive/steady it would be a lot easier to build a fleet around them.

Secondly, this mod only changes how weapon/ship AI behaves while not actually changing any ship/weapon tags/data. Having a ship mode that actually swaps out tags would probably have weird unintended side-effects.

I believe you could try to simply edit data/characters/personalities.csv and replace all the numbers under reckless with the numbers from e.g. aggressive (not 100% sure if this will actually work).

On the topic of combat GUIs:
I played around a little bit and I think that an in-combat GUI should be possible. Here's a very basic proof of concept:
Combat GUI Mockup (https://youtu.be/C7P4BoHewBw)

I also released 0.13.2, but it's only some minor fixes and cleanup, so there's no real reason to update.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: lyravega on February 06, 2022, 12:29:12 PM
On the topic of combat GUIs:
I played around a little bit and I think that an in-combat GUI should be possible. Here's a very basic proof of concept:
Combat GUI Mockup (https://youtu.be/C7P4BoHewBw)

I also released 0.13.2, but it's only some minor fixes and cleanup, so there's no real reason to update.

Nice!
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on February 23, 2022, 11:14:27 AM
So, I've got a basic version of the tag-based in-combat GUI working.

In-combat GUI (https://youtu.be/1jl5Y7gtm2I)

There's still a lot of polish & cleanup to do, so don't expect a new release anytime soon (especially given the fact that Elden Ring will come out in two days :P). But I still thought I'd share my progress with anyone interested.
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: lyravega on February 23, 2022, 11:40:37 PM
So, I've got a basic version of the tag-based in-combat GUI working.

In-combat GUI (https://youtu.be/1jl5Y7gtm2I)

There's still a lot of polish & cleanup to do, so don't expect a new release anytime soon (especially given the fact that Elden Ring will come out in two days :P). But I still thought I'd share my progress with anyone interested.

Crap, I haven't even played God of War yet... also, UI looks very nice; instead of going through lists one by one, clicking them would be super-easier =)
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: kaedys on April 20, 2022, 11:03:13 AM
Seems to be rather finicky about what it considers to be the "same variant".  The order the mods are applied seems to matter, which isn't usually an issue, but starts to become one with jullmods that are automatically applied by game mods.  For example, Commissioned Crews auto-applies mods based on your faction commission (and potentially alliances) that can break it being considered a "same variant", even if that mod is included in the saved variant, if it's in a different "slot" in the mod ordering.  In addition, and more painfully, the order of S-mods appears to be relevant as well.  I've not yet determined if it's the order the mods were added before being built in, or the order they were built in, but the S-mod order is apparently strict.  The hullmod block always displays the S-mods in alphabetical order, but the variant window displays them in their proper order, seemingly, and only hulls that had them added (or built-in, whichever it is) in that order "count".

Is there a way you could loosen up that restriction at all?  Or failing that, add an additional dialogue or modifier key to apply the specified settings to all ships of that hull type, regardless of the inferred variant?  I tend to run just a single fit per hull type in most cases, so regardless of what variant the mod or game thinks they are, they are fundamentally the same build.  And it's rather a pain going through each of those hulls and assigning the settings (especially since I'm running Fleet Size By DP and am running a fleet composed in large part of destroyers and frigates, so a fair number of hulls to apply the settings to).
Title: Re: [0.95.1a] AdvancedGunneryControl 0.13.0
Post by: DesperatePeter on April 24, 2022, 11:06:41 PM
Seems to be rather finicky about what it considers to be the "same variant".  The order the mods are applied seems to matter, which isn't usually an issue, but starts to become one with jullmods that are automatically applied by game mods.  For example, Commissioned Crews auto-applies mods based on your faction commission (and potentially alliances) that can break it being considered a "same variant", even if that mod is included in the saved variant, if it's in a different "slot" in the mod ordering.  In addition, and more painfully, the order of S-mods appears to be relevant as well.  I've not yet determined if it's the order the mods were added before being built in, or the order they were built in, but the S-mod order is apparently strict.  The hullmod block always displays the S-mods in alphabetical order, but the variant window displays them in their proper order, seemingly, and only hulls that had them added (or built-in, whichever it is) in that order "count".

Is there a way you could loosen up that restriction at all?  Or failing that, add an additional dialogue or modifier key to apply the specified settings to all ships of that hull type, regardless of the inferred variant?  I tend to run just a single fit per hull type in most cases, so regardless of what variant the mod or game thinks they are, they are fundamentally the same build.  And it's rather a pain going through each of those hulls and assigning the settings (especially since I'm running Fleet Size By DP and am running a fleet composed in large part of destroyers and frigates, so a fair number of hulls to apply the settings to).

Hi!

Thanks for the feedback!
About variant detection: Unfortunately, I simply use the Starsector API for determining variants (i.e. I didn't actually write any code to do this myself, it's Alex's code). My understanding is that it should work as long as you are using autofit, but I could see how some stuff like built-in S-mods or hullmods from other mods could break this =/

But once I finally get around to finishing my overhaul of the mod, I'll try to include a "apply to all ships of the same hull-type" option =)