Train a Clash Royale bot in Python, on your own machine: you write the reward, it learns to win. It is the trainer for the battles RoyaleGym runs, and it uses your NVIDIA graphics card.
pip install "royalegym[all]"
This is the [learn] part, for Python 3.12. On Windows with an NVIDIA card, install PyTorch
first: Install, step 4.
from royalegym import TowerHPReward, make_env
from royalelearn import Learner
def build_env():
return make_env(reward=TowerHPReward()) # what the bot is paid for
if __name__ == "__main__":
learner = Learner(build_env, save_dir="runs/my_bot")
learner.learn(total_steps=20_000) # counts all steps so far: raise it, run again to train more
learner.save("runs/my_bot/bot")It prints one line per update. To watch your bot play, see Watch It Play.
- The docs: royalegym.github.io/RoyaleGym
- Quick Start: the first bot, step by step
- Every setting: RoyaleLearn. How it works inside (Advanced): the guide
- Questions: Discord
MIT licensed. See LICENSE.
