[Mod] Aggressive AI 2.5 (2019.01.18) - Support Ended.

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

[Mod] Aggressive AI 2.5 (2019.01.18) - Support Ended.

Post by 7ate9tin11s » Wed, 26. Dec 18, 21:02

Notice
7ate9tin11s wrote:
Wed, 23. Jan 19, 22:01
So all of my stumbling about has found a lot of information about the structure and design of the vanilla Egosoft AI, at this point I am finding that the core design of the combat AI itself does not meet my vision and needs. Therefore, I am going to cease updating this mod which tries to address and extend capabilities in the vanilla AI. This means that when 1.6 comes out the mod will no longer work due to Egosoft making heavy changes to their own AI scripts rendering any diff files invalid.

I have began a complete bottom up rewrite of the AI from the interrupt level on up to the attack orders and may release it at some point. For now though I hope Egosoft's AI updates in 1.6 are decent and make for a playable game.

If someone would like to take over updating and altering this script please PM me and I can assign control of the Nexus page over. If I do not hear back by the time 1.6 is released I will delete the Nexus page.

Thank you,

-7ate
I found the original AI lacking in many respects. Turrets could take up to a minute to acquire targets, ships with both missiles and lasers would very rarely launch a missile, drone carriers were worthless since they could not use drones out of sector, mines/lasertowers were basically for player use only, and stations ignored anything smaller than a destroyer.

This fixes it.

Modules
Aggressive AI is now broken into several modules that can be managed via the in-game extensions menu. This allows you to adjust features as needed for your vision of the universe and computers processing power.
  • Core - This module must be enabled and contains massive AI fixes and minor activity adjustments for more engaging combat. See the core adjustments below for more information.
  • Dangerous Stations - Stations will preemptively attack most enemy ship types instead of only worrying about capital ships.
  • Dangerous Player Stations - Defaults to Off. Player stations should also preemptively attack most enemy ship types instead of only worrying about capital ships.
  • Deployables - Deployables like lasertowers and mines will be deployed by non-player-owned ships in regular combat. NPCs have less deployables on new ships and those that they do have only last a few minutes to compensate for their active use.
  • Escort - Escorts will stay much closer to whatever they are protecting, preferring to have overlapping fields of fire when possible. This effects all escorts, even the players.
  • Minesweeping - Turrets will recognize mines as a threat and try to handle them. Missile defense treats them as a missile, defense worries about any mines targeting you, attack all will just shoot at them along with everything else.
  • OOS Drones - Ships and stations now actively use their drones when not in the player's sector instead of just being granted magical extra damage.
  • Smart Targeting - NPC enemy target selection now also takes into account loadouts, sizes, classes, and purpose when choosing targets to attack.
  • Smart Player Targeting - Defaults to Off. Player ship enemy target selection now also takes into account loadouts, sizes, classes, and purpose when choosing targets to attack. This will cause ships to choose their own targets and occasionally ignore your orders for what they feel are better targets, not a module for control freaks ;) .
  • Debug Cleanup - Defaults to Off. Will fix old smart targeting and dangerous player station settings, leave it on with those modules off for at least a combat and hour to ensure everything is cleaned up.
  • Debug Combat - Defaults to Off. On a new game start this module creates a large combat around the player, what I use for testing.
  • Debug Scripts - Defaults to Off. Switches all AAI scripts into full debug mode, creates a very large log file if you have logging enabled!
Core Adjustments
Unless stated otherwise, all changes affect player ships too!
  • Up to 90% reduced target acquisition time for Turrets
  • Ships will not boost unless they have enough shields in reserve (depending on piloting skill and morale) and capships will favor using travel drive when possible
  • Reduced drone launch times
  • Fighters will use missiles earlier and more often when they have both guns and missiles. They can also use them consistently against components of big ships.
  • Expanded firing aperture for turrets, guns, and missiles so NPCs can shoot more often.
  • Reduced strafing run predilection. If your not shooting them why should they run away?
  • Missile defense turrets should defend against fighters if there are no missiles about
  • Increased targeting range to at least the best equipped weapons range, fixes some issues with rebalance mods that increase range on guns.
  • Unlike vanilla, AI ships should no longer waste time automatically attacking invulnerable objects like build storage and Kha'ak installations. You can still order them to attack them though if you like the pretty light show.
  • May have fixed escorts wandering off to other sectors when they should not (vanilla bug)...let me know.
