[SCR] Smart Turrets v4.7.2 (AP, 05-04-14), v2.6 (TC, 21-08-13)
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
It downloaded and unzipped ok for me just now. The file opened ok with WinRAR, 7-Zip, and plain windows explorer.
The downloaded zip file should be between 178 and 184 KB depending on what you're looking at it with.
Here's a link to the hosting site's container page for 1.5:
http://www.x1tp.com/root/index.php?opti ... =6&lang=en
The downloaded zip file should be between 178 and 184 KB depending on what you're looking at it with.
Here's a link to the hosting site's container page for 1.5:
http://www.x1tp.com/root/index.php?opti ... =6&lang=en
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
-
- Posts: 23
- Joined: Sun, 28. Dec 08, 09:32
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
Sorry for not answering this part earlier, just noticed it on a re-read.garrry34 wrote:some of the turrets seem to dissappear during battle...
There are 2 firing loops, a delay sampling one and an optimized one. The first is used until there are at least 10 samples of a given lasers refire delay (cached sample count may vary depending on how many ships/turrets are shooting around the same time)
Turrets disappearing is a side effect of the delay sampling algorithm. This alternates between having 1 gun installed and all installed after each volley. Despite how the turret looks it is actually shooting all the guns.
This behaviour is integral to the algorithm, and the purpose is difficult to explain concisely without explaining the whole algorithm for context, so I'll not attempt to unless anyone particularly wants the detail!
Suffice to say that once enough samples are collected, the optimized firing loop is used and this won't look like guns are being swapped.
When not firing at something the rest of the turret script tends to install 1 gun before a sleep, so turrets never appear empty. Emptiness may bring a 0 laser strength readout from other scripts affecting behaviour so undesirable. You can set the 'idle lasers' option in the config to make it fill the turrets before waiting so it always looks bristling with guns, but that has no benefit except for looks and can starve other turrets of guns they need. Testing a 1.6 change to fill the turret for looks when there's no enemy in alert range...
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
ah short and sweet reply lol...Shimrod wrote:...Suffice to say that once enough samples are collected, the optimized firing loop is used and this won't look like guns are being swapped...
well I have not had any CTD's since upping to 1.5, but I'm sort of playing and testing at the same time, building up my empire to what it was before the reinstall...
I always have the angelwing fully stocked, the amount of times I've restarted I just cheat my first ship in and then do the rest manually...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
8GB DDR2
ATI HD4890
Windows 7 64bit
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
I like to do my proper playthroughs by making a setup script to init the game how I like it, exploration, navsats, custom shipyards (I dislike boarding) etc.
The good thing about this approach is the script editor stays disabled, and this is a good casual deterrent to spoiling your game by the urge to script something in
Oh and modding all laser and missile volumes to 1 is mandatory. I like to have a full loadout available at all times, and this is a lot less annoying than editing TShips every time.
The good thing about this approach is the script editor stays disabled, and this is a good casual deterrent to spoiling your game by the urge to script something in

