You mostly described it above, you need to remember parent pointer and list of children pointers (and of course data payload).
Solution for finding really closest repair facility
-
Emdek
- Regular

- Posts: 1329
- Joined: 24 Jan 2010, 13:14
- Location: Poland
Re: Solution for finding really closest repair facility
It is really easy and logical. 
You mostly described it above, you need to remember parent pointer and list of children pointers (and of course data payload).
You mostly described it above, you need to remember parent pointer and list of children pointers (and of course data payload).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
-
Shadow Wolf TJC
- Regular

- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: Solution for finding really closest repair facility
This sounds like a nice idea. +1Emdek wrote:Have you ever lost unit due to auto returning it for repair and making detour to remote one?
Or were you annoyed by fact that you need wait long for repaired unit to go back to its commander due to fact it chosen remote repair facility?
If yes, then this topic is for you, if no, then it is also for you.
OK, so the main issue is that current behavior is to go to closest repair center, but closest as straight line between two points, it doesn't take into account that selected one could be in fact worst one to choose due to obstacles like cliffs, rivers, walls, units (enemy or own) etc. It's fine for VTOLs, but not for tanks, especially not hover ones (but maybe that part is addressed somehow). The main (and probably the only one) advantage is for sure speed of finding it.
My proposal (posted on IRC few times already, but I'm not sure if really fresh / original) is to use smarter (but also a bit slower to calculate) way:Of course it will take a bit to calculate those values so unit could wait up to 500 ms for results and after that time start going to closest one calculated using current approach (there is big chance that this will be really closest one anyway) and then go to calculated one when results will arrive (from another thread) and decide if it should continue or change target if really closer one is different from fallback target.
- choose 10 closest ones using current algorithm (number could be different or depend on some other variables) or using some other heuristic (ideas?);
- calculate how far they are using path finding algorithm and how long it will take to get there using given propulsion, engine power and weight;
- select fastest path and go.
We should have clean and separated function with following signature (pseudo code):Where length and time would be references to values to return (unless Path would contain them as values of it's structure, along with list of key points).Code: Select all
Path findPath(Point from, Point to, Droid* droid, float &length, integer &time)
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100