lucasguo
projects / coc-bot
building

Clash of Clans Attack Bot

A computer-vision bot that farms Clash of Clans loot with no game API: it captures the screen over ADB, reads menus and each base's loot with OpenCV template matching, and decides whether to attack. The secondary goal is to learn computer vision and system design by building in small, testable steps.

Language
Python
Emulator
BlueStacks Air (macOS)
Capture & Input
ADB via adbutils (raw screencap over a persistent connection)
Vision
OpenCV template matching, NumPy
Planned
YOLO (nano) for building detection

Roadmap

  1. Done: KM 1

    Plumbing

    Capture the BlueStacks Air screen over ADB (~176 ms/frame) and build frame-recording and offline replay tools.

  2. Done: KM 2

    Navigate

    Identify screens by template-matching their buttons, and drive the full attack loop with a state machine that only taps screens it recognizes.

  3. Done: KM 3

    Read Loot

    Read gold, elixir, and dark elixir with per-digit template matching: 96/96 labelled digits correct, and unreadable panels are never guessed.

  4. Done: KM 4

    Deploy

    Attack bases whose loot clears a threshold: drop troops along the deployable perimeter, wait out the battle, and return home.

  5. In progress: KM 5

    Building DetectionNow

    Train a YOLO nano model to detect defenses, collectors, storages, and walls, bootstrapping labels from ~100 hand-labelled frames.

  6. Up next: FINISH

    Decision Layer

    Score each base by expected value from detections and loot to choose which bases to attack and which side to deploy from.

Build log