Page 1 of 24

[SCR] MARS Fire Control (v3.05 - 06.10.09)

Posted: Sun, 18. May 08, 21:16
by Gazz
(Das entsprechende deutsche Topic ist hier.)

Turret Scripts are stupid.
They gleefully fire a 30 sec salvo on an M5 when the proverbial snow ball in hell would have a higher chance of hitting.
This was too depressing to watch so I set forth on my personal crusade to create the perfect turret script. (YMMV =)
One that only fires on those targets that it can hit.

If you're just window shopping:
subaluigi created a video (6:41, 84 MB) of XTM capital ships using MARS. >> DOWNLOAD VIDEO <<

MARS consists of 6 systems:
  • Fire Control (Turrets)
  • Goblins (your obedient minions)
  • Remote Guided Flak Missile
  • Automatic cargo collection
  • Satellite deployment
  • AL Plugin, that makes MARS available for AI capital ships (optional =)

  • Launch goblin
  • Deploy Satellites
  • Launch Flak Missile
  • Cease fire / Ignore target
MARS Fire Control: MARS Defense, MARS Offense
  • Required equipment:
    Motion Analysis Relay System (sold in nearly all equipment docks)
    X3 v2.5 recommended, not required.
  • Available for: M6 and bigger ships.
  • MARS Light available for: anything smaller
    - no weapon switching
    - no automatic launch of goblins.

    Note that MARS uses more CPU time than a simple turret script so running it on your 50 M3 might be noticable.
  • MARS does not use area weapons (PSG and ION) if neutral/friendly ships are within 4 km.
    It also watches for cargo unless the MARS ship has < 20 % shield strength.
  • MARS uses all weapons it can find in the cargo hold.
  • It is normal that only 1 laser is installed when there is nothing to shoot at.
    These lasers are available for other turrets when not needed.
  • MARS only fires on targets that it can hit.
    If the target does the usual dodge and weave routine, MARS would switch to another ship that does a nice and straight attack run.
    Or maybe a bigger and/or slower ship entered the firing arc...
  • Weapon choice.
    Hitting a target is not enough. MARS shoots to kill.
    If it calculates a 50 % hit with AHEPT and a 40 % hit with BPPC it will use BPPC because those 40 % would do 6-7 times the damage...
    Hitting the target is the primary consideration. If a laser is too slow to possibly hit it will not be considered.
  • Attack my target
    Even though MARS works independantly of any other script it takes the ship's mission and the player's intention into account.
    Therefore some ships get a bonus to their "value" as a target.
    Attack target of the MARS ship: +20 %
    Attack target of the wing leader: +25 %
    Player's target: +30 %

    The ship's mission target is... suggested... as a target but MARS will engage other enemies if it can not possibly hit this target.
    If the player targets an M5 but MARS also has a firing solution on the M2 behind it - those 30 % will not make the M5 look like an interesting target.
  • Automatic Firepower Management
    MARS continuously adapts the rate of fire of every laser to optimally match your current FPS.
  • Capture Mode
    We brake for... ships! Not for long mind you - MARS is a bloodthirsty god.
    (Settings editable in t\xx7047.xml)
  • Neutral stations are relatively save from MARS turrets.
    Cap ships with very long range weaponry may have trouble operating close to stations.
    (Settings editable in t\xx7047.xml)
  • MARS considers the weapon damage when selecting lasers.
    It would not bother firing A IRE at an M2 or Ions at a ship without shields...
  • Saving ammo is not it's job.
    If there are mass drivers aboard and they were selected as "best weapon" then MARS will fire without hesitating until it runs out of ammo.
    Of course it will then switch to regular lasers.
  • MARS works best in a target rich environment.
    Only if there are several targets available, MARS can pick the one that's easiest to hit.
  • The chance of a particular turret hitting it's target can not be increased.
    What MARS does is rate and select targets and eliminate a huge number of guaranteed misfires.
  • When your ship's turrets start tracking / turning towards an enemy, the board computer will say "Target locked on".
    This message is reset after 5 minutes of inactivity.
  • When a ship goes OOS or undocks OOS it automatically loads the highest damage weapons it has.
  • MARS can be adapted to modded weapons easily.
    All the data it needs is found in Textfile xx7047.xml.
  • Very little is hardcoded:
    Ions: flagged as an area weapon.
  • Automatic detection and use of [MOD] Heavy Capital Ship Lasers
  • Several settings editable in tesxtfile t\xx7047.xml
    Safety range for area weapon use and such...
  • Hotkey: Cease fire / Ignore target
    If an enemy is targeted this ship will permanently be ignored by every MARS system until you cancel the order the same way.
    The turrets and goblins can still "clear the trash" for you while you try to cap that elusive Pirate Nova Raider...

    If no enemy is targeted then a cease fire is transmitted to all MARS ships in the sector.
    It will last 60 seconds (editable in the config file) or until you cancel it the same way.
    Turrets will continue to track targets so they can resume firing without any delay.
