Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Exploring how to command the AI  (Read 2329 times)

Delta_of_Isaire

  • Lieutenant
  • **
  • Posts: 65
    • View Profile
Exploring how to command the AI
« on: June 09, 2021, 03:25:42 AM »

There have been some comments recently about how AI-controlled ships in the player's fleet appear to ignore orders, and how said orders might mean something different to the AI than what the player thinks they mean.


This sounds like the sort of thing that can be tested, so I want to go ahead and do that. Let's explore how controllable the AI is, and what the 'best' combinations of personalities and orders are to achieve particular behavior.

Method:
- Define a simple scenario where we want to see a certain behavior from a particular ship.
- Find a combination of personality and orders that achieves this behavior, if possible.
- Using FleetTester mod v1.0 and Starsector v0.95a-RC15.


Scenario #1a: Kiting a slower enemy with long-range weapons
Spoiler
Enemy: a lone Enforcer with 3x Light Autocannon, 2x Light Mortar, no missiles, and ITU. Steady personality.

Candidate ship: Hammerhead with 1x Hypervelocity Driver, 1x Heavy Mauler, 4x PD Laser, no missiles, and ITU.

>>> The Hammerhead outranges and outspeeds the Enforcer, which means it should be able to kite it without risk. Which combination of personality and orders achieves this?

> Steady without orders works.
> Steady + Engage works.
> Steady + Eliminate makes the Hammerhead close to minimum range.
> Steady + Search & Destroy works.
> Steady + Full Assault makes the Hammerhead close to minimum range.

> Aggressive without orders makes the Hammerhead close to minimum range.
> Aggressive + Engage, Eliminate, Search & Destroy OR Full Assault makes the Hammerhead close to minimum range.
> Aggressive + Avoid makes the Hammerhead run away like a scared chicken.
> Aggressive + Avoid + Search & Destroy still makes the Hammerhead run like a chicken.

> Cautious without orders works.
> Cautious + Engage works.
> Cautious + Eliminate makes the Hammerhead close to minimum range. Notably it retreats to vent flux quite soon as it builds up hard flux, something Steady didn't do nearly so much or so quickly.
> Cautious + Search & Destroy works.
> Cautious + Full Assault makes the Hammerhead close to Minimum range. Notably it does so more slowly than Steady, and also retreats much earlier as it builds up hard flux.
[close]
>>> Conclusion: Both Steady and Cautious AI are capable of kiting a slower enemy, keeping a steady pressure of weaponsfire until the target is destroyed. Both personalities can still be made to close the distance with specific orders. Aggressive AI is just too aggressive for kiting with long-range weapons, if the ship also has some shorter-range weapons like PD Lasers.
Scenario #1b: Kiting a slower enemy with a mix of short- and long-range weapons
Spoiler
Enemy: a lone Enforcer with 3x Light Autocannon, 2x Light Mortar and no other weapons. Steady personality.

Candidate ship: Hammerhead with 1x Hypervelocity Driver, 1x Heavy Mauler, 3x PD Laser and 1x Light Autocannon in one of the front smalls.

>>> The Hammerhead outspeeds the Enforcer, and outranges it with HVD/Mauler but also has a LAC with same range as the Enforcer's weapons. Will the AI opt to only use HVD/Mauler, or also try to use the LAC?

> No sense testing Aggressive: we already know it would close to PD Laser range in any case.

> Steady without orders makes the Hammerhead approach to LAC range.
> Steady + Engage OR Search & Destroy makes the Hammerhead approach to LAC range.
> Steady + Full Assault OR Eliminate makes the Hammerhead approach to PD Laser range.
> Steady + Avoid makes the Hammerhead run like a chicken.

> Cautious without orders works: the Hammerhead stays at HVD/Mauler range.
> Cautious + Engage OR Search & Destroy works as well.
> Cautious + Eliminate or Full Assault makes the Hammerhead approach to PD Laser range.
[close]
>>> Conclusion: When mixing weapons of different ranges, Steady AI chooses engagement range based on its shortest-range (non-PD) weapons, while Cautious AI chooses engagement ranged based on its longest-range (non-PD) weapons.

Scenario #2: Capturing and controlling strategic points / Rallying at a waypoint
Spoiler
Enemy: 2x Kite (A) with a Light Dual Autocannon, ITU, and no other weapons. Steady personality.

