[SCR] Smart Turrets v4.7.2 (AP, 05-04-14), v2.6 (TC, 21-08-13)

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sun, 22. Dec 13, 13:30

The Smart-measured stats show PPC has both higher shield DPS (9000 vs 5955) and hull DPS (1333 vs 1320).

Code: Select all

Laser=Photon Pulse Cannon, Range=8000, Speed=500, Delay=3000, Flags=0
Shield.Shot=27000, Hull.Shot=4000, Shots.Min=20, Shield.Dps=9000, Hull.Dps=1333

Laser=Plasma Beam Cannon, Range=6885, Speed=2550, Delay=6667, Flags=1026
Shield.Shot=44667, Hull.Shot=9900, Shots.Min=8, Shield.Dps=5955, Hull.Dps=1320
Where:

Code: Select all

$Laser.Range = get range of laser $Laser
$Laser.Speed = get bullet speed of laser $Laser
$Laser.Delay = get default launch time difference for missile type: $Laser
$Laser.Shield.Shot = get shield damage of laser $Laser
$Laser.Hull.Shot = get hull damage of laser $Laser
$Laser.Flags = get bullet flags of laser $Laser 
$Laser.ShotsPerMinute = 60000 / $Laser.Delay
$Laser.ShieldDps = ($Laser.Shield.Shot * $Laser.ShotsPerMinute) / 60
$Laser.HullDps = ($Laser.Hull.Shot * $Laser.ShotsPerMinute) / 60

write to log file 1234 append=1 printf: fmt='Laser=%s, Range=%s, Speed=%s, Delay=%s, Flags=%s', $Laser, $Laser.Range, $Laser.Speed, $Laser.Delay, $Laser.Flags
write to log file 1234 append=1 printf: fmt='Shield.Shot=%s, Hull.Shot=%s, Shots.Min=%s, Shield.Dps=%s, Hull.Dps=%s', $Laser.Shield.Shot, $Laser.Hull.Shot, $Laser.ShotsPerMinute, $Laser.ShieldDps, $Laser.HullDps
The script of course has to use integers so division entails some loss of precision. So doing the same via calculator shows PBC does indeed have a higher hull DPS:

PPC hull DPS = 1333.333
PBC hull DPS = 1484.926

In the integer based script I worked in shots per minute to get a higher precision, but unfortunately PBC shots per minute (60000 / 6667) comes out as 8.9995 - incurring pretty much the worst case amount of precision loss.

I'll adjust the DPS calculation to avoid significant precision loss.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sun, 22. Dec 13, 20:21

I've uploaded 4.6.3. I removed the fighter specific bias against beams, but decided not to remove the segregation of beams in the anti fighter array ordering based on my observations. The XRM Ray for example appears to stand little chance of taking down a P's shield using it's beams, and Smart kills them a lot faster by promoting projectile based alternatives if it thinks they're fast enough to hit. If the segregation were removed Smart would always pick the beam as it always meets desired bullet speed and appears to have higher DPS, despite the fact little of it is actually applied to the target.

The DPS rounding issue should also now resolved. The titan correctly switches to using beams after stripping a K's shields.

Perhaps if there were a way to query a beam's duration per shot, this would permit an estimate of how much actual DPS would be applied to a moving fighter target (where short burst = greater portion of the full DPS), and so we could remove the banding and instead apply a percentage reduction to the beam's DPS for purposes of ordering the anti-fighter laser list. That would be a more optimal arrangement, instead of having to assume that a beam has worse DPS than everything else.

4.6.3
- Fix precision error in DPS calculations resulting in occasional sub-par selection of one heavy laser relative to another.
- Remove a check preventing beam lasers being selected vs fighters unless no other laser type is available to the turret.
- Add text files for DE, PL, CS, IT, ES, FR, RU with English strings.

Joebloweres
Posts: 10
Joined: Sat, 4. Jan 14, 00:22

Post by Joebloweres » Fri, 10. Jan 14, 07:51

I was looking for another mod like MARS and found this one... Works so much better.. Mars didn't really do anything differently from what I could tell other then maybe better missile defense. You are a genius sir!

Pierre'70
Posts: 124
Joined: Sat, 30. Apr 05, 12:19
x4

Post by Pierre'70 » Mon, 24. Feb 14, 18:00

I'm running Smart with AP XRM, and I've noticed an oddity with Smart Defence on Xenon capital ships (piloted by me). When under attack by missiles, the turrets only selected the High Energy Particle Railgun and ignored the faster-firing Gamma Pulse Emitters in the hold. This resulted in every missile hitting its target (ie me!). Shouldn't the weapon-switching feature have ensured that a laser that could actually hit its target was selected?

I should add that I've been a long time fan of Smart Turrets and never noticed any other issues with it.

EDIT:

