← Back to projects

Clash Royale AI

A computer-vision-driven, PPO-powered agent that learns to battle in Supercell’s real-time strategy arena — no game API required.

Sample detection overlay

Vision first

A custom-trained YOLOv5 model spots troops, towers, elixir and current deck cards directly from raw screenshots. To keep labelling sane, I bootstrap with sprite-based synthetic images, then fine-tune on ~1.1 k hand-corrected real frames.

  • 2 000 synthetic images for rapid bootstrapping
  • Domain-randomised colours & noise to fight over-fitting
  • Separate tiny detector for deck-slot recognition

Reinforcement learning core

State vectors (ResNet-18 features ✚ detections ✚ elixir/deck stats) feed a PPO policy that chooses what to play and where to drop it. Illegal actions are masked out in the softmax so training isn’t wasted on impossible moves.

  • Discrete action space with dynamic masking
  • Online self-play on a private CR server
  • Pluggable reward shaping for aggressive or defensive styles
Read the full development blog →