Candidate ship: Eagle with 3x Railgun, 3x Pulse Laser and 5x PD Laser, ITU, and no missiles.

Mission: capture and control/defend a Comm Relay in the center of the battlefield.

>>> Two lightly armed Kites are no match for this Eagle, but they are a lot faster. Is there a way to make the Eagle stay near the strategic point and hold it, or will it inevitably be distracted by a Kite? For reference: manually piloting the Eagle this mission is a breeze. Park the Eagle on the Comm Relay, set all weapons to autofire and just turn the ship with Maneuvering Jets towards the Kites. Easy.

> Steady + Capture + Control makes the Eagle get distracted by one Kite long enough for the other Kite to capture the Comm Relay. Subsequently the Eagle does re-capture it. The same pattern then repeats. Sometimes the Eagle even prioritizes fighting the Kites over re-capturing the Comm Relay.
> Steady + Assault + Defend still makes the Eagle get distracted long enough to lose the Comm Relay.
> Steady + Rally Task Force order on the Comm Relay (instead of Capture/Assault) is no different.

Observation: Enemy Kites often prioritize flanking the Eagle to shoot at its relatively unprotected rear over capturing the Comm Relay, even when the Eagle has wandered far enough away that one of the Kites could easily capture it.

> Aggressive + Capture + Control also makes the Eagle prone to getting distracted and losing the Comm Relay.
> Aggressive + Assault + Defend is no different.
> Aggressive + Rally Task Force order on the Comm Relay is no different.

> Cautious + Capture + Control is no different.
> Cautious + Assault + Defend is no different.
> Cautious + Rally Task Force on the Comm Relay is no different.

> Timid personality makes the Eagle actively back away from the Kites even if that means completely ignoring a Control, Defend or Rally order.
[close]
>>> Conclusion: Ship AI appears to prioritize engaging enemies over staying at an assigned strategic point or rally point. And there is no way for the player to override that behavior. Which is kind of disappointing.



More scenario's to follow in the future. No promises on how far in the future that will be. Leave your suggestions for scenarios to explore!
« Last Edit: June 11, 2021, 04:35:34 AM by Delta_of_Isaire »
Logged

CozyCloudy

  • Ensign
  • *
  • Posts: 14
    • View Profile
Re: Exploring how to command the AI
« Reply #1 on: June 09, 2021, 03:29:14 AM »

Please test fleets not individual ships (It rarely has importance 1vs1 ship combat).
Logged

TaLaR

  • Admiral
  • *****
  • Posts: 2794
    • View Profile
Re: Exploring how to command the AI
« Reply #2 on: June 09, 2021, 05:17:56 AM »

Now add single HVD or Mauler to Enforcer and Cautious would probably fail. Or at least take inordinately long time.

In real encounters you usually don't have that much range+speed advantage. Plus, this relies on Enforcer being stupid - it's only chance in this scenario is to rush with Burn Drive. Or outright retreat from combat, if that was an option.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Exploring how to command the AI
« Reply #3 on: June 09, 2021, 08:54:52 AM »

Since this is likely to come up during this exploratory expedition: there's a bug/issue that I just recently fixed up in dev that would cause a ship given an order to go somewhere (for any type of order), but having more than one enemy in the way (with "in the way" being defined fairly loosely), would very likely get "stuck" trying to do that - they'd try to circle left, then right, then left, then right, etc, never making any progress around the enemy and likely drifting further away from their goal if they're also being pressured at the same time.
Logged

SonnaBanana

  • Admiral
  • *****
  • Posts: 868
    • View Profile
Re: Exploring how to command the AI
« Reply #4 on: June 09, 2021, 08:58:21 AM »

Since this is likely to come up during this exploratory expedition: there's a bug/issue that I just recently fixed up in dev that would cause a ship given an order to go somewhere (for any type of order), but having more than one enemy in the way (with "in the way" being defined fairly loosely), would very likely get "stuck" trying to do that - they'd try to circle left, then right, then left, then right, etc, never making any progress around the enemy and likely drifting further away from their goal if they're also being pressured at the same time.
Nice!
Logged
I'm not going to check but you should feel bad :( - Alex

Kahnmir

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Exploring how to command the AI
« Reply #5 on: June 09, 2021, 09:18:18 AM »

