Hire Gunnery Crews - Turret AI Version 2 (Beta 4)

The place to discuss scripting and game modifications for X²: The Threat.

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

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Hire Gunnery Crews - Turret AI Version 2 (Beta 4)

Post by Reven » Mon, 4. Oct 04, 11:20

I'm releasing Version 1.94 (2.00 Beta 4) of the "Hire Gunnery Crews" enhanced turret AI script. Anyone who is interested in checking out the bleeding edge. can download it from: ftp://ftp.excelcia.org/x2/scripts/Gunne ... 0Beta4.zip

The major change is that turrets will now automagically engage incoming missiles:
  • If they are in range. This might seem to be a no-brainer, but the stock turret AI doesn't bother to check how far a missile is when it engages it - fire a missile at an enemy ship from 50km out, and then zoom in and watch the ship fire away trying to hit it. It's actually pretty funny.
  • If the missile is a threat to you. I define a "threat" as any missile who's explosive yield is 5% or more of your ship's current shield level. So if you are in an M1/M2/TL, your turrets aren't going to bother wasting time swatting mosquitoes.
Missiles are engaged in a similar (but not identical) manner to ships. Guns are used in the following priority order:
  1. WMDs (Weapons of Mass Destruction - PSG/IonD) if the missile is in range of them, and there are no "friendly" ships within 5km of you.
  2. The best CIWS (Close-In Weapon System) gun that you carry and that your turret can mount. The criteria for what makes a good CIWS weapon is simply the weapon's refire rate.
  3. Your "main" gun, which is defined as the longest-ranged weapon your turret can mount.
This script will scan for a missile it can engage every time it switches targets, or after every 10 shots. This means that the system will reprioritize from anti-ship to anti-missile in the middle of a ship engagement. This is the one area I am most concerned about. I could make the turret do a missile scan only when it is doing a target search, but that would mean you would engage a far lower percentage of incoming missiles. However, the way I have made it, there is a chance that missiles could "distract" your turrets from capital engagements. To try and mitigate this, I have coded it so once the missile is destroyed, the turret will attempt to retarget back on the original ship. Hopefully this will keep your turret from getting pulled off important targets. I'll tweak this behavior as needed.

I would really appreciate feedback on this. The heuristics on what makes good weapons for what situation is getting complex. If you're finding that in some situations you're getting less than optimal results, post as much info as you can and I'll try and tweak the system accordingly.
Last edited by Reven on Wed, 6. Oct 04, 07:16, edited 4 times in total.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

ticaki
Posts: 4861
Joined: Wed, 6. Nov 02, 20:31
x3

Post by ticaki » Mon, 4. Oct 04, 11:28

There is no setup.* or init.* file in the archiv.

Greets ticaki
Zur Zeit nicht aktiv

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Mon, 4. Oct 04, 11:43

Yikes! I should know better than to try and make a release at four in the morning. :p

The .zip file is fixed - anyone downloading now should get the setup script with everything else.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Tue, 5. Oct 04, 02:57

I've released 1.92 (Beta 2 of Version 2).

From the README, the changes are:
1.92 Second beta of Version 2
  • Fixed a potential hang issue where missiles that are engaged at long range can cause the game to hang. Sorry about that.
  • Reduced the engagement range of missiles to the maximum CIWS laser range, instead of the maximum main laser range. This allows the missile to get in closer before it is engaged. Hopefully this is a GOOD thing, as it will reduce the time spent engaging the missile (as the shots have less distance to travel and WMD's can be used immediately) and allow the turret to retarget back on ships.
Beta 2 is available from: ftp://ftp.excelcia.org/x2/scripts/Gunne ... 0Beta2.zip

In addition to this, a change in the way the auto-update system (the system that reruns the script when it detects that it has changed) requires you to MANUALLY restart the script on any ship that has it running. There seems to be a bug in X2's scripting commands that prevents turret commands from being able to restart themselves.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

User avatar
nuclear_eclipse
Posts: 1129
Joined: Thu, 2. Sep 04, 01:54
x3tc

Post by nuclear_eclipse » Tue, 5. Oct 04, 03:23

three words:

you are awesome


This is spectacular. Great job Reven, this script is a vast improvment over the standard turret AI. Cheers! 8)