Compatibility
I've successfully tested with FOCW and Improved Kha'ak. There should be no compatibility issues with anything outside of full combat AI overhauls like this (and 2.0 is even more compatible with small changes!).

Not compatible with the 1.51 beta - Egosoft is overhauling the combat scripts and I will wait till they have finalized changes before updating this mod.

Frequently Asked Questions
1. How do I turn modules on and off?
7ate9tin11s wrote:The easiest way is through the 'Extensions' menu in-game, that way you can see a full description of the module. The more difficult, and permanent way, is to delete the module folder from your extensions directory. Please note that the two debug modules are pre-set to disabled and have to be manually enabled in game...plus you really do not want to do that unless you know what you are doing or have been asked to do it by me!
2. Can these modules be used all together or are there any restrictions?
7ate9tin11s wrote:All modules work together fine and compliment each other, the only restriction is that the core module must be enabled. Specifically, the targeting and escort modules require fixes made in the core module while other modules have less reliance.
3. What modules do you recommend for FOCW?
7ate9tin11s wrote:
  • Core - On, of course :D
  • Deployables - Off, the larger fleets/combats and increased firepower mean the extra (and comparatively wimpy) deployables are not needed.
  • Escort - This makes the fleets stay closer and turns them into spheres of extra-deadly fun! On! Sanity is for the weak! :twisted:
  • Minesweeping - Without deployables on there is no real reason to use minesweeping, off for a little less overhead.
  • OOS Drones - With the increased amounts of combat around the universe, and the relative wimpyness of drones, I suggest off for less ships being calculated OOS.
  • Dangerous Player Stations - I'd probably leave it Off in hopes my stations do not attract an enemy fleet or patrol by shooting at them preemptively.
  • Dangerous Stations - On, unless you need to survive EMP bombing stations without taking down their turrets first... :roll:
  • Smarter Targeting - On, if your system can handle it. This really helps fighters destroy capships/stations and makes your fighter screens very very important.
  • Debugs - Don't turn these on as they either mess with universe relations or generate massive log files. They default to off for a reason!
Installation
Place into your steamapps\common\X4 Foundations\extensions folder and not into your documents folder for best results.

Much kinder to an existing games...it should just start affecting ships as they get into combat.

Download
https://www.nexusmods.com/x4foundations/mods/206/
Please make sure and remove all old loose AAI mod files before upgrading.

Please let me know if you run into bugs or find other issues with this!

Changelog
Spoiler
Show
2.5 - Added debug cleanup module to allow purging settings from player-only modules.
2.4 - Split targeting into player and non-player modules. Small fixes in medium ship smart targeting.
2.3 - Hotfix for targeting loops caused by smart targeting module.
2.2 - Hotfix for missing files, updated another edge case for escorts wandering off to enemy sectors.
2.1 - May have fixed escorts wandering off to other sectors when they should not (vanilla bug). Fighters have remembered how to move when attacking stations, medium ships realized they have main guns again, several other fixes. Dangerous player stations module added (defaults off). CAT/DAT version now default and only download.
2.0 - Lots of bugfixes and modular construction.
1.5 - Lots of bugfixes (especially for capital ships) and speed improvements. Loosened up patrol/escort ranges a bit to prevent loops...may need to undo this. Make sure and remove all old loose AAI mod files before upgrading!
1.4 - Improved escort/patrol behavior (finally!), better targeting priorities, less deployables on big ships so capping is not so much of a pain. Fixed another chance to target invulnerable objects.
1.3 - Mines cleared by turrets/fighters, npc lasertowers can now destruct in-sector, boost usage limited, smarter component targeting with missiles, some OOS optimization to reduce lag.
1.2 - Contents file updated for compatibility with non-English installs. NPC ships may now only deploy a lasertower/mine once every 2-7 minutes (depending on pilots skill). This should really help framerates.
1.1 - AI should no longer automatically target invincible objects like build storage and Kha'ak stations. Deployables now category-based in case a future modder adds in new deployables. Reduced deployable usage. Minor bug fixes.
Last edited by 7ate9tin11s on Mon, 28. Jan 19, 19:37, edited 27 times in total.

