Ally Selected Units

Ally Selected Units

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

Moderator: Moderators

User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Ally Selected Units

Post by very_bad_soldier »

This is a simple widget that shows which units are selected by your teammates when playing coop.
Maybe useful for others as well or maybe there is already something like this, i dont know.
I didnt had a chance to test this in real games so far, so it is BETA. Any bug reports or improvement ideas are very welcome.
One idea is to use different colors for different teammates. At the moment all selection circles are just green regardless of the player who selected that unit.

BTW: This only works for teammates who have this widget too! ;)

v2.0
----
-optimized sending
-debug mode disabled

v1.9
------
-ally units triangle changed to pentagon
-fixed: markers appearing behind terrain/in front of units
-marker now not ground only: airplanes fixed

Updated 1.85:
-Zlib compression added
-small improvements

UPDATE 1.1:
-improved network load
-different colors for each teammate

Download in SpringDownloader or at
http://www.springinfo.info/index.php?page_id=690#136
Attachments
coop.jpg
screenie
(84.69 KiB) Downloaded 87 times
Last edited by very_bad_soldier on 26 Aug 2009, 19:38, edited 5 times in total.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Coop: Selected Units

Post by Neddie »

Excellent work, no problems here, will test further.
User avatar
[PinK]triton
Posts: 8
Joined: 25 Sep 2008, 01:27

Re: Coop: Selected Units

Post by [PinK]triton »

Great job, but did u think about lock selected stuff? i mean that when u select units others teammates cant use it.
coop mod is really interesting. I think its a really nice futur way of playing RTS, but it needs improvements.

A nice thing would be that players should have different functions with rank maybe... best rank would be able to control anything, lower rank would only listen orders ^^...(rank wont be only way to make teams ofc)

I really can imagine a team of 8 players with 1 boss 2 captains and 6 soldats.

-Boss say strategy and dont needs to control units, he focus on how metal and energy is spend on units/eco (would be nice to have a widget to set ratio about buildpower priority between spam units/defences and make eco)

-2 captains makes build orders and cons and choose to which soldats they give units to attack with (we would need a very fast widget to share units to players).

-6 soldats micro units only, each captain have 3 soldats and share them units, because soldats have no units at start.
Also soldat would be usefull as fast as u can have 5 scouts in a game. :mrgreen:

It was example of wat i imagine about a new way to play rts and i think it can be done on balanced annihilation with few changes only.

I didnt think about this only to lead some nubs ;) ill be ok to be a soldat too and only focus on attack/raids.

Sorry for my english and how i typed this i hope ull understand what i thought.

P.S : i am not code programmer so it just an idea, i cant make this alone :wink:
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Coop: Selected Units

Post by manolo_ »

maybe better as gadget, so all would see it


edit: i didnt play coop, so let me make this small suggestion: different color for halo/border for teammate
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Coop: Selected Units

Post by Gota »

Suggestion.
When one Player gives a command to a unit or units,until they finish doing it no one else can give them further orders.
This way there will be no fighting over control.
The first one to grab units is the one to control them.
Take a group,tell them to move somewhere.
If they haven't finished yet nobody can give them any other orders.
If one of the units in the group reached it's destination but other members haven't it still shouldn't be unlocked to the use of other players.Not until all the members of the group that has been given this same command have finished their movement and reached the destination.
I guess there will need to be exceptions like patrol commands.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Coop: Selected Units

Post by Beherith »

Thx for with widget!

Trit:
I think this only works with players who know each other well.
In fact, im only willing to coop with very few players. Since if you trust the other player, things will go 100x smoother.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Coop: Selected Units

Post by CarRepairer »

very_bad_soldier wrote:Maybe useful for others as well or maybe there is already something like this, i dont know.
In CA of course (selectionsend, shows ally selections in yellow), but it shows selected units of all your allies. Beware of bandwidth, jK lectured me on that.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Coop: Selected Units

Post by very_bad_soldier »

[PinK]triton wrote:Great job, but did u think about lock selected stuff? i mean that when u select units others teammates cant use it.
coop mod is really interesting.
Thanks! I tried to implement but it seems to be impossible to deselect units by Lua or to make it impossible for the player to select certain units, at least I wasnt able to figure out.
Gota wrote: Suggestion.
When one Player gives a command to a unit or units,until they finish doing it no one else can give them further orders.
Dont like it, its too important in coop mode to actually be able to do stuff like that.
CarRepairer wrote: In CA of course (selectionsend, shows ally selections in yellow), but it shows selected units of all your allies. Beware of bandwidth, jK lectured me on that.
You dont see me surprised ;)
I found the Un-/Pack-functions your widget, very useful, thanks. I knew I had seen functions like that but could not find them by myself since they are well hidden in that VFS-namespace or how it is called in Lua.
I tried another approach as your widget. I only send the difference to the current selection instead of the whole selection. I think it could reduce network load a lot, but have not tested in real games yet. Are Lua message guaranteed to arrive at the receiver? Lost messages would mean strange bugs in this approach.
Does that "SelectionChanged"-Callin actually work? I could not find a reference to it in the wiki and in the sources. Or is it only planned for future compatibility?

