[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: Scripting / Modding Moderators, Moderators for English X Forum

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

Post by Shimrod »

Ha I suspected as much, but haven't done anything yet beyond scripting myself in some computer components, microchips and IRE's :)

Initially I'm curious about potential for plugging into the new turret priority system, whether the listed targetting priorities are available to 3rd party turret scripts.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Just an update, no new version yet.

I ran some basic tests in a shrike with the stock turret commands configured with similar priority to Smart (missiles, huge ships, big ships, fighters, anything) and with laser switching enabled, against M4, M6 and drones. Smart 2.1 appeared significantly better and would also shoot fast refire lasers (PBE) more rapidly than the vanilla turret commands, which I believe is because the turret turning is run in separate tasks. I concluded it was therefore desirable and worthwhile updating smart for AP.

I have not tested the Antimissile feature as yet.

I'm working on an AP specific version of Smart. It will not be compatible with TC as it uses new script commands unavailable in TC, consequently there'll be separate TC and AP version. I plan to manage this by leaving a version gap between the current Smart (2.1) and the AP version (say 4.0) sufficient for backporting fixes, and separate download links would be used for the 2 versions.

Initially I spent some time on making exscriptor compatible with AP, without which the Smart scripts would be unmaintainable. This has been working ok so far and I've shared my exscriptor AP compatibility files (http://forum.egosoft.com/viewtopic.php?t=312689).

I examined the new AP turret configuration logic, which appears to be based in '!plugin.gz.missile.def.mk3.menu.xml'. The set of turret commands appears hardcoded so it's not possible to extend the list to include a Smart entry. It may be possible to add a Smart config option to 'follow' one of those builtin command configurations and peek into that commands config data, however at this stage I'm not planning on doing that.

I'm presently redesigning Smart's caching code. With the new APIs for laser refire and bullet flags I've been able to simplify Smart's laser caching (3 caches -> 1 cache), boost selection of PSG effect lasers, and properly detect beam lasers. For the DPS ordered laser lists I'm also multiplying the DPS by min (guns in turret, lasers of that type in cargobay) to help promote selection of plentiful lasers over those where only a few are available, which should help out in laser starvation scenarios.

For OOS I'm planning on having Smart's central ship task monitor the ships combat situation and switch lasers between best OOS hull or shield DPS (using cached OOS laser lists based on the the new OOS shield/hull APs). Whether its possible to determine the OOS ship target its shooting at, to figure out if its shields are down, is something I've yet to figure out though.

