target selection strategies

Started by
17 comments, last by Kylotan 7 years, 6 months ago

do any particular strategies for target selection seem to be superior?

IE target:

weakest first

strongest first

closest first

greatest threat first (threat being perhaps a combo of atk, def, and short range)

unit with highest atk to def ratio first

etc

i guess it also depends on your goals for the combat - survival vs destruction of some particular unit(s).

lets start with survival as the goal, the unit wants to survive the engagement.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement
Survival is a nebulous goal. Often the best way to win is not to play, i.e. just flee the combat if you can and you've satisfied your survival condition.

It's very difficult to separate target selection from acting on the target. If you have a fireball, don't target the fire-resistant enemy. If you already committed to targeting the fire-resistant enemy, and none of your other abilities are available, well then you just fell into the Stupid Zone - the AI will do something stupid because the order of operations is wrong.

But if you pick the fireball first, you can still get the same stupid behavior if all enemies are behind cover except the fire-resistant one.



The most robust strategy is to consider all targets and all interactions, and pick the best combination. Utility systems are great for this. It helps to mix in "non-targeted" actions as well (running away, healing, etc.) so you can always have something semi-reasonable to do regardless of situation.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

The most robust strategy is to consider all targets and all interactions, and pick the best combination. Utility systems are great for this. It helps to mix in "non-targeted" actions as well (running away, healing, etc.) so you can always have something semi-reasonable to do regardless of situation.


This.

Quite a few games expose their AI techniques as far as the players go. Often it is a long chain of tactical abilities.

Generally you have something in the form of {target}:{condition}:{action}.

So you might have a target of Enemy, Ally, or Self. Enemy will scan all the enemies within a certain range of your base location. A monster may have their starting point and when nobody is in range they'll wander back to the starting point; friendly units should stay moderately close to the active player. Ally targets should test against all your people in your party probably regardless of distance. And self should always be available.

Condition is generally any one of an enormous list. If it can happen in the game it belongs as a condition. Values of health > x, health < x are common for healing abilities or for knowing when health is high. Abilities can be important, like Flying if you want spellcasters and archers to take out units others cannot, and you may want to target based on weapons of melee or ranged. Conditions like poisoned, injured, cursed, or whatever fits for your game are good. If your system has ranged effects then options of standing alone, cluster of 2, 3, 4, 5+ are good. Lowest health and highest health are good for choosing attacking. You might look at stamina or magic levels, you might look at class like boss or epic boss or minion or weak relative to the characters. You also mentioned ratios of strength or magic or armor or whatever else you can think of.

Some games allow for compound conditions, either conditions from a small set or from the same set. This lets you add things like "...and not fire resistant" so you don't throw fireballs at a creature that either is weak against fire, or immune to fire, or worse absorbs fire. Repeat for various other effects.

Finally you've got the actions, which may be whatever actions the character has available.

do any particular strategies for target selection seem to be superior? IE target: weakest first strongest first closest first greatest threat first (threat being perhaps a combo of atk, def, and short range) unit with highest atk to def ratio first

None is universally best. There really is no most-winning strategy. Sometimes you'll want one, sometimes you'll want another.

For minion monsters that are stupid and only have basic attacks it may be as simple as:

Enemy:Nearest Visible:Attack

For creatures, players, or NPCs who have multiple abilities each one should have triggering factors. Maybe something like:

Self:Health < 50%:Heal

Self:Slow:Haste

Self:Poison:Antitode

... Self:{all bad conditions character can fix}:{solution for condition} ...

Ally:Health < 50%:Heal

Ally:Slow:Haste

Ally:Poison:Antitode

... Ally:{all bad conditions character can fix}:{solution for condition} ...

Enemy:health < 10%:{big attack}

Enemy:clustered 3+:{range attack}

Enemy:undead:heal

... Enemy:{something that makes sense}:{all abilities available} ...

Enemy:nearest visible:attack

You will need ways to activate everything in the character's arsenal otherwise it doesn't make sense for the to have it. If the NPC is capable of throwing fireballs but no AI lines include throwing fireballs, they may as well not exist. Even better if there are multiple ways it may trigger.

Assuming every action has a cooldown time or takes magic or whatever to activate, the AI can simply start a the top and run down the list until it finds one to activate. If nothing is appropriate, return back to the key location (near the player, or back to a waypoint, or whatever).

For your list specifically, they can all work well. Sometimes it will make sense to target the weakest first, particularly if you've got a ranged effect that is likely to kill off a bunch of the weak things and you want them out of the way, or also good for finishing off a group. Sometimes it makes sense to go for the healthiest first, although eventually they'll be damaged enough that they're no longer the healthiest and someone else will be targeted; that's useful if you've got a heavy hitter and you're trying to grind everyone down. Closest first is generally a really good strategy and is generally my preferred default action; when you aren't sure what to do, hit the nearest enemy.

In games with a party of people, generally you'll want different characters with different abilities doing different things. The tank character should likely pick the highest level creature and hit them for everything, occasionally switching if they can combo with another like breaking a frozen enemy. A healer should generally be busy adding buffs and healing team members, then throwing out debuffs and harm to enemies. A mage should generally be harming ranges of enemies and clearing out weaker characters. A thief character should be seeking out opportunistic attacks and backstabs against vulnerable targets, or using whatever abilities they've been granted in your game. Repeat for all types of characters.