User avatar
Deathsheep
Posts: 123
Joined: Fri, 20. Feb 04, 21:21
x3

Post by Deathsheep » Tue, 5. Oct 04, 12:46

Superb script!

Watching Khaak getting ripped apart/surrendering is a beautiful spectacle. :D :D :D

One question though. Say you have a ship that only has PSG's fitted to it: Will the turrets still fire, regardless of the current situation (allies in range, etc.)?

What is the over-riding factor? :?:

Cheers! :D

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Tue, 5. Oct 04, 22:17

The short answer is the script will not use your PSGs if there are friendlies in the area. It's probably useful to go into detail on how the script selects weapons, to make it clear when and how weapons are used.

First of all, there are 4 classes of weapons the script uses:
  • TrackingLasers - used to fit to a turret's guns when the turret is going to turn. Selected out of the following list:

    Code: Select all

    017   $TrackingLasers[0] = Mass Driver
    018   $TrackingLasers[1] = Alpha Impulse Ray Emitter
    019   $TrackingLasers[2] = Beta Impulse Ray Emitter
    020   $TrackingLasers[3] = Gamma Impulse Ray Emitter
    021   $TrackingLasers[4] = Alpha Phased Shockwave Generator
    022   $TrackingLasers[5] = Alpha Particle Accelerator Cannon
    023   $TrackingLasers[6] = Beta Particle Accelerator Cannon
    024   $TrackingLasers[7] = Gamma Particle Accelerator Cannon
    025   $TrackingLasers[8] = Beta Phased Shockwave Generator
    026   $TrackingLasers[9] = Alpha High Energy Plasma Thrower
    027   $TrackingLasers[10] = Beta High Energy Plasma Thrower
    028   $TrackingLasers[11] = Gamma High Energy Plasma Thrower
    029   $TrackingLasers[12] = Ion Disruptor
    030   $TrackingLasers[13] = Gamma Phased Shockwave Generator
    These are all the guns (except for PPCs) in order of how fast a turret turns with them mounted. The lower number have priority over the higher number.
  • CIWSLasers - Used as a CIWS (Close-In Weapon System) to attack approaching missiles. The CIWS laser is selected from the following list (sorted in order of refire rate):

    Code: Select all

    034   $CIWSLasers[0] = Mass Driver
    035   $CIWSLasers[1] = Alpha Impulse Ray Emitter
    036   $CIWSLasers[2] = Beta Impulse Ray Emitter
    037   $CIWSLasers[3] = Beta High Energy Plasma Thrower
    038   $CIWSLasers[4] = Alpha High Energy Plasma Thrower
    039   $CIWSLasers[5] = Gamma Impulse Ray Emitter
    040   $CIWSLasers[6] = Gamma Particle Accelerator Cannon
    041   $CIWSLasers[7] = Beta Particle Accelerator Cannon
    042   $CIWSLasers[8] = Gamma High Energy Plasma Thrower
    043   $CIWSLasers[9] = Gamma Photon Pulse Cannon
    044   $CIWSLasers[10] = Beta Photon Pulse Cannon
    045   $CIWSLasers[11] = Alpha Photon Pulse Cannon
  • WMDLasers - these are the "Weapons of Mass Destruction". As a group, these weapons are very effective against shields, less (or in-) effective against hulls, and have the property that they can hit more than one ship at a time. They are selected from the following list:

    Code: Select all

    049   $WMDLasers[0] = Ion Disruptor
    050   $WMDLasers[1] = Gamma Phased Shockwave Generator
    051   $WMDLasers[2] = Beta Phased Shockwave Generator
    052   $WMDLasers[3] = Alpha Phased Shockwave Generator
  • MainLasers - the main is the "all purpose" laser. The one you revert to when none of the special purpose lasers are appropriate. The script tries selects the longest ranged gun you have available that isn't a WMD. The following list (ordered from longest-to-shortest range) is what it chooses from:

    Code: Select all

    056   $MainLasers[0] = Gamma Photon Pulse Cannon
    057   $MainLasers[1] = Beta Photon Pulse Cannon
    058   $MainLasers[2] = Alpha Photon Pulse Cannon
    059   $MainLasers[3] = Gamma High Energy Plasma Thrower
    060   $MainLasers[4] = Beta High Energy Plasma Thrower
    061   $MainLasers[5] = Alpha High Energy Plasma Thrower
    062   $MainLasers[6] = Gamma Particle Accelerator Cannon
    063   $MainLasers[7] = Beta Particle Accelerator Cannon
    064   $MainLasers[8] = Gamma Impulse Ray Emitter
    065   $MainLasers[9] = Alpha Particle Accelerator Cannon
    066   $MainLasers[10] = Beta Impulse Ray Emitter
    067   $MainLasers[11] = Alpha Impulse Ray Emitter
