Jump to content

Getting Match Results


13 replies to this topic

#1 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 19 March 2014 - 01:50 AM

Hello!

I wonder if it would be possible to grab the results of a match from the game and save it to a file (not a screenshot, but the numbers!). We do analyze the results of our drops during training and for that reason I now take screenshots and take the values from there manually... that is kind of annoying and I wonder if there would be a tool supported way that is easier.

I played around with OCR solutions but this is also maximum a workaround. Best would be to grab the info from the game itself.

That would also be a great help for the implementation of an automation interface (league play or tournaments).

EDIT:
To be more clear:
I would need the names of my team's pilots and their MatchScore (and maybe kills).

Anyone?

Edited by Meldric, 19 March 2014 - 06:34 AM.


#2 Durant Carlyle

    Member

  • PipPipPipPipPipPipPipPipPip
  • Survivor
  • Survivor
  • 3,877 posts
  • LocationClose enough to poke you with a stick.

Posted 19 March 2014 - 08:16 AM

They will eventually have an API to tap into.

For now, screenshots are the way.

#3 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 19 March 2014 - 08:28 AM

Would we know when ™?

I have been investigating OCR SDKs to be added to a self written application (probably Java) to monitor a folder (where the screenshot would appear), pick up the file and scan defined areas of the screenshot to read the text from it, sort the data by the name column and write it to a file. Most of this is not a big deal, but finding a good (and free) OCR SDK is the trick...

If I'd knew there is an api next month, I'd stop right here...
But then again... forget the question.
;)

Edited by Meldric, 19 March 2014 - 08:41 AM.


#4 Durant Carlyle

    Member

  • PipPipPipPipPipPipPipPipPip
  • Survivor
  • Survivor
  • 3,877 posts
  • LocationClose enough to poke you with a stick.

Posted 19 March 2014 - 08:43 AM

It was one of their "We would like to do this, but no ETA" answers.

So, yeah, go ahead and work on your solution.

#5 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 20 March 2014 - 03:23 AM

Tool is finished but the OCR part... should be possible somehow, looking into it.

Looks like this so far:

----------------------------

run:
MWO ScreenShot Processor
------------------------------------
Usage:
- Specify a path in the settings for the screenshots.
- Run the tool. It will wait for a screenshot to appear.

How it works:
- It will pick up the screenshot and split the image.
* This is to have dedicated images for OCR.
* This is to increase accuracy for OCR.
- It will OCR the content of the captured screen areas.
- It will save the captured strings to temp files.
- It will then process the temp files to re-arrange the info.
- Info is stored into an XML file.
- Screenshot is then moved to folder "processed".

