Skip to content

Repository files navigation

The RoyaleSim logo: a red crown shield with a white gear on it, outlined in gold

RoyaleSim

CI License Python Docs Discord Last commit

Engine: Rust, whole numbers only Tick: 50 ms, 20 per second Coordinates: 18,000 units to one tile

The Clash Royale battle engine your bot plays in. It runs the whole match on your own machine. Most people use it through RoyaleGym and never call it directly.

An engine battle in the RoyaleViser viewer, 18 units on the board

Install

pip install "royalegym[all]" --find-links https://github.com/RoyaleGym/RoyaleGym/releases/expanded_assets/v0.1.1

That installs this engine and everything else, on 3.12, 3.13 or 3.14 (the engine alone runs on 3.10 to 3.14). Install has more.

Try it

import json, royalesim

b = royalesim.Battle(card_names=None, slot_of_k=[[0, 1, 2], [0, 1, 2]])
ids = {row[0]: i for i, row in enumerate(json.loads(b.catalogue_json()))}
deck = [ids[n] for n in ["Knight", "Archer", "Goblins", "Giant", "Musketeer", "Fireball", "Arrows", "Skeletons"]]
b.reset(seed=0, decks=[deck, deck], shuffle=1, start_tick=0, elixir_milli=[5000, 5000], tower_hp=None, spawns=[])
b.step([], 100)                                          # nobody can play in the opening seconds
r = b.step([(0, 0, 9000 * 18, 10000 * 18)], 20)         # blue plays its first card, then 20 ticks pass
print(json.loads(b.state_json())["tick"], royalesim.DEPLOY_REASONS[r[0][1]])   # 120 OK

Next

  • The engine's Python API: API
  • How it works inside, how fast and how accurate it is, building from source: Engine
  • Questions: Discord

MIT License.

About

The Clash Royale battle engine your bot plays in. Written in Rust, used from Python, no game needed.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages