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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...