[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 »

No need for reloading, at least in Smart's case. I haven't delved too deeply into MARS's 'enemy mine' logic.

Smart uses an AL plugin that scans for ships in the active sector meeting the configured criteria (neutral, enemy, Big, Huge, All, Missile boats) then starts Smart scripts on each of their turret slots. A Smart central ship task will spring into being.

When the configuration is changed to exclude a ship, Smart's central ship task will detect this in short order and shut down, swapping in default turret scripts in its place. Also when NPC ships exit the active sector Smart stops running on them, as turret scripts don't run OOS.

I'd expect the MARS NPC design to be similar in terms of enabling MARS, but I don't know what critiera if any it uses for disabling MARS.

For all practical purposes, disable whichever one is active on NPCs, wait 20 seconds or so, then enable the other. If it blows up, then blame MARS :P
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

so I copy paste smart into \addon

and nada... no new turret options :?: yes my ship have fight command ship 2

no new config on AL settings too... mars is still there but no smart whatsoever...

:?: :?: :?:

o wait... is that the turret config under the gameplay setting menu?

is that the turret command alpha beta gamma thing? wait, I guess that's not smart...?

I'm very confused, where's smart? how does it look like, where should I look at?
:lol:
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

This is the path where the scripts need to go, assuming the Steam folder is d:\Steam:

Code: Select all

D:\Steam\steamapps\common\x3 terran conflict\addon\scripts\setup.glen.smart.turret.xml
This is where the t file needs to be:

Code: Select all

D:\Steam\steamapps\common\x3 terran conflict\addon\t\9050-L044.xml
To verify the scripts are in the correct location, open the in game script editor and see if you can see 'setup.glen.smart.turret' in the list. If its not there, then the scripts are in the wrong place.

If the game loaded Smart, you'd see a message in the player logbook from Smart from after first game load. The AL plugins menu would contain a green Smart NPCs entry. When you open the command console of a ship with fight cmd software mk2 and go into the Combat menu, you'd see a green Smart menu item. If that ship had turrets, you'd see 5 green Smart turret commands available in the command console beside the builtin turret commands.

If the scripts are in the right place and the game for some reason failed to load Smart, there may be a clue in the log file that the Smart setup script should have created.
C:\Users\JohnDoe\Documents\Egosoft\X3AP\log09050.txt

Code: Select all

Smart Turrets 4.2
[0 -1   Setup       ] New install
The turret config under the gameplay setting menu is not Smart, this is built into AP.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

:lol: apparently my brain thought I extracted the files to \addon when it was on \TC :headbang:

question, how do I customize custom setting?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Smart has a config menu that can be opened through the Combat menu in the command console of ships and wings. Turret Command Profiles is at the top level of that menu, then go down into the Smart Custom entry to set its behaviour.

It opens through those places as the menu contains a context sensitive broadcast option, which can roll out Smart commands relative to the ship/wing/station the menu was opened from.

There'll also be a link to the Smart menu from that gameplay turret command menu, once they patch in Gazz's update that supports 3rd party turret script menu links. Smart's setup script already contains the integration logic ready for when that's available.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

okay, SMART vs MARS :lol:

offense mode :

setup : XRM 1.16, 1 Tyr, 32 PSPs, 24 SSCs, 8 FBCs, 40 MAMLs - Xenon core 023, enemies : A LOT :lol: NPCs are using MARS not SMART

SMART is somewhat a bit smarter with smaller guns (FLAKs, HEPT like guns) vs smaller ships and in swarmed condition, though I admit it's hard to spot the difference between 2... SMART somehow felt more efficient at killing little bugs, flies, etc; SMART also somewhat felt more smarter against missiles, but again, can't provide evidence, might be just placebo effect

both are capable of using beam weapons to kill even fighter drones

however one thing I spotted right on was SMART was reluctant in throwing PSPs toward corvettes! MARS just blown them using PSPs while SMART tried to use FLAKs & MAMLs against them, frankly this is a huge disadvantage for SMART! no I'm not exaggerating here, why because at close range (<=2KM) PSPs will have huge chance to hit corvettes and kills them much much much faster than any other terran weapons in XRM, and possibly almost any other weapons in XRM except 'charged' lasertower beam cannon and big boom missiles/torpedoes

against big ships, both are somewhat on par...

in the end it can be said that SMART save more weapon energy than MARS, MARS is more brutal at throwing anything in the inventory... while SMART more conservative at the weapon choice...

switching between MARS and SMART, there is noticeable delay when switching to MARS while SMART is quicker at activating itself

that's my report :P
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Nice eval :)

