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

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

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

leecarter
Posts: 379
Joined: Sat, 9. Sep 06, 22:35
x3tc

Re: [Mod] Aggressive AI 1.2

Post by leecarter »

BlackRain wrote: Sat, 29. Dec 18, 16:48 The shipyard supply fix mod does not "spawn more faction ships". It just helps with building the ships stuck in the queue's.
I'm aware of what it does. And as a result of helping with building ships more ships are in the universe, hence the use of my perhaps technically incorrect term "spawn".
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.2

Post by 7ate9tin11s »

7ate9tin11s wrote: Sat, 29. Dec 18, 18:57 Minor unstable update with 2 new features:
  • Mines are now handled by turrets and fighters. Missile defense turrets consider them to be missiles and high priority, defense turrets consider mines actively tracking you to be a primary target, and aggressive turrets see them as just another thing to kill. Fighters/drones will take attacks of opportunity on mines as they dogfight, but are more focused on their living foes.
  • NPC lasertowers will now destruct after 20 minutes when in the player sector instead of being permanent (Still 10 minutes OOS). God-spawned lasertowers will now no longer ever self-destruct (several stations actually start with lasertowers around them, in vanilla they destructed after an hour so were useless)
  • Boost usage limited by piloting/morale skills and the amount of shields remaining. Ships will no longer use up all their shield (I hope!)
  • Patrols, escorts, and other ship defenders will default to prioritize overlapping fields of fire and close support over chasing down enemies. This needs some major testing!
  • Player and non-player NPC flown ships will teleport dock and undock onto carriers and other ships (This is the RapidDocking extension that will likely be an optional or entirely different release eventually)
These are are pretty major changes on the universe and I could use help finding the inevitable errors and problems they cause :D

The download can be found as on optional file on Nexus: https://www.nexusmods.com/x4foundations ... ?tab=files
New unstable release, does all of the above plus:
  • Adds Mark 2-5 drones (Note that they have no faction rep requirements yet! Will likely be rep 0 for Mk2, rep 10 for Mk3-4, rep 20 for Mk5...let me know what you think the rep requirements and costs should be adjusted to!). This is the DroneVariety extension that will likely be an optional download or separate release later.
  • Fixed an object reference in lasertower fight code causing debug log issues
  • Several other minor adjustments
Buzz2005
Posts: 2298
Joined: Sat, 26. Feb 05, 01:47
x4

Re: [Mod] Aggressive AI 1.2

Post by Buzz2005 »

did little testing with unstable build

rapid docking, I land od my odyssey and when I undock it warps me between highways and I locked out of controls
to unlock have to get up from the seat and back

boost on capital ships, my odyssey used all of his shields to boost but I deleted FOCW aiscript bc it only removes boosting for capitals, maybe It should be there
I copied back the aiscript and its probably working now

dont know about fighters

mines and turrets, dont know but should it work on player ships? have a nemesis with 2 beam turrets and was near some red mines that i cant target btw and in any turret mode they were not firing

EDIT: npc ships shoot at mines and I found xenon ships just sitting in space not attacking anyone, its maybe the same problem FOCW had with boost edits make npcs not attacking
will test it with stable AI mod
Fixed ships getting spawned away from ship configuration menu at resupply ships from automatically getting deployables.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.2

Post by 7ate9tin11s »

Thanks for testing! Getting some changes in now
Buzz2005 wrote: Mon, 31. Dec 18, 14:23 rapid docking, I land od my odyssey and when I undock it warps me between highways and I locked out of controls
to unlock have to get up from the seat and back
The warp command is a bit weird and seems to have its own ideas where to warp you to. For now I will just disable warping on ships that contain the player since it is too jarring.
Buzz2005 wrote: Mon, 31. Dec 18, 14:23 boost on capital ships, my odyssey used all of his shields to boost but I deleted FOCW aiscript bc it only removes boosting for capitals, maybe It should be there
I copied back the aiscript and its probably working now
Well &^^$%#...I never updated move.attack.object.capital which handles capital movement (guns are handled in fight.attack.object.capital). Did not even realize they used two different scripts! :oops:
Buzz2005 wrote: Mon, 31. Dec 18, 14:23 mines and turrets, dont know but should it work on player ships? have a nemesis with 2 beam turrets and was near some red mines that i cant target btw and in any turret mode they were not firing
I had the mine detection limited to 3km for engagement, it will now be 5km or your weapon range (whichever is greater) on turrets for any known mines.

