Area Guard

Area Guard

Requests for features in the spring code.

Moderator: Moderators

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Area Guard

Post by Forboding Angel »

Area guard. Kinda works like pickup does. Meaning, you draw a circle, and individual guard orders are given for each unit in the circle. Useful for when you have a support unit that you want to follow your army, but you have to assign guard orders to multiple units so that if one of them dies, the support unit still follows your army around.

In BA terms: Morties guarding Sumos

In Evo terms: Arty following. ORB field medics (aoe healing for mobile units).

A lot of different unit uses.
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Area Guard

Post by dansan »

As a player I'd love to have that too. There are various scenarios I'd use it.

Couldn't it be impl. by a widget that stores lists of units2guard per unit that wants to guard?

It could have diff cycle patterns per target unit type:
  • guarding cons: if guarded con is not building/healing/moving -> cycle through list to find next active con to assist
  • guarding att/def units: either
    • guard 1 unit until it dies, cycle to next in list
    • create the convex hull of all guarded units and cycle (with attack order) around it (-> zoggops Aggressive Guard)
How to decide on cycle pattern if units are mixed?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Area Guard

Post by smoth »

Someday, you'll learn lua
Pako
Posts: 174
Joined: 12 Jul 2009, 18:57

Re: Area Guard

Post by Pako »

Patrol is kind of area guard, this thing described would be more like a group guard.

How to do it:
-doing an area guard command assigns all the units in that area to a group (only units not belonging to a group already)
-all commanded units are assigned to a other group
-if a unit belonging to a guarder group is idle it is given a guard command for a unit of other group
-adding and removing units to those groups should work easily and perfectly

If engine might have some silly group limit that should be fixed first?

I did a different kind of group guard widget for builders once but I don't remember anymore if it would be suitable for this.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

Why can't you just give a guard order to the selected unit to guard the units in selected area? Isn't that what was requested?
User avatar
Johannes
Posts: 1265
Joined: 17 Sep 2010, 15:49

Re: Area Guard

Post by Johannes »

More complicated things like what dansan and Pako are talking about, are kinda something different already.

Just allow to give a Guard order over an area that'd work like doing Attack orders on an area works - you get instantly queued to the units in there. But for friendlys instead of enemies.
For example, if you want to put something guarding a moving flea, you don't have to struggle to hit exactly where the flea is but dust draw over it. And if there's a 2nd flea in the area you'll proceed to guard it if the first one dies.

And I don't see why this should be something Lua'd, for any other reason than to save a bit of engine dev time. It's a pretty basic thing that I don't see any harm in including.

If you want something more complex (and less intuitive), then Lua it.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Area Guard

Post by Forboding Angel »

^^ this.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

I agree. But isn't area attack also done by lua?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Guard

Post by CarRepairer »

I've wanted areaguard for a long time. I'd make it but is this available yet? http://springrts.com/phpbb/viewtopic.ph ... 18#p401218
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Guard

Post by Google_Frog »

I'm sure I told you car, that command is implemented. I suspect it is a random Spring change but for a while now CMDTYPE.ICON_AREA has triggered the widget and gadget stuff even when no mouse dragging occurs.

http://springrts.com/mantis/view.php?id=2951
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

You don't need that, just use:

Code: Select all

local type, data  = Spring.TraceScreenRay(mx,my)
		if (type ~= 'unit') then
dragging related code
else
normal guard stuff
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Guard

Post by CarRepairer »

Jools wrote:You don't need that, just use:

Code: Select all

local type, data  = Spring.TraceScreenRay(mx,my)
		if (type ~= 'unit') then
dragging related code
else
normal guard stuff
You need more context for your code. If it's located in an area command, the code will never be reached if the command is not dragged (unless ICON_AREA works per Googlefrog's suggestion in which case the code is not needed). If you're imagining it in a click detection, well that's not how we create commands.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Area Guard

Post by Google_Frog »

Click detection is to be avoided.
User avatar
Johannes
Posts: 1265
Joined: 17 Sep 2010, 15:49

Re: Area Guard

Post by Johannes »

