Page 1 of 4

Experience stats from 250+ replays

Posted: 23 May 2011, 13:29
by Beherith
I plotted the xp at the time of death of the unit. When the game ended, only units with >0 xp were counted.
data available here

Fun plots:
Y axis is experience at death, X is time of death in minutes.

Image

Image

Image

etc...:
11
110
1100
A.K.
Ambusher
Anaconda
Anemone
Annihilator
Archangel
Archer
Avenger
Banisher
Banshee
Bantha
Beamer
Behemoth
Big Bertha
Blade
Bladewing
Brawler
Bulldog
Buzzsaw
Can
Catalyst
Catapult
Chainsaw
Cobra
Commander
Commander
Commander
Commander
Commando
Conqueror
Copperhead
Crasher
Croc
Crusader
Cutlass
Decade
Defender
Detonator
Diplomat
Dominator
Doomsday Machine
Dragon's Claw
Dragon's Maw
Dragonfly
Enforcer
Eradicator
Executioner
Exploiter
Fatboy
Fido
Flakker
Flash
Flea
Freedom Fighter
Gaat Gun
Garpike
Gimp
Goliath
Gremlin
Guardian
HLLT
Halberd
Hammer
Harpoon
Hawk
Hurricane
Instigator
Intimidator
Janus
Jeffy
Jellyfish
Jethro
Juggernaut
Karganeth
Kilo
Krogoth
Krow
LLT
LLT
Lamprey
Lancet
Leveler
Leviathan
Liche
Luger
Lurker
Maelstrom
Manticore
Marauder
Maverick
Mega
Mercury
Merl
Messenger
Micro
Millennium
Moho Exploiter
Moray
Morty
Nixer
Pack0
Panther
Peewee
Pelican
Penetrator
Phalanx
Phoenix
Pillager
Pincer
Piranha
Pit Bull
Poison Arrow
Pulverizer
Punisher
Pyro
Raider
Ranger
Rapier
Razorback
Reaper
Recluse
Retaliator
Rocko
SAM
Sabre
Samson
Screamer
Scrubber
Searcher
Sentinel
Sentry
Serpent
Shadow
Shark
Sharpshooter
Shellshocker
Shiva
Shredder
Silencer
Skeeter
Skimmer
Slasher
Slinger
Snake
Snapper
Spider
Stiletto
Stinger
Stingray
Storm
Stumpy
Sumo
Supporter
Swatter
Termite
Thud
Thunder
Thunderbolt
Titan
Toaster
Tornado
Tremor
Triton
Tsunami
Typhoon
Urchin
Vamp
Vanguard
Viper
Voodoo
Vulcan
Warlord
Warrior
Weasel
Wolverine
Wombat
Zeus
Zipper

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 15:52
by 1v0ry_k1ng
wow, either the warrior sucks or people suck at the warrior

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 15:53
by Beherith
Yeah, warrior does suck imo.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 16:09
by Regret
Can seems quite OP. Also Pyro seems to get shitloads of exp. :regret:

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 16:16
by Beherith
Dontknowiftrolling, but the average experience gained is on the chart title.
Only thing is that pyro loses efficiency, while can sustains it.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 17:12
by knorke
some graphs have those vertical lines where appearently lots of units die at the same time ie:
http://beherith.eat-peet.net/stuff/unitexp/Avenger.png
http://beherith.eat-peet.net/stuff/unitexp/Reaper.png
http://beherith.eat-peet.net/stuff/unitexp/Spider.png

I guess it is because 250 replays is not that much and so one big assault with one unit type has quite a big impact on the graph. But it also shows a bit how units are used.
ie fighters patroll relatively peacefull doing nothing and then suddendly die.


Also would be good to have a color gradient like this:
Image
Things might look a bit different when dots plotted on top of each other are not lost but make that spot go brighter.

data available here
the odd 0.42341.. numbers are probally XP, what are the others?

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 17:23
by Gota
The warrior is a redundant unit.a noob trap and nothing more.
It does not need to be buffed or nerfed it just has absolutely no place in tier 1 fighting...and since T2 is packed with tons of units already it has no place there either.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 17:27
by Beherith
unitname teamID experience frame_died