It seems that the GPE is also useless at missile defence, using the 'Missile Defence' option rather than Smart. Only the Dark Matter Beam Cannons hit any of the missiles, but due to their slow rate of fire most got through. I'll post over on the XRM thread and see how others handle missile defence with Xenon capitals.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sun, 2. Mar 14, 01:54

In TC the best anti missile lasers were simply those with the lowest refire delay as 1 shot could kill any missile.

In AP the addition of hitpoints to missiles changes this and its necessary to pick lasers with high hull damage for taking down torpedoes. In XRM for whatever reason heavy missiles seem even more difficult to shoot down than in vanilla. It becomes much more difficult for Smart to take down torpedo barrages in AP. Mosquito defence is effective as they can insta kill other missiles.

Fortunately light/swarm missiles still seem vulnerable to rapid fire lasers in AP, so for this reason Smart AP caches 2 sets of antimissile lasers, selecting the most rapid firing ones for light/swarm missiles and high hull damage ones for heavy missiles. These are the antimissile selections for a K turret in XRM/AP, where F and U notation describes collateral damage friendly or unfriendly lasers.

Code: Select all

Lasers.AntiMissile.ByDelay.Descending: F=ARRAY ( Gamma Pulse Emitter ), U=ARRAY ( Gamma Pulse Emitter )
Lasers.AntiMissile.ByHullDps.Ascending: F=ARRAY ( Gamma Pulse Emitter, High Energy Particle Railgun ), U=ARRAY ( Gamma Pulse Emitter, High Energy Particle Railgun )
The dark matter beam cannon is notably absent from the hull DPS array here. Delving into the code it looks like that laser is being excluded from the selection for exactly the reason you found. Smart's laser caching logic requires the refire delay to be <= 2500 ms to qualify for heavy antimissile, where the comment suggests this was intended to block super slow lasers like vanilla PSP.

The actual antimissile laser qualification requirements from the current code are:

Rapidfire antimissile:
- Refire <= 700ms
- Bullet speed >= 580ms OR beam OR PSG

Heavy antimissile:
- Delay <= 2500

Reido
Posts: 129
Joined: Sun, 9. Sep 12, 12:12
x3tc

Post by Reido » Fri, 7. Mar 14, 20:13

Has anyone else noticed that the Pulsed Beam Emitters sometimes fire at targets that are FAR outside the range of that weapon?

For some reason I'm noticing this almost every time I'm in the war sectors fighting against the Terran's, my PBE's will start firing at targets when they're 3-4 kilometers away when the range of the PBE is about 600m I believe. It got so annoying that I had to put the PBE's in the "disallowed" list to keep SMART from using them any more.

I have no idea why SMART treats the PBE differently when fighting the Terran's while shooting up the Pirates they seem to work just fine, only firing when the targets are very close (and being dammed effective at stripping the shields).

I am running a heavily modded AP game so I'm not sure if it's a conflict with anything else or not, as far as I can see there shouldn't be anything else interfering as SMART is the only turret script and no other scripts do anything in particular to the Terran's or the weapons (I did modify a few specs for missiles).


Reido

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Fri, 7. Mar 14, 20:49

Turret scripts rely on a particular script command to tell them whether a turret is able to hit a target given the installed lasers.

Code: Select all

[THIS] -> is $TargetToCheck in firing range of turret $TurretId 
Smart should only shoot while this returns true. This command is known to return false positives particularly on very large ships when using very short range lasers.

I suspect the problem is in how much this command respects the actual geometry of ships and origin of guns as opposed to ship midpoints and bounding box characteristics. It's also unclear, given a turret is a logical grouping of guns that might span a 2km side of a ship (and we're talking about a 2km range gun), whether the game uses the actual origin of a turret gun in its calculation, or perhaps determines some average origin point as a basis for its distance to target calculation.

builder680
Posts: 1315
Joined: Mon, 14. Feb 11, 03:58
x4

Post by builder680 » Sat, 8. Mar 14, 05:16

This is awesome. Now I can use the Main Gun battery on my Heavy Centaur Protoype from XRM the way it was meant to be used (since SMART will switch them out automatically) . WOOT!

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Sat, 8. Mar 14, 14:37

One thing about the main guns switching though, is whenever a gun is switched it resets the refire delay. It's not noticeable when using fighter weapons, but you might notice on the bigger ships with slow refire lasers that your front gun DPS increases as a result of firing more often than it should. It does of course drain more energy as a result, so it's still balanced by that.

This only affects the main guns because they fire whenever you pull the trigger, whereas Smart regulates turret fire to ensure proper DPS is preserved.

Reido
Posts: 129
Joined: Sun, 9. Sep 12, 12:12
x3tc

Post by Reido » Sat, 8. Mar 14, 18:44

