[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

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

Post by Shimrod » Sun, 24. Jul 11, 17:50

Smart Turrets

Smart Turrets (turret commands)
- Works on laser and missile turrets
- Laser switching
- Evaluates and switches targets
- Automatic anti-missile, missile interception, and countermissile features.
- Capturing: boarding and bailing turret modes (AP only)
- Smart can optionally be enabled on NPC race ships

Smart Main Guns (additional ship command)
- Laser switching for main guns
- Main guns remain under manual fire control

Configuration
- A configuration menu is available in the ship and wing Combat menus.

Note that the TC version of Smart samples laser delays to calculate DPS. This AP version does not require this. Use the training option in the TC version of Smart's ship menu to trigger automatic training. Turrets and main guns will shoot unknown lasers automatically to detect their DPS. You can see and even edit the laser values Smart has deduced in the DPS cache menu.

Requirements
- Fight Command Software MK2

Compatibility Notes
- 4.x is for Albion Prelude and will not work on Terran Conflict. Tested on XRM and Vanilla.
- 2.x is for Terran Conflict and is optimized use with the XTC mod.
- Smart does not conflict with MARS, both can be installed at the same time.
- The AP version of Smart has the latest features and these are not back-ported to the TC version, which is in maintenance mode.

Format
- ZIP file containing T file and script files.

Download

Version 4.x - Albion Prelude

Version 2.x - Terran Conflict

Release notes and feature list are in the second post of this thread.

References
- Maintained using X-Studio
- Originally developed using Exscriptor
- Hosted by XDownloads

Resources

The resource IDs have been selected based on available slots in the community script and download library thread. However this does not preclude the possibility of conflict as those IDs may only reflect resources used in the scripts that thread indexes.

Code: Select all

Textfile                 : 9050
Combat Commands          : 353  (COMMAND_TYPE_FIGHT_53)
Wing Combat Commands     : 353  (COMMAND_WING_TYPE_FIGHT_53)
Ship Additional Commands : 1259 (COMMAND_TYPE_SHIP_59)
Station Commands         : 1146 (COMMAND_TYPE_STATION_46)
Turret Commands          : 952  (COMMAND_TYPE_TURRET_52)
Turret Commands          : 953  (COMMAND_TYPE_TURRET_53)
Turret Commands          : 954  (COMMAND_TYPE_TURRET_54)
Turret Commands          : 955  (COMMAND_TYPE_TURRET_55)
Turret Commands          : 956  (COMMAND_TYPE_TURRET_56)
Task IDs                 : 9050-9070
Logfile                  : 9050

Edit [1st Dec 2015]: replaced outdated with working xdownloads link. X2-Illuminatus
Last edited by Shimrod on Wed, 8. Oct 14, 16:44, edited 81 times in total.

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

Post by Shimrod » Mon, 25. Jul 11, 00:16

Release Notes

AP Version

4.7.2
- Fix a bug where Smart missile turrets might not engage targets after changing sector.

4.7.1
- Launch countermissiles from missile turrets and the ship itself like mosquito defence. This feature can be disabled in the menu.
- Made missile turrets hold fire when in capturing mode
- Stopped missile turrets firing boarding pods
- Set a floor on main guns laser switching iteration time equal to the current laser refire delay, to help remedy higher than normal rate of fire caused by the laser switching when guns are being fired.
- Added support for Advanced Fight Scripts by publishing laser turret target
- As both vanilla and XRM halve the missile refire delay between missile turret volleys, do the same with Smart missile turrets for balance.
- Add a missile turret setting for using swarm class missiles on huge ships. Off by default.
- If it would take more than 250 missiles of the ships best available type to destroy a target then hold fire on the missile turret.

4.7.0
- Pulled due to packaging issues.

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.

4.6.2
- Fix 'all ships in sector' broadcast not finding docked ships.

4.6.1
- Fix the command name not displaying correctly when starting a Smart command on a ship that is OOS.

4.6.0
- Added a throttling setting to control whether Smart will reduce number of mounted lasers when laser energy is low. By default throttling will only be applied to turrets not main guns.
- Avoid rapidly firing lasers when the mode cycling hotkey is spammed.
- Add a gate rep loss avoidance setting, default on. When on, gates in the active sector are set to neutral race ownership.
- When avoiding stations, display command as COMMAND_DEFEND_STATION so the player can tell why its not shooting.
- Pick lasers more intelligently vs TS, TP, TM class targets.
- Fire amidships at huge ships when the target is estimated to be unlikely to outrun the bullet, intended to reduce miss rates from shooting at the very nose of a long ship.

4.5
- Fix a bug in capturing mode vs big ships which could make the turret go nuts and destroy the target when it should instead be holding fire.

4.4
- Add a new bailing algorithm per request: Bail or Die. This will drop hull below 10% allowing for 7% overkill margin below that. If the target hasn't bailed in a few seconds after exceeding 10% then target will be killed.
- Renamed bailing algorithm 'fastest' to 'Strip Hull'.

4.3
- Rebalanced M6 and fighter laser selection to fit both vanilla and XRM
- Fixed a bug present since 1.8 where M6 and fighter laser selection always used hull DPS ordered laser lists regardless of shield level.
- Detect if the game is Albion Prelude. If it's not then send the player a warning message and abort Smart initialization.

4.2
- Added configurable turret command profiles to allow turret command behaviours to be reconfigured
- Added an option to disable laser switching in the turret command profiles
- Added a custom turret command which acts by default as offense mode with laser switching disabled.
- Added a capturing turret command which by default will suppress shield on boardable ships, while attempting to make non boardable ships bail. Can be set to only promote bailing, to support use with NPC bailing mods.
- Included 3 bailing algorithms. The default algorithm attempts to make ships bail with maximum (87%) hull.
- Included a !init file so games are automatically *modified*, without having to enable the script editor to make Smart available.
- Increase laser speed requirement in the anti-fighter and M6 laser selection algorithm.

4.1
- Add laser turret station friendly fire avoidance, enabled by default. This isn't infallible but friendly fire possibility is greatly reduced.
- When laser energy drops below 20% boost desirability of ammo based lasers. This low power mode remains active until laser energy exceeds 40%.

4.0
- Albion Prelude compatibility. Version 4.0 and beyond are NOT compatible with Terran Conflict. Fixes may potentially be backported into separate 2.x releases for TC. The version range from 2.x - 3.9 is reserved for X3TC compatible releases.
- Laser training and the DPS cache have been removed as this data is now available via APIs.
- Antimissile has been revised for AP. Rapid fire lasers continue to be used for drones and light missiles (swarm or S class ware) whereas best hull dps lasers are now shot at the rest.
- Ships running Smart OOS will switch lasers between best hull and shield DPS depending on attack target shield condition
- Rapid fire antimissile requirements have been relaxed somewhat and balanced around vanilla AP laser stats.
- 'Expand' effect lasers (PSG) are now detected and made most preferred for anti fighter/corvette and antimissile
- The broadcast command takes into account whether the ship is in a fleet and offers a fleet broadcast option
- The missile turret wing support option now also apples to fleet members.
- Antifighter/corvette laser selection has been adjusted to select stronger/slower lasers when target speed is slower than its maximum.
- Beam lasers are now properly detected through laser flags and demoted to the bottom of antifighter laser lists.
- The collateral damage (AOE) laser list is now generated based off laser flags. The excluded laser list (tractor beam, mobile drilling) remains hardcoded.
- Fixed a bug where missile interception was not scanning missiles incoming to player stations
- Added a link to the Smart settings menu from the turret configuration menu. This link will not appear until AP is updated with the newest versions of the missile def mk3 scripts that include 3rd party menu support.

TC Version

2.6
- Fix the command name not displaying correctly when starting a Smart command on a ship that is OOS.

2.5
- Added a throttling setting to control whether Smart will reduce number of mounted lasers when laser energy is low. By default throttling will only be applied to turrets not main guns.
- Avoid rapidly firing lasers when the mode cycling hotkey is spammed.
- Included an init script to automatically make games modified. Vanilla unmodified games would otherwise require script editor activation to load Smart.

2.4
- Created a more snugly fitting model for bullet speed prediction vs fighters, optimized for the XTC mod.
- Pick lasers more intelligently vs TS, TP, TM class targets.
- Fixed flakiness in main guns laser selection.

2.3
- Fix a bug where the TC version of Smart was picking Hull ordered lasers to attack shields and vice versa versus non-huge ships.

Known Issues

The collect wares command will instantly beam wares on board from long range when a turret on that ship is running Smart. See this post for a workaround.

Installation

Install
- The 9050-*.xml file must go in the AP addon\t folder while the *smart*.xml files need to go in the addon\scripts folder.
- The Smart setup script will run after loading the game. The menus and ship commands then become available.

Upgrade
- Replace the files with the newer versions and load the game. Smart will upgrade itself automatically.

Uninstall
- Select the Uninstall option from the in-game menu. This will terminate tasks, unregister hotkeys and clear variables.
- Save the game
- Remove the Smart scripts from addon\scripts
- Reload the game. The Smart menus and commands should no longer appear after reloading.

Features

Missile Turrets

The Smart turret command works on both missile and laser turrets.

Missile turrets may fire:
- In self defence, attack target or command attack target.
- In a configurable engagement radius around the ship
- At the player's target
- At attackers and targets of wingmates and fleetmates
- At attackers and targets of formation ships
- At protected/followed ship/follower attackers and targets
- All player ships and stations in sector's attackers and targets

An appropriate missile is selected for the job. For fighter targets swarm missiles are always used if available. A barrage of potency sufficient to kill the target is fired, with a configurable degree of overkill and barrage cap.

Missile turret behaviour is configurable from the configuration menu. All targetting except the self defence/self attack target can be disabled. Not all options are enabled by default.

Beware: A missile boat will happily shoot flails or even mosquitoes at capital ships if it runs out of torpedoes.

Capturing (AP version)

Smart includes a Capture turret command which by default will suppress shields on boardable ships, while attempting to make non boardable ships bail.

Bullets shot by all Smart Capture mode turrets are tracked and this damage is factored in when determining when to shoot guns. This allows Smart a more precise level of control when stripping shield and hull from the target. Beware however that bullets shot from other sources such as main guns and other turret commands cannot be tracked, and this may result in overkill damage being applied.

In the turret command profile, capturing can be set to bailing only, where the turret will try and make all ships bail. This is to support use with NPC bailing mods.

4 bailing algorithms are included.

Maximize Hull
- Hull is lowered to a level where bailing can occur (below 87.5%)
- Shield is stripped at 15 second intervals to a level which can trigger a bail check (0% AND <1000)
- This mode is aimed at ships bailing with maximum hull

Chip Hull
- Hull is lowered initially below 87.5%, with a 5 second subsequent pause to allow ejection.
- Hull is subsequently lowered by 1% every 3 seconds.
- After reaching 2.5% hull the shields will be suppressed every 15 seconds to trigger bailing checks.
- This mode is aimed at NPC bailing mods where the bailing hull level can vary.

Strip Hull
- Hull is lowered below 87.5% with a subequent 5 second pause.
- Hull is then lowered to 25% thresholds of the max hull (75, 50, 25), with 5 second pauses between.
- Hull is finally lowered to 2.5% and shield is suppressed every 15 seconds to trigger bailing checks
- This mode is aimed at ships having a better chance to bail, where once reduced to a 2.5% threshold bailing chance is thought to be increased.

Bail or Die
- Hull is lowered below 10% with a large (7%) margin of error.
- If it hasn't bailed within 5 seconds below 10% hull, the target is marked for destruction.

The default mode is Maximize Hull, which may be changed in the global settings menu.

Note that bailing is random and heavily influenced by a morale value assigned when the ship spawns. Bailing checks may not occur for periods of many minutes. Smart helps to automate the capturing process, but it confers no special bonuses of its own to the bail chance.

Anti Missile

The anti missile feature simulates shooting individual turret guns at separate missile and drone targets allowing flail and torpedo barrages to be efficiently cleaned up.

Turrets are turned in a best-effort fashion in anti-missile, but ultimately the guns cannot be turned independently as the game isn't designed for it.

Antimissile is performed each round before firing on the main target, providing a level of defence against missiles slipping through while the turret is engaged with the primary target.

The antimissile mode can be disabled via the configuraiton menu. When disabled, missile and drone targets are evaluated normally as primary targets.

Rapid refire lasers are selected in antimissile for swarm and S ware class missiles, ensuring a rapid swarm takedown. Hull DPS ordered lasers are selected for other heavier missiles, which are tough to kill in AP.

Missile Interception

Smart turrets will shoot at missiles incoming to any ship of the same race. For the player this also includes missiles incoming to targets protected by player ships.

Retargetting

Targets are reevaluated periodically based on calculated threat/desirability. Ship values are based on laser strength, missile boats on strongest missile payload, and missiles based on payload.

A nearby target has its desirability raised over far away targets, and targets with shield damage are more preferred.

Laser Switching

The selected lasers for shooting at a target are recalculated periodically and switched if a more desirable set of lasers is found.

Shield and hull dps ordered lists are selected from for shooting captital ships, whereas a special method is used to select anti fighter/corvette lasers. This method attempts to pick the best DPS laser with sufficient speed to hit the target, where desired bullet speed and is modified by factors such as target class (fighter/M6), speed and distance away. An M6 idling at point blank range would attract slow heavy lasers, whereas an M6 flying at speed at long range would attract less powerful but faster bullets.

The various ordered laser lists on Smart enabled ships are recached when Smart is enabled on a ship, and include only those compatible lasers present in the cargobay. The data is recached when Smart is enabled on a turret or mainguns, at game reload (game data may have been modified while offline), and when the value of lasers in the cargobay changes from a previously calculated value (e.g. buy or eject a laser triggers recache).

Notes:
1. Smart is optimized for a laser rich environment, i.e where a sufficient amount of lasers of a given type is available on the ship to service all turrets that use the laser. Smart may not function well under laser starvation conditions.
2. It is normal that Smart may appear to switch only 1 laser into the turret during combat. This is to free up lasers for use by other turrets. The Idle Lasers setting will fill the turret at all times to improve looks, but this setting is not recommended unless a complete set of lasers of each type is available to satisfy all turrets.
3. If neutral/friendly targets are near (within range of longest range AOE weapon in that turret modified by ship size), then AOE weapons won't be selected.

Laser switching can be disabled in turret command profiles (AP only)

Main Guns

Smart includes an Additional Ship Command that automatically switches lasers in the main guns. This is particularly useful to swap in area effect weapons when no friendlies are around.

Note that the main guns remain under manual fire control of the player.

NPCs

Smart can be enabled on NPC ships through the included AL plugin (disabled by default). This can also be configured with more granularity through the Smart configuration menu.

The AL plugin will periodically scan and enable Smart on ship turrets in the active sector matching the configuration requirements (enemies, friendlies, both, big ships, huge ships, all ships, missile boats).

Broadcast

The Smart menu is accessible through Wing and Ship Combat menus, and through Station menus. The menu includes a context sensitive broadcast feature, which can broadcast Smart turret / mainguns relative to the object the menu was opened from. It can broadcast to all ships in sector, all owned ships, ships in wing and fleet.

Turret Command Profiles (AP only)

The behaviour of each of Smart's turret commands can be customized.

This feature is primarily useful to allow a mixture of laser switching and non laser switching commands.

A Custom turret command is supplied as an extra slot, which by default acts as a non laser switching offense mode.
Last edited by Shimrod on Sat, 5. Apr 14, 21:31, edited 46 times in total.

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Mon, 25. Jul 11, 14:15

This looks great. Im curious to read about other peoples experience using this. I will give it a shot.

One question though. How does it work with MARS? I know you cant have both scripts running on turrets simultaneously but will I be able to use some of the MARS functions, such as goblins, while using this, and just not use the MARS defense or offense options on turrets?

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

Post by Shimrod » Mon, 25. Jul 11, 14:46

joelR wrote:One question though. How does it work with MARS? I know you cant have both scripts running on turrets simultaneously but will I be able to use some of the MARS functions, such as goblins, while using this, and just not use the MARS defense or offense options on turrets?
Smart and MARS scripts don't conflict with each other, both can be present in the game. In fact I used fleet battles of MARS enabled enemy capships versus Smart enabled player ships as part of my testing.

However in my experience MARS takes over all the ships turret commands once it's been activated so it's generally not possible to mix MARS with any other turret commands.

One possible exception is that, if I remember rightly, MARS won't operate on missile turrets. This might allow Smart to be assigned to missile turrets while MARS handles the laser turrets.

So in general, unless MARS has a goblin only additional ship command mode without taking over the turret commands, you'll not be able to get goblins running with Smart enabled turrets on the same ship.

You could run the Smart Main Guns additional ship command while MARS is occupying the turrets. However the Smart DPS Cache used for main guns laser selection is only populated by Smart turrets. So unless the cache is populated some other way, the main gun switching won't pick good weapons.
joelR wrote:This looks great. Im curious to read about other peoples experience using this. I will give it a shot.
And thanks! I'm also keen to hear how it works for people, positive or negative.

HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake » Mon, 25. Jul 11, 17:53

Do you think it's essential that the DPS cache be built from realtime data? I'm considering making a script to parse MARS laser data and populate the cache with exact values instead of approximations. I understand you wanted to preserve the interoperability of Smart by deriving laser data from use, but the imprecision irks me on some level. :)

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