special character is the "Game ended!" line after which the widget dumps all units into the file and quits the game.

Known bug: destroying non fully built units also gets logged.


The widget:

Code: Select all

function widget:GetInfo()
  return {
    name      = "stats-unitkilled",
    desc      = "saves unit xp",
    author    = "beherith",
    date      = "2011 may",
    license   = "PD",
    layer     = 0,
    enabled   = true  --  loaded by default?
  }
end

function widget:Initialize()
	gameid=os.time()
	Spring.Echo(gameid)
	mapname=Game.mapName
	modname=Game.modName
	fname=modname .. "$"..mapname.."$"..gameid .."$stats.txt"
	fd=	io.open("stats/"..fname,"w")
	if fd then 
		fileopened=true
	else 
		Spring.Echo("Error, opening stats/"..fname.." failed!")
		widgetHandler:RemoveWidget()
	end
	Spring.SendCommands("setminspeed 20")
end

function widget:UnitDestroyed(unitID, unitDefID, unitTeamID)
	xp=Spring.GetUnitExperience(unitID)
	unitDefID = Spring.GetUnitDefID(unitID)
	unitDef   = UnitDefs[unitDefID or -1]
	gf=Spring.GetGameFrame()
	fd:write(unitDef.name .. " " .. unitTeamID .. " " .. xp .. " " .. gf .. "\n") 
	--Spring.Echo("Unit "..unitID.." " .. unitDef.name .. " from team "..unitTeamID.." just got destroyed by enemy unit " .. xp)
end

function widget:GameOver()
	allunits=Spring.GetAllUnits()
	fd:write("Game Ended!\n") 
	for i=1, #allunits do
		unitID=allunits[i]
		xp=Spring.GetUnitExperience(unitID)
		unitDefID = Spring.GetUnitDefID(unitID)
		unitDef   = UnitDefs[unitDefID or -1]
		unitTeamID=Spring.GetUnitTeam(unitID)
		fd:write(unitDef.name .. " " .. unitTeamID .. " " .. xp .. "\n") 
	end
	fd:close()
	widgetHandler:RemoveWidget()
	Spring.SendCommands("quitforce")
end
The spring batch launcher: (python)

Code: Select all

import os
import time

time.clock()
i=0
for filename in os.listdir(os.getcwd()+'\\tehdemos\\'):
	cmd='copy .\\tehdemos\\'+filename+' '+filename
	print cmd
	os.system(cmd)
	cmd='spring.exe '+filename
	print cmd
	os.system(cmd)
	cmd='del '+filename
	print cmd
	os.system(cmd)
	i+=1
	print 'Number, total secs', i, int(time.clock())
The plot generator: (python)

Code: Select all

import os
import sys
import numpy as np
import matplotlib
import matplotlib.pyplot as plt

names={} #ADD NAMES OF UNITS HERE
d={}
i=0
for filename in os.listdir(os.getcwd()):
	if 'stats' in filename:
		i+=1
		f=open(filename,'r')
		ln=f.readlines()
		f.close()
		ended=0
		for l in ln:
			if 'ended!' in l:
				ended=1
				continue
			l=l.split(' ')
			if len(l)<4:
				continue
			if ended==0 or (ended==1 and float(l[2])>0):
				if l[0] in d:
					d[l[0]].append((float(l[2]),float(l[3])))
				else:
					d[l[0]]=[]
					d[l[0]].append((float(l[2]),float(l[3])))
print 'Processed',i,'files, found',len(d),'unique units'
for k,v in d.iteritems():
	exp=[]
	time=[]
	nonattack=1
	avgexp=0
	for e in v:
		exp.append(e[0])
		avgexp+=e[0]
		time.append(e[1]/(30*60))
		if e[0]>0:
			nonattack=0
	avgexp/=len(exp)
	if nonattack==1 or avgexp<0.0001:
		print names[k] ,'is not an attack unit'
	else:
		print names[k],'is an attack unit'
		fig=plt.figure(1)
		plt.clf()
		plt.plot(time,exp,marker='o',color='b',linestyle='None')
		plt.title(names[k]+' avg exp='+str(avgexp)+' samples='+str(len(time)))
		fig.savefig((names[k]+'.png'),dpi=144)

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 17:54
by knorke
ah ok.
Known bug: destroying non fully built units also gets logged.
i thought so from all the 0 xp Krogoths ;)

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 20:08
by Johannes
1v0ry_k1ng wrote:wow, either the warrior sucks or people suck at the warrior
Maybe, but you can't really tell from these stats. Many units have worse avg xps. If something sucks just judging by these I'd say Maverick, it has low avg xp, and it can't tank damage for other units worth shit either, it's almost purely a damage dealer.