Shimrod wrote:This command is known to return false positives particularly on very large ships when using very short range lasers.

I suspect the problem is in how much this command respects the actual geometry of ships and origin of guns as opposed to ship midpoints and bounding box characteristics.
Thanks for clarifying that, I completely forgot about this issue (I remember reading about it a long, long time ago. I think the reason I noticed this mostly in the war sectors fighting the Terran's is that I never go into those sectors with anything less than an M7 and so I'm having the "short range gun on a large ship" issue.

I'll just restrict PBE's and other short ranged turreted lasers to M6's and smaller ships if I notice this happening again.


Reido

builder680
Posts: 1315
Joined: Mon, 14. Feb 11, 03:58
x4

Post by builder680 » Mon, 17. Mar 14, 04:11

Heya Shimrod,

I wonder if you get some free time if you would mind having a look at this discussion, including the posts following, in the Advanced Fight Scripts thread? Specifically point 2 of that post. No hurry, and I'm just more curious than anything else. Much appreciated. :)

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Mon, 24. Mar 14, 21:47

I ran into some funkyness. With my shiny new Cobra, I switched smart turrents to capture .. And the script threw everything including the kitty litter box at the M1 in one go.

Needless to say, 40-odd hammer torpedoes were a little bit too much for the PD but there wasn't much to capture afterwards. Script fired everything else including the boarding pods as well.

I'm not sure if it's Smart turrets issue or advanced fight scripts issue or both. I'm using the version of smart turrets srcript that came with fight scripts. (glen.turret.smart.xml)

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Mon, 24. Mar 14, 22:11

Oops I suspect that's Smart's bad on both counts.

Missile turrets aren't factored into capturing. I'd be inclined to have them simply hold fire in capturing mode as chance to hit is so uncertain. For example laser turrets could end up holding fire while the missile boat fires 1 missile at a time to take out a last sliver of shield, getting easily easily shot down by the target's turrets.

Looks like it needs a check to exclude boarding pods too.

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Mon, 24. Mar 14, 22:59

This may get into doctor evil territory but how about making torpedos spiral like swarm missiles on approach?

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 24. Mar 14, 23:00

Wraiths do that.

Swarm Torpedoes.

User avatar
hourheroyes
Posts: 346
Joined: Mon, 9. Apr 12, 05:14
x4

Post by hourheroyes » Mon, 24. Mar 14, 23:07

I hit the boarding pod issue last night--fortunately the target's shields were too high or I would've sent 20 good marines to their deaths

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Tue, 25. Mar 14, 10:28

That still leaves hammer torpedos and tomahawks. Right now they're dead easy to pop.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Tue, 25. Mar 14, 14:12

It might be possible to implement missile strafing through script, but I think it's outside the scope of Smart and probably best linked to a ware upgrade like missile evasion software.

While excluding boarding pods I came across a mothballed copy of Smart with a fairly sophisticated countermissile system, am looking at resurrecting it:
- Countermissiles fired from ship and from missile turrets
- Any ship could intercept missiles incoming to all that races ships
- Calculates longer range intercept point based on speed and range of the countermissile vs speed and range of the incoming missile.

If we allow for longer range countermissiles, these could intercept barrages real far away, greatly reducing the risk of any reaching the player as there'd be plenty of time to launch more countermissiles. Though as it stands the code just uses the standard 'get best missile for target' script that pretty much just returns mosquitoes.

Barleyman
Posts: 127
Joined: Sun, 16. Apr 06, 00:52
x3

Post by Barleyman » Tue, 25. Mar 14, 17:04

Not firing boarding pods is good, what about missile turrets holding fire with capture status?

WRT strafing, I've observed difficulty turrets and main guns have hitting swarm missiles even with the gentle rolling movement. I have no idea if it would be easy to duplicate.

My shiny new Cobra also demonstrated vanilla missiles and torpedoes are fairly limp against smart turret NPC capitals.

Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod » Tue, 25. Mar 14, 17:45

Yes I plan to have the missile turrets hold fire too, except for countermissile activity.

What you might be seeing with missing bullets missing or not destroying missiles is some combination of:
- Inaccuracy built into that laser
- Reduced size of hit box on the missile
- Missile hitpoints
- Spiral motion defeating the game's target leading logic, like when turrets shoot an undocking khaak cluster that is spiralling and end up shooting far wide.

All Smart does is tell the turret X to shoot at target Y, it doesn't have control over accuracy or target lead prediction.

I haven't had an M7M for a long time but I'll get plenty of exposure with testing the countermissile feature. With replicators on board I'll be happier to have them in my fleet. What tends to put me off is:
- collateral torpedo damage agroing neutral ships & killing my fighters
- missiles detonating on launch and destroying the M8 + killing my fighters
- friendly stations or ships being in between the missile boat and its target

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”