MARS Fire Control: Missiles
  • Instead of counting the damage the lasers can do to the missile, MARS uses the damage that the missile would do on impact.
    If this damage is greater than 1/4 of the remaining shield strength this missile receives a priority bonus.
    For missile defense MARS uses PSG or the laser with the shortest range.
    This "1/4" threshold can be altered in the config file t\xx7047.xml

    Missiles are still "only targets". If an M2 is firing GPPC at a target it would ignore a Silkworm but would switch to a Thunderbolt or Firestorm.
    If the same M2 is currently firing BPAC at an M5 it would switch to the Silkworm.
    An M5 is far less interesting than a guaranteed hit for 25k.
  • Missiles incoming to the Playership are a target for all MARS turrets in the sector.
    All other ships treat them as if they were the missile's target instead.
  • Only hostile ships are attacked.
  • MARS Defense is primarily a defense system.
    Enemies are only attacked if they are going after a friendly unit or a neutral ship, that the MARS ship is protecting.

    The HUD target of the player and the attack target of the MARS ship are always valid targets, provided they are hostile.
    This can also be a station.

    MARS protects all assets and attacks the ship's mission target but does not take the initiative and pick fights on it's own.
  • MARS Offense is the equivalent to Kill All Enemies.
    Now MARS is actively looking for trouble.
    Enemy stations are considered secondary targets - after any kind of ship.

    Offensive mode also enlarges the area controlled by the ship. It uses Goblins to intercept and/or delay all enemies within a 16-30km radius.
    Alas this can only work In Sector.
  • MARS Defense and MARS Offense can not be mixed on the same ship.
    This setting controls which targets the central MARS unit relays to the turrets.
    Setting one MARS turret to Defense sets all on Defense.