Would be interesting, to also see stats of how long the specific unit lived since it was built instead of since game start.

And note that the way cost is calculated, energy intensive units tend to gain more xp than m based ones compared to how hard they are to build in practice. And units that usually kill mostly those energy intensive units, gain less.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 20:21
by Neddie
Not that Mavericks can't be used well, it is just a suboptimal unit choice and frankly a suboptimal factory choice.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 20:37
by Beherith
Johannes wrote:And note that the way cost is calculated, energy intensive units tend to gain more xp than m based ones compared to how hard they are to build in practice. And units that usually kill mostly those energy intensive units, gain less.
How so?

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 21:13
by Johannes
Beherith wrote:
Johannes wrote:And note that the way cost is calculated, energy intensive units tend to gain more xp than m based ones compared to how hard they are to build in practice. And units that usually kill mostly those energy intensive units, gain less.
How so?
Most of the time 1 metal is less valuable than 60 energy, but in these calculations they're equal. Only if you're running mostly MM based economy it's true.

So if you compare for example, flash (cost 109m/914e -> 124 overall "cost") and peewee (45m/897e -> 60 cost), it's easy to say that flash is still not twice as useful nor twice as hard to build. But flash does gain xp at half the rate of peewee and give twice as much. So when my flashes meet your peewees, it's very likely the peewees will come on top in xp stats in an even battle.
Though in this example, and overall too, it's also a matter of buildtime which isn't calculated into the Cost at all.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 21:16
by Beherith
By the time the relatively high E cost units come into play, you have t2 econ.

Also, why buildtime? This graph only (and correctly) measures the success ratio of a player opting for a specific unit, and seeing how much return he got on his resource investment.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 21:40
by Johannes
Because higher buildtime means the player had to invest in more buildpower to build the unit, it's a hidden additional cost that's not included directly on its price tag.

And there aren't many ground units that have higher e/m cost ratio than aks, fleas or pws. Also t1 air units vs most t1 ground.
Or mines even more, though their stats here don't seem to properly include kills gotten after their death.
T2 econ doesn't mean MMs necessarily, if there's enough mexes to upgrade. And with high wind even t1 econ can be quite MM-y.

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 21:45
by Cheesecan
Good idea, this is a good metric for evaluating balance and finding the flavor of the month.

http://beherith.eat-peet.net/stuff/unitexp/SAM.png
http://beherith.eat-peet.net/stuff/unitexp/Pack0.png

:o

Re: Experience stats from 250+ replays

Posted: 23 May 2011, 23:17
by Jazcash

Re: Experience stats from 250+ replays

Posted: 24 May 2011, 10:14
by Google_Frog
This is interesting. I don't know exactly how XP works and I doubt many other people know either (if anyone knows and it is simple it would be great if they would post here). I recal something about low reload time units gaining XP faster than high reload time units and I'm pretty sure a units with XP give opponents more XP when they are damaged due to powerScale.

So in short I think you should move away from XP in favour of stat tracking with the unit damaged callin. You would get stats which are easier to understand.

Re: Experience stats from 250+ replays

Posted: 24 May 2011, 11:12
by Beherith
XP is a great indicator of return on investment: an xp of 0.19 (cause of wierd constants) means a unit has dealt enough damage to kill units of equal cost to itself.
eg: a fatboy killing another fatboy: both get 0.19 xp
A peewee killing a peewee: 0.19 xp
A fatboy killing a fatboy's cost (1600 worth) of peewees: 0.19 xp

So proportional to ( %(of enemy health reduced)*enemy unit cost)/(self cost)

Re: Experience stats from 250+ replays

Posted: 24 May 2011, 23:19
by SirMaverick
Nice statistic. More interesting may be X as age of the unit instead of in game time of death in minutes.