[Widget] Green Squares

[Widget] Green Squares

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

Moderator: Moderators

User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

[Widget] Green Squares

Post by Pressure Line »

Well, I was playing around with teamplatters, when i thought "hmm, I've always thought it would be nice to have the green square that shows up when you select a unit be tied to the unit's rotation." (also, iirc TA did it like this too, so good for a bit of nostalgia value too.) so after a bit of experimenting (and some wtf's to do with fighters and bombers not returning a value for Spring.GetUnitHeading.) I give you gui_greensquares_v3.lua! It even works on non-square units so when you change the build facing it has the square appropriately aligned.

Image
Image
Image
Enjoy!

*edit* fixed a grammatical error and added the 3rd screenshot to first post
Attachments
gui_greensquares_v3.lua
(2.13 KiB) Downloaded 154 times
Last edited by Pressure Line on 28 May 2010, 10:06, edited 1 time in total.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Re: [Widget] Green Squares

Post by Das Bruce »

Does the units non square base rotate in a meaningful sense? I remember they didn't but I'm not sure if this has changed.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: [Widget] Green Squares

Post by Jazcash »

It would be cool to get a customizable version of this with user customizable colours, line thickness or fill.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: [Widget] Green Squares

Post by Pressure Line »

Image

2 wide x 3 long footprint, so yeah, it works fine in terms of the widget display, although having mobile units with non-square footprints doesn't work all that well because as far as the engine is concened, the footprint doesnt rotate.

I wouldnt even know where to start on that Jaz.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: [Widget] Green Squares

Post by hoijui »

i though widgets are by nature user configurable.

but maybe he means, configurable through spring settings. i remember having seen a Lua function that lets you query a config value.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: [Widget] Green Squares

Post by AF »

A version of this which draws the squares of all structures when placing buildings would be nice, as well as team colours.
User avatar
Jazcash
Posts: 5309
Joined: 08 Dec 2007, 17:39

Re: [Widget] Green Squares

Post by Jazcash »

AF wrote:A version of this which draws the squares of all structures when placing buildings would be nice, as well as team colours.
On a completely irrelevant note, I just it would be nice if there was a widget/engine change which outlined all queued buildings to be built with a faint white outline so you can see what units are in queue to be built without holding shift on a unit or w/e.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: [Widget] Green Squares

Post by zwzsg »

Instead of green, I like it better when the selection square color is used to convey another information. TA:K had the right idea with health colored selections IMO.

Code: Select all

local health,maxHealth=Spring.GetUnitHealth(unitID)
gl.Color(
    health>maxHealth/2 and 2-2*health/maxHealth or 1, -- red
    health>maxHealth/2 and 1 or 2*health/maxHealth, -- green
    0, -- blue
    alpha) -- alpha
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: [Widget] Green Squares

Post by Gota »

How many resources does this take with many units..
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: [Widget] Green Squares

Post by CarRepairer »

zwzsg wrote:Instead of green, I like it better when the selection square color is used to convey another information. TA:K had the right idea with health colored selections IMO.

Code: Select all

local health,maxHealth=Spring.GetUnitHealth(unitID)
gl.Color(
    health>maxHealth/2 and 2-2*health/maxHealth or 1, -- red
    health>maxHealth/2 and 1 or 2*health/maxHealth, -- green
    0, -- blue
    alpha) -- alpha
Redundant, there are already health bars.

In CA, green is for your selected units, yellow for allied selected units, cyan for hovered unit.
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: [Widget] Green Squares

Post by KaiserJ »

let me be the first to say : good fking job *thumbs up*

i like it
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: [Widget] Green Squares

Post by Pressure Line »

Gota wrote:How many resources does this take with many units..
Less than teamplatters I'd imagine. I doubt you would even notice any extra slowdown.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: [Widget] Green Squares

Post by zwzsg »

CarRepairer wrote:Redundant, there are already health bars.
Healthbars are ugly, they are tiny billboarded rectangle floating over every unit breaking my feeling of immersion, so I gladly play without them given the chance.

Besides, the redundance would be to have the info spread two indicators where one combined indicator would suffice.
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: [Widget] Green Squares

Post by luckywaldo7 »

The color changing based on health sounds cool, although I think it means you cannot see the hp of enemy units D:

Next we need a selection thingy that looks more like other modern rts, with some nice gradients and maybe some animation pretty eye-candy stuff.



Not to downplay the nostalgia factor on this one of course, but while people happen to be looking at it :wink:
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: [Widget] Green Squares

Post by Gota »

Pressure Line wrote:
Gota wrote:How many resources does this take with many units..
Less than teamplatters I'd imagine. I doubt you would even notice any extra slowdown.
Ima test it and if its ok I'll add it to next SA release.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: [Widget] Green Squares

Post by CarRepairer »

luckywaldo7 wrote:The color changing based on health sounds cool, although I think it means you cannot see the hp of enemy units D:
Not to mention ally units, and any of your own units that aren't selected at the moment.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: [Widget] Green Squares

Post by zwzsg »

The thing is, for allied, enemy, or others not selected units you only need a vague idea of their health, which can be conveyed just by the smoke lightness and cadence (or blood dripping, or missing limbs, or torn clothes, or cracked metal plate, ...). It's only for units that you are controlling now that you need an immediate feedback and more precise idea of how hurt they are. Because they are the only unit you can dance.

Anyway, this is probably my personal view of how games should be: A simulation where graphics represent gameplay, instead of pretty graphics unrelated to gameplay and that can be safely ignored, with a surimposition of bars, icons, numbers and charts to read what really matters.
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: [Widget] Green Squares

Post by JohannesH »

gotta target those low hp enemies that you know you can kill with 1 shot, seeing enemy hp matters

But I like the idea of graphical effects instead of bars... But then it just should be for all units, and for all players.
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: [Widget] Green Squares

Post by luckywaldo7 »

I agree with Johannes, on a competitive level you would be gimping yourself, but if it was part of the game design consistent for every player it would work fine.

Actually I would be rather interested to see a game that used this.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: [Widget] Green Squares

Post by Pxtl »

zwzsg wrote:Anyway, this is probably my personal view of how games should be: A simulation where graphics represent gameplay, instead of pretty graphics unrelated to gameplay and that can be safely ignored, with a surimposition of bars, icons, numbers and charts to read what really matters.
There are times you need more precision than ambiguous visual cues can provide. Health is one of those. Sometimes you just need HUD information.

In a large-scale RTS with very no individually important units, you might be able to get away with that... but in most of the BA-family games where you have the Comm and your first fac and whatnot, knowing exactly how much health you've got left isn't optional.
Post Reply

Return to “Lua Scripts”