MARS Goblins:
Using Fighter Drones to defend freighters is not a novel idea.
Goblins, however, do much more for you. They are your obedient minions that distract your enemies, collect loot and deserted ships in the sector, and if launched as a pack even bring down the wayward M5 that your M2 can't catch.
  • Manual launch of Goblins available for: all ships with MARS installed.
  • Automatic launch of Goblins available for: (big) ships with active MARS turrets.
  • MARS automatically uses Fighter Drones in the cargo bay, loads them with new software and launches them as Goblins.
  • There is an AL Plugin switch to prevent all your ships from automatically launching goblins for combat missions.
  • The main difference to regular drones is the software.
    Fighter drones attack or protect until they are destroyed.
    Goblins are cowardly backstabbers. They do not want to get destroyed.
    They attack when the enemy has not noticed them, yet, but when attacked they flee at top speed on a zigzag course towards a spot behind their mothership.

    As a result they are survivors. They tie up enemy ships far longer than regular drones.
  • Goblins can only be controlled through MARS and it's hotkeys.
    X3 has hotkeys and commands for like "all Fighter Drones in sector, Protect me"
    ...Goblins simply ignore these.

    The means that the functionality of regular drones is not hurt at all.
    Feel free to also deploy regular drones and use their classic commands and hotkeys to order them around.
    Goblin and fighter drone orders do not interfere with each other in any way.
  • MARS preferrably uses Goblins against the most dangerous enemy ships.
  • Goblins rarely fight but they are tuned for a slightly higher top speed.
  • There is a Hotkey for the playership to lauch Goblins at an enemy.
    Using the hotkey you can launch up to 2x as many as MARS would launch automatically.
    They all count towards the same cap so if you launch all manually, MARS has to wait until some of them return home.

    They can be used to get the attention of ships and lure them towards the MARS ship.
    Also very useful to pull ships away from a neutral station without turning the station hostile.
    Goblin operational range is roughly 120 km.
  • (X3 v2.5 required)
    Using the hotkey if you have a cargo container or abandoned ship targeted will send a goblin to leash and retrieve it. Sending several to one item will cause them to spread out and seek out containers independantly.

    Goblins that have returned with cargo request a cargo pickup from the mothership. If a Transporter Device is installed, the cargo will be beamed aboard.
    This can be disabled for several ship classes in t\xx7047.xml if you would prefer that only transports pick up cargo while still leaving Mx class ships the option to "recover" valuables to a safer location.

    Their engines are weak so don't expect them to be very fast when hauling a heavy ship back to you.
    Still - beats flying halfway across the sector with your personal M1. =)

    If Goblins automatically (see Cargo Collection below) bring abandoned ships back to the mothership, they drop them in the general vicinity.
    If they do that on a manually given order (abandoned ship targeted) they bring them all to a spot in front of the mothership.
    With all ships bunched up in front of you, you don't have to do any fancy flying with your 4km ship.
    Just fly next to them and capture them using the SOS software.
    (On capital ships, the SOS has an enormous range, too.)
  • Pandora and other special crates (BBS missions) are ignored by the automatic cargo collection and can only be retrieved through an explicit order from the playership.
  • If you target a friendly ship (such as a TS) and press the hotkey, this ship will send out goblins to retrieve valuables in the sector.
    Obviously your second ship requires MARS and it's own drones.

    This can greatly speed up cargo collection and a TS called in to collect dropped cargo can stay well away from the ongoing battle while only endangering the much cheaper and faster goblins.
  • If you have an own stationary ship targeted (Satellite, Lasertower, SQUASH) targeted then you can send goblins to collect this exact type of object.

    This only works for all stationary objects on your personal ship.
    The global commands from the sector map are for advanced satellites only.
  • Droit de Seigneur
    If you order a goblin from your ship to collect a specific cargo container or ship then this takes precedence over all other collecting ships in the sector, even if another goblin is already enroute to or towing this target.

    If your ship does not have any free goblins at the moment, this only chases away the other goblin that may be enroute to this target.

    So if you decide that you want this crate of mosquitos instead of your cargo collecting TS you just go MINE! and send a goblin to grab it.
  • Activating the hotkey without a target selected issues a Return To Base command to all goblins in the sector.
    MARS will also not launch additional ones for 10 minutes.

    Activating the hotkey with a goblin targeted will send an RTB order to that particular goblin only.
  • Especially when a goblin has to tow a heavy load, it's range is quite limited.
    When the fuel is getting low it will return to the mothership while a colleague launches to take over.
  • MARS starts 1 Goblin per enemy ship. The direct hotkey command is not bound by this so you can launch several against a far out M5 or the likes.
  • Every MARS system has a control limit. Huge ships can control 6 goblins, all others 4.
  • Goblins attempt to return to the mothership before their battery runs out.
    A goblin can be operational for about 9 minutes, leaving a fuel reserve for 1 minute.
  • All Goblins are automatically collected if they are within 5km of their mothership when it leaves the sector.
  • If a goblin has to return to base for whatever reason it will return to it's mothership. If that is not present it will return to the closest MARS ship in the sector. If even that fails it will detach from the MARS system and operate as a regular fighter drone.
