Tactical Combat AI Mod

A place for discussion of making game modifications.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

sven wrote:
harpy eagle wrote: It's like object center is returning the distance between the target and where the carrier was before it moved. Maybe it's related to the game merging movement of different ships?
When you call them in the AI script, tactical actions should execute immediately; so after a call to action.move_ships, the new object_center() value should reflect the new position of any moved ships. (Though there may be some quirks I'm not recalling in the case that the object that moved was destroyed while moving.) Are you certain that the relevant action.move_ships call is in fact being executed prior to the problematic object_center() calls? (I.e., the carriers aren't just entering some sort of queue to be moved?)
I am pretty certain, but I can do a before/after move print of all distances to all hostile ships for just to be sure.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

Hm, I don't think I've tested any missile weapons that have submunitions yet, like vindicators.
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

Attachments
Move and Attack.png
Move and Attack.png (101.38 KiB) Viewed 18951 times
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

zolobolo wrote:Move and Attack bug
Fixed in 88af880 57fba62
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

Protean cannot move after being destroyed error

Save: https://www.dropbox.com/s/makxgphc2wrne ... 0.rar?dl=0

The separation of movement and attack behaviour seems to be a very complex mechanic - running the test games on auto-pilot until I hit an error to identify as many as possible
Attachments
Protean cannot move.png
Protean cannot move.png (49.32 KiB) Viewed 18940 times
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

Huh, that's strange. AFAICT the only way that could happen is if a dead protean was returned by current_sides_ships(). Either way it's fixed in 48e510e.

EDIT: I guess the protean could have died from AoE damage from an exploding ship. So yeah, I shouldn't have assumed that ships would stay alive from the start of the turn until they moved.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

Based on some feedback from the steam forums, I'm considering increasing the maximum distance to targets that carriers will launch fighters at.

Previously, I had erred pretty strongly on making carriers fairly conservative with how they use their fightercraft, and it seemed to be confusing people since they thought the carriers weren't launching fighters at all.

While it means that in certain situations (e.g. lone carriers versus a small fleet of ships) the AI won't win as much, I think it will be more fun for players since carriers will launch their fighters a little more often.

Plus I think that in most cases, it shouldn't impact the AI's performance that much. And being less restrictive might be a little more robust in cases where the carrier can't move much.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

zolobolo wrote:BTW, if you would like to see the mod in an extreme case, here is a late game example:
https://www.dropbox.com/s/x3xtipt9mgnig ... 9.rar?dl=0

No errors, just a bit long processing time (around half-a a minute to process the battle automatically :)) - considering the scenario, it is understandable though. Most of the ships don't seem to be able to move as they are stacked so tight together that they are boxed in by their pals and some of the front ships start within firing range from the get-go.
Just got around to loading this save and had a look. That is one monster battle :P
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

harpy eagle wrote:Based on some feedback from the steam forums, I'm considering increasing the maximum distance to targets that carriers will launch fighters at.

Previously, I had erred pretty strongly on making carriers fairly conservative with how they use their fightercraft, and it seemed to be confusing people since they thought the carriers weren't launching fighters at all.

While it means that in certain situations (e.g. lone carriers versus a small fleet of ships) the AI won't win as much, I think it will be more fun for players since carriers will launch their fighters a little more often.

Plus I think that in most cases, it shouldn't impact the AI's performance that much. And being less restrictive might be a little more robust in cases where the carrier can't move much.
We have been discussing a lot of cases which in the end resulted in a very conservative fighter management behaviour.
This is mainly due to the star-base defense problematic: it does not make sense to release ANY fighters/bombers if not within direct striking distance to the base itself. - can understand if this behaviour would upset some though if carried over to fleet battles

When it comes to fleet battles, it should not hurt the overall result that much if they engage enemy vessels (if there are no torpedoes, missiles or bombers incoming) early as long as we are clear that the fighters in this case can only serve one of two purpose:
1. Used as a decoy for the enemy to shoot at
2. Minimize allied vessel damage taken when no PD or fighter craft on the other side to defend against them

