Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  


Starsector 0.97a is out! (02/02/24); New blog post: Codex Overhaul (05/11/24)

Author Topic: Please Teach the Ship AI how to Fight as a Team  (Read 317 times)


  • Ensign
  • *
  • Posts: 7
    • View Profile
Please Teach the Ship AI how to Fight as a Team
« on: December 13, 2020, 07:05:46 PM »

So, the AI clearly has been coded to manage flux and weapons and shields quite well, but I haven't seen much evidence that it has any concept of having allies, outside of the macro-level sector of the combat map it will fight in. Please upgrade the combat code to add some of this. Here are some of my ideas to do this, with a focus on my salty frustrating experiences.
It has no willingness to engage as a team, it has no sense of urgency with regard to respect to its teammate's lives, it has no understanding of how to act in order to let itself be saved. A large part of this suicide is wasting time crawling around with its shields up while friends die around it.

1. Please team the AI that an enemy is less of a threat when that enemy is already engaged with a ship of moderately similar power. The AI will keep its cruiser out of practical weapons range from an enemy cruiser division, and WATCH as a friendly capital ship fights all 3 at once. With those 3 enemy cruisers trading shots with a capital ship, they are much less of a threat, so this friendly cruiser should decide to engage much more aggressively against the targets fighting its friendly capital ship. Currently the friendly cruiser has a descent chance of deciding to spend this entire fight behind the friendly capital ship, accomplishing nothing other than blocking its maneuverability and shooting some salamander missiles.
>The AI is currently very good about using its defensive systems to mitigate friendly fire, but it is not very good about sitting at an offset when in front of a larger friendly ship. I don't think this behavior is rooted in trying to bodyblock to save the friendly ship, because the behavior only seems to activate when aggressively closing on a weakened enemy, or when I am trying to use my Burn Drive.

2. Tell the program how to tell if its nearly friendlies need saving immediately.
>When a ship (including the player ship) suffers a critical damage, run an assistance check. Do not run if the ship has caused this check within last 15 seconds. Damage includes a flameout that prevents maneuvering, enters an overload state, remains above 90% flux capacity for 3 seconds, or takes >3% health damage within 3 seconds.
>Calculate a threat condition for the ship doing the assistance check. The code probably has a way that it asseses this so just use that.
>If the ship is in minimal threat, resolve the check. This ship is taking damage but not in need of assistance.
>If the ship is in moderate threat, look for a nearby ship that is closest in hull size to the checker's biggest threat, and assign that helper ship to engage the threat. This will mean that a capital ship will call for a capital to help it fight capitals, and destroyers and frigates to get an enemy frigate away from its engines.
>If the ship is in critical danger of destruction, look for all nearby ships capable of engaging any of the threats. If a decent match can be found for at least 1 of the threats, then initiate a saving maneuver for both the checking ship and the helper ship:
     >The helper ship can become more aggressive, and will drop its shield to gain 0-flux boost unless it itself in imminent danger. The helper ship will try to close on the threat and interpose itself between the threat and the checking ship.
     >The checking ship will attempt to move away from the danger, favoring the direction needed to retreat. Send this desired pathing information to any helper ships so that helper ships can efficiently navigate to save the checking ship.