Elixer Counter is a computer vision and machine learning project that detects Clash Royale card deployments and estimates enemy elixir in real time using motion detection, image classification, and game-state logic.
Watch the complete project walkthrough here:
https://youtu.be/bKbxBAIL_XY?si=hTeu8PayRhfHZTyp
This project is for educational and research purposes only.
All Clash Royale assets, artwork, characters, and intellectual property belong to Supercell.
This project is not affiliated with, endorsed by, or sponsored by Supercell.
- Real-time game screen capture
- Motion-based troop deployment detection
- MobileNetV2 image classification
- Enemy elixir estimation
- Real-time prediction overlay
- Python
- PyTorch
- OpenCV
- MobileNetV2
- NumPy
- MSS
- Computer Vision
- Deep Learning
Download the dataset from Kaggle:
https://www.kaggle.com/datasets/hahafirst/elixercounter-clash-royale-card-dataset
Extract the dataset into:
data/icons/dataset
Expected structure:
data/
└── icons/
└── dataset/
├── train/
├── val/
└── test/
Clone the repository:
git clone https://github.com/manav731/elixir-counter.git
cd elixir-counterInstall dependencies:
pip install -r requirements.txtSome files contain paths configured for my local machine.
Example:
DATA_DIR = r"C:\ElixerTracker\data\icons\dataset"or
MODEL_OUT = r"C:\ElixerTracker\models\card_classifier.pth"If these paths do not exist on your machine, change them according to where you stored the project.
Example:
DATA_DIR = r"D:\Projects\ArenaSense\data\icons\dataset"MODEL_OUT = r"D:\Projects\ArenaSense\models\card_classifier.pth"Make sure all dataset and model paths point to valid locations before running the project.
Run:
python src/train_card_classifier.pyThe script will:
- Load the dataset
- Apply data augmentation
- Train MobileNetV2
- Save the trained model automatically
Output:
models/card_classifier.pth
Training time depends on your hardware.
Run:
python src/get_region.pySelect your Clash Royale game window and note the coordinates.
Update the coordinates inside:
src/motion_detect_demo.py
Example:
monitor = {
"top": 56,
"left": 1051,
"width": 919,
"height": 1318
}These values are different for every computer.
After training and configuring screen coordinates:
python src/motion_detect_demo.pyThe system will:
- Capture the game window
- Detect troop deployments
- Classify detected cards
- Apply elixir logic
- Estimate enemy elixir in real time
You may replace the provided dataset with your own.
Required structure:
dataset/
├── train/
├── val/
└── test/
Each split should contain folders named after card classes:
train/
├── bomber/
├── knight/
├── pekka/
└── ...
After replacing the dataset, retrain using:
python src/train_card_classifier.pyelixir-counter
│
├── models
│ └── card_classifier.pth
│
├── src
│ ├── card_classifier.py
│ ├── get_region.py
│ ├── motion_detect_demo.py
│ └── train_card_classifier.py
│
├── requirements.txt
├── LICENSE.txt
└── README.md
- Computer Vision
- Deep Learning
- Transfer Learning
- Motion Detection
- Real-Time Systems
- Image Classification
- PyTorch
- OpenCV
- ML System Design
Manav Mehta
If you use this project, please consider giving the repository a star.
Released under the MIT License.