I should be able to improve auto generation of the collateral damage laser list using bullet flags (I'll flag PSG and IonD effects). I cannot fully automate the excluded laser list however because there are no special bullet flag on the tractor beam and mobile drilling system. I'll need to continue to exclude these by laser index.

Scripting isn't getting a big timeslice over xmas though so I don't expect any release until Jan or even Feb.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Shimrod wrote:I examined the new AP turret configuration logic, which appears to be based in '!plugin.gz.missile.def.mk3.menu.xml'. The set of turret commands appears hardcoded so it's not possible to extend the list to include a Smart entry. It may be possible to add a Smart config option to 'follow' one of those builtin command configurations and peek into that commands config data, however at this stage I'm not planning on doing that.
To be honest, I didn't have the time for many "extra" features like that. =)


It's certain that there will be an AP patch so I guess I could extend the functionality in a generic way.

The script scans a predetermined global array.
From there it fetches a text entry to display for the menu "frontpage" and a (menu) script to launch if the button is clicked.

That way any script can be added to the menu.
What it configures... that depends on the turret script in question.
For MARS, it could launch the MARS menu...


In fact, I did. It's really a small change...
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 »

That sounds good, though please treat it as a low priority from Smart's perspective. I'll not be able to fit in anything more significant than opening Smart's standard config menu through the link for some time yet :)
garrry34
Posts: 911
Joined: Sun, 17. Jul 05, 14:43
x3tc

Post by garrry34 »

sorry shimrod I should've said, I have been using it since day one, missile defense seems to work as it did, granted the missiles are tougher now, I maybe suggest doing what you did with regards to drones and up it to 2 lasers per boomstick...
PhenomII X4 940 black edition
8GB DDR2
ATI HD4890
Windows 7 64bit
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Thanks Gazz.

For antimissile, seems like mosquitoes or poltergeists are the way to go. I don't like to reinvent the mosquito defence wheel, but Smart has the added feature of intercepting missiles incoming to any ship rather than only the ship with the incoming missile seeing it.

Having Smart fire mosquitoes using its racial incoming missile array tracking would allow for significant fleet antimissile defence.

I really wish that ships included the odd missile turret supporting low yield missiles, as it'd look great visually to include short range low yield missile barrages while not being overpowered. M6's are dead to me in X3, turning slower even than some M7's. Using a couple of those unused turret slots for low grade missiles would really spice things up!
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Shimrod wrote:That sounds good, though please treat it as a low priority from Smart's perspective. I'll not be able to fit in anything more significant than opening Smart's standard config menu through the link for some time yet :)
I'll treat it as... over and done with.
If there is nothing else to configure then access to the "basic" menu is really all that's needed.
If a (menu) script is uninstalled or removed from the array, it is no longer listed. Simple.

Check out the bottom of setup.plugin.gz.mars for how to tie it into that menu.
MARS already shows up. Live and in colour.
Every entry is treated as a submenu. Zero extra work required.

Of course, that's not going to work for some time, yet, unless you also install the Missile Safety script, which includes in a subfolder the latest and greatest version of the AP turret script... with all new bugs!
Err... bugfixes, I mean.


The missile defense capabilities of the "new AP script" got somewhat more hardcore.
If you shoot a missile up the tail of a 4 Nova formation your missile has to get through a crossfire of 4 rear turrets. Finally the AI shows some team spirit!
The beauty of it? Smarter task scheduling made this possible at no extra CPU load! In some cases there should be a decreased CPU load - which is pretty important considering the lag caused by missile barrages.
Causing extra lag during a missile barrage = shooting yourself in the foot. =P

Basically, this "new ability" was a side effect of script optimisation. But don't tell anyone. =P
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 »

I like what you've done.

In Smart I found that when a barrage approaches a bunch of Smart enabled ships, this could produce significant lag which I attributed to each ships turret performing distance to target calculations on all the warheads each script iteration, particularly having to iterate the full potential target list when nothing is yet in range to shoot at.

I'd test this by spawning an M7M, spawning typically 15 player HCP in between this and the playership, and running a script to force the M7M to fire n flails at the playership (typically 10 flails, so 80 warheads). As the barrage closed to about 10km lag would kick in.

Also when playtesting Smart NPCs I'd spawn a Xenon fleet in Legends Home and have them duke it out with the sector defence. The native missile boat barrages into the massed Xenon fleet would produce lag which I attributed to the same issue.

I mitigated this lag by having the Smart central ship task, which produces a distance ordered array of incoming missiles for use by the turrets, crop the array at something like 25 nearest missiles. The central ship task also only includes missiles in the list which are about 10k from the ship, so no work is performed by the turret scripts until the missiles close (and hence the lag would only occur as the barrage came within 10km). The cap is configurable in performance settings and does not apply to the playership.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I've uploaded version 4.0 of Smart Turrets, compatible with Albion Prelude.

4.0 is not compatible with Terran Conflict. I've left a version gap for potentially backporting fixes to the TC version.

Code: Select all

- 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.
grinningsphinx
Posts: 20
Joined: Sat, 4. Jun 05, 08:22
x2

Post by grinningsphinx »

Smart 4.0 for Albion seems to have some kinda error on my install. Keeps popping up a question box asking for number of missile barrages....Im in a magnetar:)


Working as intended or ?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

That is certainly not intended. I was unable to reproduce this after spawning a Magnetar, enabling Smart, spawning 2 Xenon M's and watching Smart shoot the M's. Could you clarify how to reproduce the problem?

Its worth noting that Smart contains no text to ask for number of missile barrages, nor does it contain script parameters of that name/description or call a builtin script with those parameters. This tends to suggest the problem may be in a script other than Smart.

Here's a theory:

There is such a parameter in the following script:

Code: Select all

