Skip to content
This repository has been archived by the owner on May 1, 2022. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time

Rise of Kingdoms OCR Tools

📌 RoK Monster OCR (golang)

🌞 It brings me great pleasure to announce the golang fork by xor22h will be the official supported OCR client of the RoK Monster community. You can expect a vastly improved experience on nearly all existing RoK Monster features while greatly increasing usability.

🥰 Thank you everyone for all the help and suggestions as we put the php version of RoK Monster to rest. I look forward to our community's next chapter.

👋 Join our Discord for help getting started or show off your results!


Repository Description
rok-monster-ai Unfinished automated kingdom assistant. Used php-adb to perform scripted events on an Android device.
rok-monster-ocr This repository.
rok-monster-samples Sample images sorted by resolution and client version
rok-monster-schema Instruction sets to standardize OCR processes.
rok-monster-ui WordPress theme originally on providing a web UI for rok-monster-ocr CLI.

Discord License: MIT

Kingdom Statistics

Command line tools to help collect player statistics from Rise of Kingdoms. By analyzing screenshots we can extract various data points such as governor power, deaths, kills and more. This can help with various kingdom statistics or fairly distributing KvK rewards.


Results may vary.


  • Character recognition by Tesseract
  • Fast hash based image comparison
  • Live results with adb


  • Best results with a 16:9 image at 1920*1080.
  • English language is preferred as coordinate information lines up most accurately with English.


Below is a quick overview of the actions performed while executing the job governor-more-info-kills.

  1. rok-monster-ocr will iterate through each screenshot and compare the input image to a known fingerprint of the image containing data to capture.
  2. If a match is made the image is prepared per the instructions declared in the OCR profile. Each cropped segment represents a single data point.
    • This process is repeated for each image in the input_path.
  3. By default on completion a table is printed via CLI and a CSV file is saved in the current working directory.

📌 Input path can be defined in .env file or via CLI argument --input_path.


Official Support

  • Ubuntu 20.04.2


One line install.

curl -sSL | bash -s y

This will install all necessary dependencies and start a small demo project.

Alternatively you can clone the repository and review the install script before executing.

git clone
cd rok-monster-ocr
sudo bash




This assumes you already have PHP installed with access to Composer.

sudo apt install imagemagick ffmpeg tesseract-ocr

This does not represent the complete install instructions for all dependencies. Please review the install script for detailed installation instructions.


Using tessdata or tessdata_best models from the Tesseract repositories have produced better results than the models provided by apt-get. You can download select languages or clone the repository and set this path with in the .env file or via CLI argument --tessdata.

Alternatively you can install via apt-get. Some issues may include:

  • Incorrect user permissions
  • Models don't work with legacy engine
  • Can be less accurate
sudo apt install tesseract-ocr-all


git clone
cd rok-monster-ocr
composer install

Community Installs

These install methods are contributions made available by the community with no official support. It's the contributor's discretion to offer support via Discord.

Method Author README
Docker xor22h


Start a job via CLI

  1. Capture the necessary screens specified per the given job. In this example we need the Governor More Info profile screen.

  2. Move all images to your "Input Path" as defined in your .env file or via CLI argument --input_path.

    By default a "Media" folder is created in your current working directory if no directory is supplied.

  3. Run job:

    php rok.php --job=governor-more-info-kills --input_path=DIR_WITH_SCREENSHOTS
    Value Description
    governor-more-info-kills Default job for collecting kill points.
    DIR_WITH_SCREENSHOTS Full or relative path to DIR with screen shots.
  4. Check your current working directory for any output files.


Argument Value Default Description
debug bool 0 Prints raw OCR reading per image. Uses local --tmp_path and preserves cropped images.
job string Required Name of job defined as defined in rok-monster-schema
input_path string Required Media source path or file
output_path string getcwd() Output path for csv.
tmp_path string sys_get_temp_dir() Temp directory for images manipulated during processing
oem int 0 OCR Engine Mode
psm int 0 Page Segmentation Method
tessdata string null User defined location for tessdata. Defaults to system installation path.
compare_to_sample bool 1 Enable compare to sample
video bool 1 Enable video processing
  • bool as 0\1 or true\false or on\off


Have a question, an idea, or need help getting started? Checkout our Discord!

Honorable mentions for community members who've donated time and resources to rok-monster-ocr or

  • BouchB
  • j7johnny
  • Star Lordツ


If you find this project useful or use it in a commercial environment to manage your kingdom please consider donating today with one of the following options.

  • PayPal
  • Bitcoin bc1qx7v5vvxwnhpl3dssggy0hytcx2rpq5dkkfwyy4
  • Ethereum 0xA8Ebb6e5EC503E90551dD1bdE2d00B6C126eD5C5
  • Tron TPnGEfkUZ2py6CFkh8wgqqYehJ29EbMWVw


The code is licensed MIT and the documentation is licensed CC BY-SA 4.0.