Combat analytics

Discussion about the game and its default mods.
Post Reply
lucassss
Posts: 144
Joined: Mon Jan 04, 2016 1:55 pm

Combat analytics

Post by lucassss » Sat Aug 27, 2016 7:37 pm

I've been helping Noit with some testing of the Shattered Paradise mod and I had the idea to see which units are dangerous to who. Turns out that all it takes is changing 2 lines in the source code of OpenRA and you can get that info dumped into a debug file and later analyzed but another python program I wrote.

This allowed me to analyze a replay and get results like this (dots are inserted to prevent clutter):

--- THREE TOP EASY KILLS FOR EACH ---
dino: ('harv', 1340),('mutfiend', 827),('muradr', 520)
visc_lrg: ('cyborg', 450),('worker', 120),('mupowr', 60)
.
.
.
cyborg: ('marauder', 2023),('mutfiend', 1580),('gacnst', 1505)
.
.
.

From this one you can see that cyborgs were the most effective against marauders and against fiends, and that dinos were mostly useful for attacing harvs.

Is anyone interested in something like this for OpenRA? I'd gladly send my code to everyone who is interested, it is really only a few lines.

Murto the Ray
Posts: 486
Joined: Mon Nov 10, 2014 4:34 pm

Post by Murto the Ray » Sat Aug 27, 2016 7:44 pm

I could make a script for this which could be attached to maps quite easily with the added benefit of working right now :)

lucassss
Posts: 144
Joined: Mon Jan 04, 2016 1:55 pm

Post by lucassss » Sat Aug 27, 2016 9:11 pm

Can a lua script dump lots of data to a file? The whole idea is that we don't know in advance what to analyze, so we just record every time something damages something and then run an analyzer program on the report. What I showed is the output of the analyzer, but every damaging hit is saved.

Also, the nice thing is that you can run this on replays to see how things went in the game.

User avatar
Graion Dilach
Posts: 262
Joined: Fri May 15, 2015 5:57 pm

Post by Graion Dilach » Sat Aug 27, 2016 10:59 pm

I'd take a look to the diff, yes.
Image
Image
Image
AS Discord server: https://discord.gg/7aM7Hm2

Canavusbis
Posts: 37
Joined: Thu May 21, 2015 10:58 pm

Post by Canavusbis » Sun Aug 28, 2016 5:23 am

lucassss wrote: Can a lua script dump lots of data to a file? The whole idea is that we don't know in advance what to analyze, so we just record every time something damages something and then run an analyzer program on the report. What I showed is the output of the analyzer, but every damaging hit is saved.

Also, the nice thing is that you can run this on replays to see how things went in the game.
The Lua sandbox has been designed to prevent maps from accessing IO and other system utilities, so no.

However, a custom patch can be made for each release in order to add non-standard client-side features, if it doesn't get merged upstream. This could be done in two ways: a custom build or a mod.

Murto the Ray
Posts: 486
Joined: Mon Nov 10, 2014 4:34 pm

Post by Murto the Ray » Sun Aug 28, 2016 6:04 am

Canavusbis wrote:
lucassss wrote: Can a lua script dump lots of data to a file? The whole idea is that we don't know in advance what to analyze, so we just record every time something damages something and then run an analyzer program on the report. What I showed is the output of the analyzer, but every damaging hit is saved.

Also, the nice thing is that you can run this on replays to see how things went in the game.
The Lua sandbox has been designed to prevent maps from accessing IO and other system utilities, so no.

However, a custom patch can be made for each release in order to add non-standard client-side features, if it doesn't get merged upstream. This could be done in two ways: a custom build or a mod.
Actually, if you use print it will output into the lua log.

lucassss
Posts: 144
Joined: Mon Jan 04, 2016 1:55 pm

Post by lucassss » Sun Aug 28, 2016 11:38 am

http://pastebin.com/FCXPcbaW - Patch to modify OpenRA
http://pastebin.com/7iNXuuXB - Utility to analyze debug.log (I use command line '<' to make it input)

The whole idea to extend the analysis utility as much as we want. For example, the next thing I want to add is information about damage effectiveness. I.e. how many times did a unit target an armor class that wasn't its best class.

Matt
Posts: 1024
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Sun Mar 26, 2017 3:24 pm

The idea is good to generate hard data to improve balancing. You shouldn't patch the Health.cs as it is part of core engine. Write an IUtilityCommand to extract this from the replay. Otherwise this stays a quick hack that can't be added.

crlf
Posts: 28
Joined: Tue Jan 10, 2017 9:27 pm

Post by crlf » Sun Mar 26, 2017 7:04 pm

Are the replays themselves in a format parseable by anything other than OpenRA?

Matt
Posts: 1024
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt » Sun Mar 26, 2017 8:20 pm

The metadata header should be easy to parse. That is what sites like https://www.gamereplays.org/openra/ do. However the actual gameplay, which is just a binary stream, is better parsed by the game functions itself.

Kwendy
Posts: 48
Joined: Sat Jun 04, 2016 8:53 am

Post by Kwendy » Mon Mar 27, 2017 12:58 am

Don't forget to share your findings, oh ye who tried this code.

Post Reply