Additionally, there is a fifth sort of "pseudo" category. If you have Gamma HEPTs available and your turret can mount them, then despite what your MainLaser might be, the game will assign the GHEPT as a "HeavyLaser". This is because the GHEPT is the hardest hitting weapon on the game.

Prior to even looking for a target, the script goes through each category and picks the best gun that you own and that the turret can mount.

When it comes time to engage a ship target, the system tries to engage with (in order):
  1. WMDLaser is the first choice. It is skipped, however, if there are no non-enemy ships within 5km or if the target's shields are below 5% (because WMDs are less effective against the hull)
  2. HeavyLaser (Gamma HEPT) is the next choice. It is used if the target ship is in range of them, and if the target ship is not an M4 or M5. The reasoning behind excluding the GHEPT from use against M4s and M5s is that the PPC weapons have bullets that are twice the speed, and the extra oomf of the GHEPT isn't needed against fast targets.
  3. MainLaser is the last, "default" choice. This could also be a GHEPT, but more often than not it's from the PPC class of weapons.
Missile targets are engaged with: WMDLaser, CIWSLaser, MainLaser. The system is smart enough to check to make sure that if your CIWSLaser is a mass driver that you also have ammo on board.

And there you go - how and why it uses each weapon.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Wed, 6. Oct 04, 01:35

I've released Beta 3. No functionality changes - just a bug fix (the Hire Gunnery Crews ware wasn't showing up for anyone who hadn't used a version prior to 1.03) and added language files for Spanish, French, and German.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

khabal
Posts: 377
Joined: Sat, 6. Dec 03, 18:32
x3

Post by khabal » Wed, 6. Oct 04, 07:13

This last version, is it a final and you're just expecting to see if there are any problems with it, or it's not final and you want to add more stuff later ? Cause if it is the latter, I'll just wait till you complete it.

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Wed, 6. Oct 04, 07:21

Perhaps this will answer your question... :)

I've now completed Beta 4 . From the readme, here are the changes:

1.94 Fourth beta of Version 2
  • Fixed a bug where enemy missiles were always being engaged regardless of whether or not they were a threat (should only be engaged if their explosive yield is 5% or more of your ship's current shield level).
  • Added the "Gunnery Crews: Missile Defense" command which will engage incoming missiles (which are a "threat") fired at you from beyond 2500 meters with one of your own mosquito missiles.
As far as it goes now, I don't foresee any more changes to add new features. At least not for version 2. Once this has been tested enough that I'm confident there are none of those cardiac style bugs, I'm going to write this all up for my next tutorial. Yes, I know I've been saying this for a while, but I really mean it this time. :)
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

Vaylon
Posts: 214
Joined: Sat, 28. Feb 04, 19:14
x3

Post by Vaylon » Wed, 6. Oct 04, 08:41

Nice work Raven, It's now showing up in both docks, I'll test it later and give some feedback. But for now it's off to work for me. Well in Beta3 anyway.