Jools wrote:I agree. But isn't area attack also done by lua?
It works after /luaui disable.

Though there's a distinction to be made here though - it's not about the separate "area attack" command that you can give to a unit (shift-alt-a -> draw, this isn't Lua either though), that makes them randomly bombard spots in that area. But about giving a normal attack order and then drawing over a group of enemy units (press a -> draw).
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

Google_Frog wrote:Click detection is to be avoided.
Yes, I was thinking to have it in mousepress and mousedrag. Why is that bad? You cannot issue a guard order without clicking.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

Bump!

Thought about this some more, what would you think the user wants when he issues a grouo guard order?

Imagine you have 5 construction kbots selected, you press group guard and drag a circle that covers a bunch of units. Would you want that:
* each selected unit gets a guard order to each unit in the bunch, or
* each unit in the bunch gets a guard order from at least 1 selected unit?

If the selected unit is a radar jammer for example, you would want it to guard every unit maybe. But if you have selected 10 farks you would maybe only want each fark to guard one unit. I don't know really. How expensive is it to give units a lot of orders in theirs queues?

Also: would there be a point of matching the guardian and the guardee by for example similarity in max speed?
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: Area Guard

Post by dansan »

Jools wrote:Imagine you have 5 construction kbots selected, you press group guard and drag a circle that covers a bunch of units. Would you want that:
* each selected unit gets a guard order to each unit in the bunch, or
* each unit in the bunch gets a guard order from at least 1 selected unit?
Intuitively I would (in BA) expect the same behavior as cons have with area reclaim/heal: do the action to all units in the circle.

The other version I know only from transporters (select multiple trans, load-drag-circle over a bunch of ground units) and from cons when you hold shift (imo that is some widget). Ah - there you have it: with a modifier-key the user can select the distribution strategy like with the cons-build-order: individual or "coordinated" (distributed).
Jools wrote:If the selected unit is a radar jammer for example, you would want it to guard every unit maybe. But if you have selected 10 farks you would maybe only want each fark to guard one unit.
hmm... that's interesting. If you want a unit to cover multiple other units, that'd be only possible if they cooperate. The other units path+speed would have to be modified so they stay close enough together. I do this normally manually with ctrl+move...

This version would make rockos+rez very powerful: 10rockos+3rez: each rez becomes "responsable" for 3-4 rockos only. When a rocko[-group] dies the rez-distribution is recalculated.
That would be nicer compared to the current version, where rez often clump around a unit healing it, while around all other units get shot down without being healed.
Jools wrote:Also: would there be a point of matching the guardian and the guardee by for example similarity in max speed?
Sounds nice, but imo not intuitive. Slowing faster units down is what I would expect.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: Area Guard

Post by PicassoCT »

smoth wrote:Someday, you'll learn lua
I found F.R.S ( Feature Request Script) to be a far more powerfool language, comonly accepted by all games on the intertubes ;)
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Area Guard

Post by Jools »

Here's a first and primitive version of it:

https://code.google.com/p/xta-springrts ... pguard.lua

It currently gives guard order to all targeted units and doesn't filter out the selected units either. I'm making it better, but I have two small issues:

* Since I don't want a new button, I added the functionality to the existing guard command. It must be overridden on drag action, with the consequence that the guard order stays as the selected one even after completion. I tried to get rid of it by deselecting all units and reselecting them, but it doesn't work. Does anyone know how to clear the active order? Is there something like Spring.SetActiveCommand("none") or similar?

* I use the gl.DrawGroundCircle to draw the selection circle, it doesnt produce a filled circle and it also draws the circle outside map borders. I don't know how to use the triangle_fan method instead, it seems overly complicated. But another question is whether to use a rectangle selection method in screen space anyway, like the default rectangle selection method when you are selecting units.

Anyway, this is enough if you just want to area select to guard a moving flea.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Area Guard

Post by CarRepairer »

I was wrong about what I said, it didn't need that engine update.

Here's my version of the gadget in ZK. Should have done this years ago. http://code.google.com/p/zero-k/source/detail?r=10437#
Post Reply

Return to “Feature Requests”