AI Targeting (research)

Issue #349 resolved
Random created an issue

My understanding of AI targeting is technically still incomplete. It's possible there are some conditions or exceptions not yet discovered.

DEFINITIONS
Pri/Sec target: Explicit primary and secondary targets assigned to the Flight Group in the XWI file.
Autotarget: Any target that is allowed by the Flight Group's order, and can be attacked even if not a Pri/Sec target. For example, "Attack Enemies" autotargets fighters but not starships. "Attack Starships" autotargets starships but not fighters.
Attacker Limit: The maximum number of craft that can attack a single craft at any one time. This maximum is 3 for fighters/transports/tugs, 4 for containers/freighters/corvette, and 6 for starships. There are certain exceptions. When the limit is said to be honored, targets will not be chosen if the limit is full. If not honored, they will ignore the limit, but will contribute the total and be relevant for whoever is honoring the limit.
Locked in: The craft will not deviate and will focus on its target until it's dead or gone.

GENERAL
The AI checks for targets when their thinking time completes a cycle. They cannot target anything unless it's a Pri/Sec target, or allowed by the order's autotargeting rules.

The maximum range for considering any target (Pri/Sec, or autotarget) seems to be <3840 map units (<24.00 km)

Even if a Pri/Sec target arrives, locked in targets will not change.

LEADER
First scan for Primary targets. If none found, scan for Secondary targets. If still none found, scan for autotargets. The closest available target from its category (Pri, Sec, or auto) is always chosen. The leader honors Attacker Limit. If the limit is full, it selects the next available target.

The leader locks-in its target.

If the leader dies or withdraws (hull damaged), the next element in the flight group will assume leader control.

WINGMEN
If a wingman doesn't have a target assigned, they will perform immediate action this thinking cycle. Immediate action involves either protect leader or autotarget player. If no immediate action is taken, they will check the leader's target on the next thinking cycle.

To determine a target:

1) Leader protection is first priority. They will check if anything is currently targeting the leader, and attack the threat, no matter the range. It does not honor attacker limit. The player targeting the leader in the CMD does not count as a threat. Even if the player is actively shooting the leader, it does not count.

2) Player autotargeting is second priority. If the wingman is within 1.60 km of the player, it will autotarget the player. It does not honor the attacker limit.

3) Last priority is checking the leader target, which involves additional steps:

a) If the leader's target Flight Group has multiple elements, each successive wingman will take the next sequential element from whatever the leader has targeted. (ex: if the leader targets Alpha 2, the first wingman targets Alpha 3, second targets Alpha 4, etc). If there are no more elements left in line to choose, each remaining wingman takes the first element (ex: Alpha 1).

b) If carrying warheads and the leader's target is valid for warhead attack (fighter/transport for missile, freighter/starship for torpedo), it will lock-in at any range up to maximum range.

c) If not carrying warheads, lock-in range is 4.85 km.

4) If all the steps have been processed and no target is selected, they will fly in formation with the leader and restart from Step 1.

Special notes for wingmen:
If NOT carrying warheads or facing a warhead-valid target, then targets are NOT locked-in. Wingmen will reconsider targets when their attack run has ended. (That is, when "evasion" is triggered, where it flies away in a random direction and begins its "fly straight" mechanic). When its thinking time cycles, it checks if the "fly straight" timer is finished. If the timer is finished, the target is reset to null. Then it returns to step 1, to be processed on the next thinking cycle.

If they ARE carrying warheads or facing a warhead-valid target, then they will be locked in. Once their locked-in target is destroyed, they become more "individualistic" rather than behaving as a group. Instead of looking for targets by going through the steps above, they scan for Primary targets. If none found, scan for Secondary. If none, autotarget. Attack Limit is honored.

If the player was autotargeted by proximity and locked in, they will not deviate from the player, nor will they respond to leader threats even after their "fly straight" cycle finishes.

If they were locked in when the target dies, they will remain in "individualistic" mode, even if the new targets are not warhead-valid. Will not select targets by going through the steps.

Comments (2)

  1. Log in to comment