[Script]RS.Turret Defence

The place to discuss scripting and game modifications for X³: Reunion.

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

sdack
Posts: 1071
Joined: Wed, 26. Jan 05, 22:24
x3

Post by sdack » Sun, 2. Jul 06, 13:10

Red Spot wrote:sdack ...


1) and how should you script that ?? .. if you can write the logic for it .. I would be happy to incorp. it ........
That is not an answer to my question. By saving laser energy you also protect the enemy from your lasers. What you do is a defense and not an attack ...
1.2)gimme control over "hit" and "miss" and you *might* have a point here ..
There are many ways to do this!

Lets assume you select IREs for M5s, PACs for M4s and HEPTs for M3s as a first rule for avoiding misses (that is where your control starts). You then still have the choice which of them to use (alpha or beta). This decision could be covered by testing if the distance is above or below 50% of the weapons' firing range (if below then use the beta, if above use the alpha).
With multiple slots on a turret you could mount a weapon on every slot and then only change the ratio of alphas to betas. At long range you use 1 beta and 7 alphas, in the middle you would have 4 for each and at close range it might be a 7:1 (beta:alpha).

Another and better way is to setup a 'decision matrix' like maybe this one:

Code: Select all

    IRE  PAC  HEPT
M5   3    2    1
M4   1    2    1
M3   1    2    3
This is an example. The numbers have no other meaning than to define how good a weapon is when used on a particluar class of ship. The higher the number here is the better it is against the target.

In the next step you can then enlarge the matrix to include more conditions and choices as well as meaningful values:

Code: Select all

           aIRE  bIRE  aPAC  bPAC  aHEPT  bHEPT
M5<=600m     2     4     2     0      0      0
M5<=1200m    6     2     0     0      0      0
M5>1200m     ...
M4<=600m
M4<=1200m
M4>1200m
M3<=600m
M3<=1200m
M3>1200m
I did not fill it out however you should get the idea. "M5<=600m" meaning an M5 at below or equal a range of 600m and the values thereafter now express the amount of weapons needed to be mounted (given it would be an 8-slot turret). Again, this is an example.
Once you know the type of ship and its distance you can start searching a particular row of the matrix for the best weapon, see if it can be fitted, ...
And it still leaves you the question of how many of them the turret should mount, if you should combine best weapon with second best weapons, etc.
The matrix then can be fine tuned ... A pilot's skill level could be used to cause miss selections ... There is a lot of 'room' here.

A last example:

Code: Select all

    Range  aIRE  bIRE  aPAC  bPAC  aHEPT  bHEPT
M5   400   ...
M5   800
M5    -1
M4   600
M4  1200
M4    -1
M3   800
M3  1600
M3    -1
This now adds the range as a value into the matrix, making the range test flexible and allows for a better fine tuning. From here you can enlarge it further and even test for the race of a ship.
You can even have a seperate script that does the fine tuning for you through running benchmarks and changing the values a little ...

I do not know how you do it, maybe you already do it like this.
2) doesnt work .. and adding a "1 or 0" argument is worse than how I do it now (imo)...
(I hope you realise that this only has effect when you activate the turret(s) .. so after activation you can do with the MFP what you want ..)
Sure it does. Why does it not work to drop them of??

Sven
Last edited by sdack on Sun, 2. Jul 06, 18:35, edited 1 time in total.
---------------------------
---------------------------

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

Post by DeadlyDa » Sun, 2. Jul 06, 18:34

sdack,

It's not my intent to get involved in this discussion as a "contributor"...other that to point out that this same sort of dialog took place with the old Gunnery Crew scripts (that were signed for X2).

The GC scripts started out as an exercise to improve the AI performance of turrets, and became more and more complex to the point of being ridiculously complex. If you take a look at the GC scripts, you will find that there are differing tables for various weapon types (area effect, missile defense, fighters, etc), and that the weapons are ranked in each table.

Any script with tries to "auto-magically" select the weapons for a turret during combat is going to have something similar (e.g. ranked tables of weapons). The trick (and the point of "disagreement") comes in how you rank them :roll:

You are suggesting a method of weapon "ranking" which I'm sure makes perfect sense to you. My point is that once you start down this path, you will find that it is not as simple as it might have appeared. There are a number of variables that affect turret performance in combat, none of which have a simple metric for ranking...at least one that everyone will agree with. At a minimum, you must consider turret tracking speeds, hull and shield damage, bullet speed, etc.

The thing that was discovered with the development of Gunnery Crews (and is being proved again in this thread), is that there is simply no one un-arguably "correct" way of ranking weapons...and that everybody has an opinion :roll:

In the final analysis, the author of the script will end up doing what makes sense to him/her, and not everyone will be satisfied with the result. The "good" news is that there are other turret scripts. (...or, if someone is really serious about implementing their ideas, thay can always create their own turret scripts.)

Personally, I like Turret Defense. It is a lot better than the old AS.Turret.Guard which I had been using for ages (originally from X2, but it worked well in X3), and is of course vastly better than what comes with the stock script set from Egosoft.

By the way, if you really think your ranking system is the best (and it may well be), grab a copy of the old signed Gunnery Crews script from the X2 forum, and "adjust" the weapon tables to match your thoughts regarding weapon ranking and give it a go. I did, and (...sigh...) didn't really care for the results :D

sdack
Posts: 1071
Joined: Wed, 26. Jan 05, 22:24
x3

Post by sdack » Sun, 2. Jul 06, 19:06

DeadlyDa wrote: Any script with tries to "auto-magically" select the weapons for a turret during combat is going to have something similar (e.g. ranked tables of weapons). The trick (and the point of "disagreement") comes in how you rank them :roll:
And I have not said anything about it?! ... I am not telling Red Star here how to implement this but stay away from any code examples!! You do not really need a matrix. You can well write it as a serious of switch- and if-statements. The matrix is then just the code itself.

I am showing him how to i.e. avoid having to throttle fire powerat all, and that there is no need to save energy when your goal is to find the best weapon. Best weapon just means having best energy efficiency while still hitting the target. Maybe I should have defined "best weapon" in more detail above then ...

(Back to throttling) What is it the game does when the lasers' energy gets low? The weapons start throttling simply due to the lack of energy :idea: So if you concentrate your efforts on avoiding misses, you will find your efforts ending in naturally throttled fire power. The difference compared to doing it manually then will be that it will occur less frequent and 'right on time' ;).*)
By the way, if you really think your ranking system is the best ...
*sigh* Why do I always get insulted?! ... Do you really believe anyone thinks they have created the best or ultimate turret script? Anway, we can keep discussing improvements but stop doing these silly assumptions. I take them as insults.

Sven

*) Or possibly just as frequent but without the doubled throttling that is created by this.
---------------------------
---------------------------

User avatar
Liath
Posts: 185
Joined: Sun, 25. Dec 05, 08:16
x4

Just an idea

Post by Liath » Mon, 3. Jul 06, 02:12

I think I may have found my problem with the scripts!! I think I had an incorrect amount of weapons in my hold, and the script wasn't able to assign a full turret bay of the same weapon and I think it would get confused on when to fire. I'm not 100% sure about it, but from the behavior I noticed, I think this might be the best 'reason' for my problem.

Something I was thinking about -- I'm not sure if this would be considered 'cheating' on the turrets, so it is just an idea.

