• Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

### #ActualAshaman73

Posted 05 June 2013 - 05:10 AM

For all target(s) in range of a tower

Check if target is already targeted by other tower(s) prevent overkill.

Check for target nearest to range limit for maximum damage.

Check for threat level of target which elevates potential for selection.

Check tower power compared to remaining life of target lower target potential for selection.

At top of this I often use a weighted rating system to always choose the hightest rated object. Taking your example I would choose the following normalized rating values:

1. Check if target is already targeted by other tower(s) prevent overkill.
=> v1 = 1.0 / (1.0 + #targetByOtherTowers)

2. Check for target nearest to range limit for maximum damage.
=> v2 = max(0.0, 1.0 - distance/maxDistance )

3. Check for threat level of target which elevates potential for selection.
=> v3 = normalized thread level (0...1)

4. Check tower power compared to remaining life of target lower target potential for selection.
=> v4 = ...

Then choose a normalized weight (sums up to 1.0), e.g. w = {0.25,0.25,0.25,0.25} and calculate the rating value by using the dot-product:

rating = dot(v,w) = v1*w1+...+v4*w4

Using different w-vectors will help you to switch the behavior in a fast and easy way.

### #1Ashaman73

Posted 05 June 2013 - 05:08 AM

For all target(s) in range of a tower

Check if target is already targeted by other tower(s) prevent overkill.

Check for target nearest to range limit for maximum damage.

Check for threat level of target which elevates potential for selection.

Check tower power compared to remaining life of target lower target potential for selection.

At top of this I often use a weighted rating system to always choose the hightest rated object. Take your example I would choose the following normalized rating values:

1. Check if target is already targeted by other tower(s) prevent overkill.
=> v1 = 1.0 / (1.0 + #targetByOtherTowers)

2. Check for target nearest to range limit for maximum damage.
=> v2 = max(0.0, 1.0 - distance/maxDistance )

3. Check for threat level of target which elevates potential for selection.
=> v3 = normalized thread level (0...1)

4. Check tower power compared to remaining life of target lower target potential for selection.
=> v4 = ...

Then choose a normalized weight (sums up to 1.0), e.g. w = {0.25,0.25,0.25,0.25} and calculate the rating value by using the dot-product:

rating = dot(v,w) = v1*w1+...+v4*w4

PARTNERS