Conditions:
- Screens must be 1920x1080!
------------------------------------
Meldric (http://www.clanwolf.net)
------------------------------------
2014-03-20 13:07:58,429 [main] INFO screenshotprocessor.ScreenShotProcessor - Found path to look for ScreenShots: c:\MWO_Screens
2014-03-20 13:07:58,429 [main] INFO screenshotprocessor.ScreenShotProcessor - Found file: MWOClient_2014-03-19_22-20-54-47.png
BUILD SUCCESSFUL (total time: 0 seconds)

Edited by Meldric, 20 March 2014 - 04:03 AM.


#6 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 21 March 2014 - 01:17 AM

Hello!

I think I got it working. I am using now Java to slice the screenshot, then ImageMagick (Commandline) to do some conversions and then the Tesseract commandline OCR tool. Java then reads the txt files and puts the results into xml or txt format (this can be done as needed). Processing it into a database after that is just a very short step...

Had to apply some tricks with dummy images to increase accuracy of tesseract.exe, but I think I am pretty close to get it finished.

Even if this would not work... I expect the API to show up in the next MWO update now that I have spent two days into this. I hate Murphy sometimes...

Edited by Meldric, 21 March 2014 - 01:42 AM.


#7 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 21 March 2014 - 06:50 AM

Damn!

Can be forgotten! The OCR is not reliable at all. In general it does what is expected, but far too often a "0" is taken as a "D" or an "8" as a "B". It is simply not practical. Damn!

#8 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 21 March 2014 - 07:11 AM

This image:
Posted Image
---

Gives me this data now... working on making the OCR more reliable... hope there is a chance...

<match id="MWOClient_2014-03-19_22-20-54-47.png">
<pilot>
<name>Erzengel TL</name>
<mech>A57-D-DD</mech>
<status>ALIVE</status>
<matchscore>182</matchscore>
<kills>0</kills>
<assists>8</assists>
</pilot>
<pilot>
<name>Meldric</name>
<mech>N1 -VA</mech>
<status>ALIVE</status>
<matchscore>104</matchscore>
<kills>0</kills>
<assists>8</assists>
</pilot>
<pilot>
<name>Slrnngwind</name>
<mech>CTF-4X</mech>
<status>ALIVE</status>
<matchscore>0</matchscore>
<kills>1</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Steve0211</name>
<mech>TDH-555</mech>
<status>ALIVE</status>
<matchscore>41</matchscore>
<kills>0</kills>
<assists>7</assists>
</pilot>
<pilot>
<name>Tirick Fire</name>
<mech>CN9-AL</mech>
<status>ALIVE</status>
<matchscore>0</matchscore>
<kills>1</kills>
<assists>9</assists>
</pilot>
<pilot>
<name>Walkingbealh</name>
<mech>SHD-2|I|2</mech>
<status>ALIVE</status>
<matchscore>0</matchscore>
<kills>1</kills>
<assists>9</assists>
</pilot>
<pilot>
<name>Hakumei</name>
<mech>WVH-7K</mech>
<status>DEAD</status>
<matchscore>40</matchscore>
<kills>0</kills>
<assists>6</assists>
</pilot>
<pilot>
<name>syclnps</name>
<mech></mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Dasopfer</name>
<mech>VTR-9K</mech>
<status>DEAD</status>
<matchscore>61</matchscore>
<kills>1</kills>
<assists>8</assists>
</pilot>
<pilot>
<name>Harveolronzoflfl</name>
<mech>JM6-S</mech>
<status>DEAD</status>
<matchscore>49</matchscore>
<kills>0</kills>
<assists>8</assists>
</pilot>
<pilot>
<name>Rudenaes</name>
<mech>BJ-3</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>hun\sman196</name>
<mech>JR7-D</mech>
<status>DEAD</status>
<matchscore>19</matchscore>
<kills>0</kills>
<assists>1</assists>
</pilot>
<pilot>
<name>Wild Hog</name>
<mech></mech>
<status>DEflD</status>
<matchscore>68</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Zarlhng</name>
<mech>A57-K</mech>
<status>DEflD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>4</assists>
</pilot>
<pilot>
<name>Batlmek</name>
<mech>STK-3F</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>1</kills>
<assists>4</assists>
</pilot>
<pilot>
<name>Buris Ina!</name>
<mech>CN9-D</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Juufri Sinasapplesap</name>
<mech>STK-5M</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>4</assists>
</pilot>
<pilot>
<name>Wu|f96</name>
<mech>A57-D</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>1</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Benzpyren</name>
<mech>JM6-S</mech>
<status>DEAD</status>
<matchscore>4</matchscore>
<kills>0</kills>
<assists>1</assists>
</pilot>
<pilot>
<name></name>
<mech></mech>
<status></status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Ryner1</name>
<mech>LR-1D</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>6</assists>
</pilot>
<pilot>
<name>Caedwyt Amser</name>
<mech>A57-D</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>Vasculio</name>
<mech>F59-E</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
<pilot>
<name>fluinto Necio</name>
<mech>WVH-GK</mech>
<status>DEAD</status>
<matchscore>0</matchscore>
<kills>0</kills>
<assists>0</assists>
</pilot>
</match>

Edited by Meldric, 21 March 2014 - 07:12 AM.


#9 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 21 March 2014 - 07:48 AM

Hi!

Now I get this (in an alternativ format):

MWOClient_2014-03-19_22-20-54-47.png
>> 01. Erzengel TL | A57-D-DC | ALIVE | 182 | 3 | 8
>> 02. Meldric | N1 -VA | ALIVE | 104 | 2 | 8
>> 03. Slrnngwind | CTF-4X | ALIVE | 57 | 1 | 5
>> 04. Steve0211 | TDH-555 | ALIVE | 41 | 2 | 7
>> 05. Tirick Fire | CN9-AL | ALIVE | 59 | 1 | 9
>> 06. Wa|kingDea!h | SHD-2|I|2 | ALIVE | 57 | 1 | 9
>> 07. Hakumei | WVH-7K | DEAD | 40 | 0 | 6
>> 08. syclnps | | DEAD | 23 | 0 | 3
>> 09. Dasopfer | VTR-9K | DEAD | 61 | 1 | 8
>> 10. Harveolrnnzoflfl | JM6-S | DEAD | 49 | 0 | 8
>> 11. Radenaes | BJ-3 | DEAD | 27 | 0 | 2
>> 12. huntsman196 | JR7-D | DEAD | 19 | 0 | 1
>> 13. Wild Hug | | DEAD | 68 | 0 | 5
>> 14. Zarlhng | AS7-K | DEAD | 39 | 0 | 4
>> 15. Batlmek | STK-3F | DEAD | 30 | 1 | 4
>> 16. Boris Ina! | CN9-D | DEAD | 5 | 0 | 2
>> 17. Juufri Sinasapplesap | STK-5M | DEAD | 57 | 2 | 4
>> 18. Wu|f96 | A57-D | DEAD | 50 | 1 | 5
>> 19. Benzpyren | JM6-S | DEAD | 4 | 0 | 1
>> 20. | | | 0 | 0 | 0
>> 21. Ryner1 | LR-ID | DEAD | 57 | 0 | 6
>> 22. Caedwyr Amser | A57-D | DEAD | 35 | 0 | 5
>> 23. Vasculin | F59-E | DEAD | 34 | 2 | 2
>> 24. nuimu Necio | WVH-GK | DEAD | 5 | 0 | 3

Edited by Meldric, 21 March 2014 - 07:55 AM.


#10 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 24 March 2014 - 01:48 AM

Ok, Got everything doing as I wanted, but the success rate of the OCR is still not reliable. Something around 90%. If this should be somehow usefull, it needs to be around 99,9%, otherwise one has to doublecheck every Screenshot which makes it all useless.

Anyone around in the forums who could advice on the training procedure of tesseract? Looks pretty complicated and any help would be much appreciated.

Edited by Meldric, 24 March 2014 - 03:00 AM.


#11 Meldric Ward

    Member

  • PipPipPipPipPip
  • The Named
  • The Named
  • 159 posts
  • LocationTranquil

Posted 25 March 2014 - 05:37 AM

Hi!

Sorry to say, but this is a dead end. The success rate of tesseract is surprisingly high, it works really well... But for this application it is just not reliable enough. I sometime (not very often, but that makes it worse in fact) get wrong numbers in very small variances. Sometimes an 11 turns to a 0 while ALL OTHER numbers of the screenshot are correct. This makes it extremly hard to find the errors and that means, one needs to doublecheck every single number

--> useless!

The text on the screen is so small and blurry that this is probably not possible to be much improved. Sad, but I think I stop it here. I can't make it as reliable as needed.

@PGI:
Give us this interface, please! Or just a dump of the data in an XML file. It must be sooo damn simple to write this to a file from the game!!!

Edited by Meldric, 25 March 2014 - 05:52 AM.


#12 Night Fury76

    Member

  • PipPipPipPipPipPip
  • Ace Of Spades
  • Ace Of Spades
  • 300 posts
  • LocationAustralia

Posted 07 July 2014 - 04:49 PM

is it in the file chopping you are doing before the image to text conversion?

halve you tried just the original image to see if the same errors in the numbers occur, if not then you may be able to continue.
bloody excellent work by the way

#13 Beijing

    Member

  • PipPipPip
  • Liquid Metal
  • Liquid Metal
  • 66 posts
  • LocationFranken

Posted 11 November 2015 - 04:44 AM

I'm looking into tesseract myself right now. The results I get have the same problems as described.
The "low" resolution for screenshots is also a problem. The usually used scans are a lot higher in resolution, so OCR works better.
I found that it has some sort of training mode, but haven't grasped the concept of how it works yet.
Guess I have to do a lot of reading/studying.

Can you provide any info about your used settings or preprocessing like splitting up the screenshot into smaller parts e.g. for each scoreboard entry and/or greyscaling/black-and-white?

Edited by Beijing, 11 November 2015 - 04:59 AM.


#14 Beijing

    Member

  • PipPipPip
  • Liquid Metal
  • Liquid Metal
  • 66 posts
  • LocationFranken

Posted 18 December 2015 - 11:47 AM

Finished a pretty rough coded script which works surprisingly well.

You can find it here:
https://github.com/g...enshot-analyzer





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users