Skip to main content

No project description provided

Project description

rust-arenaclient

rust-arenaclient was created for ai-arena to act as a proxy between bots and StarCraft II. It was originally written entirely in Python, but due to performance concerns, was rewritten using Rust + pyo3.

It can be used as a stand-alone binary or as a Python library for convenience.

Installation

You can install rust_arenaclient using:

pip install rust_arenaclient

or alternatively build a binary from source using

cargo build --bin rust_ac_bin

Usage

Python

from rust_ac import Server

server = Server("127.0.0.1:8642")
server.run()

Binary

Currently the proxy server starts on 127.0.0.1:8642 when launched. Future updates will enable the user to specify host and port using command line arguments, after which this README will be updated.

Running a game

rust_arenaclient was made for the purpose of being part of a bigger system to run StarCraft II games. The system will interact with the rust_arenaclient through websockets and is known as a supervisor. rust_arenaclient only acts as a proxy between bots and StarCraft II. The starting of bots and creating game config is the supervisor's job. Example of an extremely basic supervisor script in Python:

import os, subprocess, asyncio, aiohttp
from rust_ac import Server

from rust_ac.match_runner import MatchRunner
from rust_ac import GameConfig


m = MatchRunner(bot_directory=r"D:\desktop backup\aiarenaclient\aiarena-client\aiarena-test-bots")
result = m.run_game(game=GameConfig('AutomatonLE', 'loser_bot', 'MicroMachine'))  # One game

games = [GameConfig('AutomatonLE', 'loser_bot', 'basic_bot') for _ in range(20)]

results = m.run_games_multiple(games=games, instances=3)  # Multiple games - Run 3 games at a time

Logging

Logging is done via the handly pyo3-log crate. To get the Rust logs in Python, initialize the logging library before importing rust-arenaclient, i.e.

import os, subprocess, asyncio, aiohttp
import logging # Needs to be imported before importing rust_ac
logging.getLogger().setLevel(logging.DEBUG) # Set debugging level
logging.basicConfig(filename="log.txt", level=logging.DEBUG, filemode="w+") # Write logs to a file called "log.txt"
logging.info("") # Needed to initialize logging
from rust_ac import Server

from rust_ac.match_runner import MatchRunner
from rust_ac import GameConfig


m = MatchRunner(bot_directory=r"D:\desktop backup\aiarenaclient\aiarena-client\aiarena-test-bots")
...

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

rust_arenaclient-0.2.4-cp311-none-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.11 Windows x86-64

rust_arenaclient-0.2.4-cp311-cp311-manylinux_2_31_x86_64.whl (798.2 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.31+ x86-64

rust_arenaclient-0.2.4-cp310-none-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.10 Windows x86-64

rust_arenaclient-0.2.4-cp310-cp310-manylinux_2_31_x86_64.whl (798.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

rust_arenaclient-0.2.4-cp39-none-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.9 Windows x86-64

rust_arenaclient-0.2.4-cp39-cp39-manylinux_2_31_x86_64.whl (798.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

rust_arenaclient-0.2.4-cp38-none-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

rust_arenaclient-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl (798.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

File details

Details for the file rust_arenaclient-0.2.4-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 193cda2f7a5ab1fc0ed8a36c138b4ad854031d115c8c6964a6caccb6572b0101
MD5 b5c68cfa11e4fc223e098099e0d82947
BLAKE2b-256 9ee6c7b50339d4013f9c211d41617edb8e43972ee53a5e4e4e229a856183d63b

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 38f36f564f2def7ed52a60ecf8794618163bc2db065a56c49d0b7d97e20d66b1
MD5 fd344f9c2386de5bf5652f461a97eba0
BLAKE2b-256 2723ed4f8ed130fbad811cfa3719aff596c30c933e065d1de98c673fa919fbcc

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 aa98a48bac293c09899cd4676fa5f0a6fe29ce96f56f9e0e919fbe9c28e432d8
MD5 983bd7e99ea4188d3c0c4a2c543e2f37
BLAKE2b-256 3fad67bafb6407eaf99d39d73751ceaf0b8b1378a9222bc3cf54c78a5be2ca14

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 ee65e765761d2ed40ea2f797b20e38287a82ee33e02ee94554eec239c0e44cc7
MD5 59b39e14129deeba85a728b89ae3e23d
BLAKE2b-256 95ac9415401073b168f3c8cc9d4728fd25566a5a0d814c5947c6e59f9982a1ec

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 87bc13640e86ddcda8ea2ea946309db288e60c74bd4694a4def990b1ac0e816c
MD5 e39cb34e1ccc9d2b90cdc5c1d9e27a08
BLAKE2b-256 a40804288758bd2d3a89fbaf19a5620b533d7b76fb75526def8dd7c011ffed04

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 bf371a00bd4310926a0a471d7816a090a93d1849387e9d1b2c108d17a7b4d13e
MD5 286da90ec1aa323106856e4cba227f56
BLAKE2b-256 099e7fc96dc75183a30fc7020b055ed068671a69bb92e74c94cea0bd5491ef85

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 e45e7b0826e27d35af367f0eb57f065488ec1d0c10bc34fd672d9542aea497de
MD5 8c0f94359d9625052dbcc570252f5839
BLAKE2b-256 a72cacaa480cdbd7141d7f6e5985be6b4c8a29e56a61732fc36c814c93eddaac

See more details on using hashes here.

File details

Details for the file rust_arenaclient-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rust_arenaclient-0.2.4-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 8afcd656377ce76c3c1b5f2542d4b228f8eba9195b67f8ffe73b8f3bbb6d1940
MD5 c47afe81a78dc20e284bdde93fcf62c1
BLAKE2b-256 f4f430511e1141cff84a32fe5fd9552a9f00cdfaf207405ae8bf4e42022c7e50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page