So yeah, it could make sense to launch them early on in one of the above cases, but would try to keep reserves
The first instinct of the player would be to throw everything at the enemy and the kitchen sink, yes... but this is by far not the most efficient tactic. Reserving fighters allows them to fight another day and once the carrier is up-and-close, they can make numerous rounds on the enemy without being caught outside exposed.

Hmm so maybe like this:
IF no enemy starbases
AND no incoming torpedo, missile (also including Vindicator), bomber, fighter, assault fighter
THEN engage with a single squadron
ELSE reserve

This way a Fleet carrier can send out two waves of fighters before getting into mid range and still have one squadron left to fight with
But even with the above, the efficiency of big carriers will be reduced as they are throwing away their valuable strike craft on the enemy while being perfectly capable to soak up the damage in close range for a while - but this is again more of a shield balance issue
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

Did you plan on reducing movement speed of faster fleet elements to that of the slowest functional (not disabled) attack ship?

In the below case it is visible why this would increase the survivalist of small ships.
During fleet vs fleet combat this is not that apparent as the distance between various fleet elements does not build up that much, but in case of planetary invasions the attacked will clearly suffer large casualties as these rush ahead without PD cover and being the only (and rather) soft targets in range for the defenders to fire upon
Attachments
Too fast.png
Too fast.png (387.09 KiB) Viewed 18889 times
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

There doesn't seem to be any activity during the below marked enemy turn stages

Does the AI actually do something there or could it be removed to reduce wait time for the other side?
Attachments
No activity.png
No activity.png (453.64 KiB) Viewed 18889 times
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: Tactical Combat AI Mod

Post by zolobolo »

In the below example, the carrier only has a squadron of Interceptors left
Its target opportunities are:
1. Full health Light Cruiser with Battle-shields (the nearest one)
2. Heavy Cruiser with depleted shields
3. Damage Light Cruiser equipped with missiles and no shields
4. A third Light cruiser on full health and Battle Shields

Interceptors engage the nearest Light Cruiser with full health
Would it make sense for the Interceptors to chose either the second of third option instead?
All the three targets are within strike distance, but the second and third option would result in potentially destroyed ships while the first one is absorbed by shield - so distance might be too high of a priority here (normally this is important but not so much when all options are within strike distance)
Attachments
Inter.png
Inter.png (1.05 MiB) Viewed 18889 times
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

zolobolo wrote:There doesn't seem to be any activity during the below marked enemy turn stages

Does the AI actually do something there or could it be removed to reduce wait time for the other side?
Hmm, I have an idea for how this could be handled.
zolobolo wrote:Did you plan on reducing movement speed of faster fleet elements to that of the slowest functional (not disabled) attack ship?
I had some ideas, but no real plans. Nothing that would be simple to implement, either. Ship placement and positioning is probably an entire topic in itself.
zolobolo wrote:Interceptors engage the nearest Light Cruiser with full health
Would it make sense for the Interceptors to chose either the second of third option instead?
I'd have to see the save for the exact distances and numbers.
zolobolo wrote:so distance might be too high of a priority here (normally this is important but not so much when all options are within strike distance)
Within a certain distance, the distance should not have any more effect on priority. That's how it's intended, anyways.

For fighters attacking ships, there's two factors that reduce priority of a target based on range: potential lost attacks, and point defense exposure. The AI applies the lowest of the two.

Both factors have a minimum distance that is applied. I'll have to post here again with more details once I can.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Tactical Combat AI Mod

Post by harpy eagle »

I guess something I haven't really looked at in detail is: how far, exactly, do fightercraft actually move each turn? There's a launch_range() function but does that actually return the fightercraft move distance? And sometimes fightercraft appear to be able to move between turns, so what are the rules governing that? I'd need to do some code diving to answer those questions.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: Tactical Combat AI Mod

Post by siyoa »

harpy eagle wrote:Ship placement and positioning is probably an entire topic in itself.
I think this is making it to the top of the list now, a lot of issues come from current ship placement and positioning

the thing is, a single formation is not going to solve this, you need different formation depending on situation (are you/AI attacking a planet, a big fleet with carriers, do you plan to capture something to gain access to that technology you are missing, ...), you may want different ships at the front of the fleet for each different scenario
How did YOU get a key? All right, go in.
Post Reply