Some weapons have a higher turn rate (like pbe), so perhaps if the target is 15° (just an example #) out of the target cone, then perhaps it should switch to a faster moving turret, then when it is back in range, switch to the weapon that it will use for attacking. Just an idea, though!!

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

Post by DeadlyDa » Mon, 3. Jul 06, 05:53

Sigh...I really should have resisted the urge to contribute to this thread. There was absolutely no intent to insult or demean any one. I don't do that...ever.

Maybe there is a language issue, or I just used bad word selection.

You sounded like you had a good idea of how the weapons should be ordered...and there is nothing wrong with thinking you had it working in the best possible way.

I know from personal experience that there are many different styles of game play, and clearly the style of game play you prefer will impact your weapon selection. I know it does for me.

I even went out of my way to poke fun at myself for trying to tweak the old Gunnery Crews scripts...where I had asked several experienced players for their opinions, and never did reach a consensus.

I'm not sure why you feel you were insulted...but please accept my sincere apologies. I obviously offended you, and that was never my intent.

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot » Mon, 3. Jul 06, 08:25

sdack ...


as it is I'm now about to release the 4th turret-script I made for X3 ..
and each one had a diff. way of operating and deciding what guns to use and when at what range .. etc etc ..

my conclusions;
the way I'm doing it now (in this and the *new* scripts) is imo the best way to go ..

now let me explain what I mean with *best* ..
-the scripts are not even close to demanding .. heck they might actually be as 'un-demanding' as the vanilla scripts ..
-the game controls it .. not libs. .. (wich allows the script to be used in custom games ..)
-its fast .. no extra logic needed to do all sorts of (unneeded) checks ..
-its pretty to see .. I pers. really love the firing in "pulses" when energy goes down ..
-if one turret would use all energy there might be up to 6 others (incl. main-turret) that cant fire anymore cause 1 turret was a bit ego. ... my script avoids this behaviour and as explained a point above I like this "new feature" ..
-.............


in the end your ideas might very well be able to improve some behaviour ..
but with my experiance writing turret-scripts I wouldnt hold my breath ....
(any kind of "specialysation" or use of libs. is going to backfire when its comes down to flexibility .. and specially on a turret-script I find that very important ..)


anyway I would advise you to have a look at the German-forums and the aegis script .. as Deadly explained it makes use of a fair share of libs. and I think your ideas might fit better in that script than it would in mine .. judged on how the scripts work ..
do note this .. the biggest reasons for me to not be interested in the ideas are;
-I did a lot of work with turrets and I've used things 'like' your ideas .. the turret-script I had available to the community before this one actually made you pick diff. weapons for diff. tasks (anti miss/anti light fighter/etc etc) .. and well simply put .. that script no longer exists ........ :wink:
-how demanding is a script .. dont forget that when you enter a gate all ships at the spot activate their turrets .. thats a lot of scripts when you enter a Xenon sector .....





Liath ...

well I do advise to install max. weapons in your turrets as "default weapons" .. and than give them "extras" ...
anyway I hope you dont mind me say that I wont be trying to chase it down ..
as after tomorrow I've got 4 free days and by the end of those I'm sure I've released the newest scripts ..


for that "feature" I have to point you in the direction of aegis ......
(I pers. do see it as cheating(well at least something that unbalances the relation between main-weapons and turrets) .. wich means it wont make it into my scripts ..:))



G

sdack
Posts: 1071
Joined: Wed, 26. Jan 05, 22:24
x3

Post by sdack » Mon, 3. Jul 06, 09:28

Red Spot wrote:...
I do see your point even if you do not see it yourself ... You could have answered with something like "Thanks, ..." - yet just another example. But since you seem to go for a fourth generation of scripts, with no end to it, you are on a journey of your own experience. I'll leave you alone with that then. Have fun and keep improving!

Sven

Edit:

Just one last suggestion (...). Use a ship's relation to the race other (or is it unknown?) to determine if a player allows for friendly fire or if he does not. This is a less frequently used value and if this relation is set to 'enemy' it can be seen as willingly doing friendly fire ("... to others"). It is by default set to 'friendly' and can be set for every ship independently. How about that?

@DeadlyDa: Apology accepted

@Jakesnake5 below: I wiped sector 101 with a standard split dragon! You cannot impress me ;)
Last edited by sdack on Mon, 3. Jul 06, 19:30, edited 8 times in total.
---------------------------
---------------------------

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Mon, 3. Jul 06, 14:04

I like ships with turrets. I like flying ships with turrets. I LIKE turrets to do some work in furballs so I don't get my butt wasted quite so fast. RSTD does just fine.

