AI target selection

More
20 years 1 month ago #18242 by Second Chance
Here's a few of questions to keep everyone busy.
  • Does anyone happen to know how the AI selects an individual target? What the criteria might be and if it changes for a given situation?
  • Will a turret attempt to track an object moving faster than the turret can traverse? Or does it simply rely on the target-lead system (which in this case should result in no shot being fired)?
  • Is there any way to directly assign a target or target criteria to a turret?
  • How about telling a particular turret not to shoot at a particular target? (I believe this is unlikely.)

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
20 years 1 month ago #11611 by MajorTom
Replied by MajorTom on topic AI target selection

Originally posted by Second Chance

Here's a few of questions to keep everyone busy.

Are you trying out some kind of new management technique on us here ;)
It's probably better you tell us what you are trying to achieve instead of posing lots of hypertheoretical questions to keep us busy :D

Does anyone happen to know how the AI selects an individual target? What the criteria might be and if it changes for a given situation?

primarily it is the "threat" rate of the ship itself and the sum of the "threat" rates of all it's subsims. There is also apparently an additional factor concerning distance to the target.
Additionally, there seems also to be a factor in relation to distance and the size (or perhaps mass) of the ship, but I'm not sure about that. Theoretically the threat rate could be coupled with LOD0/LOD1 in flux? (which would account for the size to distance to threat ratio)

Will a turret attempt to track an object moving faster than the turret can traverse?

I don't think so. I've seen situations where a fast moving ship can move past a turret unscathed. This may however be more related to the turrets bolt speed than to the "reacquire_time" or "max_heading_velocity" or "max_elevation_velocity". If thats really important for you, it's probably best you set up a test script and scenario for that.

Is there any way to directly assign a target or target criteria to a turret?

The only influence you have on a turret is to set turret_mode = 1 meaning it will fire at the currently selected (hostile) target in the contact list. Or you set turret_mode = 0 and it will fire at will (at hostile targets).

How about telling a particular turret not to shoot at a particular target? (I believe this is unlikely.)

As you have no direct interface to the turret AI (except "turret_mode") you can only lock down all weapons on a ship or none at all. You could however use a work around to achieve this. For example, temporarily remove the particular turret subsim (you will probably have to reset the AI when you put the turret subsim back on the ship). Another, probably better way, would be to use an ammo based turret subsim and temporarily set it's supply of ammo to 0 when the particular target is not supposed to be hit, then reload it after the situation is over.

Or, you could set the particular target industructable temporarily (but during that time it would be industructable for other weapons too). Alternativly you could temporarily remove the target from the target list or set it hidden. The effect would be almost the same as setting it industructable, though.

Iwar2 Multiplayer Fan Site

Please Log in or Create an account to join the conversation.

More
20 years 1 month ago #11614 by GrandpaTrout
Replied by GrandpaTrout on topic AI target selection
Flamineo wrote some turret control code in his damage mod engineering screen. I think it turned off the turrets power, but I don't actually remember.

Binishi did a huge amount of work on turrets in his Unleashed mod. I think he actually gave up on turrets directly, and instead mounted extra ships to the player freighter. Then he could give AI orders. So that might be a place to look.

-Gtrout

Please Log in or Create an account to join the conversation.

More
20 years 1 month ago #11625 by Second Chance
Replied by Second Chance on topic AI target selection
Well, mostly I was interested in what suggestions I would get. Not many, I guess [:(].

What I would like to have are big, slow-tracking, massively powerful guns meant to fire long ranges at capital ships, that don't waste their time trying to track a tiny speedy fighter when there's a slow moving carrier sitting right in front of them.

And small, weaker, rapid-firing guns meant to engage small, weaker, faster craft and that won't waste time shooting at larger ships they couldn't even hope to scratch.

So basically what I wanted was a way to tell each gun which ship it should be trying to shoot at. So I guess I'll have to go with something like invisible turret-fighters or mounted ships like Binishi did so I can directly give them orders.

Alternatives are welcomed.

MajorTom, were you saying that all AI try to target the most dangerous (or highest threat value) ship all the time? But wouldn't that mean that every weapon and ship would attack (more or less) one ship at a time (i.e. the most "dangerous" ship)? If there were a mass and range factor affecting things that would be ideal, but I've never seen anything about it. Does anyone have more info on how mass or range relates to targeting choice?

You mentioned a fast moving ship moving past a turret unscathed, but then also mentioned bolt speed as a potential factor. The most important question I have about that is: Did the turret actually fire and try to hit the ship? If yes, then that means the turret did attempt to track a target moving faster than it could traverse (bummer [:(]).

I'll avoid using turrets if I have to, but I think it would be more enjoyable if we could figure out how to make the turrets behave as required. (Unless it's impossible. Then it probably wouldn't be much fun.)

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
20 years 1 month ago #11627 by mdvalley
Replied by mdvalley on topic AI target selection
I came up with a system to choose targets. I call it the TAR system. Here’s how it works:

Every friendly ship runs each enemy ship through a formula. It then selects the enemy with the highest result and goes for it.

The formula:
TAR = Eap / ( Hp / Hit + T * Sap )

Eap is the attack power (in hp/second) of the enemy ship. Hp is the hull strength (or hit points) of the enemy ship. Hit is the percent of your ship’s firepower that will actually reach the enemy hull (from 0 to 1). Dodging, LDA shields, etc., will determine that number. T is the amount of time (in seconds) required to close to weapons range (0 if already in range). Sap is the attack power of the ship doing the calculating.

Eap, Hp, and even Hit and Sap can change as a battle progresses, so the friendly ships will have to keep recalculating to find out if another enemy is a better target. (You also have to look out for divide-by-zero errors).

The end result is that the AI will seek to eliminate enemy firepower as efficiently as possible. Fighters don’t suicide against cruisers (Hit makes sure of that), and ships tend to gang up on enemies (which is a good strategy anyways).

What do you think? It viable? Is flux up to it? Hit might be troublesome to calculate.

Please Log in or Create an account to join the conversation.

More
20 years 1 month ago #11632 by Second Chance
Replied by Second Chance on topic AI target selection
The concept is sound, and similar to what I'm trying to accomplish. Unfortunately, at the moment it only works with ship AI, not turret AI. But if turrets prove impossible to work with, I'll end up mounting ships as guns and ordering them in the same way you are. Just using a different formula. I wouldn't think it should cause any trouble in the SP game. Any decent computer today should have processing time to spare. Just don't run it too frequently.

All in all, I think it's a great idea. And I'm glad someone besides myself is even thinking about it. Good luck.

btw - If you make flux read the formula from an INI at startup it will be easier for end-users to customize. Just remember to explain what variables are available to them.

My top questions are just a small part of a massive C&C Pog I'm developing to control fleet actions, down to the smallest single ship. The beauty of it (hopefully) will be that the same C&C functions will be reused all the way down the chain of command. All the way down to a single ship's captain ordering which of his weapons fire at which targets, or whatever.

The top level of command will be with the command flagship (which will be dynamically chosen and rechosen as ships are lost during a battle). This flagship will determine an appropriate strategy and tell all the other ships what the overarching goals are and assign the appropriate ships to each task group. Each task group will then have it's own command ship to direct each ship in the group towards completion of the assigned task. It will then be up to the commander of each individual ship to determine how best to carry out the group leaders orders while still working with the group.

This is a simplistic explanation, but you get the idea. This is why it's important for me to be able to control what gun fires at what ship.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.