• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Relation between unit range and tile range ?

Status
Not open for further replies.

Ardenian

A

Ardenian

Between each terrain center in the world editor there is a distance of 128 units.
Now I wonder whether unit range is equal to that distance in ratio 1:1, 128 unit range is the distance like 128 units between two terrain tiles.

I cannot really believe it is 1:1, as a melee unit has 100 or 150 range and that would be around one whole tile.

Does someone know by chance an answer to this ?
 
Level 12
Joined
May 22, 2015
Messages
1,051
I think it is measured from the very center of the units. 100 range would actually look a little more like 100 - the unit's collision radius - the target's collision radius (assuming collision radius matches the model size properly). This would be more like 68 or 52 range from the edge of the attacker's collision to the edge of the target's collision. That's like 40% of a tile width distance between the units.
 

Ardenian

A

Ardenian

Oh yes, silly me, thank you!

Alright I tested it, however, the results are not satisfying. A footman attacked when another one reached 150 range distance, although the object data says he has 90 range.

When I changed their range to 256, he attacked at 316 range.
Both times a difference of 60, I make further tests with a ranged unit.

EDIT: @SAUS So in theory it is a 1:1 ratio ?
 
Level 12
Joined
May 22, 2015
Messages
1,051
I thought it was 1:1. Your test data is kinda denying it though lol.

What are you doing for your tests?
 

Ardenian

A

Ardenian

For my concern it doesn't matter what is the true range of a unit, but whether object data uses the tile units as well, for example, for an aura.

Why would my test deny your theory ? As you say there is more than only the attack range, but also collision sizes. Wouldn't my test rather prove your theory ? :)

I move a unit of mine towards a hostile unit, both without movement speed.

Now the final test with ranged units, in case a default melee unit always uses collision size or whatever. If the results will be the same, then uhm..

EDIT:

Same, object data says 400, but they already attack each other at 461

EDITEDIT:

Aura seems to behave even stranger, at 450 aura range the enemy unit got the buff at 475.
 
Last edited by a moderator:
Level 12
Joined
Mar 13, 2012
Messages
1,121
Yes, the unit for terrain measurement is the same as collision size, attack range, etc. It's all the same.

The range of a normal attack is
x:= collision size of attacker
y:= collision size of target
z:= attack range of attacker
x + y + z

When moving units are involved things get more complicated. Towards each other moving units will not stop right at attack range but run a bit closer. If one unit is running away the attack might be started below max range but be released above it, as between attack start and release the range motion buffer of a unit is added so it doesn't right away stop the attack if the target goes out of max range.

The range of a normal aura is
x:= aura range
y:= collision size of potential target
x + y

Mind that the functions GroupEnumUnitsInRangeXXX do not take collision size into account but just raw distance measure to the unit center.

While IsUnitInRangeXXX will take collision size of any involved unit into account.
 
Status
Not open for further replies.
Top