Satellite Deployment:

Sometimes a scout ship or two just isn't enough.
If you've arrived with your battle fleet... you need intel!
  • Hotkey : Deploy Satellites

    From the cockpit you have more direct control while on the sector map, all your ships work together to execute the command.

    If you use this hotkey in the cockpit:
    • the command is only given to one of your ships if you have one targeted
    • if not, it's given to your own ship only
    If you use the hotkey on any sector map,
    • the command is potentially executed by all ships in the sector
    • They do not waste any effort but instead try to do the job in the most efficient manner.
    • If a ship with satellites in the cargo bay is closer to the far gate of the sector, this one will deploy the satellite destined for that gate and all ships' goblins will work together to tow the satellites into place.
      If your TS that brought the satellites only has one drone aboard that is not going to delay matters since all other MARS ships in the sector will assist.
  • Only Advanced Satellites are used.
  • An AL Plugin allows you to set how many satellites should be deployed with the default 1x Hotkey function.
  • Hotkey 1x: Deploy default
    as set with the AL Plugin.
  • Hotkey 2x: Collect all Adv Satellites
    The ship(s) with the most free cargo space will collect as many satellites as it can with one swarm of goblins.
    A regular ship like a TS can collect 8 sats at once, a capital ship 12.

    If you give the order from a sector map and the ship runs out cargo space, free goblins, or is simply out of range to get all satellites, other ships will assist.

    From the cockpit you can order one specific ship to do the collection.
  • There are 3 extra modes to override the preset deployment pattern of the AL Plugin
  • Hotkey 3x:
    Deploy 1 sat per jump gate
  • Hotkey 4x:
    Deploy 1 sat per jump gate
    + 8 in box formation
  • Hotkey 5x:
    Deploy 1 sat per jump gate
    + 8 in box formation
    + light up all trade lanes between all jump gates
  • If a deploy order is interrupted / unfinished for any reason then MARS ships in the sector will attempt to complete it.
    After 1 hour the order is forgotten and has to be reissued manually.
    (running such a script indefinitely is uhh... bad =)
  • A deploy command can be aborted and resumed at any time using the hotkeys.

    For instance, you may have given a global RTB command to all goblins.
    If you give another deployment order from the sector map, all ships in range will launch goblins to finish towing the satellites into formation.
  • A satellite stays part of the formation until a goblin starts towing it away.
    You will see this from the name change.
MARS Remote Guided Warhead / Flak Missile:
The RGW is used in one X3 story mission. Now it has gotten a new purpose.
  • Hotkey : Launch Remote Guided Warhead
  • This missile is only used on the playership and has to be guided to the target manually.
  • Unlike regular missiles, the RGW creates a cloud of super heated plasma.
    It has a total diameter of about 3 km but cools down quickly while expanding so it's most effective in the center.

    Massive capital ships won't be impressed with a little temperature shock but a small M5 just can't take the heat...

    This missile is only really effective against fighters so it's also known as a Flak missile.
  • RGW are launched with the hotkey. This also targets the missile so you can see the target data it displays:
    Distance to closest enemy / Closing speed

    You can change your target anytime.
    A second press of the hotkey re-targets an active missile.
  • If the RGW is targeted it can be detonated remotely with the same hotkey.
  • Proximity Fuse:
    If an enemy ship enters close range to the warhead (Distance red), the fuse is armed.
    Unlike a dumb fuse the RGW still attempts to get even closer but detonates immediately when it has reached the point of closest proximity and is in danger of overshooting the target.
    If you get those anywhere close to the target, they never just fly past it and start circling...

    If the distance is shown in yellow an enemy ship is within damage range but there will be no automatic detonation.
  • If the missile is shot down it does not detonate.
  • Remote controls:
    Mouse, Joystick - anything.
    The missile flies to whereever you point your cockpit's crosshairs.
  • Acquisition / Ammo:
    There are 2 factories in split space that produce these missiles.
  • If you target one of your own missile factories, the hotkey refits them to produce Flak missiles so you can build your own.
    The previously produced missile must have cost at least 10000 Cr so a cheap Mosquito factory will not suffice.

    This does work with regular "vanilla" factories but users reported problems with Ashley's Fabs. The reason is that Ashley's "Fixer" keeps fixing the fab back and that can not work.