-NJ
Live Life without Fear

Z0diac
Posts: 213
Joined: Fri, 6. Aug 04, 19:43
x3

Post by Z0diac » Wed, 6. Oct 04, 11:41

In one of the other treads I read about your objections to signing this script.

The more I read about it (The script I mean), the better I like it and wanna try it. But I absolutely do NO want a modified tag that screws up the nice visuals.

Is it not possible for you to make 2 editions? One with the lame, incessant levels the mods want you to implement for it to get signed and one edition with no levels for people who can bare the "Modified" tag.

Please, think about it...
Signatures are for the wicked.

ticaki
Posts: 4861
Joined: Wed, 6. Nov 02, 20:31
x3

Post by ticaki » Wed, 6. Oct 04, 12:53

huh?... hm the last posting in the other topic is translated by mauzi... im not sure if the words = what i would say!

I would say... think about level because they adding more deepness to the script... it isn't a must be thing.

Greets ticaki
Zur Zeit nicht aktiv

Vaylon
Posts: 214
Joined: Sat, 28. Feb 04, 19:14
x3

Post by Vaylon » Wed, 6. Oct 04, 20:31

Z0diac see link below to Sticky and in the first post by Burianek is a link in his sig to some files, one of which is the No Modified Tag Mod! Download this file and run it. This when you start X2 click on the new Select mod Package button and click on No Modified then okay, play game from then on with no stupid Modified label plastered across the screen.

http://www.egosoft.com/x2/forum/viewtopic.php?t=48593

Also note that the tag remover does nothing but hide the tag the same way Egosoft put it there so it will not cause ANY harm at all to your game.

-NJ
Live Life without Fear

rfoote
Posts: 171
Joined: Thu, 18. Dec 03, 17:51
x3tc

Post by rfoote » Wed, 6. Oct 04, 22:16

Reven wrote:Perhaps this will answer your question... :)

I've now completed Beta 4 . From the readme, here are the changes:

1.94 Fourth beta of Version 2
  • Fixed a bug where enemy missiles were always being engaged regardless of whether or not they were a threat (should only be engaged if their explosive yield is 5% or more of your ship's current shield level).
  • Added the "Gunnery Crews: Missile Defense" command which will engage incoming missiles (which are a "threat") fired at you from beyond 2500 meters with one of your own mosquito missiles.
As far as it goes now, I don't foresee any more changes to add new features. At least not for version 2. Once this has been tested enough that I'm confident there are none of those cardiac style bugs, I'm going to write this all up for my next tutorial. Yes, I know I've been saying this for a while, but I really mean it this time. :)
Hi Reven-

Still no good. I downloaded "Gunnerycrews 200Beta4" , opened it in Winzip, moved (drag and drop) the scipt files to the X2 script folder, and the "t" file/s to the X2 "t" file....

Then I restarted X2, loaded a "save game" and checked Argon and Omicron Lyrae Equipment Docks.....no listing for Gun Crews....no change from the standard listing at all.

What am I doing wrong?

rfoote@blackfoot.net

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Wed, 6. Oct 04, 22:53

If you have the setup.plugin.guncrews.xml file in your script folder, and 442498.xml in your t folder, then the ware should show up. If it doesn't, then I can think of only two reasons. One is that you are using a version of X² that is older than 1.4. The other is that the ware slot I used is being used already by some other script that you have installed.