On the M6 front Smart originally selected highest DPS lasers. However in playtesting I found that the fast M6 could quite easily evade heavy laser fire, so I implemented a special heuristic laser selection.

This aims to select the highest DPS laser it thinks has sufficient speed to hit the target, with the speed threshold influenced by distance to M6 and the speed its travelling. When the M6 comes within 500m it'd shoot heavy lasers, and as it goes further out at 500m steps, the speed requirement increases by multiples of the target's own speed.

I notice having a quick look in XRM, that the M6 speeds are above 200 m/s. This might explain why Smart is preferring faster lasers in compared with my observations in vanilla, where if I recall correctly, M6 were going between 100-150m/s.

Though it seems to me that it's going to be pretty hard to hit an M6 manoeuvring at 200 m/s with PSPs at even 1000m.

I'll do some testing this week with XRM vs M6 and see how it looks. I tweaked the algorithm in 4.2 to double the range multiplier, and maybe this was too much when it's multiplying M6 speeds of 200ms.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

Shimrod wrote:Nice eval :)

On the M6 front Smart originally selected highest DPS lasers. However in playtesting I found that the fast M6 could quite easily evade heavy laser fire, so I implemented a special heuristic laser selection.

This aims to select the highest DPS laser it thinks has sufficient speed to hit the target, with the speed threshold influenced by distance to M6 and the speed its travelling. When the M6 comes within 500m it'd shoot heavy lasers, and as it goes further out at 500m steps, the speed requirement increases by multiples of the target's own speed.

I notice having a quick look in XRM, that the M6 speeds are above 200 m/s. This might explain why Smart is preferring faster lasers in compared with my observations in vanilla, where if I recall correctly, M6 were going between 100-150m/s.

Though it seems to me that it's going to be pretty hard to hit an M6 manoeuvring at 200 m/s with PSPs at even 1000m.

I'll do some testing this week with XRM vs M6 and see how it looks. I tweaked the algorithm in 4.2 to double the range multiplier, and maybe this was too much when it's multiplying M6 speeds of 200ms.
while your decision logically sound in theory, in reality M6 are quite easy to hit using PSPs when they came into <=2 KM range.... I say easy does not mean 75% or more hit percentage... just somewhat around 30-50% but the damage/hit IMO makes it worth for the try...

as for XRM M6, they are fast but they have slow turning... so the AI can't turn fast that is why it's still quite easy to hit them using capital weapons in close range...


another thing with SMART & XRM compatibility, MARS use... well, MARS equipment to be used and with current XRM, it's indeed quite pricey and can't be fit into M3 or smaller CMIIW

SMART with Fight MK2 OTOH is far cheaper and can be fit into even M5, so things are quite a bit unbalanced here... maybe this is not your concern though :P :roll: :lol: speaking about this, does this mean SMART available on all ships that have turrets if I set it on? including TS, TP and maybe turreted M5?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

SMART with Fight MK2 OTOH is far cheaper and can be fit into even M5, so things are quite a bit unbalanced here... maybe this is not your concern though
Ideally I'd link it to a fight cmd MK3 priced similary to the trade cmd MK3, however there isn't one and I'm not too worried about it.

If you like you can change the ware type requirement as follows:
1. Edit this line in setup.glen.smart.turret to desired ware.

Code: Select all

* Ware type Smart is linked to
$RequiredWare = {Fight Command Software MK2}
2. Invoke Smart's Uninstall option from the menu.
3. Save and reload.
speaking about this, does this mean SMART available on all ships that have turrets if I set it on? including TS, TP and maybe turreted M5?
Smart works on any ship except XRM PAR ships.

I'm looking into the M6 laser heurstic. Seeing if I can get a balanced algorithm for vanilla and XRM using an xls to plug in speed and distance.

------------

Tyr is failing to hit Xenon P with PSP's > 1km about 95% of the time. 3 P's destroyed the Tyr over the period it was missing.

I did notice the routine was picking beam lasers as a fallback if none met speed critiera, when it should have picked the fastest none beam instead. Will have that fixed.
deca.death
Posts: 2939
Joined: Mon, 28. Feb 11, 19:50
x3tc

Post by deca.death »

OK, found a nasty bug.

Seems like your new version gives khaak ships with beta and gamma kyons somewhat of chaingun rapidfire buff :) And to make things worse, I encountered it when I installed new version of XRM so I was put off track, didn't know where problem might be. So I tested every possibler solution, pull out all recent software, codes, reinstall drivers for GPU, tested all beam ships in various combinations ... Initial fire they open is so rapid that it makes system stutter so I though problem might be in sound codecs ...