Automatic Cargo Collection
  • There is an additional ship command "Collect Cargo"
  • X3 v2.5 required.
  • All ships with MARS and fighter drones can use it although it is intended for freighters.
  • If an area 7000m around the ship is clear of enemies it starts collecting cargo containers.
  • If the ship is a carrier it will also collect abandoned ships.
    They are all towed back to the carrier but not claimed. Alas this task is too complicated for a mere goblin.
    Still - doing that is not very hard since they are all arranged around the carrier for your convenience.
  • TS have the annoying habit of launching lots of Fighter Drones when under attack.

    If MARS Cargo Collection is active on a ship (not only TS!) then the number of regular fighter drones allowed to Follow/Protect this ship is limited to Missile Fire Probability / 5.
    (You can set this value in 5 % increments)

    So if you set MFProbability to 10%, all but 2 regular fighter drones will automatically be recovered when the Egosoft script launched 10...
    If the ship's attacker is destroyed or no longer in the same sector, all drones are recovered.

    This can also be useful to transfer drones all across a sector.
    The donor ship merely ejects all 50 drones into space.
    You order all drones to protect the receiving ship.
    If the receiving ship has the cargo collect script active it will recover most or all (Missile % setting) of these drones when they get there.
    (And drones are considerably faster than a freighter =)
  • Pandora and other special crates (BBS missions) are ignored by the automatic cargo collection and can only be retrieved through an explicit order from the playership.
  • Ships fill their cargo bay to almost 100 %. On a freighter this will not be noticable.
  • Automatic detection and use of [MOD] Racial Laser Variants
    A TS collecting heavy lasers that an enemy ship dropped will automatically change them to regular lasers so they can be used and traded normally.
  • MARS is a completely self contained script and should not be incompatible with anything.
    (Provided you update it's base data if you install a weapon mod =)
  • The AL Plugin shows the currently installed version. (updated after the next reload)
  • The installation of MARS is delayed for maximum compatibility and easier troubleshooting.
    After "installation" it takes 2 minutes and 1 save/reload of X3 for MARS to completely activate.
Image (ZIP)
For the time being there won't be an SPK version. There is still the occasional bugfix or tweaking...
Maybe one day when it's in a "wrap up and forget" state.

Resources used:
Textfile: 7046
Textfile: 7047 (Laser data for mod-adaption)
Task IDs: all task IDs end with ...7046
Command slot: COMMAND_TYPE_TURRET_46 (Defense)
Command slot: COMMAND_TYPE_TURRET_47 (Standby)
Command slot: COMMAND_TYPE_TURRET_48 (Offense)
Command slot: COMMAND_TYPE_SHIP_51 (Collect cargo)
Library: lib.ut.pos.from.2.grades.and.rad

Posted: Sun, 18. May 08, 21:28
by Locksley
Great! A new script from Gazz :D

So if I got a mod that changes the fire rate of the weapons your turret pluging take that into account? This seems to be the trouble with other turret scripts. Ah, looking at the script bullet speed I take it it only checks for speed and thus the possibility to hit fast moving targets?

Right now I got a mod that changes the TS file to increase damage and decrease firerate to make fewer bullets fly around and thus save some CPU cycles.

As of right now I am using mrcann's turret suite and haven't really checked if the refire rate is off.

Instant download!


Posted: Sun, 18. May 08, 21:47
by Gazz
This is how the Priorities for MARS laser choice look.

This is not a fixed table but merely examples of how lasers would be assigned to randomly selected ships.

Code: Select all

MARS Laser choice order for
                                                            Titan / 
Missile     Dolphin SF  Hyperion    Buster      LX          Elephant
A PSG       C PSG       C PSG       B Flak      B Flak      C PSG
B PSG       B Flak      B PSG       A Flak      A Flak      B PSG
C PSG       A Flak      B Flak      Ion         Ion         A PSG
B Flak      Ion         A Flak      B PBE       B PBE       C PPC
A Flak      B PSG       C PPC       A PBE       A PBE       B PPC
Ion         C PPC       A PSG       MD          A PAC       B Flak
B PBE       A PSG       B PPC       B IRE       B PAC
A PBE       B PPC       A PPC       A PSG       Conc
MD          A PPC       B HEPT      A PAC       A HEPT
A IRE       Conc        Conc        B PAC       A PSG
B IRE       B HEPT      A HEPT      Conc        A PPC
A PAC       B PAC       B PAC       B PSG       B HEPT
B PAC       A HEPT                  C PSG       B PPC
Conc                                A HEPT      C PPC
A HEPT                              B HEPT      C PSG
B HEPT                              A PPC       B PSG
A PPC                               B PPC
B PPC                               C PPC

Here the results of some v1.00 test battles

Always 1 M2 vs 30 M3 + 3 M6.
All equal conditions.
The "regular" M1 had the "Attack all Enemies" turret script and anti-fighter lasers. (Flak whenever possible)

The MARS M2 had all possible weapons available.

Note how the regular Titans didn't even survive their battles.
My test script wouldn't actually let them die (because I want the data =) but instead records how dead they died. =)

The biggest surprise (for me =) was how MARS increased the Python's effectivity by nearly 100 % as well.
I thought that any ship should be able to hit with an instant-hit weapon like Flak...
699 End of fight. Titan Flak+APPC, Att.a.E. lost 147 perc shield strength or 13283636.
33 / 33 attackers were destroyed in 699 sec. 1 kill every 21 seconds.

807 End of fight. Titan Flak+APPC, Att.a.E. lost 133 perc shield strength or 12037298.
33 / 33 attackers were destroyed in 807 sec. 1 kill every 24 seconds.

407 End of fight. Titan MARS lost 51 perc shield strength or 4655436.
33 / 33 attackers were destroyed in 407 sec. 1 kill every 12 seconds.

283 End of fight. Titan MARS lost 41 perc shield strength or 3710348.
33 / 33 attackers were destroyed in 283 sec. 1 kill every 8 seconds.

378 End of fight. Titan MARS lost 75 perc shield strength or 6790817.
33 / 33 attackers were destroyed in 378 sec. 1 kill every 11 seconds.

312 End of fight. Python Flak - Att.a.E. lost 46 perc shield strength or 3739258.
33 / 33 attackers were destroyed in 312 sec. 1 kill every 9 seconds.

323 End of fight. Python Flak - Att.a.E. lost 48 perc shield strength or 3904606.
33 / 33 attackers were destroyed in 323 sec. 1 kill every 9 seconds.

319 End of fight. Python Flak - Att.a.E. lost 37 perc shield strength or 3002061.
33 / 33 attackers were destroyed in 319 sec. 1 kill every 9 seconds.

201 End of fight. Python MARS lost 35 perc shield strength or 2847019.
33 / 33 attackers were destroyed in 201 sec. 1 kill every 6 seconds.

155 End of fight. Python MARS lost 42 perc shield strength or 3389239.
33 / 33 attackers were destroyed in 155 sec. 1 kill every 4 seconds.

190 End of fight. Python MARS lost 33 perc shield strength or 2688084.
33 / 33 attackers were destroyed in 190 sec. 1 kill every 5 seconds.

Posted: Sun, 18. May 08, 22:29
by Makita
Woot sounds really good any chance of it being compatible with ... light=xone

Posted: Mon, 19. May 08, 00:03
by s9ilent
Wow, this is an interesting script, I've often pondered about how to create the "ultimate" turret script

Out of curiosity, how did you use the turrets offset? So far I've only been able to project co-ordinates forwards/backwards from a ship. Any attempt to project up/down cause errors when the alpha axis is not near 0. (I tried wiki-ing it, and something about gimbal lock, or quante...nerions? came up, in short ???!?!?!??)

(I've only managed to briefly read through this, as I had to temporarily downgrade monitors :( it's too small :S)

Posted: Mon, 19. May 08, 12:02
by Gazz
s9ilent wrote:Out of curiosity, how did you use the turrets offset? So far I've only been able to project co-ordinates forwards/backwards from a ship. Any attempt to project up/down cause errors when the alpha axis is not near 0. (I tried wiki-ing it, and something about gimbal lock, or quante...nerions? came up, in short ???!?!?!??)
You probably spotted that in the logfile. =)
So yes, the script does use turret offsets (the front turrets of an M2 are quite a ways off).