Post by Shimrod » Mon, 25. Jul 11, 18:21

Sure, it doesn't matter where the data comes from. Dipping into MARS data sounds like a good optimization to populate the cache.

There's a menu where you can view the cache contents and set the laser delays manually. It's designed to let you correct any glaring issues, though in general the auto sampling produces good values.

The code that pokes it into the cache is at glen.turret.smart.menu.xml:476. Probably best if I move that MaxSamples fudging part of it into glen.turret.smart.dpscache.update in future, lets you pass in values without having to navigate the cache buckets.

Maybe I'll add a button on the cache menu in 1.1 to pull the data from MARS arrays or t files, though it's making assumptions that those formats won't change. I'd not want to copy that data unconditionally though as there's no guarantee MARS data structures or t files lying around aren't stale.

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

Post by Shimrod » Mon, 25. Jul 11, 23:04

RE import of MARS laser stats: doesn't appear possible (delay) or necessary (dps)

My vanilla TC install 03.cat TLaser.pck lists a 676ms refire for gauss cannons according to 'X3 Editor TC's output. The MARS 7047 'vanilla tc' t file entry does not contain this value:

Code: Select all

<t id="220">  Gauss Cannon  </t><t id="221">  42218  </t><t id="222">  17943  </t>
<t id="223">  0  </t><t id="224">  55  </t><t id="225">  900000  </t>
So it looks like the laser delay isn't in there. I know from previous discussions that MARS performs dynamic delay tuning, so I guess MARS also works this out from scratch rather than an exported delay start point.