!ship.cmd.missile.attack.std.xml:<argument index="3" name="a.amt" type="Var/Number" desc="Number of barrages" />
If a script is calling !ship.cmd.missile.attack.std.xml and supplying too few parameters, the game would I suspect pop up a box to get a value for the missing parameter.

Looking at X3TC, the !ship.cmd.missile.attack.std script accepts only one parameter. In X3AP it accepts 3 parameters.

Could you be using some X3TC script which calls !ship.cmd.missile.attack.std with too few parameters when run on X3AP?

Try searching the other addon\scripts files to determine what is calling !ship.cmd.missile.attack.std, and confirm the number of parameters specified in each case. This may lead you to the script or mod which is incompatible with AP.
Sirin111
Posts: 32
Joined: Sun, 8. Jan 12, 14:09

Post by Sirin111 »

Hello, will this thing make my game ***modified***?

ANd how do i uninstall this? Readme says:
- Select the Uninstall option from the in-game menu.

Where this menu exactly? :?

//Edit: I use smart version For AP
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Copying the files in shouldn't automatically make games modified. But the game will not use Smart scripts unless it has been put into modified mode and reloaded.

To get Smart working you need to either:
1. In a non modified game, activate the script editor, save and reload. Smart will then initialize and be available on reload.
2. Copy in an empty !init script, such as the one available in my Custom Start zip. This will force all games into the modified status, so that Smart is available without having to access the script editor.

When Smart is initialized and ready to use in a game you should see:
- A message in the player message log saying thanks for trying Smart.
- When combat commands MK2 is available, ship turret command options will include Smart commands.

Smart's menu can be accessed from 4 places:
- Ship Combat Commands menu
- Wing Combat Commands menu
- Station Additional Commands menu
- A menu link inside the AP turret configuration menu in the main options menu. Note: this will not appear until a later AP patch level when Gazz's 3rd party integration support appears.

Smart's broadcast command operates relative to the thing the menu was opened from.
Sirin111
Posts: 32
Joined: Sun, 8. Jan 12, 14:09

Post by Sirin111 »

Thx, сould it be that I copyed Smart files to my X directory, NOT activated the script editor and my game still changes to ***Modified*** ?

And if I did not open the script editor, do I need to do to so to uninstall the Smart? or simply remove the files?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Thx, сould it be that I copyed Smart files to my X directory, NOT activated the script editor and my game still changes to ***Modified*** ?
Copying Smart scripts alone into a completely vanilla install should not make games automatically modified (and neither will Smart be installed by default into games). It should be straightforward to verify that by trying it out; modified status should not affect existing savegames, only games created/loaded subsequent to modification.

To force modified status, scripts usually include an unsigned script with a name beginning '!init'. At game load or new game start, the game loads the init script and automatically modifies the game. Smart does not include an init script. I'm actually planning on including one in a subsequent Smart release; I believe MARS includes one by default.
And if I did not open the script editor, do I need to do to so to uninstall the Smart? or simply remove the files?
If Smart did not install into a game, there will be no Smart menu to do an ingame uninstall from. Just remove the files.
Sirin111
Posts: 32
Joined: Sun, 8. Jan 12, 14:09

Post by Sirin111 »

Shimrod wrote:
Thx, сould it be that I copyed Smart files to my X directory, NOT activated the script editor and my game still changes to ***Modified*** ?
Copying Smart scripts alone into a completely vanilla install will not make games automatically modified (and neither will Smart be installed by default into games). It should be straightforward to verify that.
I see :3 I somehow made ​​my game a modified and now are trying to understand exactly how I did it.

I have three mods installed, and I do not know which one is led to the status of the modified tag.

http://forum.egosoft.com/viewtopic.php?t=249168 - cockpit
http://forum.egosoft.com/viewtopic.php?t=267427 - beautiful space
and third is Smart :(
Shimrod wrote:If Smart did not install into a game, there will be no Smart menu to do an ingame uninstall from. Just remove the files.
I understand that I have no menu for the smart, because I did not enable the script editor, so I just delete the files, thx :)
User avatar
Rakeris
Posts: 407
Joined: Wed, 31. Dec 03, 04:25
x4

Post by Rakeris »