So ... when smart for npc is enabled, khaak vettes become killers and destroyers become planet busters :) Turning smart for npc off everything turns to normal. Now that I think of it, it's possible that my beam ships that I called in remained on my previous turret settings when I changed ownership so it's possible that problem is more widespread then I taught.

Rapid solution to a problem would be most appreciated ;)
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I've been trying to repro this for an hour and its not happening for me.

Khaak destroyers, corvettes and frigates are not any more overpowered than they already were, both in player and NPC hands with Smart enabled.

The only thing I noticed is that 9 beta kyons on the front of the corvette shoots with no refire delay in the hands of the player. This takes out M6 and M7 pretty fast. It has nothing to do with Smart. However in the hands of the NPC, they seem to use some delay when firing the main guns, so this may not be the problem.

Though I did notice during my testing when an NPC corvette was chasing an M6, it killed the M6 pretty fast with its mainguns. Again not Smart related.

- Can anyone else corroborate this problem?
- Does the TLaser file show an unusual refire rate for kyons?
- Could there be some other mod affecting this than XRM+Smart?
- Does Smart have any special settings configured?
Last edited by Shimrod on Tue, 7. Feb 12, 00:58, edited 1 time in total.
deca.death
Posts: 2939
Joined: Mon, 28. Feb 11, 19:50
x3tc

Post by deca.death »

Shimrod wrote:I tried both spawning myself in a player khaak destroyer, and spawning a khaak race destroyer with Smart NPCs enabled (verified active through tracing).
Let me clarify: Problem happens only when AI's commanding the ship. When I take ownership, fire rate is normal. I've checked with Xeditor2 - fire rates are normal, for beta kyons around 45 hits/min.

When you personally fly the ship you can squeeze and not release trigger but that's and old vanilla bug that cannot be remedied and it's considered cheating /that's why all XRM ships have beam weapons exclusively in turrets.

I know how hard kynos hit very well, but my description of "chaingun" was fairly accurate - when xenon M6 is circling around my M2 it shoots like 10 beams in second and my shields melt away very fast. It can kill M2. It takes down shields of another corvette in 2 seconds. When I turn off smart for NPCs, fire rate returns to normal. When I enable it again - I have the same problem.

Khaak fighters (alpha kyons) have no problems - they behave OK.

I'm using cheat script to recreate the ships and it never fails. First time I've encounter it in a normal gameplay. I've tested atlas (was mine, I've changed ownership) with full compliment of plasma beam canons. No problems there. Unknown object prototype with 8+2 laser tower beam canons also behaves normally. It seems that only khaak for some reason get beserk.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I've got 15 khaak corvettes spawned around a player tyr, Smart NPCs enabled, and all I'm observing in fire rate is their main guns shoot somewhat faster than turrets.

Lacking a local repro, one thing you could try is generating some logging during when the KM6 is shooting like crazy. Set debug mode on in Smart's global settings, trace level 10, and select the KM6 as the logging target. This way it'll capture logging coming from the KM6 rather than the playership. Log is generated to:

Documents\Egosoft\X3AP\log09050.txt

Also how many kyons are available in the KM6 cargobay? Could be related to laser availability.
deca.death
Posts: 2939
Joined: Mon, 28. Feb 11, 19:50
x3tc

Post by deca.death »

Shimrod wrote:I've got 15 khaak corvettes spawned around a player tyr, Smart NPCs enabled, and all I'm observing in fire rate is their main guns shoot somewhat faster than turrets.
I've just tried again. Created corvette, killed it, my shields on 98% (H dragon)
Enabled smart, created corvette, got killed in two seconds, with computer stuttering in freezing for few seconds. When I enable god mode then I can watch insane fire rate of those things.

I have these mods installed:
Pure X HUD
MilitaryBaseResponseRevamp-V2.14
missile_safety
missile_defence_MMD-mk2
Smart_turrets 4.2
NoStationWrecks-V1.0
XRM_HULL_LOW /hull multiplication
XTended Galactic New System V105
extended comunication
Auto jump, terran jump
numeric race ranks_tc
Ranking pirate-yaki
IE Immersive environments 1.0
XRM_ALL_PLOTS_COMPLETE_1.5
Litcube's Bounce V1.643
Automated Satellite Network-V2.00
Pirate guild
Yaki Armada
Set debug mode on in Smart's global settings, trace level 10, and select the KM6 as the logging target.
Where can I find global settings for smart?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Open ship command console, go to Combat->Smart->Global Settings.

