Getting more information from Age of Empires 2 to better analyse games
Unfortunatly, I couldnt do it with the standard ressource panel. The numbers are very small and the background can distract the ocr by a lot. Thats why I created a small mod which increases the font size and replaces distracting parts of the ressource panel with black background. Get the mod here https://www.ageofempires.com/mods/details/16655
I use ffmpeg to film the ressource panel and timer. The video needs some enhancement to make it better readable for the tesseract. Thats why I gray scale it, then negate it to have black letters and double the size. Last I take picutres for every second of the video (not every in game second).
I use the libraries magick for image processing and tesseract to read the data. See the code. I increase the accuracy by decreasing the canvas to each datafield. With microbenchmark I tested the speed of the process and could increase it by editing most images with ffmpeg instead of R. Now 624 pictures take around 60sec to read.
Now I have a pretty nice table with a lot of information about the game. See example_stats to look at some graphs.
Here you can download sample data to follow the steps. You will need to adjust the file paths.
- source video
- enhanced video
- screenshots
- aoe2_data.rds (output data from R)