Tactical Combat AI Mod
Re: Tactical Combat AI Mod
Another scenario involving Carrier and fortresses:
Phase 1: Cruisers attack with missiles until ammo is depleted (this makes some sense keeping the range but of course we know that all the missiles will not be doing any actual damage and could have served as decoys or damage dealers in close range)
Phase 2: Cruisers move closer to fire heavy weapons staying out of range from fortresses
- Again range-wise makes sense but they are unable to deal real damage from this distance and against such heavy shields
- Military transport also moves into this range which is perfect as they can attack together later
- Fleet Carrier stays as Phase 1 stage which is not optimal as it will be too far behind once Phase 3 kicks in
- Standoff timer here seems longer then 20 turns. They are firing with heavy weapons for 22-23 Turns + the Phase 1 Turns
Phase 3: All Cruisers, the Transport and the Carrier move into close range to fire all weapons.
- Assault Shuttles are lost due to PD - here is where those rockets and fighters could have been handy but there were no rockets left and fighters too far away
- The Transport should ideally bail out of the fight once its main weapon is lost as it can be considered as a civilian transport at that point with valuable cargo: tank battalion inside of it which should be protected and saved for the invasion itself
- Fleet carrier never engages with its 3 Interceptor squadrons (fortresses keep interceptors reserved, but in close range this does not make sense for either side: If the Interceptors can deliver their payload in one turn, they cannot be intercepted, and from the defending side: if enemy is in striking distance, there will not be time to scramble fighters to intercept rockets and other small craft so they should conduct anti-vessel runs at this range)
To sum it up:
- Keeping max distance for rockets only makes sense for 2-3 turns (unless you are the tinkers ), else you will run out of munition once the real fighting begins and this turns a relative advantage of heaving missiles into a disadvantage when these are just empty weapon slots. Bombers, Assault Shuttles have great use for their coverage in close range to take away PD fire
- Reduction of standoff timer to 10-12 turns seems sensible and overall turn limit to 40 accordingly
- Military Transports should bail out as soon as their Assault Shuttles are destroyed (act like civilian transports even if PD is left on them)
- Carrier should close in during second phase like the military transport does to support other fleet elements during the final phase
- Interceptors should not be reserved in close range but conduct anti-ship runs both from attacker and defender perspective
Phase 1: Cruisers attack with missiles until ammo is depleted (this makes some sense keeping the range but of course we know that all the missiles will not be doing any actual damage and could have served as decoys or damage dealers in close range)
Phase 2: Cruisers move closer to fire heavy weapons staying out of range from fortresses
- Again range-wise makes sense but they are unable to deal real damage from this distance and against such heavy shields
- Military transport also moves into this range which is perfect as they can attack together later
- Fleet Carrier stays as Phase 1 stage which is not optimal as it will be too far behind once Phase 3 kicks in
- Standoff timer here seems longer then 20 turns. They are firing with heavy weapons for 22-23 Turns + the Phase 1 Turns
Phase 3: All Cruisers, the Transport and the Carrier move into close range to fire all weapons.
- Assault Shuttles are lost due to PD - here is where those rockets and fighters could have been handy but there were no rockets left and fighters too far away
- The Transport should ideally bail out of the fight once its main weapon is lost as it can be considered as a civilian transport at that point with valuable cargo: tank battalion inside of it which should be protected and saved for the invasion itself
- Fleet carrier never engages with its 3 Interceptor squadrons (fortresses keep interceptors reserved, but in close range this does not make sense for either side: If the Interceptors can deliver their payload in one turn, they cannot be intercepted, and from the defending side: if enemy is in striking distance, there will not be time to scramble fighters to intercept rockets and other small craft so they should conduct anti-vessel runs at this range)
To sum it up:
- Keeping max distance for rockets only makes sense for 2-3 turns (unless you are the tinkers ), else you will run out of munition once the real fighting begins and this turns a relative advantage of heaving missiles into a disadvantage when these are just empty weapon slots. Bombers, Assault Shuttles have great use for their coverage in close range to take away PD fire
- Reduction of standoff timer to 10-12 turns seems sensible and overall turn limit to 40 accordingly
- Military Transports should bail out as soon as their Assault Shuttles are destroyed (act like civilian transports even if PD is left on them)
- Carrier should close in during second phase like the military transport does to support other fleet elements during the final phase
- Interceptors should not be reserved in close range but conduct anti-ship runs both from attacker and defender perspective
- Attachments
-
- Phase 1.png (1.05 MiB) Viewed 12783 times
-
- Phase 2.png (1.12 MiB) Viewed 12783 times
-
- Phase 3.png (903.61 KiB) Viewed 12783 times
Re: Tactical Combat AI Mod
Notice that all these examples and mechanics (with the exception of Assault Shuttle behavior) is limited to invasions against star base defended planets as these are the most extreme scenarios that can break the mechanic due to sheer distances, various engagement ranges and huge amount of PD and small crafts involved
Couldn't really find any issues with fleet vs fleet combat. The AI is even better now at commanding my fleets in some occasions (when there are a lot of moving parts and reserves) then myself which is awesome
Couldn't really find any issues with fleet vs fleet combat. The AI is even better now at commanding my fleets in some occasions (when there are a lot of moving parts and reserves) then myself which is awesome
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
I haven't touched any of the retreat code, so it's still using the vanilla behaviour: Which is to only retreat if we have absolutely no weapons to fire this turn, including PD (Actually I did change it slightly, as a quick fix for a bug I noticed while testing: autofire can make ships retreat even if they are in perfectly good fighting condition, it now checks for undestroyed weapons. But I haven't given that code more than a glance over).zolobolo wrote:- Military Transports should bail out as soon as their Assault Shuttles are destroyed (act like civilian transports even if PD is left on them)
It's something I'd like to work on later down the road, along with perhaps getting the AI to retreat from hopeless battles.
That makes sense. If we're an interceptor, and the target is close enough, there's no point reserving for anything since we'll be back in our hangar next turn. There is still potential for PD exposure but with such a short distance to travel I guess it's fair just to ignore it.zolobolo wrote:- Interceptors should not be reserved in close range but conduct anti-ship runs both from attacker and defender perspective
So in this case it might be better to just not consider reserving at all. The only difference I'd like is to make it check 1/2 the strike range, to ensure the interceptors can make a full round trip this turn and not be exposed to next turn's PD. Otherwise it weighs priorities (although still with a x3 bonus for being within range). This will be after the next upload.
Fair enough, though I not sure at this point for how the AI should think about this. Perhaps the AI should only enter stand off and bombard mode if it has overwhelming missile/bomber firepower relative to PD?zolobolo wrote:- Carrier should close in during second phase like the military transport does to support other fleet elements during the final phase
Stand off and bombard works really well for softening up planetary defenses when there is not much PD or crafts present. Those planets usually pack a lot of firepower but are somewhat vulnerable so the AI can avoid a lot of losses by staying back. I guess it doesn't as well in this case though as you've observed.
Probably around 75% of the targeting code I have is one way or another related to handling crafts and intercepts nowzolobolo wrote:Notice that all these examples and mechanics (with the exception of Assault Shuttle behavior) is limited to invasions against star base defended planets as these are the most extreme scenarios that can break the mechanic due to sheer distances, various engagement ranges and huge amount of PD and small crafts involved
It makes sense though, as a mechanic it adds a lot of decision making to the combat aspect of the game. I'm trying hard to focus on AI decision making rules that improve general performance and not fixate too much on problematic cases however.
That's really encouraging to hearzolobolo wrote:Couldn't really find any issues with fleet vs fleet combat. The AI is even better now at commanding my fleets in some occasions (when there are a lot of moving parts and reserves) then myself which is awesome
I am going to upload a new version soon that has a couple new things, including assault shuttles that work against non-immobile ships, and threat assessment for ships carrying them.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
Haha, sorry missed your post at the bottom of the last page.
I guess it's a tricky situation. My thoughts when I was coding was that in a fleet combat situation you want to be sending out craft to attack ships since there may be friendly ships engaged with them that need the support.
Interceptors can also attack missiles/craft and so weigh the value of doing their damage to a ship vs preventing the damage of a missile/craft. Reserving for missiles/craft not yet launched was a natural part of that.
I guess in the same way reserving bombers for targets that are too far away might make sense. Again though the AI doesn't know if that far away target might be engaged with friendly ships in which case it might be better to attack it now?
Sorry, I'm not sure I understand.zolobolo wrote: Wouldnt the intereptors be intercepted though? Could they not penetrate the shields with disruptors?
Right now the AI doesn't think about the timing of getting missiles/crafts to all arrive at a target at the same time to overwhelm PD. As a result the bombers get sent out because they have nothing else to do.zolobolo wrote: The more important question here might be: why the bombers have been sent out if the calculation is aware that they will not be doing any damage? Shouldnt they be reserved untill the enemy gets close and other weapons can open fire as well?
I guess it's a tricky situation. My thoughts when I was coding was that in a fleet combat situation you want to be sending out craft to attack ships since there may be friendly ships engaged with them that need the support.
Interceptors can also attack missiles/craft and so weigh the value of doing their damage to a ship vs preventing the damage of a missile/craft. Reserving for missiles/craft not yet launched was a natural part of that.
I guess in the same way reserving bombers for targets that are too far away might make sense. Again though the AI doesn't know if that far away target might be engaged with friendly ships in which case it might be better to attack it now?
I added it myself. It's something I've seen used in a lot of other game's AI though. Probably because it's so simple.zolobolo wrote:I like this system a lot more: was it already in the game or did you spice up the code with this target priorisation mechanic yourself?
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
Update (3db6ecd):
- The AI now considers reserving direct-fire PD for missiles/craft not yet launched if the PD weapon's own ship is within strike range of the missile launcher/craft carrier. Should help the AI deal with energy torpedoes aka plasma launchers.
- AI now considers hit chance when deciding to attack missiles/craft with direct fire weapons.
- Reduced "stand off and bombard" turn limit to 20, cease fire turn limit to 40.
- Interceptors now consider the distance to hostile carriers/launchers when deciding to reserve, while also considering that the hostile missiles/bombers will likely be closer once launched.
- Interceptors now check if they can reach their target in time before it reaches it's target, when considering to intercept in-flight craft.
- Prevents interceptors and PD from all reserving for the same target. They are now aware if other weapons are reserving for the same launcher, and will consider other options.
- Fixed a vanilla bug that was preventing the AI from using assault shuttles/transporters against non-immobilized ships.
- Added threat assessment for ships equipped with boarding modules/shuttles/transporters. Might need tweaking, though it rightly considers military transports very high priority, given their ability to take ships out of combat in a single turn.
- Significant refactoring and code cleanup.
Re: Tactical Combat AI Mod
There is an error when calculating boarding hazard (see below) - this seems to block further parts of the AI script as the enemy fleet does not take any actions
Until Military Transport is on the field this pops up, once transports have been eliminated and the calculation is no more, the enemy fleet moves again as usual
Until Military Transport is on the field this pops up, once transports have been eliminated and the calculation is no more, the enemy fleet moves again as usual
- Attachments
-
- Boarding hazard error.png (772.37 KiB) Viewed 12772 times
Re: Tactical Combat AI Mod
Would it be possible to display interception warning for small crafts (including Assault Shuttle) before launch like they are shown on the top right corner for movement?
Since the new AI function introduces reservation of PD, this would help the player to evaluate if an attack is worth it especially for Assault Shuttles
Since the new AI function introduces reservation of PD, this would help the player to evaluate if an attack is worth it especially for Assault Shuttles
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
Sorry about that. Now fixed in d8dc996.zolobolo wrote:There is an error when calculating boarding hazard (see below) - this seems to block further parts of the AI script as the enemy fleet does not take any actions
Hang on, another issue...
OK, fixed properly now - 3fd1fba
Last edited by harpy eagle on Mon Apr 02, 2018 9:38 pm, edited 3 times in total.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
I'm not sure. One difference from the interception warning and what you're asking (if I understand correctly), is that the interception warning for movement is shown when there are crafts in-flight that are specifically tracking a ship.zolobolo wrote:Would it be possible to display interception warning for small crafts (including Assault Shuttle) before launch like they are shown on the top right corner for movement?
Since the new AI function introduces reservation of PD, this would help the player to evaluate if an attack is worth it especially for Assault Shuttles
Whereas in this case the PD could potentially autofire on anything, so it doesn't specifically reference any particular craft. So it would have to be a different kind of computation, one that checks if anything in general might autofire on your craft on it's way to the target.
Also just realized that since assault shuttle modules are handled very differently from craft hangars, the AI won't reserve PD for them. That's something that I will look at.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
Update (7755b5f):
- AI now considers reserving PD for enemy assault shuttles. Though I haven't seen PD be particularly effective at destroying them yet.
- Improved the boarder threat assesment. Now based on an estimation of crew damage that would be dealt by a capture attempt.
- The decision to capture vs raid is now based on the estimated crew damage vs the remaining crew of the target ship.
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
Update: When reserving interceptors, the AI will check for any targets that are within roundtrip range, and attack the best one it finds (5e29186).
Re: Tactical Combat AI Mod
You are a whizz
Assault Shuttles are working now: both Raiding and Boarding are working at least on basic level
PD is ok if a bit weak against Assault Shuttles, as else they couldn't be used - would be too easy to nullify their effects and the transports need to be able to get in at least one or two raiding or Boarding action before they are taken out of the equitation for them to be worth producing.
Now that boarding is a thing though I am exited to see how the AI fares on both tactical and strategic level
Assault Shuttles are working now: both Raiding and Boarding are working at least on basic level
PD is ok if a bit weak against Assault Shuttles, as else they couldn't be used - would be too easy to nullify their effects and the transports need to be able to get in at least one or two raiding or Boarding action before they are taken out of the equitation for them to be worth producing.
Now that boarding is a thing though I am exited to see how the AI fares on both tactical and strategic level
Re: Tactical Combat AI Mod
The bottom orange Transport captured the destroyer instead of the cruiser - does the prioritization of Assault Shuttles consider the shield of the target? The cruiser is more heavily shielded then the captured destroyer. Since their "attack" ignore shield, they should either avoid this metric or calculate it as a positive as the more heavily shielded the target is, the juicier it is for Assault Shuttles
The top orange transport did something even stranger: it has boarded another destroyer in the middle of the enemy group.
When looking at the configuration of the nearest destroyer and the one that has been targeted, it seems that the one in front is clearly a more outdated version (half the deflector screens and old reactor), but the Shuttles also received PD fire on their way in. I think that distance needs to be a slightly higher priority for Assault Shuttles then for other weapons to avoid as much PD fire as possible
The top orange transport did something even stranger: it has boarded another destroyer in the middle of the enemy group.
When looking at the configuration of the nearest destroyer and the one that has been targeted, it seems that the one in front is clearly a more outdated version (half the deflector screens and old reactor), but the Shuttles also received PD fire on their way in. I think that distance needs to be a slightly higher priority for Assault Shuttles then for other weapons to avoid as much PD fire as possible
- Attachments
-
- Assault priority.png (541.61 KiB) Viewed 12731 times
Re: Tactical Combat AI Mod
Another planetary invasion case
The attackers loose this one though the fleet outfit can crack it this is why:
1. In phase one carrier attacks the transport with its bombers - perfect
2. The top and bottom destroyers move in to attach the carrier - sub-optimal considering its shield and the bombers at hand
3. All other attacking ships move in and attack the bombers - perfect
4. Transport survives the attack with minimal damage and moves in to raid the carrier - perfect
5. Having decimated the bomber squadrons, most of the attacking ships move in to attack the planet - ok
6. After decimating the planetary defenses they turn back to all attack the carrier -ok
7. All attackers are now stuck between a carrier with gigantual shield regeneration and a planet with 25% of its gun and torpedo capacity and this are slowly grinned away
The end-result might be avoided in several ways I think:
1. Finish off the carrier before moving in to eliminate the planet defenses and stay out of range until then
2. Finish off planetary defenses before moving back to the carrier
3. Higher prio for taking down bombers then taking down carrier or planet defense so that the transport survives and can carry on raiding
The attackers loose this one though the fleet outfit can crack it this is why:
1. In phase one carrier attacks the transport with its bombers - perfect
2. The top and bottom destroyers move in to attach the carrier - sub-optimal considering its shield and the bombers at hand
3. All other attacking ships move in and attack the bombers - perfect
4. Transport survives the attack with minimal damage and moves in to raid the carrier - perfect
5. Having decimated the bomber squadrons, most of the attacking ships move in to attack the planet - ok
6. After decimating the planetary defenses they turn back to all attack the carrier -ok
7. All attackers are now stuck between a carrier with gigantual shield regeneration and a planet with 25% of its gun and torpedo capacity and this are slowly grinned away
The end-result might be avoided in several ways I think:
1. Finish off the carrier before moving in to eliminate the planet defenses and stay out of range until then
2. Finish off planetary defenses before moving back to the carrier
3. Higher prio for taking down bombers then taking down carrier or planet defense so that the transport survives and can carry on raiding
- Attachments
-
- Engagement Y.png (884.34 KiB) Viewed 12729 times
- harpy eagle
- Posts: 296
- Joined: Sat Mar 10, 2018 3:25 am
Re: Tactical Combat AI Mod
The metric used for deciding on boarding targets is the total damage output of all weapons divided by the amount of remaining crew. I'm guessing they went for the destroyers first because of their lower crew count. I did consider factoring in defensive capability (which is currently calculated as armour + shields + shield regen*2) but I wanted to start with as simple a metric as possible and defence seemed a secondary concern (e.g. a ship with lots of shields and barely any weapons should be a non-target).zolobolo wrote:The bottom orange Transport captured the destroyer instead of the cruiser - does the prioritization of Assault Shuttles consider the shield of the target? The cruiser is more heavily shielded then the captured destroyer. Since their "attack" ignore shield, they should either avoid this metric or calculate it as a positive as the more heavily shielded the target is, the juicier it is for Assault Shuttles
If capturing the destroyers was clearly a worse move than capturing the cruiser in this case, then maybe the metric could be changed to something like offence*defence/crew or offence*sqrt(defence)/crew.
I guess, although we also don't want the AI to ignore a good target just because it's farther away. Sooner or later I'm going to need to make the AI aware of the amount of PD possessed by the enemy fleet.zolobolo wrote: The top orange transport did something even stranger: it has boarded another destroyer in the middle of the enemy group.
When looking at the configuration of the nearest destroyer and the one that has been targeted, it seems that the one in front is clearly a more outdated version (half the deflector screens and old reactor), but the Shuttles also received PD fire on their way in. I think that distance needs to be a slightly higher priority for Assault Shuttles then for other weapons to avoid as much PD fire as possible
That's a very interesting failure. I'm not sure why the destroyers did not attack the bombers, nor why they stopped attacking the planet if the carrier had significant shield regen and barely any craft left.zolobolo wrote: Another planetary invasion case
The attackers loose this one though the fleet outfit can crack it this is why:
1. In phase one carrier attacks the transport with its bombers - perfect
2. The top and bottom destroyers move in to attach the carrier - sub-optimal considering its shield and the bombers at hand
3. All other attacking ships move in and attack the bombers - perfect
4. Transport survives the attack with minimal damage and moves in to raid the carrier - perfect
5. Having decimated the bomber squadrons, most of the attacking ships move in to attack the planet - ok
6. After decimating the planetary defenses they turn back to all attack the carrier -ok
7. All attackers are now stuck between a carrier with gigantual shield regeneration and a planet with 25% of its gun and torpedo capacity and this are slowly grinned away
The end-result might be avoided in several ways I think:
1. Finish off the carrier before moving in to eliminate the planet defenses and stay out of range until then
2. Finish off planetary defenses before moving back to the carrier
3. Higher prio for taking down bombers then taking down carrier or planet defense so that the transport survives and can carry on raiding
I'd have to see what the most significant factors in their decision making were to know for sure what to change. Are you ok with providing another save file?