I used the script in the Exodus Mod, on the Mother ship Genesis. This ship is a HUGE M0 class, with 12 guns per turret. With TD running, she's hitting at anything in range, Cap or M5.

When she decides to go after the fighters, its wise to wear earplugs cause it gets NOISY with flaks going off. And with 36 onboard, she can load up a LOT of the turrets for hosing.

I took her to X101 and watched the party. Nice light show.

I don't need AEGIS. Though, being able to have the turrets help with capping might be nice, I mostly need turrets that can track and kill targets. Specially with the swarms I get into. :)
Perfection is in the hands of God, we bags of dirt can only do the best we can©
[ external image ]
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

Baenrae
Posts: 171
Joined: Sat, 31. Dec 05, 13:38
x3

Post by Baenrae » Wed, 5. Jul 06, 09:12

Hello !

First of all: Sorry, for not having the Time to read the whole Thread!
Couil may be my Questin has been answered earlier.

Does this Script prevent friendly Fire! :?
Fighting in an Friendly Sector with a multi-Turret Ship makes a lot of new Enemies, an I am looking for a Way to prevent that.

MfG Gromph
Nutze: WVH, opt Zielerfassung, HVT, Waffenkontrolle, Scoutspezialsoftware, Ausrüstungspacks, FCC, SGS, GMUS, Lazerzaun, Kampfsotware MK3 & GAIUS, Sektormutter, MARS, SOS MK2, Goner Secrets, WLS, BIER, Escort, Apricot PHQ, X534-Mission, Raketenkreuzer und Spielereingreiftruppe. Danke allen Scriptern und Übersetzern!

theredman
Posts: 78
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by theredman » Wed, 5. Jul 06, 10:43

I havent tried this script yet but this would be a cool addition to the crew mod... crew that gets experiance ect and also changes to flack as well as mds ect depending on there skill and there enemy there fighting.....

the whole crew idea for all the ships sounds good and haveing to pay them for there services and being able to hire veterans ect at difrent stations.


Question is will these mods come out in the naxt game as standard game as some of the mods are hard to live without !!!

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Wed, 5. Jul 06, 15:44

@Baenrae
No. FOF of the script is based on missile launch percentage, and only applies to AOE weapons ussage. If the turrets are set to "Attack Enemies", they WILL shoot at enemies in range, friendly sector or not.

I can't say what the next version will do, but 3.15 is like that. Always wise to set turrets to Missile Defense when you don't want them shooting.

OOS doesn't matter, as ships don't do 'collateral' damage.
Perfection is in the hands of God, we bags of dirt can only do the best we can©
[ external image ]
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

Hieronymos
Posts: 830
Joined: Fri, 30. Dec 05, 22:14
x3

Post by Hieronymos » Thu, 6. Jul 06, 22:16

RS,
couple of questions:
1) How would the script behave in a ship equipped with a fair amount of extra weapons of various types, that possesses turrets of varying sizes?

1b) As in F 8x, L/R 6x, B 4x, U/D 2x (28 total slots)..?? So that if ship had, say 4x BHEPT's, 10x AFlak's, 4x BFlaks, 20x GPPC's...and was swarmed by enemy fighters--could the rush to swap in anti-fighter weaponry insufficient to stock all turrets result in any probs like ctd's? (my understanding at present is that if there aren't a full 'set' of weapons to fully fill a particular turret, that they simply won't be switched in)

2) In the anti-fighter scenario above, would the ship bother firing turrets stuck with GPPC's at fighters, or would it conserve energy for its Flaks?

3) Can the script be modified to also include weapon-switching for Fixed-frontal hardpoints?

4) Can the script be modified to mount less the full number of appropriate weapons in a turret, if there are not a full 'set' matching that turret's size?

5) Is it possible to release the script in .spk format as well?

6) Do or will you ever equip mission-generated NPC's in the DDRS with Turret Defense to make them more challenging?

Thanks,
Hieronymos

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Thu, 6. Jul 06, 22:23

