Smart Area Reclaim - Page 2

Smart Area Reclaim

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post 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
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Smart Area Reclaim

Post by Regret »

aegis wrote:todo:
  • optimized reclaim sorting (don't zigzag)
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post by TradeMark »

oh yeah im blind.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim

Post 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
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post 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.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim

Post 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
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Smart Area Reclaim

Post by imbaczek »

optimal algorithm is the online traveling salesman problem (as if the "standard" TSP wasn't hard enough), don't bother.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post 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...
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim

Post 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
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Smart Area Reclaim

Post by Gota »

It wouldnt make more sense to make the movement circular?
Image
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim

Post 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
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Re: Smart Area Reclaim

Post by ginekolog »

sounds like a usefull widget. Will try it once u finish it.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post by TradeMark »

that is still zigzag? why cant you make it work as it works by default?
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Re: Smart Area Reclaim

Post 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.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Smart Area Reclaim

Post 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.
Last edited by TradeMark on 18 Aug 2008, 16:49, edited 2 times in total.
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Re: Smart Area Reclaim

Post 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).
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Smart Area Reclaim

Post 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.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim

Post by aegis »

Image

I broke the quadrant code so it's extremely inefficient, but it looks cool anyway
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: Smart Area Reclaim

Post by imbaczek »

bonus points for simulated annealing solution.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: Smart Area Reclaim

Post 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.
Locked

Return to “Lua Scripts”