User avatar
Xfan989
Posts: 318
Joined: Sun, 5. Nov 06, 16:07
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by Xfan989 » Wed, 26. Dec 18, 21:35

Sounds good :thumb_up:
especially the faster target aqusition time of turrets - always looked kinda stupid seeing those turrets rotating around like crazy looking for a target.
But is it possible to remove the auto-deployable feature? Not a fan of this.
Also, predictable question - compatible with FOCW and/or Shield and Weapon Rebalance?
Die Nacht ist nur so dunkel, damit man sie besser sieht.

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by 7ate9tin11s » Wed, 26. Dec 18, 22:05

Xfan989 wrote:
Wed, 26. Dec 18, 21:35
Sounds good :thumb_up:
especially the faster target aqusition time of turrets - always looked kinda stupid seeing those turrets rotating around like crazy looking for a target.
But is it possible to remove the auto-deployable feature? Not a fan of this.
Also, predictable question - compatible with FOCW and/or Shield and Weapon Rebalance?
For the auto-deploy, the easiest method to disable it is to edit AggresiveAI\libraries\loadoutrules.xml and replace the contents with:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
<replace sel="//rules/deployable/rules/ruleset[@type='default']">
      <ruleset type="default">
      </ruleset>
</replace>
</diff>
If noone has any deployables then they cannot be deployed. :D Alternatively, just remove the lines you do not want in there as they are pretty self-explanatory. I've already limited it down really far so traders will have a couple towers, small fighters none, etc.

Lastly, it is completely compatible with Shield and Weapon Rebalance, likely compatible with FOCW (but not tested). The worst you may have to do is delete any other mods matching filenames in aiscripts (i.e. fight.attack.object.fighter.xml), but since I do a full replace it should not cause problems...that is why it is still beta ;)

User avatar
Xfan989
Posts: 318
Joined: Sun, 5. Nov 06, 16:07
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by Xfan989 » Wed, 26. Dec 18, 22:18

FOCW only makes changes to move.attack.object.capital in aiscripts, so I guess I will give it a try. Hopefully those bloody L-turrets will stop derping around and actually lock onto a target faster :)
Die Nacht ist nur so dunkel, damit man sie besser sieht.

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by 7ate9tin11s » Thu, 27. Dec 18, 02:07

Xfan989 wrote:
Wed, 26. Dec 18, 22:18
FOCW only makes changes to move.attack.object.capital in aiscripts, so I guess I will give it a try. Hopefully those bloody L-turrets will stop derping around and actually lock onto a target faster :)
Some quick testing shows no conflicts or issues with FOCW. Capships were merrily blowing things up.

TZER
Posts: 30
Joined: Sun, 29. Nov 09, 20:34
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by TZER » Thu, 27. Dec 18, 09:19

Is it at all possible for you to look into fighters and docking? It's stupid how long it takes carriers/destroyers to release the fighters they carry. I have also heard that they won't launch fighters unless you force them too, which is also kinda weird. Carriers as they are right now are kinda sucky.

Otherwise awesome mod addition :mrgreen:

Kayser99
Posts: 23
Joined: Mon, 20. May 13, 13:18
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by Kayser99 » Thu, 27. Dec 18, 11:39

Noice!, give this a try...I will!

Like the whole launching of ships and drones, can I also ask, is there a way to change the behavior or the whole "recall subordinates" thingy/ mechanic? Until improved by Egosoft

I have not tried it again and prefer to battle without fleets/ drones and escorts as it just does not work, like jumping to sector (or pretty much doing anything else) the mother ship needs to recall subordinates, recalling repair drones one by one in an unstoppable landing/ taking off 1 by 1 loop forcing your capital to crawl at a suicidal 75 m/s crawl unable to stop it or increase speed...then you die. Sad Panda

Or the fleet will either rush off first leaving you behind, they die alone, or they crawl far behind leaving you rushing in first and you fight alone...