Should have the updates out later today when I have given them a quick test.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.2

Post by 7ate9tin11s »

As a side note for 1.3 ...should the AI be able to board ships? :twisted:
User avatar
Xfan989
Posts: 318
Joined: Sun, 5. Nov 06, 16:07
x4

Re: [Mod] Aggressive AI 1.2

Post by Xfan989 »

Maybe AI should be able to fight properly in the first place :D
Watching those Behemoths trying to kite and turn around occasionally to fire their main guns is a pain.
Though that's not related to your mod of course.
Die Nacht ist nur so dunkel, damit man sie besser sieht.
Buzz2005
Posts: 2298
Joined: Sat, 26. Feb 05, 01:47
x4

Re: [Mod] Aggressive AI 1.2

Post by Buzz2005 »

Xfan989 wrote: Mon, 31. Dec 18, 18:58 Maybe AI should be able to fight properly in the first place :D
Watching those Behemoths trying to kite and turn around occasionally to fire their main guns is a pain.
Though that's not related to your mod of course.
With this mod they fire often but not at anything :D
Watched odysseys fire there main battery guns "at" HAT Behemot, he was turning and maybe trying to line up but the whole time he kept on shooting allover the place
I guess its the mods turret targeting change, while he is turning a target is in line for a second so why not send a couple of salvos :D
Fixed ships getting spawned away from ship configuration menu at resupply ships from automatically getting deployables.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.2

Post by 7ate9tin11s »

Xfan989 wrote: Mon, 31. Dec 18, 18:58 Maybe AI should be able to fight properly in the first place :D
Watching those Behemoths trying to kite and turn around occasionally to fire their main guns is a pain.
Though that's not related to your mod of course.
That would be related to the capital movement script which I did not realize existed. I've given it a pretty heavy rework this morning to allow for more shooting and less dancing. I just need to see if it makes the capships work a bit better. Time to trigger a war!
User avatar
Xfan989
Posts: 318
Joined: Sun, 5. Nov 06, 16:07
x4

Re: [Mod] Aggressive AI 1.2

Post by Xfan989 »

Sounds good!
Whoever created that script at Egosoft spend to much time In World of Warships. Looks completly stupid.
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 1.2

Post by 7ate9tin11s »

Hmmm, forcing escort distance to be shorter causes massive lag and slowdowns due to how pursue distance in handled in the scripts. That is not going to get in 1.3, back to wide ranging escorts. :evil:
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.3

Post by 7ate9tin11s »

Oh, what is this? Just in time for the new year! :thumb_up:

Version 1.3
  • Mines cleared by turrets/fighters. Missile defense mode prioritizes mines like missiles, defense prioritizes mines targetting you, attack all kills them like everything else.
  • NPC lasertowers will now destruct in-sector after 20 minutes, but god-spawned lasertowers will no longer ever destruct.
  • Boost usage limited by shields and morale values, capships will now use travel drive more reliably.
  • Smarter component targeting with missiles for small and medium ships.
  • OOS optimizations for capships, they will no longer waste time jockying for position when it does not matter. In-sector they can now move in 3 dimensions instead of 2
Download
https://www.nexusmods.com/x4foundations/mods/206

Warning
No idea how loading an older save will work with this. New game recommended.
ApoxNM
Posts: 783
Joined: Wed, 5. Dec 18, 06:17
x4

Re: [Mod] Aggressive AI 1.3

Post by ApoxNM »

Hi there,

