Target Selection in RTS Battles - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Target Selection in RTS Battles

Description:

User wants a good outcome but might have other priorities than directing the ... The solution for one army will involve the target for each of its units given ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 25
Provided by: webdocsCs
Category:

less

Transcript and Presenter's Notes

Title: Target Selection in RTS Battles


1
Target Selection in RTS Battles
  • Doug Demyen

2
Outline
  • Introduction
  • Problem Setup
  • Challenges
  • Helpful Observations
  • Static Strategies
  • Fixed Priority
  • Randomized
  • Dynamic Strategies
  • Genetic Algorithms
  • Stochastic Hillclimbing
  • Simulated Annealing
  • Further Work
  • Conclusion

3
Introduction
  • Outcomes of battles in RTS games can vary greatly
    simply by selection of targets
  • User wants a good outcome but might have other
    priorities than directing the battle
  • Similarly, we want enemy AI to seem as if someone
    is directing the battles

4
Problem Description
  • A battle is made up of a number of units
    belonging to one of at least two opposing armies
  • Each unit has three attributes we are concerned
    with
  • Hit points
  • Attack Strength
  • Cooldown Period

5
Problem Description (Contd)
  • At each moment in the battle, each active unit
    that has not attacked for its cooldown period
    deals it attack strength of damage to a target
    unit
  • That units hit points are reduced by this
    damage, and if they fall to or below zero, that
    unit is no longer active
  • The battle continues in this way until only one
    army has any remaining units

6
Solution Description
  • The solution for one army will involve the target
    for each of its units given any situation in the
    battle
  • This is huge these possibilities cannot be
    enumerated
  • Another problem is that in an RTS, we must
    determine targets quickly good targets mean
    nothing if we are dead!

7
Solution Description (Contd)
  • Also the battle is seldom static rarely will
    all units join the battle at the same time and
    battle until the end
  • Units can join a battle in progress, and can
    leave a battle before it is finished or they are
    eliminated
  • Unexpected events could change the battle like a
    bomb dropped on some units
  • Want an approach that can handle this

8
Helpful Observations
  • Generally we want persistent targets
  • Once we target a unit, we should target it until
    it is eliminated
  • This is because eliminating units stops them from
    inflicting damage on allied units thus a more
    fit solution
  • Obvious departure from this is when the targeted
    unit will be destroyed this turn anyway

9
Helpful Observations (Contd)
  • Also, events many time steps ahead in the battle
    seldom affect the desired solution
  • We still want to maximize the damage and
    casualties inflicted versus that sustained,
    regardless of the time
  • For example, doing poorly for some part of the
    battle does not help to win the overall battle

10
A More Compact Solution
  • This allows us to represent an effective solution
    as follows
  • For each allied unit, define an attack queue
    where it targets each unit in the queue until it
    is destroyed, then moves on to the next
  • The queues will be used for a certain time
    (several seconds of the battle), so they only
    need to hold a few enemy units

11
Attack Queue Example
2 3 1
4 1 3
2 4 1
4 2 3
Attack Queues
2
3
4
1
Indices
12
What is the Goal?
  • Should the goal be eliminating the opposing army?
  • If 97 allied units destroy 3 enemy units with 50
    of them firing wildly into the air, is that
    success?
  • If those 3 units destroy 20 units in the opposing
    army before they are destroyed, did they fail?

13
A Definition of Fitness
  • The goodness of a target designation or its
    fitness will be defined as
  • The amount of damage totally dealt to opposing
    units plus a bonus for each enemy eliminated
  • Minus the total amount of damage sustained by
    allied units and an additional penalty for
    allied units lost

14
Approaches
  • Some static strategy for example, aiming every
    unit at the active opposing unit that poses the
    greatest threat
  • A more dynamic approach evaluate different
    target designations and try to find the best one

15
Fixed Strategy
  • Define an opposing units threat to be the ratio
    of its damage per turn (attack strength /
    cooldown period) to hit points remaining
  • The opposing unit with the highest such ratio is
    targeted by all units
  • If the units already targeting this unit is
    sufficient to destroy it, aim subsequent units at
    the enemy with the next highest threat, and so on

16
Randomized Strategy
  • Using the threat definition in the last slide,
    the randomized version
  • Aims each allied unit randomly at one of the
    opposing units with the highest assessed threat
  • Cant determine when to pick a different unit to
    target because others will destroy it this turn
  • Used for comparison purposes

17
Evolutionary Algorithms
  • This type of solution lends itself to
    evolutionary algorithms
  • Have the advantage of working on a solution and
    returning the current best whenever its out of
    time
  • Since solutions are determined every few seconds,
    they can also be determined if the battle changes

18
Genetic Algorithm
  • For n allies and attack queues of length k,
    encode it as a genome of length n k
  • Random genes for mutations are indices of
    opposing units that are active and do not appear
    earlier in the same units attack queue
  • Crossovers have their normal meaning

19
Stochastic Hillclimbing
  • With a target list encoded similarly to a genetic
    algorithm genome
  • Generate a neighbour of it by changing a target
    (similar to mutating)
  • Test the fitness of this neighbour
  • If it is more fit, replace the current solution
    by this new one
  • Iterate until time has expired

20
Simulated Annealing
  • Similar to stochastic hillclimbing, except
    solutions that are not as fit can be accepted
  • Probability of this happening decreases with more
    iterations
  • Less likely to get stuck in a local maximum,
    but might produce a poor solution if not allowed
    to converge

21
Further Work
  • Extend to ORTS-like system of different kinds of
    attack (piercing, explosive, etc.) and different
    defenses
  • Incorporate attacks with non-constant damage
  • Take into account inter-unit distances, attack
    ranges, and unit movement

22
Conclusion
  • In light of the challenges of target selection in
    RTS battles, I feel evolutionary algorithms
    provide
  • Flexibility for a changing environment
  • Ability to produce a good solution quickly
  • Improved solutions given more time
  • More comparisons still to come . . .

23
References
  • Alan Watt and Mark Watt. AI Techniques for Game
    Programming. Premier Press, 2002.
  • Alexander Kovarsky. Heuristic search applied to
    abstract combat scenarios. Masters Thesis,
    University of Alberta, 2004.
  • M. Tim Jones. AI Application Programming. Charles
    River Media, 2003.

24
Questions?
  • Thank You
Write a Comment
User Comments (0)
About PowerShow.com