FlynTie
Posts: 36
Joined: Wed, 12. Dec 18, 01:42

Re: [Mod] Aggressive AI 0.1-beta

Post by FlynTie » Thu, 27. Dec 18, 11:52

Ok i had a run with it and jumped into a few fights and just spectated a few fights and i gotta admit that was quite the thrill!

Combined with your Improved Khaak mod, combat becomes quite challenging and fun. Certainly an improvement and i'm looking forward to what you got in store for us.

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by 7ate9tin11s » Thu, 27. Dec 18, 16:35

TZER wrote:
Thu, 27. Dec 18, 09:19
Is it at all possible for you to look into fighters and docking?
Kayser99 wrote:
Thu, 27. Dec 18, 11:39
Like the whole launching of ships and drones, can I also ask, is there a way to change the behavior or the whole "recall subordinates" thingy/ mechanic? Until improved by Egosoft
I did leave most of that code alone this pass, from what I recall a lot of it is based on a mix of the fighter pilot and the carrier commanders skill. As with most skill-based things they set the lower levels as drooling idiot (Really Egosoft, it takes a level zero 60 seconds to see a red dot on the radar!?), so it should not be too bad to make fighters launch faster. Docking might be less adjustable as it is mostly down to the atrocious docking AI and pathfinding. Will take a look though.

TZER
Posts: 30
Joined: Sun, 29. Nov 09, 20:34
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by TZER » Thu, 27. Dec 18, 17:21

7ate9tin11s wrote:
Thu, 27. Dec 18, 16:35
I did leave most of that code alone this pass, from what I recall a lot of it is based on a mix of the fighter pilot and the carrier commanders skill. As with most skill-based things they set the lower levels as drooling idiot (Really Egosoft, it takes a level zero 60 seconds to see a red dot on the radar!?), so it should not be too bad to make fighters launch faster. Docking might be less adjustable as it is mostly down to the atrocious docking AI and pathfinding. Will take a look though.
Is it okay to say I love you? Without you modders I would have left this game on the shelf by now <3

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 0.1-beta

Post by 7ate9tin11s » Thu, 27. Dec 18, 18:22

*pokes at drone bits*

"Wait, what!? ...drones are not launched or used by M's when out of sector...but drone carriers are M's... :shock: :evil: "

This may take a little bit.

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.0

Post by 7ate9tin11s » Fri, 28. Dec 18, 01:40

Version 1.0 released on Nexus. Ships and stations will now use drones when out of sector!

Download
https://www.nexusmods.com/x4foundations/mods/206/

I've looked into the carrier code and it looks like both launching and landing are completely locked behind the undock and dock actions. Since there is no forced teleport move available in x4 (that I can find) a rapid launch/retrieve system would require destroying then cloning a new ship every time. Messy, but I might poke at it if I get bored.

Aside
Well, being landed on a pirate station when a bunch of Xenon decide to attack is one heck of an experience now...every docking bay continually brings up a defensive drone and launches it, station batteries open fire, Xenon die a terrible death (and this is with FOCW super Xenon!). :rofl: :eg:

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [Mod] Aggressive AI 1.0

Post by BlackRain » Fri, 28. Dec 18, 02:55

7ate9tin11s wrote:
Fri, 28. Dec 18, 01:40
Version 1.0 released on Nexus. Ships and stations will now use drones when out of sector!

Download
https://www.nexusmods.com/x4foundations/mods/206/

I've looked into the carrier code and it looks like both launching and landing are completely locked behind the undock and dock actions. Since there is no forced teleport move available in x4 (that I can find) a rapid launch/retrieve system would require destroying then cloning a new ship every time. Messy, but I might poke at it if I get bored.

Aside
Well, being landed on a pirate station when a bunch of Xenon decide to attack is one heck of an experience now...every docking bay continually brings up a defensive drone and launches it, station batteries open fire, Xenon die a terrible death (and this is with FOCW super Xenon!). :rofl: :eg:
You mention forced teleport, would warp work? There is a warp command.

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.0

Post by 7ate9tin11s » Fri, 28. Dec 18, 03:07

