Page 1 of 3

Widget to display team eco

Posted: 12 Jul 2011, 01:12
by Jools
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

Re: Widget to display team eco

Posted: 12 Jul 2011, 03:12
by zwzsg
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.

Re: Widget to display team eco

Posted: 12 Jul 2011, 10:38
by Floris
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.

Re: Widget to display team eco

Posted: 12 Jul 2011, 11:48
by manolo_
iceui already have something like this

Re: Widget to display team eco

Posted: 12 Jul 2011, 12:02
by Jools
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.

Re: Widget to display team eco

Posted: 12 Jul 2011, 15:50
by Floris
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

Re: Widget to display team eco

Posted: 12 Jul 2011, 16:22
by Jools
Ok, not sure I know how to do this, but I'll give it a try.

Re: Widget to display team eco

Posted: 13 Jul 2011, 07:41
by manolo_
and then the widegt should export a short txt file, so you could import into excel n stuff :D

Re: Widget to display team eco

Posted: 17 Jul 2011, 03:00
by Jools
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.

Re: Widget to display team eco

Posted: 17 Jul 2011, 11:33
by dansan
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 :)

Re: Widget to display team eco

Posted: 17 Jul 2011, 16:04
by Floris
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.

Re: Widget to display team eco

Posted: 17 Jul 2011, 16:10
by Jools
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.

Re: Widget to display team eco

Posted: 17 Jul 2011, 16:14
by Jools
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).

Re: Widget to display team eco

Posted: 17 Jul 2011, 16:26
by Jools
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? :)

Re: Widget to display team eco

Posted: 17 Jul 2011, 16:56
by zwzsg
They are alive units when you build them, that instadie into their wreckage when finished.

Re: Widget to display team eco

Posted: 17 Jul 2011, 18:00
by aegis
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?

Re: Widget to display team eco

Posted: 17 Jul 2011, 20:22
by Jools
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...

Re: Widget to display team eco

Posted: 18 Jul 2011, 20:39
by manolo_
please post a fix-list so i could note these for the wDB

Re: Widget to display team eco

Posted: 19 Jul 2011, 00:22
by Jools
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.

Re: Widget to display team eco

Posted: 19 Jul 2011, 19:11
by manolo_
or you ask vbs for an account for the wdb and u could update it yourslf ;)