Smart Area Reclaim v1.1

Smart Area Reclaim v1.1

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

Moderator: Moderators

Post Reply
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Smart Area Reclaim v1.1

Post by aegis »

Smart Area Reclaim:

When you area reclaim, it normally just grabs everything, no matter if you actually need energy or metal.
With this widget, when you issue an area reclaim command centered on a specific type of feature (energy or metal) it will only reclaim features of the type in the center.

This means you don't need to reclaim rocks and corpses when you only need energy, and don't need to reclaim trees and vegetation when you only need metal.
You activate the widget by starting an area reclaim from a reclaimable feature (like a tree or rock), by clicking on the feature and dragging outward.
When activated, the widget will only reclaim metal or energy objects, depending on whether you centered the area reclaim circle on a metal or energy object.

v1.1
  • uses a basic nearest-neighbor traveling salesman approach for choosing the feature reclaim order for mobile units
  • uses mostly-optimum circular reclaim for stationary units like nanos, which minimizes turn waiting
  • can now choose the center feature more easily at any camera angle
  • properly finds future unit position when unit was given a move command in the queue before the area reclaim command
  • now treats features with both metal and energy as metal-only, so an area reclaim for metal won't pick up extra energy (build storage if you don't want to waste the energy)
  • better respects the original reclaim circle, instead of sometimes reclaiming features outside it
  • performance improvements
v1.0
  • Basic functionality.
todo:
  • spread super-long updates over multiple frames or widget updates so it won't lag no matter how many builders/features are involved
  • resource prioritizing (if you're E stalling but have max M, go for E, and vice versa...)
  • maybe a custom queue to look nicer and take into account new reclaimable features that appear while reclaiming (how would I draw a custom area command in the queue, instead of just an icon?)
  • maybe take into account the pathfinder, so won't consider a feature on the other side of an impassible wall to be "nearby"
Screenshots:
Image
Commander reclaiming several different areas with move commands between.

Image
Nano reclaiming a mostly-optimal circle.
Attachments
unit_smart_area_reclaim.lua
(6.57 KiB) Downloaded 156 times
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

Re: Smart Area Reclaim v1.1

Post by SeanHeron »

Sounds very nice - I was having frustrations in exactly this respect in a very recent game!
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Smart Area Reclaim v1.1

Post by Google_Frog »

Can you add reclaiming of a single unit type to this widget? This would replace my widget specific unit area reclaim using the better path optimisation you've created.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: Smart Area Reclaim v1.1

Post by Jazcash »

Does this work properly now? I've had it for ages but never used it because it never worked properly. I'll check it out next time I play ^_^
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Smart Area Reclaim v1.1

Post by aegis »

Jazcash wrote:Does this work properly now? I've had it for ages but never used it because it never worked properly. I'll check it out next time I play ^_^
I fixed several major issues and made the reclaim order work as well as the built-in area reclaim

version 1.0 was somewhat unusable for large reclaims because the reclaims were done in a totally random positional order (possibly by feature id)
Post Reply

Return to “Lua Scripts”