BlackRain wrote:
Fri, 28. Dec 18, 02:55
You mention forced teleport, would warp work? There is a warp command.
Well, huh. I looked through for every variation on 'move' and 'jump' I could think of and never tried warp. Nor did I see it when looking through commands, but there it is in common. :oops:

Combined with 'request_docking' -> 'dock' for instant docking and I think we can do rapid launch and retrievals if we want. :gruebel:

BlackRain
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 7406
Joined: Mon, 15. Dec 03, 18:53
x4

Re: [Mod] Aggressive AI 1.0

Post by BlackRain » Fri, 28. Dec 18, 04:05

7ate9tin11s wrote:
Fri, 28. Dec 18, 03:07
BlackRain wrote:
Fri, 28. Dec 18, 02:55
You mention forced teleport, would warp work? There is a warp command.
Well, huh. I looked through for every variation on 'move' and 'jump' I could think of and never tried warp. Nor did I see it when looking through commands, but there it is in common. :oops:

Combined with 'request_docking' -> 'dock' for instant docking and I think we can do rapid launch and retrievals if we want. :gruebel:
I don't see why not, have you looked at the cheat menu mod for X4? You can warp right into a docking bay (as docked) with your ship using the cheat menu. So it should be feasible to do this for docking ships at a carrier.

hasmossis
Posts: 3
Joined: Fri, 28. Dec 18, 04:43

Re: [Mod] Aggressive AI 1.0

Post by hasmossis » Fri, 28. Dec 18, 05:02

hi my game wont start when the mods in the correct folder any other way of installing it? as i really want this mod thanks

7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.0

Post by 7ate9tin11s » Fri, 28. Dec 18, 05:37

hasmossis wrote:
Fri, 28. Dec 18, 05:02
hi my game wont start when the mods in the correct folder any other way of installing it? as i really want this mod thanks
The mod should go in your c:\program files\Steam\steamapps\common\X4 Foundations\extensions folder (or equivalent wherever you installed X4). If your using Windows 7 there are apparently some weird issues and you may need to use the cat tool to archive to mod into a cat file for it to work.

I'll eventually be archiving this into a cat myself, but need to stop making rapid changes to it first.

hasmossis
Posts: 3
Joined: Fri, 28. Dec 18, 04:43

Re: [Mod] Aggressive AI 1.0

Post by hasmossis » Fri, 28. Dec 18, 07:17

hi thanks for the quick respose im on win 7 so that exsplains it im downlaoding cat packing tool now do i just pack the whole mod file or just the xml files?

TZER
Posts: 30
Joined: Sun, 29. Nov 09, 20:34
x4

Re: [Mod] Aggressive AI 1.0

Post by TZER » Fri, 28. Dec 18, 07:21

7ate9tin11s wrote:
Fri, 28. Dec 18, 03:07
Well, huh. I looked through for every variation on 'move' and 'jump' I could think of and never tried warp. Nor did I see it when looking through commands, but there it is in common. :oops:

Combined with 'request_docking' -> 'dock' for instant docking and I think we can do rapid launch and retrievals if we want. :gruebel:
Ooooh, that may be something I'd be interested in. At least until Egosoft can do something about the atrocious time it takes AI to take off and land from their carriers. Btw is it me doing something wrong when my carriers won't launch there fighters when enemies are close and combat has started?

Kayser99
Posts: 23
Joined: Mon, 20. May 13, 13:18
x4

Re: [Mod] Aggressive AI 1.0

Post by Kayser99 » Fri, 28. Dec 18, 10:11

Would there be a clash with TaterTrader mod?, I am looking at about 70% of my TaterTrader ships just parked doing nothing. 5 star capt's, 30 jump buy and sell orders, some on buy 30 jumps and sell 0 jumps back to a "home system", multiple wares. Do not have homebound option ticked. The only ones that seem to be trading are the ones linked to stations.

This was just an observation, and i did not see any changes related to trading ships in mod description, and it could very well just be my ships don't have anything to trade but I have over 100+ trade ships and if 70% are idle it makes me wonder...i will observe it a bit more or perhaps re-issue the tatertrade orders.

Post Reply

Return to “X4: Foundations - Scripts and Modding”