P.S.
New version upped...
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Coop: Selected Units

Post by Niobium »

very_bad_soldier wrote:
[PinK]triton wrote:Great job, but did u think about lock selected stuff? i mean that when u select units others teammates cant use it.
coop mod is really interesting.
Thanks! I tried to implement but it seems to be impossible to deselect units by Lua or to make it impossible for the player to select certain units, at least I wasnt able to figure out.

...

Does that "SelectionChanged"-Callin actually work? I could not find a reference to it in the wiki and in the sources. Or is it only planned for future compatibility?
You can deselect units via Lua, by doing a GetSelection() type call, removing items from the result, then calling a SetSelection() type call with the new table.

I have never got the SelectionChanged callin to fire, and it's not in widgets.lua atm, don't know why it's still around.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Coop: Selected Units

Post by very_bad_soldier »

Niobium wrote: You can deselect units via Lua, by doing a GetSelection() type call, removing items from the result, then calling a SetSelection() type call with the new table.
Hm, can't find any references to those functions in the wiki and not in the spring sources. Calling them fails too. You actually used them already?
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Coop: Selected Units

Post by CarRepairer »

I didn't know SelectionChanged doesn't work. Oh well, my widget works regardless of that fact but thanks for letting me know.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Coop: Selected Units

Post by REVENGE »

The win continues.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Coop: Selected Units

Post by Evil4Zerggin »

You basically have to use CommandsChanged if you want a callin for when the selection changes.
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Coop: Selected Units

Post by Niobium »

very_bad_soldier wrote:
Niobium wrote: You can deselect units via Lua, by doing a GetSelection() type call, removing items from the result, then calling a SetSelection() type call with the new table.
Hm, can't find any references to those functions in the wiki and not in the spring sources. Calling them fails too. You actually used them already?
Thats why I added 'type' after them, because theres a few variants.

http://springrts.com/wiki/Lua_UnsyncedR ... cted_Units
http://springrts.com/wiki/Lua_UnsyncedC ... _Selection

Easiest is probably:
Spring.GetSelectedUnits() -> { [1] = unitID, ... }
Spring.SelectUnitArray( { [1] = unitID1 , [2] = unitID2 , ...} [,boolean append] ) -> nil

With table.remove/insert
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Coop: Selected Units

Post by very_bad_soldier »

Oh dear, silly me :?
Thanks for the hint...
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Re: Coop: Selected Units

Post by Neddie »

Even if you could make it impossible, you would need to override that behaviour at points. You don't want somebody going Ctrl-A, or even Ctrl-Z at times.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Coop: Selected Units

Post by CarRepairer »

neddiedrow wrote:Even if you could make it impossible, you would need to override that behaviour at points. You don't want somebody going Ctrl-A, or even Ctrl-Z at times.
Already taken care of, there's an upper limit to the amount of data I'm sending.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Coop: Selected Units

Post by smoth »

may I have permission to include this in gundam?
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Coop: Selected Units

Post by very_bad_soldier »

Of course you can. The same applies for the easy facing thingie.

But I am sure this one can still be improved a lot. I will try to implement some of the good ideas from this thread.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Coop: Selected Units

Post by CarRepairer »

very_bad_soldier wrote:I tried another approach as your widget. I only send the difference to the current selection instead of the whole selection. I think it could reduce network load a lot, but have not tested in real games yet. Are Lua message guaranteed to arrive at the receiver? Lost messages would mean strange bugs in this approach.
Interesting idea but yes this could end up with strange errors if something goes wrong. If you saw in my widget I took the easy way out by only transmitting up to 10 selected units. This means there is no need for a "difference report" like you use. The reason I am satisfied with the 10 unit limit is that beyond that many units I find that it's not really useful information to know that my ally is briefly selecting 200 units on the screen, or he did a ctrl-A. For the most part all I need to know is stuff like:

He is selecting that constructor over there so he's building something.

He has selected 10 of these tanks among his army so he's probably about to use this squad or all the tanks nearby, to either attack something or get into a new position.
Post Reply

Return to “Lua Scripts”