Widget to display team eco

Widget to display team eco

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

Moderator: Moderators

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Widget to display team eco

Post by Jools » 12 Jul 2011, 01:12

I'm looking for a way to make a widget for spectators to easily follow which team is leading in terms of eco, metal, energy, maybe kills too.

I'm looking into advice about how to format the interface, maybe a bar graph of eco ratios, where leading team is 100% would be nice. But there are probably better ideas too. If you've played civilization, you know that it has a good graph over civilization influence, maybe something like that.

Also I'm not really certain of how to draw that graph in the spring UI in the game.

Update:
Newest version = 1.57

Official github page: https://github.com/springjools/Ecostats
Bug tracker: https://github.com/springjools/Ecostats/issues
Attachments
ecostats_1.57.zip
version 1.57
(263.67 KiB) Downloaded 29 times
Last edited by Jools on 09 Apr 2014, 15:53, edited 18 times in total.
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Widget to display team eco

Post by zwzsg » 12 Jul 2011, 03:12

Was about to say how it must a gadget since widget can't gather intel on enemy, but then you said spectators, so it should be okay.

To draw graph in Spring UI:
- Use the call-in DrawScreen or DrawScreenEffect
- Use Spring's Lua OpenGL


For some exemple, look into the DrawScreen functions of Kernel Panic, look into LuaRules/Gadgets/ sos.lua or shoot_n_run.lua

Or actually the DrawScreen function of any other gadget or widget that has a DrawScreen or DrawScreenEffect.
0 x

User avatar
Floris
Balanced Annihilation Developer
Posts: 599
Joined: 04 Jan 2011, 20:00

Re: Widget to display team eco

Post by Floris » 12 Jul 2011, 10:38

Very good idea, and i've got some exta inut for you:

It would be nice if you dont fill the bar up to 100% but instead add a prospected eco amount that fills up the remaining percentage to 100% The prostpected amount is just an addup of all unfinished eco buildings.

And... maybe also count the total firepower of the units availible for each team.
Then you truly get to know if a bigger eco probably means victory or fail.
0 x

User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget to display team eco

Post by manolo_ » 12 Jul 2011, 11:48

iceui already have something like this
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 12 Jul 2011, 12:02

Floris wrote:Very good idea, and i've got some exta inut for you:

It would be nice if you dont fill the bar up to 100% but instead add a prospected eco amount that fills up the remaining percentage to 100% The prostpected amount is just an addup of all unfinished eco buildings.

And... maybe also count the total firepower of the units availible for each team.
Then you truly get to know if a bigger eco probably means victory or fail.
That's a very good idea. With total firepower, you mean sum of all hitpoints of war units?

I though of something like this:

[link to imageshack removed]

Alternative 1 would have a history of eco ratios; alternative 2 would just show current ratios but be easier to make, and to also show more information.
Last edited by Jools on 24 Aug 2015, 19:11, edited 1 time in total.
0 x

User avatar
Floris
Balanced Annihilation Developer
Posts: 599
Joined: 04 Jan 2011, 20:00

Re: Widget to display team eco

Post by Floris » 12 Jul 2011, 15:50

That's a very good idea. With total firepower, you mean sum of all hitpoints of war units?
Well I don't know, that's why I said 'firepower' so someone with proper engine knowledge would know what unit properties to use.



both Alternatives look awsome to me, just make the metal bars more greyish
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 12 Jul 2011, 16:22

Ok, not sure I know how to do this, but I'll give it a try.
0 x

User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget to display team eco

Post by manolo_ » 13 Jul 2011, 07:41

and then the widegt should export a short txt file, so you could import into excel n stuff :D
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 17 Jul 2011, 03:00

Here's a first playable version of the widget.

Below is a screenshot with explanations to how it works. I don't like mouseover tooltips, so he who wants to know the functionality should read this message (or ask someone else).

[link to imageshack removed]

[link to imageshack removed]


Legend:

1. Buildpower bar. Leading team's is 100%, rest of teams show ratio to leader. This has two parts: the green shows buildpower other than air, and the yellow shows air buildpower (in this game no-one has air bp). Buildpower means sum of all team units of the ".buildSpeed" value in unitDefs.

2. Springkills. How many kills the team has according to spring engine.

3. Firepower bar. Works as the buildpower bar, except the blue is mobile firepower and the black is stationary. Firepower means sum of HP of all units that have weapons.

4. Team Kills, calculated as kills when one finished unit is destroyed by an enemy.

5. Team losses. Works the same way.

6. Team energy income per second ratio. The leading team bar is shown as 100%, and other team bars are shown as ratios of leader.

7. Springlosses. How many units the team has lost according to the spring engine.

8. Team energy income per second..

9. Team metal income per second ratio. Works similar to the energy bar (yum)

