Modifying enemy s ship in-sector combat maneuvering AI for atmosphere-in-space flight model

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

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

ZeR054
Posts: 2
Joined: Sun, 4. May 25, 09:56

Modifying enemy s ship in-sector combat maneuvering AI for atmosphere-in-space flight model

Post by ZeR054 »

Hi!

I am tinkering a bit with the flight model to achieve a more atmosphere-in-space feel for s class ships. No modern space sim that I'm aware of has chosen to go this direction, something like warthunder cold-war era plane maneuvering in space could be fun to try.

So far I'm increasing ship speeds a bit (potentially a lot, but that would require further balancing weapons and other stuff so idk), increasing significantly thruster strafe thrust to mimic atmospheric on-rails turning, significantly reducing acceleration, and modifying steeringcurve to have a turn rate that starts relatively low at low speeds, peaks at around 60% of top speed and then diminishes again, roughly like fighter E-M charts. Also making yaw very weak, increasing horizontal and vertical drag and such.

Flying around in asteroid fields and such like this already feels good, but the existing combat maneuvering AI doesn't adapt well to the changes. It seems that it tends to brake to 0m/s, turn to point at its target, and then re-accelerate/shoot at its target, rather than maneuvering smoothly and maintaining speed. This works badly with lower low-speed turn rates and slow acceleration. Tbh even just setting a speed floor at say 30% of its ship's thrust during combat could provide a much better starting point for the enemy AI to feel better to fight with the atmospheric flight model, but ideally I would seek to play around with the AI a bit more. There's also the question as to whether AI-vs-AI s ship battles would just degenerate towards endless turning without additional tweaks :teladi: .

I have only modified asset macros so far, and any advice/knowledge/intuition on feasibility and how to modify the enemy s ships in-sector low-level maneuvering AI, if anyone has experience with this aspect, would be greatly appreciated :)

Some of my questions:
  • How moddable is the maneuvering AI? What scripts to change? Any major limitations?
  • Is it the same as jobs scripts, or are jobs for more high-level behaviours?
  • Do s ships use a single combat maneuvering script for all enemies, or do they behave differently whether they are attacking another fighter or a larger ship? Because a combat behaviour that works with other fighters may cause fighters to just circle around slower capital ships without being able to target them effectively, having separate behaviours would help.
Cheers :boron:
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Modifying enemy s ship in-sector combat maneuvering AI for atmosphere-in-space flight model

Post by Realspace »

Take a look at my XRSGE mod, I added spheres of atmospheric influences around planets. There the physics change (super-imposed effect) adding friction, other than disruption of travel and boost (and damage), but you can use the influences to change only physics in some regions of space.
Other than that, I think a way would be creating virtual macros of the existing engines that have a different behavior, then these engines /thrusters should be applied through scripts somehow, don't know how) but keep in mind that the air friction effect is applied in units macros (so ship's models) more than engines.
You can look in the files of REM where I do the opposite, remove the friction. But also the new effects added by 7.50 (jerk) that can be manipulated to achieve your goal. But how to make these apply is beyond my knowledge. If you want to add physics in some regions of space only then the first thing and the influences in libraries is the way to go (and the controlschemes_default.xml).
ZeR054
Posts: 2
Joined: Sun, 4. May 25, 09:56

Re: Modifying enemy s ship in-sector combat maneuvering AI for atmosphere-in-space flight model

Post by ZeR054 »

Thanks for the info! I really like the concept of your XRSGE mods, didn't know they had different physics around planets, cool! The main effect I use for mimicking air friction is the thruster strafe rather than unit drag macros, I figure its just easier to balance the turning this way independently of how fast I make ships go. I have started looking a bit at various scripts such as fight.attack.object.fighter.xml, unfortunately I can't find any meaningful description of scripts behaviours, such as the various flightbehaviour and flightcontrolmodel commands. For example there seem to be available commands such as flightbehavior.dogfight1 and flightbehavior.dogfight2 that don't seem to be used in current fighter attack logic. I'll probably just try changing stuff and seeing if anything works to my liking.

Return to “X4: Foundations - Scripts and Modding”