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):
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
PS: I think I might also rename Opportunist mode xD Maybe something like "Conservative" would be a better name.