However, I use them without doing any 3D math at runtime.
Each turret just substracts 70 % of "his" true offset from the distance to the center of the ship.
Perfect? Nah. But usable in a turret script that has to run often. =)

Try your best and fudge the rest. =)

Posted: Mon, 19. May 08, 19:06
by Gazz
Locksley wrote:So if I got a mod that changes the fire rate of the weapons your turret pluging take that into account? This seems to be the trouble with other turret scripts.
If the intention of this is to save CPU cycles then every turret script adapts to a slower refire rate of lasers because the refire rate is enforced by the mod.

The only thing that's really broken with turret scripts is that the refire rate of extremely fast lasers is always too low when in a turret.

I have an idea for how to fix that without cheating (okay, I would have to cheat but just a tiny little bit =) but I'm not sure if that would be such a big deal.

If I decouple aiming and firing then the turret would aim at the target normally. Then it would keep firing until the turret reports that aiming failed.
That means that the turret could be cheating for up to 0.5 sec (less if I lower the wait) and fire at the target without a proper aim.

That a turret can keep tracking a target once it has had an aim is practically guaranteed for those fast firing weapons because their rotation speed is immense.
And for a slow weapon those 0.5 sec tops simply don't matter. That's what... 0.7 more bullets fired? Oh terrible pity.
That way I could let MD or PBE fire at full tilt boogie with up to 1 bullet per frame just like you can from a player cockpit...

