Metadata-Version: 2.4
Name: royalesim
Version: 0.1.13
Requires-Dist: numpy>=2.0 ; extra == 'dev'
Requires-Dist: msgspec>=0.19 ; extra == 'dev'
Requires-Dist: pytest>=8.0 ; extra == 'dev'
Requires-Dist: hypothesis>=6.100 ; extra == 'dev'
Requires-Dist: ruff>=0.16 ; extra == 'dev'
Requires-Dist: mypy>=2.0 ; extra == 'dev'
Requires-Dist: maturin>=1.15,<2.0 ; extra == 'dev'
Requires-Dist: opencv-python>=4.10 ; extra == 'oracle'
Provides-Extra: dev
Provides-Extra: oracle
License-File: LICENSE
Summary: RoyaleSim: deterministic, integer-only Clash Royale battle engine (Rust, PyO3 binding)
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

<p align="center"><img src="docs/media/logo.png" width="128" alt="The RoyaleSim logo: a red crown shield with a white gear on it, outlined in gold"></p><h1 align="center">RoyaleSim</h1>

<p align="center"><a href="https://github.com/RoyaleGym/RoyaleSim/actions/workflows/suite.yml"><img alt="CI" src="https://github.com/RoyaleGym/RoyaleSim/actions/workflows/suite.yml/badge.svg"></a> <img alt="License" src="https://img.shields.io/github/license/RoyaleGym/RoyaleSim?style=flat-square&color=555"> <img alt="Python" src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB?style=flat-square&logo=python&logoColor=white"> <a href="https://royalegym.github.io/RoyaleGym/"><img alt="Docs" src="https://img.shields.io/badge/docs-royalegym.github.io-8957e5?style=flat-square&logo=readthedocs&logoColor=white"></a> <a href="https://discord.gg/4D2BS5JBHP"><img alt="Discord" src="https://img.shields.io/discord/1551699576304705647?style=flat-square&logo=discord&logoColor=white&label=discord&color=5865F2"></a> <img alt="Last commit" src="https://img.shields.io/github/last-commit/RoyaleGym/RoyaleSim?style=flat-square&color=555"></p>

<p align="center"><img alt="Engine: Rust, whole numbers only" src="https://img.shields.io/badge/engine-Rust%2C%20whole%20numbers%20only-DEA584?style=flat-square&logo=rust&logoColor=white"> <img alt="Tick: 50 ms, 20 per second" src="https://img.shields.io/badge/tick-50%20ms%2C%2020%20per%20second-555?style=flat-square"> <img alt="Coordinates: 18,000 units to one tile" src="https://img.shields.io/badge/coordinates-18%2C000%20per%20tile-555?style=flat-square"></p>

The Clash Royale battle engine your bot plays in. It runs the whole match on your own machine.
Most people use it through [RoyaleGym](https://github.com/RoyaleGym/RoyaleGym) and never call it directly.

<p align="center"><img src="docs/media/battle-page.gif" width="100%" alt="An engine battle in the RoyaleViser viewer, 18 units on the board"></p>

## Install

```bash
pip install "royalegym[all]"
```

That installs this engine and everything else. Use Python 3.12. [Install](https://royalegym.github.io/RoyaleGym/install/) has more.

## Try it

```python
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](https://royalegym.github.io/RoyaleGym/repos/royalesim/api/)
- How it works inside, how fast and how accurate it is, building from source: [Engine](https://royalegym.github.io/RoyaleGym/repos/royalesim/engine/)
- Questions: [Discord](https://discord.gg/4D2BS5JBHP)

MIT License.