the AI can simply start a the top and run down the list until it finds one to activate.

my decision tree based AI currently works this way, but i find its very sensitive to the order in which checks are made and potential moves are selected / rejected.

it would seem that utility based would avoid this by always checking everything, and going with whatever is best. that would mean you would not have to prioritize the possible moves. OTOH, they get "prioritized" via the "weighting curves" used in each evaluation. IE a potential "move" that always returns a utility score of 1.0 would be a "high priority".

what about the fact that with a prioritized decision list, each condition implicitly includes "not any of the previous conditions"?

IE lets say we have 3 possible moves: moves A, B, and C.

with a decision tree:

if (condition A) do_move_A

else if (condition B) do_move_B

else do_move_C

with a utility system its would be something like:

score move A based on condition A.

score move B based on conditions (!A && B)

score move C based on conditions (!A && !B && C)

high score wins.

is this correct?

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

The utility example is not quite right. Options A B and C are all independent. You should not check the conditions of A to see if it is viable to run B.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

The utility example is not quite right. Options A B and C are all independent. You should not check the conditions of A to see if it is viable to run B.

no, i mean that the conditions for running option B be are that condition A is not met and condition B is met. if-then-else does that implicitly.

allow me to rephrase:

i'll use letters for conditions and numbers for options, so its clear a condition is not asocciated with any particular option.

if-then-else decision tree:

if (A) do option1

else if (B) do option2

else if (C) do option3

becomes in utility system:

if (A), do option1

if (!A && B) do option 2

if (!A && !B && C) do option 3

or more precisely (since utility systems use scoring functions, not just simple boolean evaluations):

score of option1 = f(A)

score of option2 = f(A,B)

score of option3 = f(A,B,C)

(where: A,B,C are the decision variables involved in scoring an option and are analogous to the conditions A,B,C used in a decision tree).

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

If you want to hard-code your decision process, don't use a system that's designed to make flexible decisions.

I don't understand what you gain by forcing a utility scoring system to basically turn into a decision tree.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Standard response...

http://www.gdcvault.com/play/1021848/Building-a-Better-Centaur-AI

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Depends alot on the various game mechanics of the combat (and related movement/healing skills/ammo/etc...). How complex it is will explode the available strategies/tactics and the decisions which migh be made to get best results.

Frequently there is an 'across turns' (temporal) element to strategy where a tactic needs to be a sequence of actions, as well as the AI considerations being a dynamic situation problem.

Some games Ive played have area effect attacks where it is advantageous to hit a cluster of targets to do the most damage

Many games have opponent hit/attack with their full attack power until the time they are dead so you want to concentrate fire to kill the already damaged targets as much as possible (depending on how good your defensive resistance is) Some game situations have a cluster od weaker minions with near the same attack as ONE very tough/high-HP 'boss' - where you want to kill the minions first before finally grinding down the 'boss'

Other games have cooldown timers for different attack styles which means your strategy shifts as the battle progresses matching your spectrum of attacks being available

and some have prep buildups where you have to stay undisturbed long enough to get the BIG zapper attack off with all it multipliers (other games have combination action attacks which likewise require a sequence to get off an attack of much higher impact)

"Getting it before it reaches you" ... (range preference and movement to maintain range if possible) - frequently 'range' oriented character classes are 'squishy' (low HP and measely armor) and die very fast in melee

and some 'attacks' which you can only do at close range

A target that can move between cover (or with partial defensive factors from cover its in) is less preferred than one out in the open that you can concentrate on destroying.

One game has enemy movement which takes them out of your firing range and then circles around and comes in at a different angle (you want to tehn fire at available targets in the mean time, but also turn to face the incoming enemy when its returning. There also then is an interval for healing (some actions of which take dedicated setup time to have their effect and get cancelled if interrupted)

Of course there is the movement element of your trying to get as much defensive cover while minimizing your targets (or a particular BEST target)

some games the maneuverbility is important so then theres a consideration of the terrain you choose to move through/get to... (which often has alot to do with INITIAL positioning before the 'battle starts (ambush selection or getting into a good defensive position)

Some game mechancs are different about how you are allowed retreat/disengagement (which can turn out to be the best strategy in a losing situation (or the result of poor randoms or unexpected enemy reinforcements)

Then there is the whole 'what allies do I have and for what can I count on them for) -- directly as pets/squadies or indirectly as nearby allies keeping some portion of the enemies busy or opportunities to concentrate fire etc...

---

A combat AI I once did kept a target tracking list for the AI (each object) so as to NOT have to rebuild its target data EVERY time (alot of processing) and required extra mechanisms to add/remove targets as they came into or left the battle situation.

The strategy employed a planner method to track options and set goals and a WHOLE lot of evaluation processing to digest situational data to use for the decision making.

Short of such a complex system, just improving AI somewhat over the usual : "stand/walk the rail, then activate on radius, then charge at player to melee or start range attack, and continue til dead" standard 'dumb' scripting of opponents will be better than what many games have had for so long.

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

This topic is closed to new replies.

Advertisement