in a thread concerning boarding: viewtopic.php?f=180&t=409853&start=60

we have figured out that laser turrets or deployables trigger a game crash when boarding ships. Are you familiar enough with the code to be able to find a fix?
Or is there a way in your mod to limit ships to a certain number of turrets (like 10)?
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.3

Post by 7ate9tin11s »

ApoxNM wrote: Tue, 1. Jan 19, 13:35 Hi there,

in a thread concerning boarding: viewtopic.php?f=180&t=409853&start=60

we have figured out that laser turrets or deployables trigger a game crash when boarding ships. Are you familiar enough with the code to be able to find a fix?
Or is there a way in your mod to limit ships to a certain number of turrets (like 10)?
I've already reduced the number of towers in most ships via the loadouts. There is also the optional file download that will prevent all deployables on new ships too. As for determining why lasertowers would cause crashes during boarding...I'll have to look at the boarding scripts some but I bet the crash is related to the ship being boarded having subordinates alive and running the lasertower code (I wonder if it is just the lasertowers missing the faction change interrupt when a ship swaps sides?).
ApoxNM
Posts: 783
Joined: Wed, 5. Dec 18, 06:17
x4

Re: [Mod] Aggressive AI 1.3

Post by ApoxNM »

7ate9tin11s wrote: Tue, 1. Jan 19, 18:16
ApoxNM wrote: Tue, 1. Jan 19, 13:35 Hi there,

in a thread concerning boarding: viewtopic.php?f=180&t=409853&start=60

we have figured out that laser turrets or deployables trigger a game crash when boarding ships. Are you familiar enough with the code to be able to find a fix?
Or is there a way in your mod to limit ships to a certain number of turrets (like 10)?
I've already reduced the number of towers in most ships via the loadouts. There is also the optional file download that will prevent all deployables on new ships too. As for determining why lasertowers would cause crashes during boarding...I'll have to look at the boarding scripts some but I bet the crash is related to the ship being boarded having subordinates alive and running the lasertower code (I wonder if it is just the lasertowers missing the faction change interrupt when a ship swaps sides?).
Thanks for the answer, will download that version and try it out!

I haven't looked at any files so I have no idea what exactly is the cause and which functions are triggered when boarding happens, I would be curious to know tough.
Scoob
Posts: 11180
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Mod] Aggressive AI 1.3

Post by Scoob »

Hi,

Firstly, thanks for this mod, it's very much needed!

Secondly, regarding:

"Patrols, escorts, and other ship defenders will default to prioritize overlapping fields of fire and close support over chasing down enemies. This needs some major testing!"

I'm not seeing any different behaviour currently. My Frigate has two Corvettes in its squad and the Corvettes still wander off and do their own thing, they do not stay even remotely near the lead ship. As such, the Frigate, and both Corvettes, are getting their behinds kicked by a single Xenon M each. If they stuck together, their combined turret coverage should roast a single M no problem.

I'll continue to observe the behaviour...all ships under AI control of course, I'm just riding on the lead ship.

Note: all Captains are zero star, so perhaps their rookie status impacts behaviour?

Scoob.
Scoob
Posts: 11180
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Mod] Aggressive AI 1.3

Post by Scoob »

Another query if I may. I'm unsure whether you consider this in scope for this mod, but I was wondering if you might be able to address the following issue:

I observe how ships given an attack order will often fly to where a target was at the time the order was given. This often leads to combat not being actually engaged for ages. As a current example in my game, I have a Destroyer patrolling and I identified a hostile and moved to attack it. However, it's always going to where the target was, as I mentioned, and this has been going on about forty minutes now! Additionally, which doesn't help, my ship will use its travel drive to approach the target, but, if the target exits travel drive so will my ship. So, say my ship is moving towards where the target was using Travel Drive and the target ship engages its travel drive, my ships continues to where said target was. However, once the target comes out of its travel drive - usually 100's of km away - my ship also exits travel drive and proceeds in the same (wrong) vector at normal speeds. Thus never catches the target. This is most apparent when a larger ship is chasing a smaller one.

