Jump to content

Discussion about: UnitAI (approaching and ranged unit's max range)


Recommended Posts

When a ranged unit attack a enemy, current UnitAI behavior is :

(1) Handle attack order

(2) CheckInRange. if enemy not in range, goto (3)

(3) MoveToTargetRange (min/max range)

(4) When move is completed, goto (2)

-------------------

My question is:

The MoveToTargetRange (especially max range!) is really useful to the ranged unit's approaching behavior?

I found some faults:

Situation 1:

There are two units (A and B, A is ranged unit whose max range is 20).

Let A attack B and B attack A.

You will find that A often approach B but overstep and then walk back.

It's only a bug and it could be fixed by adding some CheckInRange code in approaching timer.


Situation 2:

There are two units (A and B, A is ranged unit whose max range is 58).

A is on one the side of river, B is on the other side.

Now let A attack B and B flee A along the river bank.

You will find A will lost B. (A won't go across bridge...)

Is this behavior normally?

After some thought, I've come to some conclusion: (maybe wrong)

(1) The max range in approaching is only useful to the unit which has a very long range (eg: catapult) or target is a building.

(2) Archer should be look as melee and not use weapon range as motion's maxrange to approach.
It should use maxrange=0 approach and check its weapon range(maxrange) repeatly to decide attack.

Edited by chansey
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...