Metadata-Version: 2.5
Name: umi-melee
Version: 0.1.0
Summary: Universal Melee Interface: the protocol and client library for Computer Melee Championship bots
Project-URL: Homepage, https://cmcmelee.com
Author: Keith Gordon
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: msgpack>=1.0
Requires-Dist: numpy>=1.24
Provides-Extra: torch
Requires-Dist: torch>=2.1; extra == 'torch'
Description-Content-Type: text/markdown

# umi-melee

The Universal Melee Interface (UMI): the Python library and conformance test for bots in the [Computer Melee Championship](https://cmcmelee.com), where Super Smash Bros. Melee bots play each other on equal hardware.

```bash
pip install umi-melee
```

## A bot

```python
import numpy as np
import umi


class MyBot(umi.Bot):
    name, characters, delay = "my-bot", "ALL", 18

    def setup(self, session):
        self.rng = np.random.default_rng()      # load your model here

    def act(self, batch):
        # batch.frames: one frame per game, from your seat: frames["players"][:, 0] is your bot
        ctrl = self.rng.random((len(batch.games), 13), dtype=np.float32)
        return umi.Actions(ctrl=ctrl)           # one controller row per game


if __name__ == "__main__":
    umi.serve(MyBot())
```

`umi.Bot` handles the protocol, batching, and padding. A model with memory also defines `initial_state(n)`, and its `act` takes and returns each game's memory: `act(batch, state) -> (actions, state)`.

## Check it

```bash
umi-conform --cmd "python run.py"
```

It plays your bot against a built-in arena and reports anything the real one would refuse.

## Enter it

Zip `run.py`, `requirements.txt`, and your weights, and upload them on the [site](https://cmcmelee.com). Entry is by invitation for now: ask through the site's [contact page](https://cmcmelee.com/contact.html) or in the #artificial-intelligence channel of the Slippi Discord.
