Metadata-Version: 2.4
Name: pachinko-pybind
Version: 0.9.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Games/Entertainment :: Real Time Strategy
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: numpy>=1.21
Requires-Dist: gymnasium>=0.26
Requires-Dist: requests>=2.28
Requires-Dist: websocket-client>=1.5
Requires-Dist: stable-baselines3>=2.0 ; extra == 'train'
Requires-Dist: sb3-contrib>=2.0 ; extra == 'train'
Provides-Extra: train
Summary: Python bot SDK, Gymnasium RL environment, and offline engine for Pachinko-RTS
Keywords: rts,game,bot,reinforcement-learning,gymnasium,pachinko
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://pachinko-rts.com/bots
Project-URL: Example Bot, https://github.com/Slaggamuffin/pachinko-rts-bot
Project-URL: Homepage, https://pachinko-rts.com

# pachinko-pybind

The official Python SDK for [Pachinko-RTS](https://pachinko-rts.com) — a
real-time-strategy game with a poker-style betting layer, built to be played
by bots. Write a bot, test it offline against the built-in AI, train an RL
policy in the Gymnasium environment, then connect it to the live server.

**Docs & getting started: [pachinko-rts.com/bots](https://pachinko-rts.com/bots)**
· **Example bot repo: [Slaggamuffin/pachinko-rts-bot](https://github.com/Slaggamuffin/pachinko-rts-bot)**

## What's in the wheel

| Package | What it is |
|---|---|
| `pachinko_sdk` | Bot API (pure Python): `Bot` base class, typed game state, actions, betting hooks, offline runner (`run_local`), live-server client (`run_online`) |
| `pachinko_gym` | Gymnasium environment for RL training — tensor observations, self-play from any seat, batch evaluation |
| `pachinko_pybind` | The compiled game engine core (Rust, via PyO3) that powers offline play — the exact engine the live server runs |

## Quickstart

```bash
pip install pachinko-pybind
```

```python
from pachinko_sdk import Bot, AttackMoveGroup, run_local

class Rusher(Bot):
    def on_tick(self, state):
        if not state.enemy_units:
            return []
        target = state.enemy_units[0]
        return [AttackMoveGroup([u.id for u in state.my_units], target.x, target.y)]

result = run_local(Rusher(), num_players=2, seed=42)
print(result.placement, result.net_chips)
```

Betting is optional to engage with — the `Bot` defaults auto-call every
betting round, so an RTS-only bot works out of the box. Override
`on_bet_action` / `on_mulligan` when you want to play the chips too.

Offline play is identical to live play: `run_local` runs the server's match
rules (time cap and score tiebreak, betting every 5 minutes, the command rate
limit, settlement, the live economy) and drives your bot with the same SDK code
as `run_online`, so it gets the same `GameState` and callbacks. For training,
`pachinko_pybind.LiveGame` is the same match step by step (with multi-game
stepping on all cores, snapshots, and built-in-AI labels), and the
`pachinko_gym` environment uses the same rules. Every rule can be switched off
for an experiment.

To play on the live server, create a bot account at
[pachinko-rts.com](https://pachinko-rts.com), then:

```python
from pachinko_sdk import run_online
run_online(MyBot(), "https://pachinko-rts.com/orchestrator", bot_token="...")
```

Full API reference, RL training guide, and worked examples:
[pachinko-rts.com/bots](https://pachinko-rts.com/bots).

## Supported platforms

Prebuilt wheels for Python 3.9+ on:

- Linux x86_64 / aarch64 (manylinux and musllinux)
- macOS arm64
- Windows x64

## Provenance & source

The engine core is the closed-source engine of the live game, so this package
ships as prebuilt wheels only (no sdist). What you can verify:

- **Every release is built and published from GitHub Actions via
  [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/)** —
  no human ever handles the wheels or an API token. Each file on PyPI carries
  a provenance attestation; see the *"details"* link next to any file under
  [Download files](https://pypi.org/project/pachinko-pybind/#files).
- The Python halves (`pachinko_sdk`, `pachinko_gym`) ship as readable source
  inside the wheel — `pip download pachinko-pybind` and unzip it to audit
  them. The SDK makes network connections only when *you* call
  `run_online` / `run`, and only to the server URL you pass it.

## License

MIT.

