🤖
⚔️
🛡️
Open Source GPL v3

MBR-NG: MyBotRun Next Generation

Modern, resolution-independent, background-mode Clash of Clans bot built in Python. Inspired by MyBotRun and designed to match premium features of ClashFarmer.

Python 3.10+PyQt6OpenCV + ONNX YOLOEasyOCRADB Background

Why MBR-NG Stands Out

FeatureMBR (AutoIt)ClashFarmerMBR-NG
PriceFREE (GPL v3)~$10-20/moFREE
Source CodeOpen (AutoIt)Closed (PyArmor)Open (Python)
ResolutionFixed 860x720AnyAny (0.0-1.0 relative)
Background ModeAero only, screen ONMinimized, screen OFFTrue ADB background
VPS SupportNoYesYes + Headless
Auto-Launch EmulatorNoNoYes (BS/LD/Nox/MEmu)
GUIAutoIt nativePyQt6Modern PyQt6 Dark + Web Dashboard
AI/MLNoOpenCVONNX YOLO + EasyOCR
NotificationsNoNoTelegram + Discord
Multi-AccountManualNoSupercell ID Switching
Stats DatabaseNoNoSQLite Persistent
Builder BaseNoNoYes
Clan GamesNoNoYes
Auto-UpdaterNoYesGitHub Releases
Windows 11NoYesYes
DPI ScalingMust be 100%AutoAuto-detect

Key Features

True Background Mode

Uses ADB (Android Debug Bridge) for screen capture and input. BlueStacks/LDPlayer can be minimized and your screen can be turned OFF. Perfect for VPS / dedicated servers.

Resolution Independence

All coordinates stored as relative values (0.0-1.0). Auto-scales to any emulator resolution. Supports DPI scaling natively. Works on 720p, 1080p, 1440p, 4K.

Auto-Launch Everything

Auto-detect installed emulators (BlueStacks, LDPlayer, Nox, MEmu). Auto-launch emulator if not running. Auto-launch Clash of Clans via ADB. Auto-optimize emulator settings.

Modern PyQt6 GUI + Web Dashboard

Dark theme out of the box with real-time screen preview via ADB. Live statistics dashboard. System tray integration. Web dashboard accessible from any device on your network.

Advanced Computer Vision

Multi-scale template matching, EasyOCR for reading resources/troop counts/timers, ONNX Runtime with YOLO object detection (optional), and hybrid matching: Template + Feature (ORB).

Smart Gameplay

Dead base detection with OCR + HSV collector analysis. Auto-login & obstacle handler (15+ popup types). Ban detection with immediate stop. Smart search filtering (dead/live/trophy/smart modes).

Village Management

Auto-collect resources, auto-donate troops, clear obstacles, auto-upgrade walls, Builder Base attacks, and Clan Games automation.

Multi-Account Support

Supercell ID switching. Cycle through multiple accounts. Per-account profiles with JSON presets.

Notifications

Telegram Bot real-time alerts. Discord Webhook notifications. Attack completion alerts, error notifications, and daily summary reports.

Anti-Ban Features

Humanized input (random delays, position jitter). Configurable farming schedule (3 time windows). Random break intervals. Session time limits. Attack rate limiting. Screenshot on error.

Architecture

State Machine

IDLE → INITIALIZING → LAUNCHING_EMULATOR → WAITING_FOR_GAME → TRAINING → SEARCHING → ATTACKING → RETURNING → COLLECTING → BUILDER_BASE → CLAN_GAMES → (loop)
↓ BREAK (anti-ban)

Detection Pipeline

Screenshot (ADB) → Preprocess → ONNX YOLO → Template Match Fallback
↓ EasyOCR (resources)
↓ HSV Analysis (collectors)

Project Structure

MBR-NG/
mbr_ng/core/ADB wrapper, detector, actor, orchestrator, config
mbr_ng/cv/Matcher, OCR, ONNX object detection
mbr_ng/strategies/CSV engine, built-in strategies
mbr_ng/emulator/Auto-launch BS/LD/Nox/MEmu
mbr_ng/village/Trainer, manager (collect/donate/upgrade)
mbr_ng/search/Dead base, login handler
mbr_ng/builderbase/Builder Base attacks
mbr_ng/clangames/Clan Games automation
mbr_ng/multiauth/Multi-account switching
mbr_ng/database/SQLite statistics
mbr_ng/notifications/Telegram + Discord
mbr_ng/web/Flask web dashboard
mbr_ng/updater/GitHub update checker
mbr_ng/gui/PyQt6 interface

Quick Start

Installation

git clone https://github.com/subkhanibnuaji/MBR-NG.git
cd MBR-NG
python -m venv venv
venv\Scripts\activate  # Windows
pip install -r requirements.txt

Usage

# GUI Mode
python main.py

# Headless (VPS/Server)
python main.py --headless --profile default

# With web dashboard
python main.py --headless --web-dashboard --dashboard-port 8080

# Build .exe
python build.py

Changelog

v1.1.12026-06-01
  • Critical bug fixes: init order, duplicate attack records, star detection, QImage buffer crash
  • Thread safety with RLock, orphaned thread fixes, double-start guard
  • Unbounded log growth capped, bare except clauses replaced
  • Added tests/test_detector.py and tests/test_config.py — 11/11 passing
v1.1.02026-05-28
  • Emulator auto-launcher (BlueStacks 5, LDPlayer, Nox, MEmu)
  • Auto-login handler for Supercell ID
  • Army trainer with configurable compositions
  • Village manager, dead base detector, Builder Base support
  • Clan Games automation, SQLite stats database
  • Telegram & Discord notifications, web dashboard, auto-updater, multi-account manager
v1.0.02026-05-24
  • Initial MVP release
  • Core framework: orchestrator, ADB wrapper, CV detector, actor
  • Relative coordinate system (0.0–1.0) for resolution independence
  • PyQt6 dark-themed GUI with live preview
  • CSV attack strategy engine (MBR v8.x compatible)
  • State machine: 13 states from IDLE to PAUSED

Disclaimer

Using bots in Clash of Clans violates Supercell's Terms of Service. This software is for educational purposes only. Use at your own risk. Features to reduce ban risk are provided, but there is no guarantee of account safety.

MBR-NG is open source under GPL v3. It is a spiritual successor to MyBotRun and is written from scratch in Python.