Page 2 of 4

Re: Smart Area Reclaim

Posted: 16 Aug 2008, 20:41
by TradeMark
i think that reclaim queue goes wrong, it makes zigzag when i put unit reclaim an area, so it doesnt try to find the next nearest, it takes nearest from the middle spot

Re: Smart Area Reclaim

Posted: 16 Aug 2008, 20:58
by Regret
aegis wrote:todo:
  • optimized reclaim sorting (don't zigzag)

Re: Smart Area Reclaim

Posted: 16 Aug 2008, 22:21
by TradeMark
oh yeah im blind.

Re: Smart Area Reclaim

Posted: 17 Aug 2008, 22:53
by aegis
I have an idea for a quick algorithm to do so and will upload a new version soon

a fully definitive algorithm based on closeness of features would require many iterations unless I'm missing something

Re: Smart Area Reclaim

Posted: 17 Aug 2008, 23:01
by TradeMark
maybe make it call a function every time it has reclaimed one ? like the normal reclaim does now, i think.

so uh, i think this should be implemented in spring engine.

Re: Smart Area Reclaim

Posted: 17 Aug 2008, 23:06
by aegis
I'm pretty sure I can't check every time it finishes a reclaim in a widget without polling (which I want to avoid)

but what I'm doing now should work

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 00:32
by imbaczek
optimal algorithm is the online traveling salesman problem (as if the "standard" TSP wasn't hard enough), don't bother.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 01:41
by TradeMark
its better when it doesnt do it THAT optimal :)

easier to predict where they go when they just takes nearest every time they reclaim some other.

if i had just one reclaimer, then that optimal way would be best.

and i doubt it would work well anyways, since the features can be reclaimed before some optimal reclaimer reaches that feature ;) so it would just kind of fuck up anyways...

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 02:08
by aegis
almost done with a better algorithm

Image

edit: I noticed the bottom left quadrant was reversed. it's fixed now but I'm too lazy to upload a new screenshot


if you can't tell, it's reclaiming every tree in range of the tower around in a circle
since the distance doesn't matter for nano speed, this is the fastest possible way to reclaim a circle of trees :)

(new update: stationary units don't try to reclaim features outside of their range)

I need to update it for mobile cons, then I will release

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 03:57
by Gota
It wouldnt make more sense to make the movement circular?
Image

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 04:13
by aegis
not in the sense you are thinking

it's already using a circle

your idea would make it constantly turn the nano turret

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 08:39
by ginekolog
sounds like a usefull widget. Will try it once u finish it.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 13:28
by TradeMark
that is still zigzag? why cant you make it work as it works by default?

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 15:54
by ZellSF
Because the default is horribly inefficient compared to aegis' way of doing it. At least for nano turrets, don't know how well it applies to normal cons..

Read aegis' posts again carefully, I think you're misunderstanding something.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 16:47
by TradeMark
i just looked at the pic he posted, and its zigzag, unless im fucking blind.

hold on, NANOTURRETS? who the fuck reclaims trees with nanoturrets. we use rez bots >_>


NOBODY goes in middle of map and build nanotower there and then reclaim trees.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 16:48
by ZellSF
You *are* fucking blind. It's a nano turret, it stays static, and it reclaims everything in a circle. It just does so in an order in which it minimizes time spent rotating (which is time wasted).

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 20:04
by Gota
aegis wrote:not in the sense you are thinking

it's already using a circle

your idea would make it constantly turn the nano turret
Didnt look carefull enough on the pic.
I was thinking of cons or the commander.
When inside the designated reclaim zone a unit can reclaim in a circular movement centered at its location.
If the unit is outside the relcaim zone the circular movement can begin from the entry point into the zone by the unit.

(for nano turrets its of course not good since they dont waste time moving)
in any case its not THAT important as long as you nanpo and the enemy's work the same.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 20:54
by aegis
Image

I broke the quadrant code so it's extremely inefficient, but it looks cool anyway

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 21:06
by imbaczek
bonus points for simulated annealing solution.

Re: Smart Area Reclaim

Posted: 18 Aug 2008, 21:07
by TheFatController
Wouldn't sending that many commands (assuming its a loop with GiveOrderToUnit(unitID, CMD.RECLIAM, featureID, {"shift"}) be pretty spammy with netcode etc?


I'd build an optimized list eg:

reclaimList[unitID] = {sortedlistoffeatures}

Then set the unit to reclaim the first first feature and cycle through the rest of the list every time UnitIdle was called until it ran out of features or received a player command.

You could then go a step further and do stuff like remove features from the queue if an enemy fixed defense was spotted in range of them.