From a combat perspective, this is one of my largest frustrations when watching my AI-controlled squads (attempt to) fight.

It'd be interesting to hear your thoughts on this behaviour, and whether it's something that can perhaps be improved via modding.

Cheers,

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

Re: [Mod] Aggressive AI 1.3

Post by 7ate9tin11s »

Scoob wrote: Tue, 1. Jan 19, 19:01 "Patrols, escorts, and other ship defenders will default to prioritize overlapping fields of fire and close support over chasing down enemies. This needs some major testing!"
I unfortunately had to remove that for 1.3 final as, due to how the scripts handle patrol distance, it causes massive lag (I went from 60fps to 1-2fps when I forced the AI to use shorter ranges...really bad):
7ate9tin11s wrote: Tue, 1. Jan 19, 02:07 Hmmm, forcing escort distance to be shorter causes massive lag and slowdowns due to how pursue distance in handled in the scripts. That is not going to get in 1.3, back to wide ranging escorts. :evil:
The beta build tried to enforce this, but did it via the defaults instead of forcing it and the defaults are just not used. It could probably work for players only without too terrible an issue, but I like to keep the playing field even between PC and NPC :doh:

It is on my list to continue to look at, but will require a full rewrite of the combat behavior so it does not cause reset loops all the time.
7ate9tin11s
Posts: 813
Joined: Fri, 11. Nov 05, 23:18
x4

Re: [Mod] Aggressive AI 1.3

Post by 7ate9tin11s »

Scoob wrote: Tue, 1. Jan 19, 20:21 I observe how ships given an attack order will often fly to where a target was at the time the order was given. This often leads to combat not being actually engaged for ages. As a current example in my game, I have a Destroyer patrolling and I identified a hostile and moved to attack it. However, it's always going to where the target was, as I mentioned, and this has been going on about forty minutes now! Additionally, which doesn't help, my ship will use its travel drive to approach the target, but, if the target exits travel drive so will my ship. So, say my ship is moving towards where the target was using Travel Drive and the target ship engages its travel drive, my ships continues to where said target was. However, once the target comes out of its travel drive - usually 100's of km away - my ship also exits travel drive and proceeds in the same (wrong) vector at normal speeds. Thus never catches the target. This is most apparent when a larger ship is chasing a smaller one.
The nice part about the vanilla system is that it is very low overhead resource-wise. Like the prior answer, this is doable, but doing it for everyone in the universe may have bad consequences. Perhaps a middle ground where the target location is re-evaluated every so often? I could probably work in some omniscience where they instead go to the destination of the target (if known)...I will think on it.
Scoob
Posts: 11180
Joined: Thu, 27. Feb 03, 22:28
x4

Re: [Mod] Aggressive AI 1.3

Post by Scoob »

Thanks for the replies @7are9tin11s :)

I just re-read the comments before mine and realise now you had mentioned its removal, sorry about that.

Regarding ships flying to where their target was, yeah, I'm sure it's very light calculation-wise, but it's also a bit rubbish. My Destroyer has been flying back on forth in one Sector for over an hour now, as its target flies around seemingly randomly lol. I think a check every n seconds solution might work well, perhaps factoring in distance along with frequency. So, at long range - i.e. when there are 100+km to travel - it can check for course correction less frequently. Once within 15-20km though, this could be increased. This would (hopefully) help in situations where potentially LOTS of ships go to attack one or more targets at long range. I.e. when an enemy emerges from a Gate and EVERYTHING in the sector wants to target it. If using travel drive, checking target destination makes sense.

Cheers,

Scoob.
balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [Mod] Aggressive AI 1.3

Post by balogt »

though this isn't the result of your mod, my xenon M and N ships don't shoot at all. even if I stand still they don't attack me. everything else goes into pew pew mode if I agro them and other xenon attack me, just not those 2 ships. any ideas?

Return to “X4: Foundations - Scripts and Modding”