https://github.com/aknavj/sc2leavebot
StarCraft 2 Leave Bot utilizing OpenCV, Tesseract-OCR and Win32 API
https://github.com/aknavj/sc2leavebot
Last synced: 2 months ago
JSON representation
StarCraft 2 Leave Bot utilizing OpenCV, Tesseract-OCR and Win32 API
- Host: GitHub
- URL: https://github.com/aknavj/sc2leavebot
- Owner: aknavj
- Created: 2020-05-24T00:33:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T14:38:01.000Z (about 5 years ago)
- Last Synced: 2025-02-12T23:19:27.389Z (4 months ago)
- Language: Python
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sc2leavebot
StarCraft 2 Leave Bot utilizing OpenCV, Tesseract-OCR and Win32 APIIn-Action Video Footage [here](https://www.youtube.com/watch?v=vd1A5gEf4ss)
# How it works?
The principle of this Python script is pretty simple. The script will basically grab image frame from the application (utilizing python win32 API), then it looks for specific regions, something like the area of interests in the image (utilizing OpenCV) and if it is able to detect string information (utilizing tesseract OCR), then the action is called.This script won't read anything from application process memory, it is not working on any kind of injection method or something similar to it. It is more likely trying to simulate and execute what "human eyes" see, in this case, what is on the display screen.
# What i would like to add/or fix in future!
- faster application snapshot grabber!
- setup application run scenario using parameters
- matchup, race, mode
- what is a goal for final (dropped) MMR?
- proper detection method and mouse pointing, area selection (instead of hard-coded, here you go mouse (x,y coords)!)
- detail gathering of information like:
- profile player
- mmr
- matchup map load screen
- player names
- map name
- map snapshot
- in game
- gather chat log
- score screen
- map name
- lenght of a game - timer
- Base MMR of both players (or team)
- decrease or increase of MMR of players (or team)
- do you have any additional ideas?# Installation
## Basic packages
- Install latest Python 3.8.3 [64-bit](https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe) or [32-bit](https://www.python.org/ftp/python/3.8.3/python-3.8.3.exe)
-- Do not forget add Python into your PATH!
- Install latest Tesseract OCR (tesseract-ocr-w32-setup-v5.0.0-alpha) [64-bit](https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-v5.0.0-alpha.20200328.exe) or [32-bit](https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w32-setup-v5.0.0-alpha.20200328.exe)
## Python Modules
After installing Python and Tesseract OCR we need to fetch a few packages via pip, start your command line```python -m pip install --upgrade pip ``` -- this will upgrade your pip
```pip install pywin32``` -- install WIN32 API support for python
```pip install win32gui``` -- install WIN32 API GUI support for python
```pip install opencv-python``` -- install opencv for python
```pip install pytesseract``` -- install tesseract-ocr for python
## Execution / Run script
1. Run StarCraft II
- In game Settings setup Display Mode instead of Fullscreen to Windowed Fullscreen
2. Wait for game come up to Main Screen (after Login Screen) and run
3. Run command line (cmd.exe) from sc2leavebot directory using command
```python main.py```## Modfiication of Variables
Just open globals.py in text editor and edit it depending your needs!