Page 1 of 1

Team Stats

Posted: 23 Dec 2011, 02:32
by eyu100
This is a widget that I wrote for myself to give me more information as a spectator (since I almost always spectate rather than play). It displays the "assets" possessed by each allyteam - that is, the total metal in all the allyteam's storages, plus the metal cost of each of the allyteam's units. I found this to be a good measure of the power of each team - teams with significantly more assets were much more likely to win.

For FFA games, this widget shows the total metal possessed by each allyteam, along with its percentage of the total (so if ally 1 has 1000, ally 2 has 1000 and ally 3 has 2000, the widget would display 25, 25, and 50). For normal team games of just two allyteams, it does the same thing as for FFAs and also prints the natural logarithm of the ratio of the two teams' assets (ally 0 / ally 1); for example, if the two teams are even, the ratio is 1 and the logarithm is 0. (I display the logarithm so it's clear to me that a ratio of 0.5 is the same as a ratio of 2 except favoring the other team; with logarithms, one is just the opposite of the other (- ln 2 vs. + ln 2).

Press CTRL to display the information. The widget is very rough, since I wrote it for myself. In particular, there is no way to change where it displays the text, and it displays the value of ln (ally 0 / ally 1) even in FFA games, where it is not very useful.

How do you tell which team is which? (It only displays the allyteam numbers, which are not shown anywhere else ingame.) For team games (at least for those hosted by SPADS) the allyteam with team 0 in it is allyteam 0. For FFA games, it's unfortunately very hard to tell. Maybe somebody here could come up with a solution :lol:

EDIT: Actually, in 1v1v1 FFA games, I think the allyteam number is the same as the team number; it's in 2v2v2 games where it gets really confusing.

Re: Team Stats

Posted: 23 Dec 2011, 03:27
by knorke
How do you tell which team is which?
Not sure what you mean but I guess you are confused by the player/team/ally thing?

playerid: each player has its unique playerid.

teamid: multiple players can have the same teamid = they controll the same set of units. ("comsharing")

allyid: multiple teams can be on the same allyteam/allyid. That means their units will not shot each other.

What I found usefull is to think like:
players: have names
teams: have colors
allyteams: have startboxes
the allyteam with team 0 in it is allyteam 0.
you can not rely on that.

Re: Team Stats

Posted: 23 Dec 2011, 06:31
by eyu100
the allyteam with team 0 in it is allyteam 0.
you can not rely on that.
Yeah I know I can't rely on that, but it seems to work for SPADS games with just two teams. I understand what allyteams are (otherwise I couldn't have written this widget); my problem is that I can't view ally team *numbers* directly, ingame. I may know that allyteam 4 is winning, but who is that? I guess it's easy enough to tell who's winning, but if allyteam 5 is in fourth place and contains teams 7 and 15, I don't know how to figure out which teams (which set of colors) this corresponds to.

Re: Team Stats

Posted: 23 Dec 2011, 12:47
by Pako
You can get the startbox and then calculate if it is left/right/north/south and if there is no start box then name it as the first players name.

Why not use:

Code: Select all

Spring.GetTeamUnitStats 
 ( number teamID ) ->
   nil | number killed,
         number died,
         number capturedBy,
         number capturedFrom,
         number received,
         number sent

Spring.GetTeamResourceStats 0.82 and later 
 ( number teamID,  string "metal" | "energy" ) ->
   nil | number used,
         number produced,
         number excessed,
         number received,
         number sent

Spring.GetTeamStatsHistory