You want to make the DDRS missions NPC's even MORE impossible to take? Give me a break.

All non-player npc ships use the DEFAULT weapon swtiching code ES gave them. RS's scripts give the PLAYER the ability to use, and assign HIS npc ships, similar abilities.
Perfection is in the hands of God, we bags of dirt can only do the best we can©
[ external image ]
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot » Thu, 6. Jul 06, 22:51

Hieronymos ..


1.1) it handles pretty well ...:)
1.2) no problems

2) it will fire .. but as turning speed for larger weapons is slower than for smaller your turrets with smaller weapons will fire before the others ..
(just use it and you'll see how the turrets behave .. it'll be easier than me having to explain it .. but simply said; the more weapons the more effective your turrets can be ..)

3/4/5) nope ...

6) correct me if I'm wrong .. but iirc I've already said that I want to finish work on FC so I can use the scripts in DDRS ..... :twisted:



G

Hieronymos
Posts: 830
Joined: Fri, 30. Dec 05, 22:14
x3

Post by Hieronymos » Fri, 7. Jul 06, 00:53

FC?

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Fri, 7. Jul 06, 05:28

Fleet Command maybe. He's also rewritten some of the ES ship combat scripts for that.

You'll have to wait for it to see. :)
Perfection is in the hands of God, we bags of dirt can only do the best we can©
[ external image ]
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

sdack
Posts: 1071
Joined: Wed, 26. Jan 05, 22:24
x3

Post by sdack » Fri, 7. Jul 06, 12:47

Another suggestion (see it as a question "Does your script do ...?" if you like):

When a ship is hit it often does a defensive move making it harder to hit it the same second again. Since your script combines turrets to get around this problem (maybe you do not see it like that), here is another idea to improve this further:

Once all turrets (in range) have fired, lets assume with a beta HEPT, they switch to the alpha HEPT and fire again. The switching is timed so that the bolts of the beta and alpha weapon can impact at the same time. The target is then hit with even more bolts and still not a chance for a defensive move (you probably like that).

Such an "overlapped fire"-mode will be useful while a target is still far away and will increase the (average) amount of damage done on a first strike. Secondly, switching to a faster weapon also defines a good end as to when stop firing the slower weapon and can be seen as a means to save energy (but only if the faster needs less energy). The turrets can then switch back to the beta weapon and start again with the overlapping of bolts. It is, if you like, a sort of throttling combined with an increase of damage while avoiding misses due to a target doing defensive moves.

It will also look cool when rounds of different speed impact simultaneously.

Sven
---------------------------
---------------------------

Hieronymos
Posts: 830
Joined: Fri, 30. Dec 05, 22:14
x3

Post by Hieronymos » Sat, 8. Jul 06, 03:28

Does this script also govern use of Kha'ak kyon weaponry? For captured Kha'ak cap ships, or...er..other custom ships capable of mounting conventional weaponry and kyons?

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Post by Red Spot » Sat, 8. Jul 06, 15:43

sdack ..


as explained turrets *usually* (and if needed/req.) can switch to smaller weapons if the targets hull/shields go down ...
this does however not work by 'picking' a step smaller weapon .. as this would req. libs. (wich I do not want to use in this script)

and this also doesnt work based on 'impact' as that is the same as 'hit and miss' and there is no control over that ..



Hieronymos ..

those are weapons arent they ...;)
(part of the point I do NOT use libs in this script .. as if I would forget this is a highly modable game ..:D)



G

Jakesnake5
Posts: 2880
Joined: Fri, 17. Feb 06, 04:55
x4

Post by Jakesnake5 » Sat, 8. Jul 06, 17:37

What I want to know, is how(or if) Hier capped Kha'ak ships, or guns. :)

And Kyons are 'kill it, kill it NOW' type weapons, hard to use for capping based on their damage levels.
Perfection is in the hands of God, we bags of dirt can only do the best we can©
[ external image ]
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

Post Reply

Return to “X³: Reunion - Scripts and Modding”