There's no real value in importing the DPS values themselves. They're only used in making ordered lists of lasers by descending DPS for selecting best weapons vs BigShips. Actual dps is determined by the refire delay.

Accuracy of DPS doesn't matter as long as they're in the right list order. The delay sampling should be sufficiently accurate that this is the case, and if it isn't the cache can be tweaked or flushed to set a better delay.

So based on this I'm concluding a MARS delay import isn't possible, and DPS import has such low potential value versus scale of change (to decouple delay from DPS values in Smart) that it doesn't seem a worthwhile exercise.

The key thing to get right or wrong is the laser delay itself, as this yields the actual dps of the turret.

Halconnen
Posts: 831
Joined: Sun, 22. Feb 04, 12:55
x3tc

Post by Halconnen » Mon, 25. Jul 11, 23:35

Yeah, and even those size values that -are- in there are only -guidelines- for MARS. They're supposed to tell MARS what ship sizes the guns are most effective against, but I've still seen M2s PPC the hell out of small stuff if it figures the chance of hitting is big enough. (i.e. 0m/s M3 just loafing around)

So MARS does lots of non-hardcoded calculations, too.

I'll be giving this a try next weekend, I doubt I'll have much useable time for proper testing during the work week. D:

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

Post by Shimrod » Tue, 26. Jul 11, 00:01