The avoid command is an interesting one, because while its a fantastic way to keep your frigates from wandering up to that luddic path promethean,
It also makes them avoid just about everything else even remotely in the vicinity, which makes it really hard to get your ships to do anything.

I think like the range that the AI avoids ships at currently is only appropriate if the avoided ship has a burn drive or a phase skimmer (yes I know LP Prometheans have burn drive), but could otherwise stand to be tightened up a bit. This would make Avoid a lot easier to use because your ships would be more likely to engage other things.

What would be really nice is if a little adjustable bubble/circle popped up around the avoided ship on the tactical screen that allowed you to adjust the avoid distance manually by shrinking or enlarging the bubble, but maybe that is asking for too much and would change the command from "avoid" to "avoid at a radius of 500 units" or whatever.

Actually, what IS the default radius that ships avoid at for the avoid command, does anyone know? Is that in the game files somewhere? can its be adjusted manually (in the game files)?
Would be interesting to play around with.

Man this topic could get extensive because there is a lot to say about every command.... I'm still trying to figure out exactly how the escort command works
« Last Edit: June 09, 2021, 09:26:31 AM by Kahnmir »
Logged

TotenKopf

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Exploring how to command the AI
« Reply #6 on: June 09, 2021, 09:33:36 AM »

Avoid used to annoy me a little bit, but then I realized that if a gave that command and ships still managed to end up engaged I would be absolutely furious. With practice I've found the commands to be satisfactory.

I read in here somewhere that the enemy ship AI appears more competent and capable than your own partially because the AI makes more use of the full assault command. As a beginner I was overly cautious, but I feel I've had better outcomes being more aggressive

Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Exploring how to command the AI
« Reply #7 on: June 09, 2021, 09:47:58 AM »

Actually, what IS the default radius that ships avoid at for the avoid command, does anyone know? Is that in the game files somewhere?
I'm only guessing, but I'd imagine it's whatever the ship-to-avoid's weapon range is.

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7224
  • Harpoon Affectionado
    • View Profile
Re: Exploring how to command the AI
« Reply #8 on: June 09, 2021, 09:51:00 AM »

Very interesting, thanks for laying out the scenario and findings clearly! I've never really tested the effects of "full assault" so would be very interested in seeing exactly how it changes things.

I'd love to also see the effect of personality on situations where the AI is outranged and not outspeeded. Say a Tempest vs a Hammerhead/Enforcer or even a Hammerhead with mid/short range weapons vs an Enforcer with long range weapons.
Logged

Delta_of_Isaire

  • Lieutenant
  • **
  • Posts: 65
    • View Profile
Re: Exploring how to command the AI
« Reply #9 on: June 10, 2021, 01:35:04 AM »

Please test fleets not individual ships (It rarely has importance 1vs1 ship combat).

You're not wrong, but it's important to establish the baseline before considering more complex scenarios! First establish that a particular behavior is possible under ideal circumstances, then gradually add complications and see if the behavior holds up or breaks down. Makes it easier to pinpoint the cause of behavior failure (and therefore to find solutions).

Actually, what IS the default radius that ships avoid at for the avoid command, does anyone know? Is that in the game files somewhere?
I'm only guessing, but I'd imagine it's whatever the ship-to-avoid's weapon range is.

In the simple Enforcer vs Hammerhead scenario, Avoid on the Enforcer makes the Hammerhead run away much further than the Enforcer's weapon range. Even further than the Hammerhead's own superior weapon range. In fact it seems to run away until the Enforcer is outside its detection range (i.e. the non-obscured area on the command overlay).

Whether the Hammerhead would still run away that far if it had orders targeting something near the Enforcer remains to be seen.
Edit: when ordered to capture a Comm Relay while there's an Avoid order on the Enforcer, the Hammerhead will attempt to fly around the Enforcer towards the Relay, but backs away from the Relay if the Enforcer approaches it. All the while, the distance it maintains towards the Enforcer is larger than its own (superior!) weapon range. This is the same for Cautious/Steady/Aggressive/Reckless personalities.
« Last Edit: June 10, 2021, 02:00:02 AM by Delta_of_Isaire »
Logged

DuckFlux

  • Ensign
  • *
  • Posts: 10
    • View Profile