Posted: Mon, 19. May 08, 19:56
by Sandalpocalypse
This uses the existing MARS ware? Very efficient!

Posted: Mon, 19. May 08, 20:20
by Gazz
Hehehe. And it fits beautifully!
Motion analysis is exactly what the script is doing and it relays this information to all connected turrets so the same calculations don't have to be done for every turret separately. =)

Each turret only compares this general hit probability to it's own lasers and distance - and this system allowed me to use a slower timer for the actual turret scripts.
So even though this script burns a lot more CPU time than a generic turret script, the calculations are spread out as well as I could manage.

Posted: Mon, 19. May 08, 20:26
by Sandalpocalypse
Hmm... any chance of being able to get them elsewhere? Those of us on an anti-Split jihad have some issues here. Lack of afterburners is bad enough... 8)

Posted: Mon, 19. May 08, 21:56
by Gazz
Sure, that's easy. Change the race in the setup script. =)

I choose split because all the other races have area weapons of some sort. Only the split have to actually hit their targets.

Hmmmmmm. I found a bug in the implementation of my intended formula.
The result of that was outright amazing. =)

Compare a battle log of an AI turret Titan:
561 Falcon destroyed. 19 remaining.
2089 Falcon destroyed. 18 remaining.
2531 Falcon destroyed. 17 remaining.
2562 Falcon destroyed. 16 remaining.
2999 Falcon destroyed. 15 remaining.

