How joellim31314/clashbot works
ClashBot automates Clash Royale in an Android emulator: it captures each frame, classifies the screen and battle scene, chooses a Hog 2.6 action, then taps or swipes through emulator control. The runtime also handles menus and post-battle screens. Perception combines pixel-based state and elixir checks, YOLO arena detections, and template-matched hand cards; strategy consumes that scene. A separate model-development branch generates synthetic detection data and trains YOLO. Unsampled modules are included only where README capabilities and the visible entry-point wiring support their roles.
Main entry points: main.py Game loop · state.py State and scene detection · strategy.py Hog 2.6 strategy · screen.py Frame capture
Components 16
Bot Runtime
- Game loop
main.py - Game configuration
config.py
Game Perception
- Frame capture
bot/screen.py - State and scene detection
bot/state.py - Arena detection
bot/vision.py - Hand card matching
bot/vision.py
Strategy And Actions
- Scene and action data
bot/models.py - Hog 2.6 strategy
bot/strategy.py - Emulator actions
bot/actions.py
Detection Model Development
- Synthetic data generation
data/generate_training_data.py - Dataset definition
data/dataset.yaml - YOLO training
data/train_yolo.py
Other components
- Bot operator
- Android emulator
- Sprite library and backgrounds
- YOLO framework
Connections 24
- Bot operator → Game loop: starts
- Game loop → Frame capture: creates capture
- Game loop → State and scene detection: creates detector
- Game loop → Arena detection: initializes
- Game loop → Hand card matching: initializes
- Game loop → Hog 2.6 strategy: creates strategy
- Game loop → Emulator actions: creates executor
- Frame capture → Android emulator: captures frames
- State and scene detection → Frame capture: requests frames
- State and scene detection → Arena detection: detects arena
- State and scene detection → Hand card matching: identifies hand
- State and scene detection → Scene and action data: builds battle scene
- State and scene detection → Game configuration: reads thresholds
- Game loop → State and scene detection: captures and classifies
- Game loop → State and scene detection: requests battle scene
- Game loop → Hog 2.6 strategy: decides action
- Hog 2.6 strategy → Scene and action data: reads scene returns action
- Hog 2.6 strategy → Game configuration: reads deck rules
- Game loop → Emulator actions: dispatches taps and plays
- Emulator actions → Android emulator: sends taps and swipes
- Synthetic data generation → Sprite library and backgrounds: loads inputs
- Synthetic data generation → Dataset definition: generates training data
- YOLO training → Dataset definition: trains from definition
- YOLO training → YOLO framework: trains model