I suspect Smart will also be guilty of shooting that M3, as long as there's nothing better (threat=laser or best missile strength modified by distance and shield strength) to shoot at.

I use a pretty low tech calculation though. If it's a fighter going > 50m/s, > 3km away and isn't able to shoot us with main guns, it gets ignored. There's commented out code to fall back to that target if there's no other target of lower threat, but I ended up leaving this out as I hate shooting PPCs at long range fighters.

Laser selection for non BigShips is based on best ascending refire delay that can reach the target. So if that M3 is limping along at 1% hull at 8km or so it might well get shot at by PPC :)

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

Post by Shimrod » Tue, 26. Jul 11, 01:42

I've released 1.1 ahead of schedule to address a bug with the main guns command that made it unusable.

When a limited set of lasers was available the main guns would alternate between different weapons, as the lasers already installed would not be taken into account when refreshing the laser, causing it to switch to the next best lasers and back again.

Sorry for not catching this before initial release. A side effect of my testing on a ship with a modified cargo bay so it could accommodate a full laser suite for each turret. This doesn't affect the turret script as this already swaps out lasers before picking new ones.

There were no other changes besides fixing a misleading code comment, bumping the version number and recompiling the scripts.

To upgrade simply replace the scripts (t file hasn't changed). Running scripts will detect version change at game load and restart themselves.

DarthVain
Posts: 845
Joined: Mon, 2. Jun 03, 11:53
x3tc

Post by DarthVain » Tue, 26. Jul 11, 11:45

Somehow the file can't be downloaded.
Another one bites the dust!!

DarthVain

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 26. Jul 11, 12:30

Halconnen wrote:Yeah, and even those size values that -are- in there are only -guidelines- for MARS. They're supposed to tell MARS what ship sizes the guns are most effective against, but I've still seen M2s PPC the hell out of small stuff if it figures the chance of hitting is big enough. (i.e. 0m/s M3 just loafing around)

So MARS does lots of non-hardcoded calculations, too.
Yah... lots. =P The DPS are only needed for deciding how to put the best hurt on the target.

This does influence target choice but not if a laser is fired or not.

An M5 at 3km, flying away from you at 200 m/s is unlikely to get shot at... ever.
The same M5 flying towards you or aiming for a close pass may be flying into a PPC barrage because the script would then treat PPC as a laser with a 550 m/s bullet speed.
The laser would clearly pass the "can do" test but DPS has nothing to do with that.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

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

Post by Shimrod » Tue, 26. Jul 11, 13:00

DarthVain wrote:Somehow the file can't be downloaded.
The download link worked OK for me just now. The download counter on x1tp.com has risen since last night too. I'd suspect a temporary outage on x1tp.com, unless the problem persists for you.

Here's a link to the containing page on the host:
http://www.x1tp.com/root/index.php?opti ... 15&lang=en

Regarding best lasers for target, I've employed the following logic:

OOS: Swap in best shield dmg per shot to all turrets
BigShip (inc. m6)/Station
- Shield <=5 % = best hull dps with enough range
- Shield >5 % = best shield dps with enough range
Everything else: fastest refire delay with enough range

AntiMissile: best delay with speed > 700, range < 5000, delay < 1000, 1 DPS cache sample & not ammo based.
N.b. antimissile kicks in only when antimissile is enabled or lasers are available - otherwise missiles/drones are processed based on standard targetting/laser selection, i.e best delay. However I've limited it so that only 1 gun will be populated when shooting those targets via main firing loop.

This works well in general though it's never going to be as good as having access to laser flags and details regarding fragmentation dmg, or direct hints as to best type of target.

I'd really like to bias flaks for fighters/m6 and psg's (well, for everything!), but no option except to hardcode. Would be good to get some indicator of fragmentation dmg to boost flak selection legitimately, no way to tell though.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 26. Jul 11, 16:37

AntiMissile: best delay with speed > 700, range < 5000, delay < 1000, 1 DPS cache sample & not ammo based.
Lowest shield damage / shot should work just as well.

Shimrod wrote:I'd really like to bias flaks for fighters/m6 and psg's (well, for everything!), but no option except to hardcode.
Bullet speed is available and that's key for any anti-fighter bias.
That's all that "Flak" really means in X3.

Shimrod wrote:Would be good to get some indicator of fragmentation dmg to boost flak selection legitimately, no way to tell though.
As for the usefulness of fragmentation damage...
http://forum.egosoft.com/viewtopic.php?t=240049
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

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

Post by Shimrod » Tue, 26. Jul 11, 18:08

Gazz wrote:Lowest shield damage / shot should work just as well.
Sure, although I preferred fastest refire possible for antimissile, where swarms are then least likely to penetrate the defence as its firing so quickly (1 shot per gun per missile per iteration).
Gazz wrote:Bullet speed is available and that's key for any anti-fighter bias.
I initially based anti-fighter off bullet speed however this had a tendency in cmod4 to always select the gauss cannon, firing projectiles at great speed with 6s refires, usually unable to hit small ships. The ion cannon as a beam laser was also fast bullet wise but inappropriate for fighters.

I elected for low delay as these (preferring PRG, PBE, IRE etc) are able to consistently hit small targets rather than fast speed beams and gauss cannons which don't have a good hit rate. They might not have optimal DPS but they get the job done in the end.

I'll do some testing based on selecting speediest laser when m3 target is around the 2km mark. I'll need to add a fudge factor to exclude beam lasers, say using a refire or range cap. Will take some time though as I've currently reverted to vanilla for some test cycles before I go back to cmod.

M6's also vex me. A DPS based selection is generally good but they are often maneuverable enough - especially when attacking some other target than self or 2 m6's flying in a loop chasing each others tails - to avoid the slow pot shots.

A delay based selection sucks vs m6 though as they out regenerate pea shooters. I tried to come up with the perfect formula for M6 factoring in target, laser speed, dps, delay, distance to target. Eventually wrote that off and just use dps, which generally works well enough.

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

Post by Shimrod » Wed, 27. Jul 11, 04:25

Selecting by speed over delay for fighters is working well in vanilla so far. Some comparative data below from a couple of boreas turrets, flaks come out tops.

Code: Select all

ByDelay=ARRAY ( Pulsed Beam Emitter, Phased Repeater Gun, Mass Driver, Energy Bolt Chaingun, Particle Accelerator Cannon, High Energy Plasma Thrower, Concussion Impulse Generator, Ion Pulse 

BySpeed=ARRAY ( Flak Artillery Array, Pulsed Beam Emitter, Cluster Flak Array, Phased Repeater Gun, Mass Driver, Particle Accelerator Cannon, Energy Bolt Chaingun, High Energy Plasma Thrower, ... )

Code: Select all

ByDelay=ARRAY ( Gauss Cannon, Concussion Impulse Generator, Ion Pulse Generator, Cluster Flak Array, Flak Artillery Array, Photon Pulse Cannon, Ion Cannon )

BySpeed=ARRAY ( Flak Artillery Array, Cluster Flak Array, Concussion Impulse Generator, Ion Cannon, Gauss Cannon, Ion Pulse Generator, Photon Pulse Cannon, Flak Artillery Array, ... )

qwizzie
Posts: 562
Joined: Thu, 1. Jun 06, 12:17
x4

Post by qwizzie » Wed, 27. Jul 11, 12:40

Any chance this is compatable with mods like XRM or SRM ?
I'm playing XRM right now which has some new lasers in the tlasers
i think... wondering how this script would handle that.

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

Post by Shimrod » Wed, 27. Jul 11, 13:32

Its intended to be compatible with any mod, I did all my testing for 1.0 with SRM + CMOD4 installed. Currently doing vanilla trials. Haven't tried XRM though. X-tended is something I'm keen to try it with.

The idea with the laser delay sensing and heuristic laser selection is to avoid dependency on hardcoded laser statistics. No assumptions are made except for the set of lasers we never want to select (e.g. tractor beam), and those which we don't want to fire with friendlies around (e.g. PSG).

Note that I've got a change in the works for 1.2 to support ability to switch mods underfoot while Smart is installed. To improve performance in laser selection, arrays of compatible lasers sorted by range, speed and so forth are cached per ship per turret. As this cache can become stale if game data is edited or a mod applied, I'm adding logic to detect game data change and rebuild the cache.

qwizzie
Posts: 562
Joined: Thu, 1. Jun 06, 12:17
x4

Post by qwizzie » Wed, 27. Jul 11, 15:16

sounds interesting .. i will await yr new update and try it then

(----____JEFF____----)
Posts: 269
Joined: Sat, 20. May 06, 14:55
x3tc

Post by (----____JEFF____----) » Wed, 27. Jul 11, 15:57

Just a word of warning, if you make a XTC variant keep in mind ECM is also part of it and that all the default turret scripts are replaced with ECM compatible variants (the actual scripts aren't replaced, but other scripts are assigned to the default commands). This can be reset by turning off an AL option, but it might be smart to mention that to users (though I don't even know if you do any replacing of scripts anywhere, or might plan to do so in the future).

Anyway always nice to see more turret scripts ^^

Post Reply

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