Skip to content

Install and configure the bot

Wiki: Bot Installation Setup Guide


Prerequisites

  • Linux or Windows on x86-64. The bot is only tested on Linux.

To change the bot or write actions for your own deck, set it up from the source code instead: see Bot Development, Setting up.

Step 1: Install uv

uv is a standalone tool that manages Python versions and environments automatically. If you already have it (uv --version), skip to Step 2.

  • Open a terminal (on Windows, PowerShell) and install uv:
  • Linux:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  • Windows, in PowerShell:
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  • Restart your terminal so uv is on your PATH, then check it works with uv --version.

Step 2: Install the Bot

  • Install the bot with uv:
    uv tool install --python 3.12 https://github.com/Pbatch/ClashRoyaleBuildABot/archive/refs/heads/main.zip
    
    uv downloads the bot and everything it needs, including Python 3.12 if you don't have it, into a folder of its own. You don't need Git or a separate Python.
  • If uv warns that its folder isn't on your PATH, run this, then open a new terminal:
    uv tool update-shell
    

Step 3: Run Setup

  • Download the rest of what the bot needs:
    clashroyalebuildabot install
    
  • This downloads the bot's own copy of ADB (which it uses to talk to your device) and the bot's OpenVINO models (from Hugging Face) into the bot's data folder. Running it again keeps what's already there. If you skip this step, the bot downloads ADB and the models when it starts (and updates them when a new version of the bot needs newer ones).
  • To run the bot's ADB yourself, put clashroyalebuildabot in front of the command, for example clashroyalebuildabot adb devices.

Testing the Bot

Now, let's verify that the bot operates correctly:

  • Ensure you're in the Clash Royale lobby.
  • Start the bot:
    clashroyalebuildabot
    
  • In the web UI that opens in your browser, check the device serial in the settings (run clashroyalebuildabot adb devices to find it, or see Connecting a Phone). If the configured device isn't found, the bot uses the first connected device.
  • Press start (▶) to start the bot. Press it again (■) to stop.
  • To run the bot without opening a browser, or to control it from scripts, see The Web UI and the HTTP API.

The installed bot plays the deck it ships with: Archers, Goblin Barrel, Baby Dragon, Cannon, Knight, Mini P.E.K.K.A, Musketeer and Witch. To play another deck, write actions for it from the source code (see Bot Development), or let your own program choose the plays over the HTTP API.

Where the Bot Keeps Its Files

The bot keeps your settings, its debug output (logs, screenshots and labels), its copy of ADB and the downloaded models in a data folder of its own:

System Data folder
Linux ~/.local/share/clashroyalebuildabot (or $XDG_DATA_HOME/clashroyalebuildabot)
Windows %LOCALAPPDATA%\ClashRoyaleBuildABot

The bot prints the folder when it starts. Updates never touch it. Run from the source code, the bot uses the project folder instead.

Configuration

The default settings are in clashroyalebuildabot/default_config.yaml. They're part of the bot, and updates replace them.

To change a setting (including your 8-card bot.deck), either change it in the web UI's settings and press Save to config.yaml, or create config.yaml in the data folder yourself. It only needs the settings you want to change, in the same sections as the defaults:

ingame:
  play_action: 1.5
To go back to the defaults, delete it.

Updating

The bot doesn't update itself. To get the latest version, run:

uv tool upgrade --reinstall clashroyalebuildabot
--reinstall makes uv download the bot again. Without it, uv keeps the copy it has. Your settings in config.yaml are never touched by updates (see Configuration).

Updating from an older version

Older versions were run from a clone of the repository, with uv run python main.py. To switch to the installed bot, install it as above, then copy the config.yaml from your clone into the data folder. Move anything you want to keep out of the clone's debug folder, then delete the clone.

Uninstalling

uv tool uninstall clashroyalebuildabot
This leaves your data folder. Delete it too to remove your settings and debug output.