Re: Exploring how to command the AI
« Reply #10 on: June 10, 2021, 05:22:34 AM »

I've been playing a bit against the Remnant in my more recent play, and using the avoid order on Radiants, escort orders on the player ship, and some eliminate orders here and there, and have observed a few aspects of their behavior.

Escorting ships don't seem to care about avoid orders, at least not to any degree that I've been able to observe. When an avoid targeted Radiant starts charging into engage the player ship, the friendly escorts will be quite happy to move closer to the avoid target rather than pull back behind the player ship. I'm not sure if they attempt to satisfy both orders where possible, i.e. they will pull back far enough to stay out of avoid range, and stay within escort range. It may be possible that Radiant closes the distance so quickly that the escorts are quickly left in a situation where there is no place within escort range of the escort target that isn't also fully within avoid range of the avoid target, in which case they have to completely ignore the avoid target in order to comply with their escort orders.

I'm not sure what behavior I would expect in the situation above. Perhaps the escorting ships can try to be no closer to the avoid target than the ship they are escorting, but otherwise not give it any special consideration. At least with this behavior they will try to show some respect of the avoid order while not also totally hiding behind the player.

Another thing I've noticed is that ships given an eliminate order on a ship will still try to fully comply with avoid orders. I had a case where I ordered a significant force of my ships to eliminate a Radiant that was moderately close to a second Radiant that had an avoid order on it. The friendly ships were fast enough to gather at a point where the eliminate targeted Radiant was between them and the avoid targeted Radiant, but they wouldn't cross that avoid boundary to get within weapon range of the eliminate target.

This behavior meant that in order to allow the ships to engage the eliminate target I need to remove the avoid order. The problem with this is that I still want the rest of my fleet to avoid the second Radiant, and in order to allow the eliminate order to be followed I've opened up the possibility that some careless unassigned ship will now wander into threat range of the second Radiant unnecessarily.

Again I'm not sure what the behavior should ideally be in this case. It does feel slightly inconsistent that ships given a direct order will seemingly prioritize a general non-direct order. I like that they take the avoid order into consideration, but I feel that once they've mostly navigated around the avoid ship to start vectoring in on the eliminate target, that they should be allowed to close the distance.

These cases serve to highlight the main difficulty in interpreting the players intent in a system like this. There are rules and priorities at play that the player needs to learn in order to use the system effectively, but there isn't an easy way to teach the player the underlying rules. The player needs to observe a lot of scenarios play out in order to develop a mental model of how the system actually works. During this learning period the player forms assumptions about what the eliminate, escort, and avoid orders do based on their current need. The players then become prone to frustration when they discover that these orders play by their own rules. Rules which make a lot of sense in a lot of situations, but need to be hacked a bit to work in the current situation.

« Last Edit: June 10, 2021, 03:09:58 PM by DuckFlux »
Logged

Delta_of_Isaire

  • Lieutenant
  • **
  • Posts: 65
    • View Profile
Re: Exploring how to command the AI
« Reply #11 on: June 11, 2021, 04:40:57 AM »

These cases serve to highlight the main difficulty in interpreting the players intent in a system like this. There are rules and priorities at play that the player needs to learn in order to use the system effectively, but there isn't an easy way to teach the player the underlying rules. The player needs to observe a lot of scenarios play out in order to develop a mental model of how the system actually works. During this learning period the player forms assumptions about what the eliminate, escort, and avoid orders do based on their current need. The players then become prone to frustration when they discover that these orders play by their own rules. Rules which make a lot of sense in a lot of situations, but need to be hacked a bit to work in the current situation.

Which is why exploring AI responses to orders and maybe eventually writing an overview/guide on the topic is useful!



Added to Opening Post: Scenarios 1b on mixing long-range and short-range weapons, and scenario 2 exploring how the AI goes about defending strategic points.

Turns out it really is impossible to make AI ships sit tight in a particular location. They always get distracted by enemies.
Logged

Drazan

  • Captain
  • ****
  • Posts: 287
    • View Profile
Re: Exploring how to command the AI
« Reply #12 on: June 11, 2021, 06:39:40 AM »

Thank you for this. There were sooo many discussions where people actively refused to belive that ships dont capture points, even when screenshots/videos where showed. Now this might convince more people.
Logged