3754 End of fight. Titan standard lost 41 perc shield strength or 3721436.
5 of 20 fighters were destroyed in 3754 sec.

With that of the identical MARS Titan (who also had 2 Xenon P thrown at it for good measure)
41 Falcon destroyed. 21 remaining.
41 Falcon destroyed. 20 remaining.
56 Falcon destroyed. 19 remaining.
72 Falcon destroyed. 18 remaining.
77 Falcon destroyed. 17 remaining.
87 Falcon destroyed. 16 remaining.
92 Falcon destroyed. 15 remaining.
108 Falcon destroyed. 14 remaining.
113 Falcon destroyed. 13 remaining.
128 Falcon destroyed. 12 remaining.
139 Falcon destroyed. 11 remaining.
144 Falcon destroyed. 10 remaining.
149 Falcon destroyed. 9 remaining.
164 P destroyed. 8 remaining.
180 Falcon destroyed. 7 remaining.
195 Falcon destroyed. 6 remaining.
210 Falcon destroyed. 5 remaining.
251 Falcon destroyed. 4 remaining.
282 Falcon destroyed. 3 remaining.
308 Falcon destroyed. 2 remaining.
370 P destroyed. 1 remaining.
405 Falcon destroyed. 0 remaining.

405 End of fight. Titan MARS lost 46 perc shield strength or 4211665.
22 / 22 attackers were destroyed in 405 sec.

The MARS Titan had destroyed an even bigger fleet before the Titan with AI turrets (the weapon changing ones) had shot down a single ship...

I throught this might have been random chance and repeated it.
Now the Titan destroyed the same fleet in 297 seconds...
The first run must have been a warm up round...

Believe it or now. I'm not cheating one bit in this script. =P

Posted: Mon, 19. May 08, 23:48
by Gazz
This is looking a lot better now so...

Beta 6 released...

I also included the test scripts to spawn an instant battle 5 km north of your ship.
Please enable MARS before spawning the battle so the script installation is complete.

asks you how many attackers (M3) you would like.
For every 10 M3, 1 M6 is added.

It also lets you enter a number for the logfile.
You can have multiple battles running at the same time and they all write their data to only their own logfile.

Posted: Tue, 20. May 08, 09:16
by znix77
Thanks Gazz for this simple to use turret script.. Been looking for one since starting on X3 for the first time about a month ago .. Must say your scripts are great to use, keeping it simple and effective. Changed the battle script with a Xenon K and 10 Ls.. was kinda amazing to see the turrets switch priorities as the battle progressed and the Titan managed to win!

Posted: Tue, 20. May 08, 11:50
by Gazz
Note that the Titan always wins this fight.
The logfile tells you how much shield strength it lost during it and if it lost 150 % shield strength... it didn't really survive.

This test script is to see how effectively the turrets work and how quickly they destroy how many ships. Not who wins. =)

Oh, this test can be aborted "cleanly" with opening the playership's cargo bay for a few seconds.

I haven't tested cap ship opponents, yet, but I bet MARS would give them a run for their money, too.

BTW: This test script is actually a worst case scenario. All attackers attack directly from the Titan's weakest side.
If you want a more realistic initial engagement, add 3-4 km to the attacker's X and Y spawning coordinates.

Then you will see it's "forward defense" working and intercepting the attackers before they even get into firing range.

Posted: Tue, 20. May 08, 11:56
by Locksley
I was just wondering about a few things (and thanks for your previous answer).

I installed your 1 beta and went to a sector were I got 35fps and started the mars thingy. It installed fine.

Now; I had not gotten the upgrades but it went fine installing and also having the turret commands set at MARS, and they fire at ships and so on. But if it shouldn't work without the upgrades maybe the commands should be grayed out and non chooseable <sp>.

And now I've upgraded to beta 6, but I guess the main code is the same since I cant reinstall MARS (did find a better sector, 41 fps :P maybe I should uninstall/reinstall?)