I jumped into a khaak sector to experience naturally spawned khaak rates of fire, and haven't seen any of them do anything unusual. They definitely have Smart running.

Looking like I can't repro this locally so will need to go off your own findings. Hopefully the log contents will give some clue.

The only mod that looks potentially suspicous is the following, assuming its turret related:
missile_defence_MMD-mk2

Could you link me to the thread for that?

Assuming its this one:
http://forum.egosoft.com/viewtopic.php?t=238799

Did you notice this?
MD Mk2 is not compatible with X3: Albion Prelude.
deca.death
Posts: 2939
Joined: Mon, 28. Feb 11, 19:50
x3tc

Post by deca.death »

Shimrod wrote: Could you link me to the thread for that?

http://forum.egosoft.com/viewtopic.php?t=238799

But your scripts happily coexisted for a long time in my game. I'm pretty sure new version did this somehow. I killed many khaak before and never noticed that. And again, I've enabled smart for NPCs not so long ago, when we concluded it offers greater chances of boarding pods getting thru, MMD mk2 prioritizes them (quite sadistic, really ;) and smart treats them (thankfully!) like any other missile.

Anyway it's getting late here but we'll continue investigation tomorrow.


EDIT:
I play XRM.TC, i know about prelude missile scripts improvement.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I play XRM.TC
Herein my lie the problem.
Smart version 4 is designed for Albion Prelude and will not work on Terran Conflict. Use the 2.x version for Terran Conflict.
I can't imagine what would happen if trying to run Smart 4 on TC, as it uses many script commands which don't exist. It sounds like you're experiencing some of that undefined behaviour.

You'll need to stick with Smart 2.x for TC. Be sure to run Smart's uninstall to clean out the 4.x scripts and settings, before downgrading to version 2.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

Shimrod wrote:
Tyr is failing to hit Xenon P with PSP's > 1km about 95% of the time. 3 P's destroyed the Tyr over the period it was missing.

I did notice the routine was picking beam lasers as a fallback if none met speed critiera, when it should have picked the fastest none beam instead. Will have that fixed.
wut? :o you aren't playing XRM are you? maybe that's the difference... 3 P won't be able to kill a Tyr in XRM, it take at least 10 P, as for PSP, try stopping your Tyr or move so slowly (<20m/s) PSP will hit Ps since they are also slowing down near you... or maybe once again XRM is too much different than vanilla...
deca.death
Posts: 2939
Joined: Mon, 28. Feb 11, 19:50
x3tc

Post by deca.death »

Shimrod wrote:
I play XRM.TC
Herein my lie the problem.
Smart version 4 is designed for Albion Prelude and will not work on Terran Conflict. Use the 2.x version for Terran Conflict.
And as always we've came to "stupid user" human factor :) Damn, I was so eager getting my hands on that shield control /bailing settings that I overlooked most obvious ....

JFTR, your bailing settings work just fine even in TC ;)
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Yeah XRM, stationary tyr with M6 floating around and laser selection algorithm changed to favour slow lasers.

Was highly ineffective shooting PSPs at around the 1-2km mark where the M6 are flying around. I've experimented a little this evening and plan some changes, although most likely I won't be switching in PSP's unless the target is within 1km.

However the balancing will take some time because it makes a huge difference when flying an M6 or M7, because distance to target doesn't take into account the size of the player ship and where the turrets are located relative to the origin, so fixing one case can screw over others.
your bailing settings work just fine even in TC ;)
I can't believe you got that far :)

Actually the bailing stuff works based off shield and hull damage per shot, so much of the tracking would still be accurate. But things like this will fall over:

Code: Select all

411   |$Laser.Flags = = get bullet flags of laser $Laser 
412   |* Can't strip shield with mass drivers
413   |skip if not ( $Laser.Flags & [Bullet.IgnoreShield] ) 
414   ||endsub
Because the bullet flags command isn't available in TC.

I'd love to create a unified single version. They'd need to backport the new script commands to TC though. They haven't backported any commands, just checked. The command they reused for getting laser refire delay (get default launch time difference for missile type), is returning strange numbers in TC.

I suspect what probably happened in your khaak case, is the refire delay was reported by that API as something very low, so Smart is firing them extremely quickly. The TC version of Smart uses the laser training feature to estimate laser refire delays.

I've added version detection to the 4.3 setup script. If it's not AP it'll send a message to the player and exit.

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