quantumstate Posted May 13, 2012 Report Share Posted May 13, 2012 I thought it would be useful to get some stuff graphed for testing AI's.Basically I added this to my AI so in this case it graphs the number of units that the AI has.log("graph::units:" + gameState.getOwnEntities().filter(Filters.byClass("Unit")).length + ":" + gameState.getPlayerID() + ":" + gameState.timeElapsed);units and gameState.getOwnEntities().filter(Filters.byClass("Unit")).length are what you would change. You can graph lots of stuff simultaneously (though you need to add more colors to the styles variable in the python script).Then I wrote a quick and dirty python script to graph it using matplotlib (comes as part of scipy).import reimport pylab as pf = open('{path to logs folder}/mainlog.html', 'r')log = f.read()r = re.compile("graph\:\:\S+\:[0-9]+(\.[0-9]+)?")vals = re.findall(r"graph\:\\S+)?\[0-9]+(\.[0-9]+)?)?\[0-9]+)?\[0-9]+(\.[0-9]+)?)?", log)#print valsa = {}for i in vals: key = i[0] + " Player " + i[3] if not key in a: a[key] = [[],[]] a[key][0].append(i[1]) a[key][1].append(float(i[4])/1000.0)f1 = p.figure()p.grid()count = 0styles = styles = ['r-', 'g-', 'b-', 'k-', 'm-', 'r--', 'g--', 'b--', 'k--', 'm--', 'r:', 'g:', 'b:', 'k:', 'm:']for key in a: count += 1 p.plot(a[key][1], a[key][0], styles[count], label=key)p.legend(loc='best')f1.savefig("out.png")And thus you get prettiness. Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted May 13, 2012 Report Share Posted May 13, 2012 Nice. This could be very handy for visualizing the AI's performance during a game and fine-tuning it Quote Link to comment Share on other sites More sharing options...
quantumstate Posted May 13, 2012 Author Report Share Posted May 13, 2012 We can also hook stuff into the rest of the simulation system for more fun. I spent a while trying to work out how to get the resources gathered stat in the AI and then realized that it would be dead easy to add some code to the statistics component. Quote Link to comment Share on other sites More sharing options...
Pureon Posted May 13, 2012 Report Share Posted May 13, 2012 It's a simplified version of the Achievements Timeline from Age of Kings So the graph suggests qBot reached a population of 300 in under 25 minutes? Quote Link to comment Share on other sites More sharing options...
quantumstate Posted May 13, 2012 Author Report Share Posted May 13, 2012 It's a simplified version of the Achievements Timeline from Age of Kings So the graph suggests qBot reached a population of 300 in under 25 minutes?We should put something like this in game at some point. Yes, I disabled the attack component though, normally stuff would have died much earlier. Quote Link to comment Share on other sites More sharing options...
fabio Posted May 14, 2012 Report Share Posted May 14, 2012 This looks cool, eventually it could be integrated in the final statistics and eventually made accessible also during the game in a dedicated panel. Quote Link to comment Share on other sites More sharing options...
wraitii Posted May 14, 2012 Report Share Posted May 14, 2012 Interesting development tool, interesting to have in the game. Quote Link to comment Share on other sites More sharing options...
rjs23 Posted August 16, 2012 Report Share Posted August 16, 2012 This would be nice to have! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.