Oh and modding all laser and missile volumes to 1 is mandatory. I like to have a full loadout available at all times, and this is a lot less annoying than editing TShips every time.
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
Shimrod, I've a suggestion for a future update, its to do with the missile turrets specifically the turret on a M3B, is there anyway to put the turret to sleep if the ship is docking, just to reduce collateral damage due to friendly fire...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
8GB DDR2
ATI HD4890
Windows 7 64bit
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
I've uploaded 1.6.
The coolest feature is that any player ship can intercept missiles incoming to any other player ship in the active sector, including missiles incoming to protected targets. Okay maybe not all that cool, but it's not trivial to do, especially efficiently, and it would be uncommon to find a turret script that supports this.
Better lasers should get picked for all fighter targets via the heuristic laser selection algorithm, now expanded from its use on M6. Rather than shooting IRE's at them as a weapon of choice, it'll pick the best DPS with sufficient speed, where speed requirement increases with range. In XRM testing this showed a huge improvement in the rate fighter die at.
Some major under the hood changes were made to the caching system, with the ship caching split out into global and local caches to facilitate detection of turret compatible laser modification at load time and sharing of caches between ships of the same type. Also there's a new sector cache where an elected master Smart ship will perform the scans to support the missile interception feature.
I had some framerate drop when testing 10 swarm missiles (= 80 individual missiles) being shot to the player when intercepted en route by a pack of 20 heavy centaur prototypes. Analysis suggests the lag is equivalent to the 20 HCP's tracking 80 fighter targets, checking distance to target and so forth. There was no special lag from the group when intercepting barrages of 10-20 torpedoes.
Oh, and I also added that station menu to let Smart be broadcast to docked and homebased ships
Full changelog in the 2nd post as ever. I've done 3 nights of regression testing on various features and situations, turning up some optimization opportunities in the analysis. Feels stable, and the final upgrade test went smooth. Lets hope it's as stable as 1.5 seems to be (i.e no news is good news!)
The coolest feature is that any player ship can intercept missiles incoming to any other player ship in the active sector, including missiles incoming to protected targets. Okay maybe not all that cool, but it's not trivial to do, especially efficiently, and it would be uncommon to find a turret script that supports this.
Better lasers should get picked for all fighter targets via the heuristic laser selection algorithm, now expanded from its use on M6. Rather than shooting IRE's at them as a weapon of choice, it'll pick the best DPS with sufficient speed, where speed requirement increases with range. In XRM testing this showed a huge improvement in the rate fighter die at.
Some major under the hood changes were made to the caching system, with the ship caching split out into global and local caches to facilitate detection of turret compatible laser modification at load time and sharing of caches between ships of the same type. Also there's a new sector cache where an elected master Smart ship will perform the scans to support the missile interception feature.
I had some framerate drop when testing 10 swarm missiles (= 80 individual missiles) being shot to the player when intercepted en route by a pack of 20 heavy centaur prototypes. Analysis suggests the lag is equivalent to the 20 HCP's tracking 80 fighter targets, checking distance to target and so forth. There was no special lag from the group when intercepting barrages of 10-20 torpedoes.
Oh, and I also added that station menu to let Smart be broadcast to docked and homebased ships

Full changelog in the 2nd post as ever. I've done 3 nights of regression testing on various features and situations, turning up some optimization opportunities in the analysis. Feels stable, and the final upgrade test went smooth. Lets hope it's as stable as 1.5 seems to be (i.e no news is good news!)
-
- Posts: 831
- Joined: Sun, 22. Feb 04, 12:55
Is it enough for one ship to have a protect order for a target for ALL nearby playerships to start swatting missiles aimed at it, then?
That's pretty darned epic.
On that note, how does Smart handle shield-ignoring weapons?
I've had some good experiences with MARS swatting M5s and similar with projectile cannons rather than using other lasers on hand (this is very noticable with the relatively heavily shielded improved khaak scout in XRM...) assuming the ships happen to venture close enough.
That's pretty darned epic.

