A configurable computer-vision assistant for automating repetitive activities in mobile or PC games. The bot combines OpenCV template matching, a Tk/OpenCV hybrid GUI, and a flexible workflow engine so you can build and share game-specific automation packs without touching the core code.
Documentation files were added to the docs/ folder. See docs/en.md and docs/de.md for full installation and usage instructions.
- Workflow driven – Define automation flows in profiles
tasks.yamlwith ordered steps, triggers, and per-action metadata. Import, edit, and reorder tasks visually inside the Tasks tab. - Template collections – Each template key can track up to 10 reference images. Manage, preview, and capture replacements directly from the Templates tab (including screenshot + crop tooling).
- Profile-aware configs – Keep complete game setups (config, tasks, templates) under
profiles/and switch between them from the Settings tab for Multi-Game Support. - Dual control backends – Use Android emulators/device via ADB or drive a Windows window.
- Monitor Interface – Hybrid Tk/OpenCV monitor with heatmap overlays, history scrubbing, real-time dashboard, and structured log viewer.
- Safety & recovery – Centralised error handling and home-screen stabilisation routines keep automation loops resilient.
- Statistics - Stats can be dynamically defined and stored in a sqlite Database. Even if you close the Bot, the Data will be there for maximum 30 Days.
- Python 3.9 or newer
- OpenCV and Pillow (installed via
requirements.txt) - these need maybe other Tools for Windows to be installed like make Tools for Windows. - For Android control: Android SDK platform tools (
adb) on PATH - For Windows control:
pyautogui,pygetwindow, and Pillow
git clone https://github.com/flyinghuman/gamebot.git
cd gamebot
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# start your android emulator or start the windows game | configure it in config.yaml:
# if you use android emulator consider to use android 13 for better performance than the older ones.- Edit
profiles/my-game/config.yamlto match your device backend, thresholds, ROIs, and other preferences. - Drop your template images into
profiles/my-game/templates/(each template key may reference up to 10 files) - use the lastwar sample profile to have a good starting point. - Adjust
profiles/my-game/tasks.yamlto describe the workflows you want to run or use the gui to define them. - Start the bot and choose your profile from Settings → Configuration Profile (or update
profiles/active_profile.txt).python3 bot.py
- Use the GUI tabs to monitor activity, tweak settings, capture templates, and maintain your task library.
Each profile bundles a complete bot setup under profiles/<name>/:
config.yaml– settings, ROIs, and general behaviourtasks.yaml– workflow definitions for the task enginetemplates/– template images referenced by the profile config
Select the active profile from the Settings tab or by editing profiles/active_profile.txt. Sharing a profile is as simple as zipping its folder and distributing it to other users.
Each profile ships with a config.yaml that drives almost every runtime behaviour. Each entry stores both value and comment to ease editing. Key sections include:
bot_title/language– Sets the window caption and default GUI language.control_mode,windows_title,device_serial– Select Android (adb) or Windows control and supply identifiers.- In Adnroid Mode an Emulator like Bluestacks with enabled ADB is required. Android Mode is the recommented Mode because you can use your PC normally beside the Bot and even Lock the Screen.
- In Windows Mode the Bot sends Mouse klicks into the Game Window and you MUST STAY LOGIN in Windows so that the Bot can click in the Window. Using your Windows is not possible because the Bot grab your Mouse and clicks into the Window.
template_scale_test– Optional auto-scaling probe to compensate for resolution changes.rois&templates– Normalised ROIs and template metadata. Replace these entries with assets from your target game.tasks_file– Path to the workflow definition file (defaults totasks.yaml).
A matching config.yaml is included for LastWar Survival Game (TM) to get a quick bootstrapping.
This Project is not related with LastWar Survial Game - it uses it only as a sample reference. This is a Universal Game Bot - you can use it also for other Games which can be automated through Picture Recognition and automated requrring Clicking Tasks.
With the sample reference (with only german pictures in landscape mode) you can:
- automatically hunt for treasures, dig them out and also grab gifts
- automatically spent for alliance technology
- automatically give alliance help
- automatically collect alliance gifts
The Templates tab lets you:
- List every template key defined in
config.yaml. - Attach up to ten images per key, reorder them, or remove obsolete samples.
- Preview each asset and view the ROI used for matching.
- Capture a screenshot from the active control backend, crop the relevant region, and store it as a new or replacement template image.
Changes can be saved back to config.yaml so they are available to other users.
Workflows describe automation sequences and are stored in tasks.yaml (configurable path). Each task contains:
id,name,description,enabledtriggerblock (currently interval-based with optional randomisation and run-at-start flag)stepsarray. Built-in step types now cover taps, waits, logging, flag/detail management, nestedif / elsebranches, loops, task chaining, and utility actions likepress_back. Template-oriented steps use a dropdown fed by the active profile so you never mistype a key.
The Tasks GUI tab offers full CRUD, reordering, duplication, validation, and persistence for these definitions, including nested step editors and a visual condition builder.
find_and_tap now accepts an optional duration argument (milliseconds). When provided, the bot issues a swipe with identical start/end coordinates to emulate a long press. The helper wait_and_tap defaults to short taps but can receive a duration override for controls that require holding.
- No templates detected – Verify file paths in
config.yamland confirm images were captured at the current resolution. The Templates tab preview highlights any missing files. - Window not found – Ensure the
windows_titleentry matches the actual window caption (partial matches are supported bypygetwindow). - ADB timeouts – Confirm the device appears under
adb devicesand increasetemplate_scale_testthresholds. - Task errors – The log tab highlights validation issues. You can inspect
tasks.yamlto confirm each step type and parameter.
This project is released under the GNU GPLv3. See LICENSE for the full text.
More detailed user and developer documentation is available under the docs/ folder:
docs/en.md— English documentation (installation, Bluestacks, GUI, task authoring, examples)docs/de.md— German documentation (same content, translated)
Please read the docs for platform-specific setup steps and the Tasks how-to.
If you find this project useful and want to support continued development, please consider making a small donation to the developer. There is no required donation — but contributions help with maintenance and improvements.
Thank you for supporting the project!
BTC: bc1qydkjt2gfxr7uz4pt4jldpzwxqty8nc76vtv9ss
ETH: 0x5D0F170eBc8caC2db4F9477E26A4858142abDEEB
XRP: rUvTGRaqg9Q7DTJoMRGRVBZ1fpKaZQcx5a
DOGE: DRPr2oh2ynd4FJ66BrPFfskE1jpEWWnBpm
DASH: Xnzed2r417hGfgLG4DqCCTSNPci6FbvgHW


