Page 1 of 1

Target Priority AI

Posted: 29 Jul 2006, 20:33
by Argh
Hi guys. I'm going to keep this one short. I'd like to know if anybody has looked into the challenges of making units not all fire at the nearest target yet, simply put.

Why? Because it severely retards proper targeting in a variety of situations, is why. And it's incredibly unrealistic, to boot. This problem really hit me upside the head when I added aircraft to NanoBlobs (just a basic series of modifications to the Wolf unit, really), and made the Archer the AA unit of the game as a counter. It takes quite a few more Archers to knock down a Wolf stream than it should at present, because multiple Archers will all attack the first Wolf, instead of "realising" that the first Archer's missile will hit and kill the Wolf, and saving their shots for the next one. This has lead to a number of game-design black holes... such as whether or not to simply give Archers a ridiculously high ROF to compensate (thus causing lots of lag), upping their health to an unrealistic level so that they statistically take down 2 Wolves for every Archer killed (the game-design norm I was seeking) which would have other game-design complications, etc., etc.

Instead of using all of these kludges... I'd rather go to the source of the problem, which is that currently Spring's targetting AI is rather crude. Is there any way around this quandary through GroupAI, for example? My understanding is that Krogothe has made a lot've progress with targetting code, so my feeling is that this might be practical, but I thought I'd get some feedback and see if anybody was interested in this problem.

Posted: 29 Jul 2006, 20:42
by AF
The problem is that AI's cannot see projectiles untill they hit the target.

In 0.73b1 there's a weaponsfired event which helps remedy this but GroupAI have nothing. The problem si the AI cant tell if a shot capable of killing the unit has already been fired.

Also KAI code is udner lck and key, dont expect anything from it untill KAI 1.0 is released and krgothe fullfills his promise of making KAI opensource. However from what has been said it seems that KAI deals more with calculating ballistic trajectory paths, and micromanagement dealing with weapon ranges.

Your only option is for an internal thing or a scoring system that drops the score of enemy units that've been chosen already. The internal code would be a better choice however as a groupAI would eliminate the chance to apply other AI's to combat units.

Posted: 29 Jul 2006, 21:30
by Argh
Hmm. Any ideas on how this could be implemented? I'm thinking that every unit would need to scan the sphere/cone, see what targets were valid targets, then check against scoring value, and shoot at the thing with the lowest current score. Then wipe the scores every second or so, to allow for things dying...

I'd think we'd also need a FBI tag for this one, too... I doubt if it'd be desirable for land units, due to the large number of LOS checks that would be involved, but I may be wrong on that...

Posted: 29 Jul 2006, 21:43
by KDR_11k
Perimeter does that, SupCom promises it too, AFAIK. I think it could be done by giving each unit an "outstanding damage" counter that keeps track of how much damage is currently flying in its direction, if that's enough to kill the unit (perhaps with an adjustable margin of overkill in case shots miss) all attackers pick a new target.

Posted: 29 Jul 2006, 22:22
by Egarwaen
KDR_11k wrote:I think it could be done by giving each unit an "outstanding damage" counter that keeps track of how much damage is currently flying in its direction, if that's enough to kill the unit (perhaps with an adjustable margin of overkill in case shots miss) all attackers pick a new target.
I can see a few problems with this. Namely, a big unit firing a weapon at the target that can't possibly hit it. Dealing with the damage end of things is fairly simple, though, and your suggestion works great. The problem you run into is working out the likelihood of that potential damage actually being delivered, which means you have to think about weapon types, turn rates, unit speeds, flares...

Posted: 29 Jul 2006, 23:47
by Argh
I think that's where the "overkill rating" would come into play. I'd say that there should be some integer value set that would allow, say, a maximum of X shots from available weapons to be sent at a given target. The default would be very high, of course, for backwards compatibility and to allow older gameplay to be preserved (for those modders who prefer seeing their units waste ammo on something that's statisically "dead" ;))

Posted: 31 Jul 2006, 08:52
by yuritch
This overkill rating should probably be weapon type specific. Like guided missiles have it close to 1 (rarely misses) and cannons have it close to 0.5 (often misses), beamlasers have 1 (always hits). Of course, this should be mod side definable (for ex. if mod has a lot of flares - missiles miss often, their coefficient should be adjusted).

Posted: 31 Jul 2006, 13:16
by TheBlasphemer
How about distributing the bots?
Say if you have 50 A units defending, and 10 B units are attacking, set up the queue so that each B unit will have 5 A units attacking it, instead of 50 units attacking the first...

Posted: 31 Jul 2006, 23:38
by Hunter0000
TheBlasphemer wrote:How about distributing the bots?
Say if you have 50 A units defending, and 10 B units are attacking, set up the queue so that each B unit will have 5 A units attacking it, instead of 50 units attacking the first...
This is counterproductive as it would likey cause side A to loose if side B's units were large. Ignoring statisticly 'dead' units = good. Auto spreading of damage = bad.

Posted: 01 Aug 2006, 04:28
by sintri
Spreading your damage on different units is a bad idea here, and in pretty much every strategy game since bringing a unit down to low health does nothing to lower it's attack capibilities. But more so attacking the first unit you see is the logical thing to do. Say you have a column of the same units, the one in front of course will fire first as soon as the target reaches within range. As the unit gets closer, obiously the next unit down the column will fire until the unit dies, asuming that the unit dies before it reaches the second one, the second will still have it's weapon loaded for whatever comes next. Asuming as well that the weapon fired doesn't have a near instantneous firing velocity, most weapons in TA fire linearly rather than high trajectory. So even if the first shell kill the target, the consequent shells would still fly on and hit whatever's behind.

Posted: 01 Aug 2006, 04:45
by Egarwaen
sintri wrote:So even if the first shell kill the target, the consequent shells would still fly on and hit whatever's behind.
Except they usually wind up hitting the wreckage of target 1, leaving the others unscathed.

The current behaviour is for everything within range to fire as soon as they sight a target. This is especially bad when firing at light units and air units with slow-reloading high-damage weapons.

Posted: 01 Aug 2006, 05:01
by krogothe
It would be possible to do with group AIs. It wouldnt work 100% of the time but it would be reliable enough for general combat. I havent the time to code one but i can help if you have the will to spend the time to learn c++ (will be handy if you plan to work in spring for more than a few weeks). Should be a one day job, but i doubt it would appeal to players to have to use the groupa whenever they want to play NB

Posted: 01 Aug 2006, 10:25
by Dragon45
The solution to this is to have scouts and staggered defenses. Simple.

It's not really a problem IMHO.

Posted: 01 Aug 2006, 15:29
by krychle
make GroupAi, add all your units to it (it must think about weapons, not units), group ai will maintain all enemy units that are in range and add it to target list, sort it (like you want, ... by damage, weaknes, danger,....), attack it, for example 2x more damage that is needed, other units attack second one like first, if unit survive, do calculation again and fire 2x damage again
___
sory for my english....