Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

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

Pages: [1] 2 3 ... 21

Author Topic: [0.97a] AdvancedGunneryControl 1.17.0 - Updated for 0.97a  (Read 173996 times)

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
[0.97a] AdvancedGunneryControl 1.17.0 - Updated for 0.97a
« on: April 25, 2021, 06:01:33 AM »

AdvancedGunneryControl 1.17.0
Customize weapon behavior on auto-fire

(Requires LazyLib)
(Requires MagicLib)
(LunaLib required for access to LunaSettings)


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!



Features
  • Apply one or more tags for each weapon group to customize their behavior on auto-fire
  • Many tags, such as targeting or avoiding shields, PD mode and many many more
  • GUI-based configuration in combat, refit screen or on the campaign map
  • Tags are automatically saved between combats and reloads
  • Seamlessly switch between simple mode (6 tags) and advanced mode (over 20 tags)
  • Customize AI-controlled ship behavior through ship modes
  • Create your own default tags with the option to automatically apply them
  • Customize most aspects of the mod through an extensive settings file
  • Can be safely added to/updated/removed from ongoing campaigns
[close]



Latest changes: AI Improvements, Update for 0.97a, LunaSettings integration (overrides Settings.editme when LunaLib is present. Visit the Tag tab to select a tag list!), Tag Storage modes for easier tag automation, new ship modes KeepAway/FarAway

Quick instructions:
  • Unzip the archive in your Starsector/mods folder
  • Play the game and press the "J"-Key during combat or on the campaign map or refit screen to open a GUI
  • In combat, target an ally or ship module(R-Key) beforehand to adjust their modes
  • (optional) In the campaign GUI, use the last option to access a GUI to set up custom/automated tags
  • (optional) edit Starsector/mods/AdvancedGunneryControl/Settings.editme to add/remove tags, customize mod behaviour etc.



FAQ
Do weapon mode tags apply to AI-controlled ships?
Yes. Do note, however, that weapon mode tags only affect weapon groups that are set to auto-fire. The AI will often decide to "manually" control some of the weapon groups, especially missiles.

Can I somehow make the AI obey tags for those groups?
Yes. To do so, apply the ForceAF tag to the weapon group(s) that you want to enforce tags for. This will force the ShipAI to set those weapon groups to auto-fire mode. Do note, however, that this might have undesired side-effects. When the AI chooses to e.g. manually control missiles, there is a reason for that: Conserving ammo. So when you decide to set a weapon group to ForceAF, it is recommended to use additional tags to ensure that the ship doesn't simply constantly fire that weapon group at any available targets.

Can't you simply implement tags in such a way that they also affect weapon groups that are not set to auto-fire?
That might theoretically be possible, but I don't have any plans to actually implement such logic. Such logic would have to heavily interact with the ShipAI, as the ShipAI makes decisions regarding "manually" controlled weapon groups. This would most likely bet tons of work, get very messy, would require completely different logic for manually controlled and autofire weapon groups and trying to implement this generally sounds like a bad idea. If you really want this feature, happen to know Kotlin and are feeling a bit masochistic, you are more than welcome to try to implement it and open a PR. I will even try to support you, if you ask nicely.

Ship Modes and the ForceAF-tag don't seem to work for the player-controlled ship.
This is not a question, but still correct. Ship modes and the ForceAF-tag modify the ShipAI and hence don't work for ships that don't have a ShipAI, namely the player ship.

Did you essentially split one large question into multiple small questions in order to justify adding a FAQ-section?
That's a baseless accusation!

Are modules (i.e. separate sections of giant ships found in some mods) supported by this mod?
Since 1.8.0 modules are fully supported in the combat-GUI. They are not selectable in the campaign GUI, since they are not a ship in your fleet.

Have these questions actually been asked frequently, or did you just make them up?
While I did indeed make up these questions with this exact structure and wording, questions about how tags, autofire-mode and ship modes work and interact with each other have been asked quite frequently in this thread, on Discord and even on Youtube.

Does your mod use semantic versioning?
To be honest, not really. I originally intended to use semantic versioning, but then I realized that there are simply too many different types of compatibility (Starsector version, library versions, persistent data). Therefore, I only increment the major version when an update comes out that renders the configured tags/modes from a previous version unusable. So far, that only happened once, when I switched from a mode/suffix scheme for weapon modes to a tag-system.

Can you add some sort of fighter controls to the mod?
No. That is simply beyond the scope of this mod. It's called advanced gunnery control after all. I know, by that definition, ship modes are beyond the scope of this mod too, but I really needed to add ship modes for the ForceAutofire ship mode, so I thought I might as well add ship modes. Maybe I (or someone else) will create a mode like "Wing Commander" in the future?

How do automatic/suggested tags work when there are different weapon types in the same group?
To be honest, it's kind of arbitrary. The first weapon in the weapon group gets chosen to determine which tags to apply. I could maybe add a setting to let the player decide what should happen in this case (apply no tags, combine tags for all weapons or use the first weapon), but so far nobody has complained, so I kind of assume that the current logic mostly works. People don't tend to put radically different weapons in the same group.
[close]


AGC in 60 seconds
video
[close]
In-depth explanation video
video
[close]

Mod integration for mod authors
You can blacklist weapons to prevent my mod from messing with their autofire AI.
You can add suggested tags that players can quickly apply to their weapon groups in the campaign GUI. Feel free to use the GUI to customize suggested tags (accessible via campaign GUI) to generate them and use the Backup feature to write them to a file.
You can have AGC add tags to enemy ships via custom ship data entries, to e.g. force your big bad missile spam boss to actually shoot its missiles.
You can use the AGC combatgui lib to easily create your own combat GUIs. Note: Jar-path has changed since 1.6.0
For details: Documentation
[close]


Contributors
  • Thanks to Seanra for contributing the option to ignore fighter shields and the PrioritisePD, TgtShieldsFT, AvdShieldsFT and ConservePDAmmo tags!
  • Thanks to Genir for fixing an issue with weapon aiming! Also many thanks for tons of refactoring work and small improvements!
[close]

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

Happy modding & gaming together!
« Last Edit: March 14, 2024, 09:19:14 AM by DesperatePeter »
Logged

ModdedLaharl

  • Ensign
  • *
  • Posts: 37
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #1 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.
Logged

Harpuea

  • Lieutenant
  • **
  • Posts: 58
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #2 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
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #3 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^^

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #4 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.

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #5 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:
  • 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)

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^^

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #6 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)

Dark.Revenant

  • Admiral
  • *****
  • Posts: 2806
    • View Profile
    • Sc2Mafia
Re: [0.95a] AdvancedGunneryControl 0.1.0
« Reply #7 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
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.2.0
« Reply #8 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!

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.2.0
« Reply #9 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.
« Last Edit: April 29, 2021, 01:15:06 PM by DesperatePeter »
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.3.0
« Reply #10 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.

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.4.1
« Reply #11 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.

Harpuea

  • Lieutenant
  • **
  • Posts: 58
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.4.1
« Reply #12 on: April 30, 2021, 06:17:24 PM »

Wow. That was fast. I'll test it out as I play.
Logged

Vulpis

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.4.1
« Reply #13 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?
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: [0.95a] AdvancedGunneryControl 0.4.1
« Reply #14 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!
« Last Edit: May 01, 2021, 01:56:44 PM by DesperatePeter »
Logged
Pages: [1] 2 3 ... 21