On that note, how does Smart handle shield-ignoring weapons?
I've had some good experiences with MARS swatting M5s and similar with projectile cannons rather than using other lasers on hand (this is very noticable with the relatively heavily shielded improved khaak scout in XRM...) assuming the ships happen to venture close enough.
-
- Posts: 3206
- Joined: Thu, 16. Jul 09, 12:24
MARS tends to be finicky and not choose the right weapon for the situations that can evolve on the fly as I noted from battles in recent games. It has a habit of choosing the capital class beam weapons to shoot at fighters which makes me face palm. Those aren't the most effective weapons to shoot fighters down.
I haven't given this a real go yet but I wonder if it chooses the right weapons that'll have the most effectiveness on the target facing the ship your in or ships the turret commands are installed on.
I haven't given this a real go yet but I wonder if it chooses the right weapons that'll have the most effectiveness on the target facing the ship your in or ships the turret commands are installed on.
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
Yes that should work. All the missiles are lumped together in a global array, processed by all Smart ships in the sector and any in firing range are shot at. (scan code= glen.turret.smart.cache.sector: Execute)Halconnen wrote:Is it enough for one ship to have a protect order for a target for ALL nearby playerships to start swatting missiles aimed at it, then?
It can't detect them as laser flags are unavailable in game.Halconnen wrote:On that note, how does Smart handle shield-ignoring weapons?
Until 1.6 Smart would select the fastest laser available for fighter targets, so mass driver would be a typical candidate.
In 1.6 they'll be selected less often with the new laser selection algorithm for fighters. Mass drivers will get picked when there's nothing else fast enough to hit a fighter target available. They'll continue to be popular with the anti-missile mode with their low refire delays.
Like with the shield ignoring lasers Smart can't tell a beam apart from flak.Requiemfang wrote:It has a habit of choosing the capital class beam weapons to shoot at fighters
Smart 1.6 will pick the best DPS laser meeting a speed requirement that increases with range to target, so it's increasingly likely at closer ranges something other than a beam will be picked, however it all depends on available lasers, their DPS and bullet speeds.
Also remember when testing that Smart needs to train up its DPS cache when first starting out as it hasn't otherwise got refire delay and DPS values for lasers. It might pick weird lasers to begin with as anything it has no cached value for appears high DPS in order to promote it being selected and evaluated. You can peek into the DPS cache via the menu system to see what it'd figured out already.
Targets are always evaluated relative to the ship the turret commands are running on. In 1.6 it'll pick the best shield dps (shield > 5%) or hull dps for M7 or bigger, use a special algorithm for M6/M8 and fighters, and pick the fastest bullet speed laser for anything else.Requiemfang wrote:I haven't given this a real go yet but I wonder if it chooses the right weapons that'll have the most effectiveness on the target facing the ship your in or ships the turret commands are installed on.
With the heuristic approach the best shield or hull DPS laser meeting a speed requirement is selected. Speed requirement is calculated as follows:
Code: Select all
* Fighters on 1% hull can still dodge PPC fire.
$Victim.Speed = $Victim->get max upgraded speed
* $Victim.Speed = $Victim->get current max speed
$Speed.Bias = 1
skip if not $Victim->is of class {Fighter 2034}
$Speed.Bias = 3
$Speed.Modifier = ( $Victim.Range / 1000 ) + $Speed.Bias
$Speed.Desired = $Victim.Speed + ( $Victim.Speed * $Speed.Modifier )
Thanks man. You have a particular knack for rooting out bugs =)garrry34 wrote:I put in a request for the missile coverage you have put in, elsewhere before, I am well chuffed you have put that in, I shall put it through its paces and let you know any feedback...
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
Could you post or pm me the 'story call stack dump' out of the x3crash.log file?
Do I just need to jump into paranid prime with a cobra and open up to reproduce it?
Is it specifically when a separate missile defence mk2 turret script is active on the same ship or the target ship that there's a crash?
Cheers.
Observations so far in testing:
- Missile def MK2 (vanilla mode) enabled in AL menu
- I wiped out paranid prime with a cobra and wing of bombers, no crash.
- Empires edge is having a bad day. Kraken added to missile fleet. Mars enabled on enemy capships.
- Seems not to automatically target stations unless player targets them, I'll look into this.
Do I just need to jump into paranid prime with a cobra and open up to reproduce it?
Is it specifically when a separate missile defence mk2 turret script is active on the same ship or the target ship that there's a crash?
Cheers.
Observations so far in testing:
- Missile def MK2 (vanilla mode) enabled in AL menu
- I wiped out paranid prime with a cobra and wing of bombers, no crash.
- Empires edge is having a bad day. Kraken added to missile fleet. Mars enabled on enemy capships.
- Seems not to automatically target stations unless player targets them, I'll look into this.
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43
I'm just in my flagship, smart on all my turrets and main guns, happened with mars enabled for all ships and where they would only use mk2, I wasn't using missile's, so don't know why this is popping up, the crash is to do with enemy turrets...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
8GB DDR2
ATI HD4890
Windows 7 64bit
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
The stack trace is weird as it appears to include both elements of Gazz's missile defence MK2 (plugin.gz.missile.load.att.e.std), and Litcube's missile boat add-on (Lib.Cmd.Turret.Barrage).
It looks like they're both running on some ships TaskId 3 which is one of its turret tasks, and maybe one has interrupted the other which might explain the interleaved calls into separate scripts.
The obvious (but not necessarily right) conclusion would be Gazz&Litcube's scripts are competing with each other on a single enemy turret and stepping on each others toes.
Is it possible to take Smart out of the equation by running the Uninstall option after loading (don't save obviously
), then using MARS instead temporarily on your flagship then seeing if you can repro a crash?
Was Litcube's script a recent install? It looks like Gazz's one is integrated with XRM, otherwise not sure how I'd have it locally, but I don't have Litcube's locally suggesting you installed that explicitly at some point.
It looks like they're both running on some ships TaskId 3 which is one of its turret tasks, and maybe one has interrupted the other which might explain the interleaved calls into separate scripts.
Code: Select all
Story call stack dump:
[000000]->[0351cc]#-199751(2023)[702].StartThisScriptID(3, {"plugin.gz.missile.load.att.e.std",42,"Start Attack Enemies - player",1,0,0,{...},0,0,100}, {4,3}, 0)
[03538b]->[035fcd]#-199751(2023)[702].__runScript({27437161,0,3,3,{...},{...},0,3,{...},100,0,0,0}, {"Lib.Cmd.Turret.Barrage",44,"Lib Cmd: Main turret barrage",46,0,{...},{...},{...},{...},911}, 65542, -199751, {4,3}, 0)
[060427]->[0aa6fd]#-199751(2023)[2004].ShootMissileSECOBID(3962, 3, 29, 0)
Is it possible to take Smart out of the equation by running the Uninstall option after loading (don't save obviously

Was Litcube's script a recent install? It looks like Gazz's one is integrated with XRM, otherwise not sure how I'd have it locally, but I don't have Litcube's locally suggesting you installed that explicitly at some point.
-
- Posts: 907
- Joined: Tue, 18. Feb 03, 01:43
In fact there's no interrupt, reading the code for both scripts. Missile def mk2 invokes !turret.missileattack in the event that it's a missile turret, and the add-on package includes a replacement !turret.missileattack script.
So MK2 is legitimately calling the missile boat add-on script. As to why its crashing though, I still can't guess.
There are a few crashes reported in Litcube's thread with the same crashing instruction.
http://forum.egosoft.com/viewtopic.php? ... &start=135
Looking at the crashing instruction vs the line of script it came from:
ShootMissileSECOBID(3962, 3, 29, 0)
= [THIS] -> fire missile $Missile from turret $Task on $Enemy
That suggests:
[THIS] = null
$Missile = 29 (spectre)
$Task = 3 (turret 3)
$Enemy = 3962 (probably game's hashcode)
Assuming the 4th param is the refobj, seems like ship is destroyed or somehow [THIS] has otherwise become null. Smart may have contributed to its destruction, but doesn't seem responsible for the crash!
Scary thought that turret scripts might continue to run after a ship has been destroyed.
So MK2 is legitimately calling the missile boat add-on script. As to why its crashing though, I still can't guess.
There are a few crashes reported in Litcube's thread with the same crashing instruction.
http://forum.egosoft.com/viewtopic.php? ... &start=135
Looking at the crashing instruction vs the line of script it came from:
ShootMissileSECOBID(3962, 3, 29, 0)
= [THIS] -> fire missile $Missile from turret $Task on $Enemy
That suggests:
[THIS] = null
$Missile = 29 (spectre)
$Task = 3 (turret 3)
$Enemy = 3962 (probably game's hashcode)
Assuming the 4th param is the refobj, seems like ship is destroyed or somehow [THIS] has otherwise become null. Smart may have contributed to its destruction, but doesn't seem responsible for the crash!
Scary thought that turret scripts might continue to run after a ship has been destroyed.
-
- Posts: 911
- Joined: Sun, 17. Jul 05, 14:43