Ok been testing out smart, and I have to say I like it, I find the weapon choices/throttling a li8ttle better than MARS. One thing that I really don't like is how smart will fire on stations that are behind targets. If the station was far enough away the lasers wouldn't reach it wouldn't be a problem. Mars doesn't seem to do this. Is there an option for this or a way to change it?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I was looking for something bite sized to pad out 4.1, that fit snugly.

Station friendly fire avoidance enabled by default. Turrets will search for friendly+neutral stations within 15km, and do nothing if the turret is able to shoot that station in its firing arc. Can be disabled via menu to avoid that processing. This won't eliminate friendly fire but will reduce it:
- Checks are not made within the inner firing loop (performance) which continues to fire at a target for 2 shots or 2 seconds before the turret script loops and does the station check. The ship may have moved in that period.
- I suspect that the 'can fire on target' command might report false when the station centre point is out of view, but when extremities of the station may still extend into the firing arc.

The other feature is boosting desirability of ammo based lasers when laser energy drops below 20%. This triggers a laser recache where DPS for ammo lasers is doubled for purposes of DPS based sorting, and further multiplied based on number of gun slots in turret (since ammo lasers are not throttled). The mode cuts out as energy exceeds 40%, where lasers are recached without any ammo bias.

Code: Select all

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%.
I set up some battles of player ships (Smart turret and main guns) vs Xenon ships. All identically equipped with full laser loadout (laser ware volumes all modified to 1), player ships all set to attack all enemies, spawned 20km apart.

20 vs 20 marauder hauler = 20 Smart ships survived
20 vs 20 heavy osprey = 15 Smart ships survived
20 vs 20 hyperion vanguard = 12 Smart ships survived
10 vs 10 tern sentinel = 5 Smart ships survived
30 vs 30 eclipse = 30 Smart ships survived
30 vs 30 fenrir = rapid response zeus crashed the party. was looking pretty even.
20 vs 20 gladiator = 3 xenon gladiator survived (pretty comical)

Observations:
- M6 laser generators seem to have been boosted significantly in AP. Hyperion was like the energizer bunny. The M7 tern sentinel had a weaker generator than the M6's.
- I attribute the M6 survival rates to Smart's weighting similar target priorities and concentrating fire on the most wounded enemies, where the builtin AI turrets tend to spread their fire more randomly.
- The fenrir fight was looking pretty even. These support only 1 laser type, suggesting switching algorithm may be a key factor in Smart's other successes.
- In the tern fight I noticed many Xenon ships were out of laser energy, where Smart wasn't, and observed the energy bolt chainguns + gauss being swapped into the Smart ships when energy got too low.
- In the huge ship fights much seems to depend on luck of whether the ship is manoeuvring and avoiding the heavy fire, as much as how clever the turret script is.
- In the M8 fights the Xenon were using countermissiles that took out the Smart barrages. I'll add mosquito defence to my spawn scripts next time I try that to even the odds!
Kvalyr
Posts: 336
Joined: Sun, 1. May 05, 15:56
x4

Post by Kvalyr »

I tried this out briefly as it sounds great, but wasn't able to find an option to disable the weapon-switching functionality of the scripts.
Am I missing something, or is that not an optional feature?

I'd like to use this for its smarter turret behaviour in other regards, but I prefer to keep a tight reign on what weapns my ships use in which turrets manually (especially for my playership TL, which holds weaponry in storage that I don't want it using automatically); even if it puts me at a tactical disadvantage.

If I'm not just being stupid/blind and it's not already an option, I'd love for the switching to become toggle-able (in menus, no need for a hotkey I think). If it's not on the cards I can probably just modify the scripts myself to comment out the relevant code, though.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

There's no option for disabling laser switching at the moment.

The simplest option would be to toggle it globally. However it it makes more sense to configure on a per turret basis. I'd like to avoid per ship configuration options outside of the turret command itself. At the same time I don't want to hog lots of turret command IDs for combinations of options.

I'm thinking perhaps a single new Custom turret command, whose behaviour can be configured globally:
1. Behaviour: offense, defense, attack my target
2. Laser switching: on/off

Not sure if this'd be flexible enough, but making the existing turret commands similarly configurable would allow them to be repurposed.

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