[MOD] BetterTurrets. Updated 20.12.2014
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Wanted to post my follow-up to the report I made in the Captain AI Overhaul thread here because it really involves the Better Turrets mod rather than the Captain AI Overhaul which is working well.
I managed to recover the save that I had immediately before the incident I outlined regarding the Sucellus attacking a Titurel and using only the Plasma cannons without using the IHC.
Immediately before command to attack is given, Defence Officer status reads:
Defending
Defending
Standing By
After command to attack is given, status reads:
Defending
Attack Enemies
Attacking
Reloading the save after disabling Better Turrets and restarting X Rebirth has the Sucellus using IHC as expected after the command to attack is given.
With Better Turrets active, found that the line "Attack Enemies" [Ship -> Details -> DO -> Details] is indeed switchable, and clicking change switches the status to:
Attacking Enemies
Attack Enemies
Attacking
but there is no noticeable difference in behavior. That is, the Sucellus is still not firing IHC.
Aha! Switching DO behavior to "Attacking" BEFORE issuing the command to attack does lead to the Sucellus firing the IHC. Is this working as intended?
I managed to recover the save that I had immediately before the incident I outlined regarding the Sucellus attacking a Titurel and using only the Plasma cannons without using the IHC.
Immediately before command to attack is given, Defence Officer status reads:
Defending
Defending
Standing By
After command to attack is given, status reads:
Defending
Attack Enemies
Attacking
Reloading the save after disabling Better Turrets and restarting X Rebirth has the Sucellus using IHC as expected after the command to attack is given.
With Better Turrets active, found that the line "Attack Enemies" [Ship -> Details -> DO -> Details] is indeed switchable, and clicking change switches the status to:
Attacking Enemies
Attack Enemies
Attacking
but there is no noticeable difference in behavior. That is, the Sucellus is still not firing IHC.
Aha! Switching DO behavior to "Attacking" BEFORE issuing the command to attack does lead to the Sucellus firing the IHC. Is this working as intended?
-
- Posts: 54
- Joined: Sun, 1. Jan 06, 12:17
Great piece of work, much appreciated, keep up the good work !cicero111 wrote:Hi, just a shameless plug for my new WIP mod:
http://forum.egosoft.com/viewtopic.php? ... 15#4457015
Decided to rewrite that captain AI code from scratch - take it for a spin and give me some feedback in that thread
One question: Can we use both of your mods at the same time (Captain AI AND BetterTurrets) ?
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Sorry, my mistake. Should've read the whole thread in more detail before I put my foot in my mouth -- doable in a thread three pages long. So, working as intended.
Question though. I switched to Better Turrets after I started my campaign, so I don't know if "Attacking" or "Defending" is set as default behavior for player-owned ships in a new campaign started with the mod already installed. After switching though, all of my ships are set to defensive behavior unless manually set to offensive.
If I understand correctly, this means that my non-combatant ships will only fire at particular surface targets (primarily weapons and engines), and will NOT fire at hulls unless set to offensive. Is that right?
Would it be correct to gather that offensive behavior would be a preferable default though, with defensive behavior only useful for capping support?
If not, is there any particular reason I would want my freighters and stations to only target weapons and engines, and not shoot at hulls, in the event that they're attacked?
Question though. I switched to Better Turrets after I started my campaign, so I don't know if "Attacking" or "Defending" is set as default behavior for player-owned ships in a new campaign started with the mod already installed. After switching though, all of my ships are set to defensive behavior unless manually set to offensive.
If I understand correctly, this means that my non-combatant ships will only fire at particular surface targets (primarily weapons and engines), and will NOT fire at hulls unless set to offensive. Is that right?
Would it be correct to gather that offensive behavior would be a preferable default though, with defensive behavior only useful for capping support?
If not, is there any particular reason I would want my freighters and stations to only target weapons and engines, and not shoot at hulls, in the event that they're attacked?
-
- Posts: 108
- Joined: Sat, 13. Aug 11, 14:30
@w.evans
Nice to se the Sucellus is firing as it should
"Defending" is the default state of most DO's - this mod does not change the DO states at all, but only checks what the ship DO state is when building target lists. For NPC ships i added that they ignore DO state and always use "agressive mode" no matter what.
Also important is that this mod only has "in zone code", OOZ combat calculations is running vanilla code.
So - a defensive playerowned DO in the same zone as the player will try to disarm and immobilize the target (also if attacked). Small ships are swatted as usual no matter the DO state of course, its only for L/XL/station targets where it matters.
Edit: And have to add, this mod only changes what the capship DO does, station DO's are not changed by this one but the code might be reusable.
@LUBEggA
Thanks
This one will work nicely with captain AI overhaul mod, I'm using BT mod in my testing of that one 
Nice to se the Sucellus is firing as it should

