• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to get unit on-foot travel duration?

Status
Not open for further replies.
Level 13
Joined
Mar 29, 2012
Messages
530
I have a system that scans for neutral hostile groups over the map, the first group is 3500 distance away (reachable by a Blood Mage hero) and second group is just 2000 distance away but the Blood Mage needs to circle around the island coast to get there.
So I want the system to return the closest group (by on-foot travel duration).

What I really need here is how to get the duration a unit need to travel to a certain point.

My current idea is:
Create a dummy that has the maximum possible movement speed and order it to go to the target point and calculate how long it travel. (a delay before the result though, but I don't mind if there is no better idea)
What do you think?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Dummy with 522 or whatever the max is movement speed will take many seconds to reach the points. It would give the best results however.

A complex data driven trigger system could be made to deal with this problem. For example one could create your own node based pathing system. The node based pathing system is fed with data representing all the routes units can take to generally move around. When requesting the nearest creep camp it can then calculate an estimated distance from each creep camp to the desired point via the node network which factors in obstacles. Traversing even a fairly complex node network with 100s of nodes several times should be well within the capabilities of JASS.

Depending on where one will do the measurements, one could also create a system of cached results. For example if the Blood Mage is in region X then you know the nearest camp will be Camp1 as opposed to if it were in region Y where the nearest camp is Camp2. The results may not be perfect near boarders between regions and feeding in all the data would be time consuming but should be fairly trivial to implement such a system and performance should still be good enough for your needs.

Shame this is not StarCraft II where there is a native that does exactly what you need...
 
Level 13
Joined
Mar 29, 2012
Messages
530
Dummy with 522 or whatever the max is movement speed will take many seconds to reach the points. It would give the best results however.

A complex data driven trigger system could be made to deal with this problem. For example one could create your own node based pathing system. The node based pathing system is fed with data representing all the routes units can take to generally move around. When requesting the nearest creep camp it can then calculate an estimated distance from each creep camp to the desired point via the node network which factors in obstacles. Traversing even a fairly complex node network with 100s of nodes several times should be well within the capabilities of JASS.

Depending on where one will do the measurements, one could also create a system of cached results. For example if the Blood Mage is in region X then you know the nearest camp will be Camp1 as opposed to if it were in region Y where the nearest camp is Camp2. The results may not be perfect near boarders between regions and feeding in all the data would be time consuming but should be fairly trivial to implement such a system and performance should still be good enough for your needs.

Shame this is not StarCraft II where there is a native that does exactly what you need...
Wow this is beyond me. xD
I'll just use my idea. It still can help the system I'm making.

Pray for 1.40
Put it on the prayer line.
 
Level 13
Joined
Mar 29, 2012
Messages
530
There might be something salvageable from Ammorth's Pathing Algorithm System if you're willing to dig through it. It uses CSCache which is now deprecated, but I have a fake CSCache library that emulates it with a hashtable you can use. iNfraNe's LL library probably still works.
There are lot of things I need to learn it seems. I'll see if I must dig this one, otherwise thank you.
 
Status
Not open for further replies.
Top