If you have updated to 1.4, then I would really appreciate it if you could send me a zip file with the following:
  • <X²>/script/*.*
  • <X²>/t/*.*
  • < X²>Xnn.sav, where 'nn' is the number of a save game where the problem exists.
You can email this to kfitzner@excelcia.org. Once I have it, I'll track down the problem and make sure it works for you.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

User avatar
Nemomuc
Posts: 315
Joined: Tue, 23. Mar 04, 19:49
x2

Post by Nemomuc » Wed, 6. Oct 04, 23:08

Great Script : works really good on my system.

But the german language file in Beta 4 .. Yikes :shock:

Here is a better one :

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<language id="49">

<page id="17" title="Boardcomp. objects" descr="Quad line groups for ware factory pairs or twins (spoken by Boardcomputer)">
 <t id="5863">Geschützpersonal</t>
 <t id="5864">Sie können hoch trainierte und gut ausgebildetes Geschützpersonal anwerben, um  Geschütztürme Ihres Schiffs zu bemannen.  Diese erfahrenen Mannschaften sind im allgemeinen viel wirkungsvoller als die derzeit verwendete Standardkampfsoftware.</t>
</page>

<page id="2010" title="Commands" descr=" ">
 <t id="925">\033RGeschützpersonal:\033X Greife Feind an</t>
 <t id="1218">\033RGeschützpersonal:\033X Raketenabwehr</t>
</page>

<page id="2011" title="Commands" descr=" ">
 <t id="925">\033RGP\033X.A.F.</t>
 <t id="1218">\033RGP\033X.R.V.</t>
</page>

<page id="2498" title="Text" descr="Text for Reven's scripts">
 <t id="1000">\033RGeschützpersonal:\033X Raketenabwehr unmöglich\033Y%s\033X, keine Moskitoraketen im Laderaum mehr vorhanden.</t>
</page>
</language>
I suggest to change the ware slot to 5833 if possible, 5863 is used by the Hullrepairsystem HRS (i am not willing giving up HRS). And almost 100000 Credits are plenty enough or a gunnery crew.

Btw what about putting the Gunnery Crews into Argon Trading Stations, hire people on a Trading station as the Sectors Headquarter seems to be more logical than at a Equipment Dock. (It works with your script).
Last edited by Nemomuc on Thu, 7. Oct 04, 12:18, edited 2 times in total.

User avatar
DeadlyDa
Posts: 1882
Joined: Mon, 5. Jan 04, 04:46
x4

Post by DeadlyDa » Thu, 7. Oct 04, 01:43

You will find that 5833 is used by Xai Corp Jumpdrive, which many of us use. I switched Gunnery to 5873/5874...which is not in use on my config, and all is well now.

Muriah NIN
Posts: 16
Joined: Thu, 18. Dec 03, 08:06
x3tc

same problem here

Post by Muriah NIN » Thu, 7. Oct 04, 04:28

While pulling my hair and wondering why the gunner crew script is not working, I came across this posting....Thank god I still have some hair left :wink:
Don't wanna kill da bum!

User avatar
Reven
Posts: 1133
Joined: Thu, 10. Jul 03, 07:42
x4

Post by Reven » Thu, 7. Oct 04, 08:27

Nemomuc wrote:..the german language file in Beta 4 .. Yikes :shock:
The translation was done compliments of Google Languages. I would translate it forward and backwards to try and get the best translation I could, but you know how those things are. You can often understand the result, but the grammar is less than desired. :p

I figured having something was better than nothing. Was it at least understandable?
Nemomuc wrote:Here is a better one :
Thank you VERY much! I appreciate the help with that.
I suggest to change the ware slot to 5833 if possible, 5863 is used by the Hullrepairsystem HRS (i am not willing giving up HRS). And almost 100000 Credits are plenty enough or a gunnery crew.
Well, I've had slot 5863 picked for this since February when I released those tutorials.

If I ever do hope to get this thing signed, it's going to have to be VERY expensive, seeing as I'm getting comments about it being too effective.
Nemomuc wrote:Btw what about putting the Gunnery Crews into Argon Trading Stations, hire people on a Trading station as the Sectors Headquarter seems to be more logical than at a Equipment Dock. (It works with your script).
Actually, I like wanted to take it a step further and have it available only through the BBS. However, I just barely have been accepted into level 5, and I'm wading through the BBS mission system now, so it might be a while before that happens. As it stands now, moving it to the trading stations seems a better idea. I think I'll do that in the next beta.
You were warned... pirates will be hunted down like vermin.

Ex Turbo Modestum

Post Reply

Return to “X²: The Threat - Scripts and Modding”