"Defending" is the default state of most DO's - this mod does not change the DO states at all, but only checks what the ship DO state is when building target lists. For NPC ships i added that they ignore DO state and always use "agressive mode" no matter what.
Also important is that this mod only has "in zone code", OOZ combat calculations is running vanilla code.
So - a defensive playerowned DO in the same zone as the player will try to disarm and immobilize the target (also if attacked). Small ships are swatted as usual no matter the DO state of course, its only for L/XL/station targets where it matters.
Edit: And have to add, this mod only changes what the capship DO does, station DO's are not changed by this one but the code might be reusable.
@LUBEggA
Thanks


-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Defense Officers will always have defensive behavior on by default regardless of whether or not the campaign was started with the mod installed. Got that, thanks.
Is there a particular reason why that behavior is default though? It seems like it would only be useful as capping support. So if I had, for example, a freighter with a Defense Officer who sucked, and that freighter were attacked while I was in-system, there would theoretically be a chance that he won't detect any surface elements and simply not fire, wouldn't there?
I do understand that defense mode is the default as set by the base game (haven't checked to see if DO behavior is switchable in vanilla v3.0 b5 by the way, or what that might do), and I don't mind manually switching everyone over to offensive so that any half-blind drunk DOs would at least fire at something when engaged; but I was just wondering if there was any particular reasoning at work that I might have missed.
Is there a particular reason why that behavior is default though? It seems like it would only be useful as capping support. So if I had, for example, a freighter with a Defense Officer who sucked, and that freighter were attacked while I was in-system, there would theoretically be a chance that he won't detect any surface elements and simply not fire, wouldn't there?
I do understand that defense mode is the default as set by the base game (haven't checked to see if DO behavior is switchable in vanilla v3.0 b5 by the way, or what that might do), and I don't mind manually switching everyone over to offensive so that any half-blind drunk DOs would at least fire at something when engaged; but I was just wondering if there was any particular reasoning at work that I might have missed.
-
- Posts: 108
- Joined: Sat, 13. Aug 11, 14:30
Can't remember if DO's have been switchable since release, but have been since 2.0 atleast and still is in 3.0b5. I'm just using the flag since - well as you say, is not much game mechanic in there other than making them more trigger happy when flying nearby a enemy ship and firing at before being fired upon.
With explicit attack target or have been fired upon it DO state does not really matter in vanilla iirc.
So - it was a very convenient switch to use since did not have to make new UI stuff, but what would be nice is to make the mode switchable by hotkey - fumbling into those nested menus to switch states while in battle have killed me more than once
Also a global ignore target (similar as the X3 MARS) is something I'm looking at, that one has to be combined with captain AI though. Easy to do in AI code - hotkey/UI stuff, not so much - still have a lot of research todo there.
Edit: And yes, a really crappy defensive DO on playerowned ship who did detect the ship but not any surface elements will actually just idle since they are not allowed to fire at hull. There is also a slim possibility a 0 star DO will not even detect the ship/station at all (skill bonuses is recalculated for each object at each target check interval).
With explicit attack target or have been fired upon it DO state does not really matter in vanilla iirc.
So - it was a very convenient switch to use since did not have to make new UI stuff, but what would be nice is to make the mode switchable by hotkey - fumbling into those nested menus to switch states while in battle have killed me more than once

Also a global ignore target (similar as the X3 MARS) is something I'm looking at, that one has to be combined with captain AI though. Easy to do in AI code - hotkey/UI stuff, not so much - still have a lot of research todo there.
Edit: And yes, a really crappy defensive DO on playerowned ship who did detect the ship but not any surface elements will actually just idle since they are not allowed to fire at hull. There is also a slim possibility a 0 star DO will not even detect the ship/station at all (skill bonuses is recalculated for each object at each target check interval).
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Cool! Makes it valuable to actually hire decent crew.
Switching my whole fleet to offensive mode, then selective defensive when capping then.
Another odd thing though, I had my Sucellus squadron (now with two Taranis in addition to the earlier two Stromvoks) escort me, all in defensive mode, to try and help cap a Light Sul, and they almost blew it up. No command to attack this time, just had them follow me as I got in close to blow up the Jump Drive and Engines. Plasma missing the surface elements and hitting the hull? Splash damage? All five ships have 5,5,5 DOs as well as 5,5,5 Captains. (Or close to that, might be a couple of fours in there.)
And thanks a lot for your work. Having a blast!
Switching my whole fleet to offensive mode, then selective defensive when capping then.
Another odd thing though, I had my Sucellus squadron (now with two Taranis in addition to the earlier two Stromvoks) escort me, all in defensive mode, to try and help cap a Light Sul, and they almost blew it up. No command to attack this time, just had them follow me as I got in close to blow up the Jump Drive and Engines. Plasma missing the surface elements and hitting the hull? Splash damage? All five ships have 5,5,5 DOs as well as 5,5,5 Captains. (Or close to that, might be a couple of fours in there.)
And thanks a lot for your work. Having a blast!
-
- Posts: 108
- Joined: Sat, 13. Aug 11, 14:30
Yeah - they will try to focus fire and only hit those surface elements but they do miss sometimes
Both splash damage, turret inaccuracy on long range + slow moving "bullets" toward moving/rotating target, and if low angle they might damage the hull with some of the shots.
Glad you found the mod useful - AI coding on this engine is a fun little "metagame" on its own, so if you have any ideas for improvements please let me know

Both splash damage, turret inaccuracy on long range + slow moving "bullets" toward moving/rotating target, and if low angle they might damage the hull with some of the shots.
Glad you found the mod useful - AI coding on this engine is a fun little "metagame" on its own, so if you have any ideas for improvements please let me know

-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Everything seems to be working fine, once you know how everything works, and how everything's supposed to work!
Only thing I could think of at the moment has to do with defensive behavior being active by default. Would be more convenient if offensive behavior were default, but then "defensive" wouldn't really be accurate anymore since it's more of a "support" mode than anything.
Three modes would seem to be ideal: an offensive mode behaving the way it does now, a support mode behaving the way "defensive" works now (although aggressively targeting anything within range while only targeting their surface elements might be marginally better), and a defensive "lie low" mode for freighters and such which would try and avoid attracting attention by NOT firing at anything unless fired upon first.
Although I do understand that changing anything above would entail touching the UI, and that aside from being beyond the scope of this mod, it would have the potential to cause more compatibility issues.
But yeah, using the new external camera to watch a Taranis' turrets and engines being picked apart by two Taranis and two Stromvoks while a Sucellus bangs away from range is way cool.
Oh, and a lesson learned: The Sucellus sucks at OOZ, but is awesome IZ. I now have three Sucellus with two Stromvoks for point defense on my squadron. The Taranis and the other Stromvoks are patrolling OOZ at Twilight Sentinel where I can conveniently pull them to my squadron for capping duty when I'm IZ.
Planning on heading into Albion next to cap or wreck PMC mining ships. Would be interesting to see if that'll drive up the prices of minerals thereby making a market for my mining fleet. And all before opening up Omicron Lyrae!
Only thing I could think of at the moment has to do with defensive behavior being active by default. Would be more convenient if offensive behavior were default, but then "defensive" wouldn't really be accurate anymore since it's more of a "support" mode than anything.
Three modes would seem to be ideal: an offensive mode behaving the way it does now, a support mode behaving the way "defensive" works now (although aggressively targeting anything within range while only targeting their surface elements might be marginally better), and a defensive "lie low" mode for freighters and such which would try and avoid attracting attention by NOT firing at anything unless fired upon first.
Although I do understand that changing anything above would entail touching the UI, and that aside from being beyond the scope of this mod, it would have the potential to cause more compatibility issues.
But yeah, using the new external camera to watch a Taranis' turrets and engines being picked apart by two Taranis and two Stromvoks while a Sucellus bangs away from range is way cool.
Oh, and a lesson learned: The Sucellus sucks at OOZ, but is awesome IZ. I now have three Sucellus with two Stromvoks for point defense on my squadron. The Taranis and the other Stromvoks are patrolling OOZ at Twilight Sentinel where I can conveniently pull them to my squadron for capping duty when I'm IZ.
Planning on heading into Albion next to cap or wreck PMC mining ships. Would be interesting to see if that'll drive up the prices of minerals thereby making a market for my mining fleet. And all before opening up Omicron Lyrae!
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Would it be possible to have escort ships' DO modes follow that of the ship that they're following? So in my Sucellus with two Taranis squadron example, one would have to change the DO mode of just the Sucellus, and the modes of the two Taranis would follow suit? Would be a lot easier to switch modes of a whole squadron on the fly immediately before engaging.
Although admittedly, having to decide between obliterate and capture when a target's 30+ km away adds an element of strategy to it. But it gets tedious having to do it for 3-5 ships every engagement, as you've probably experienced.
Although admittedly, having to decide between obliterate and capture when a target's 30+ km away adds an element of strategy to it. But it gets tedious having to do it for 3-5 ships every engagement, as you've probably experienced.
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Quick bug report. Not sure if it has something to do with this mod, but thought I'd report it here since Better Turrets has some drone deployment functionality.
Was hanging out near the Shipyard at Zone Darned Hot Air when one of my Titurels (automated via Yorrick's Yet Another Trader) jumped in and proceeded to dock with the Shipyard to trade. I then noticed the Titurel trickling Interceptor drones, which it kept deploying through the docking procedure, trading, undocking, and jumping out. The Titurel did not wait for the drones before jumping out, and other than the drones deploying, it proceeded as in any other trade run. Also important: there were no hostiles in zone whatsoever.
Only reason I could think of is that the Titurel might have been engaged by hostiles right out of zone right before he jumped in, or even while he was boosting from Zone Fervid Corona, and that some drone deployment switch were activated, and not switched off. In case of out of zone deployment, that wouldn't have been activated by Better Turrets, would it? Because Better Turrets doesn't have OOZ functionality? But could Better Turrets then have kicked in as the Titurel moved in zone, thereby interfering with the deactivation of drone deployment?
Also perhaps relevant: the drones were deployed organized into wings of 3 (could have been groups of 4 or more, but I counted at least one group of three) interceptor drones, but are then just sitting there doing nothing. The Titurel has since jumped on out of zone.
Was hanging out near the Shipyard at Zone Darned Hot Air when one of my Titurels (automated via Yorrick's Yet Another Trader) jumped in and proceeded to dock with the Shipyard to trade. I then noticed the Titurel trickling Interceptor drones, which it kept deploying through the docking procedure, trading, undocking, and jumping out. The Titurel did not wait for the drones before jumping out, and other than the drones deploying, it proceeded as in any other trade run. Also important: there were no hostiles in zone whatsoever.
Only reason I could think of is that the Titurel might have been engaged by hostiles right out of zone right before he jumped in, or even while he was boosting from Zone Fervid Corona, and that some drone deployment switch were activated, and not switched off. In case of out of zone deployment, that wouldn't have been activated by Better Turrets, would it? Because Better Turrets doesn't have OOZ functionality? But could Better Turrets then have kicked in as the Titurel moved in zone, thereby interfering with the deactivation of drone deployment?
Also perhaps relevant: the drones were deployed organized into wings of 3 (could have been groups of 4 or more, but I counted at least one group of three) interceptor drones, but are then just sitting there doing nothing. The Titurel has since jumped on out of zone.
-
- Posts: 108
- Joined: Sat, 13. Aug 11, 14:30
I agree the Sucellus is close to OP IZ now that it manages to point that gun the right way. Had a plan to buy more of them and test with 5 sucellus wingmen - could be fun.
Have been thinking about doing some balancing in the OOS calculations (they are a bit simplistic..), but balancing those in an iterative retest process seems like an excruciating boring task, so are hoping Ego will do some fixing there for now
Agree setting each wingman DO state is a bit tedoius - having wingmen check and adapt leader ship's DO state is a really good idea, and might be doable without introducing new UI stuff actually. I'll look into that
Interesting bugreport about those drones. Haven't changed much about them from vanilla code except stopping them pursuing small targets beyond 3KM, but have not added rangecheck for L/XL. Think your theory is right there about hostiles OOZ before jumping in, no other reason they should be launched.
I'll add a sanity check/max range for L/XL targets as well, should stop that one from happening.
The wing size of drones depends both on DO skill + ship size. L ships have half as many in each wing as XL's (the suls is an exception from that rule).
..and yes, the vanilla drone follower/leader AI attack scripts could do some work, have looked in there but not poked anything at that code yet.
Lot's of good ideas there - thanks
Have been thinking about doing some balancing in the OOS calculations (they are a bit simplistic..), but balancing those in an iterative retest process seems like an excruciating boring task, so are hoping Ego will do some fixing there for now

Agree setting each wingman DO state is a bit tedoius - having wingmen check and adapt leader ship's DO state is a really good idea, and might be doable without introducing new UI stuff actually. I'll look into that

Interesting bugreport about those drones. Haven't changed much about them from vanilla code except stopping them pursuing small targets beyond 3KM, but have not added rangecheck for L/XL. Think your theory is right there about hostiles OOZ before jumping in, no other reason they should be launched.
I'll add a sanity check/max range for L/XL targets as well, should stop that one from happening.
The wing size of drones depends both on DO skill + ship size. L ships have half as many in each wing as XL's (the suls is an exception from that rule).
..and yes, the vanilla drone follower/leader AI attack scripts could do some work, have looked in there but not poked anything at that code yet.
Lot's of good ideas there - thanks

-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Glad to help. Especially since helping in this case might eventually translate to more fun for me!
Giving it a rest though since the last two beta updates are incompatible with a bunch of mods. NOT complaining, the changelogs seem to indicate a much better game shaping up. Figuring that I'll have to restart the campaign once the Teladi DLC is installed anyway. Will miss my 9 Titurels though.
Giving it a rest though since the last two beta updates are incompatible with a bunch of mods. NOT complaining, the changelogs seem to indicate a much better game shaping up. Figuring that I'll have to restart the campaign once the Teladi DLC is installed anyway. Will miss my 9 Titurels though.
-
- Posts: 3769
- Joined: Mon, 1. Oct 07, 02:18
*ghostly voice* Cheat in some money.w.evans wrote:Glad to help. Especially since helping in this case might eventually translate to more fun for me!
Giving it a rest though since the last two beta updates are incompatible with a bunch of mods. NOT complaining, the changelogs seem to indicate a much better game shaping up. Figuring that I'll have to restart the campaign once the Teladi DLC is installed anyway. Will miss my 9 Titurels though.
Editing posts since long before I remember.
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Posts: 1278
- Joined: Sun, 7. Dec 03, 12:03
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
Haven't played lately, but there's this report:
http://forum.egosoft.com/viewforum.php?f=141
if you're playing the 3.0 beta.
Also possibly relevant, the Captain AI is in charge of controlling the ship (Better Turrets only affects the Defence Officer AI) and, with the limited field of view on the Sucellus' main gun, it doesn't fire unless the nose of the ship is pointed directly at the target. Are you using cicero111's Captain AI Overhaul as well? The 3.0 beta supposedly has a new captain AI which tries to keep it's distance from targets, but I don't know how good it is at keeping it's nose on target.
edit: just fired up the game running both Better Turrets and Captain AI Overhaul. Had Sucellus on my squad, and attacked a Taranis. Confirm that Sucellus did not fire IHC. Moreover, the Sucellus did not behave the way it used to with Captain AI Overhaul, moving very close to the Taranis and trying to engage via broadside.
Still odder, I had the squadron attack a PMC Fedhelm. Had three Sucellus: one, I had directly attack; the second, I changed the DO first, then switched behavior to defensive, back to offensive, then attack; the third, withdraw first, then attack. All of the ships closed with the Fedhelm, but none attacked. I then fired a Tristar at the Fedhelm from 4 km. Everyone then started firing after detonation of the Tristar, but none of the Sucellus had IHC oriented on the target, and no one fired the main gun.
http://forum.egosoft.com/viewforum.php?f=141
if you're playing the 3.0 beta.
Also possibly relevant, the Captain AI is in charge of controlling the ship (Better Turrets only affects the Defence Officer AI) and, with the limited field of view on the Sucellus' main gun, it doesn't fire unless the nose of the ship is pointed directly at the target. Are you using cicero111's Captain AI Overhaul as well? The 3.0 beta supposedly has a new captain AI which tries to keep it's distance from targets, but I don't know how good it is at keeping it's nose on target.
edit: just fired up the game running both Better Turrets and Captain AI Overhaul. Had Sucellus on my squad, and attacked a Taranis. Confirm that Sucellus did not fire IHC. Moreover, the Sucellus did not behave the way it used to with Captain AI Overhaul, moving very close to the Taranis and trying to engage via broadside.
Still odder, I had the squadron attack a PMC Fedhelm. Had three Sucellus: one, I had directly attack; the second, I changed the DO first, then switched behavior to defensive, back to offensive, then attack; the third, withdraw first, then attack. All of the ships closed with the Fedhelm, but none attacked. I then fired a Tristar at the Fedhelm from 4 km. Everyone then started firing after detonation of the Tristar, but none of the Sucellus had IHC oriented on the target, and no one fired the main gun.
Last edited by w.evans on Sat, 6. Dec 14, 20:26, edited 1 time in total.
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
@swatti Captain AI Overhaul and Better Turrets? No conflict. Both are made by cicero111, and alter different scripts:
Captain AI Overhaul modifies the captain (maneuvering) script [command.fight.attack.xml, command.move.wait.xml, move.attack.object.xml, and move.escort.capital.xml]
Better Turrets modifies the defence officer (targeting and firing) script [fight.attack.object.capital.xml].
Captain AI Overhaul modifies the captain (maneuvering) script [command.fight.attack.xml, command.move.wait.xml, move.attack.object.xml, and move.escort.capital.xml]
Better Turrets modifies the defence officer (targeting and firing) script [fight.attack.object.capital.xml].
-
- Posts: 1278
- Joined: Sun, 7. Dec 03, 12:03