10. Player side, colour and whether he has commander alive (if commander is dead the emblem is shown as a miniature format, kinda like in super mario bro's 2 in Nintendo; if player is dead then nothing is shown).

11.Team metal income per second.

12 (missing, to the left of 10) The start position of the team, if present. (Average of individual players' start positions).

Btw, team means team as in normal language, Juventus is a football team and it consists of a number of players.
Attachments
gui_ecostats_0.82.zip
Version 0.82
(135.76 KiB) Downloaded 64 times
Last edited by Jools on 24 Aug 2015, 19:11, edited 4 times in total.
0 x

dansan
Server Owner & Developer
Posts: 1192
Joined: 29 May 2010, 23:40

Re: Widget to display team eco

Post by dansan » 17 Jul 2011, 11:33

Works for me!

Where does the ding.ogg go (and what is it for)?

My wish: make the widget movable by mouse-grab or Ctrl+F11.

Thank you :)
0 x

User avatar
Floris
Balanced Annihilation Developer
Posts: 599
Joined: 04 Jan 2011, 20:00

Re: Widget to display team eco

Post by Floris » 17 Jul 2011, 16:04

whats the diffrence between 'spring kills' and 'team kills'? does spring kills also counts friendly fire as kills? It just confuses and doesnt give much more valuable info. Just count total lost units in one number.

For the rest, totally awesome! You made it very very complete!

You could scale down the teamcolor squares to half it's size, this way you can fit 10 players in 2 rows just fine.

And yes being able to drag the widget position would be welcome.

Maybe 'rename' "Kill & Losses" to "Kills & Deaths" or "Wins & Losses". Just to be consist.
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 17 Jul 2011, 16:10

Yes, my wish is also to be able to move it, I'm working on it and trying to figure out how to do it. I know that fore some people it might appear in the middle of the screen.

Although not documented, I think spring counts a loss or death (OTA uses kills and losses) as whenever a unit that has an id ceases to exist. I think this could mean when you cancel a build queue, when you morph a commander, when you self-d a unit, when a bomber bombs your factory and kills 10 units in the queue etc. Not sure how kills are calculated.

Eventually I'd like to use just one number, but I put both there to have a means to compare with the end-game statistics. Also, if you reload the widget the counters get reset, but not the spring ones.
Last edited by Jools on 17 Jul 2011, 16:15, edited 1 time in total.
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 17 Jul 2011, 16:14

The ding.ogg is a sound file and it goes into spring/LuaUI/Sounds. Ogg is just like .mp3 except not under copyright.

It plays a "DING" sound when someone takes the lead. If you dont want it you can disable it by setting the "SoundOn" setting to false in the widget (line 46), or just ignore it (I updated the widget to check for the presence of the file).
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 17 Jul 2011, 16:26

Interesting fact: when you build a dragon's teeth, spring reports this as a unit loss. Are they alive dragons that die when you place them? :)
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7017
Joined: 16 Nov 2004, 13:08

Re: Widget to display team eco

Post by zwzsg » 17 Jul 2011, 16:56

They are alive units when you build them, that instadie into their wreckage when finished.
0 x

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

Re: Widget to display team eco

Post by aegis » 17 Jul 2011, 18:00

this is a cool idea + improvement on existing team stats. I think it looks a bit big+randomly textual, might be hard to read if you have many teams

any thoughts on designs for shorter display that still adequately shows the same information?
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 17 Jul 2011, 20:22

Maybe a way to minimise it and only show kills? You are free to suggest things...

Yes it doesn't work very well for over 5 - 8 teams, but how often do you have FFA:s with that many players? Okay maybe in BA you do...
0 x

User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget to display team eco

Post by manolo_ » 18 Jul 2011, 20:39

please post a fix-list so i could note these for the wDB
0 x

User avatar
Jools
XTA Developer
Posts: 2804
Joined: 23 Feb 2009, 16:29

Re: Widget to display team eco

Post by Jools » 19 Jul 2011, 00:22

You mean fixlists between version or what remains to be done?

There have been tons of small fixes and bugfixes, such as:
-- killcondition for a team was no e production, now checks No of units
-- Removed springskills and now labels for kills and losses, you know what they are anyway.
-- Added a kill and lossesbar to the bottom. Each kill = 1 pixel until someone exceeds widget width.
-- Added a check for when a team has placed their start marks and how many people have connected.
-- Added: when a player has units but has adandoned them, the side icon will show as dimmed.
-- When teams have died it removes the eco counters and shows kills and losses summary.
Last edited by Jools on 04 Apr 2012, 22:49, edited 1 time in total.
0 x

User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Widget to display team eco

Post by manolo_ » 19 Jul 2011, 19:11

or you ask vbs for an account for the wdb and u could update it yourslf ;)
0 x

Post Reply

Return to “Lua Scripts”

cron