Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: aiarena/rust-arenaclient
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.21
Choose a base ref
...
head repository: aiarena/rust-arenaclient
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 16 commits
  • 19 files changed
  • 3 contributors

Commits on Jun 30, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6b53af5 View commit details

Commits on Jul 1, 2022

  1. Update to latest protobuf and sc2-proto-rs (#41)

    * Update to latest protobuf and sc2-proto-rs
    
    * Fix broken test
    danielvschoor authored Jul 1, 2022
    Copy the full SHA
    e4a91dd View commit details
  2. Migrate to tokio-tungstenite (#43)

    * First attempt
    
    * Implement conversion to tokio-tungstenite from websockets-rs
    
    * Formatting
    
    * Formatting
    danielvschoor authored Jul 1, 2022
    Copy the full SHA
    abc9ec1 View commit details
  3. Bump version to 0.2.0

    danielvschoor committed Jul 1, 2022
    Copy the full SHA
    02b5f05 View commit details

Commits on Jul 2, 2022

  1. Copy the full SHA
    b0a7853 View commit details
  2. Bump to version 0.2.1

    danielvschoor committed Jul 2, 2022
    Copy the full SHA
    dfdabfe View commit details
  3. Copy the full SHA
    7acc7cf View commit details
  4. Fix for async timeouts

    danielvschoor committed Jul 2, 2022
    Copy the full SHA
    0191145 View commit details
  5. Formatting

    danielvschoor committed Jul 2, 2022
    Copy the full SHA
    17d61b6 View commit details
  6. Apply clippy lints

    danielvschoor committed Jul 2, 2022
    Copy the full SHA
    91a1d01 View commit details
  7. Bump version to v0.2.2

    danielvschoor committed Jul 2, 2022
    Copy the full SHA
    6f8c6c1 View commit details

Commits on Nov 11, 2022

  1. Feature/remote shutdown (#45)

    * chore: Update dependencies
    
    * feat: Add line number to logging
    
    * feat: Add ability to shutdown server via websockets
    
    * chore: Bump pyo3 and pyo3-log
    
    * chore: Implement clippy suggestions
    
    * chore: Run cargo fmt
    danielvschoor authored Nov 11, 2022
    Copy the full SHA
    671b6fd View commit details
  2. chore: Bump to v0.2.3

    danielvschoor committed Nov 11, 2022
    Copy the full SHA
    33d31df View commit details
  3. chore: Update action versions (#46)

    * chore: Update action versions
    
    * ci: Update CI python versions
    
    Remove Python 3.7 and add Python 3.11
    danielvschoor authored Nov 11, 2022
    Copy the full SHA
    71ad9f8 View commit details
  4. Copy the full SHA
    2a24939 View commit details

Commits on Jul 31, 2023

  1. Update README.md website URL

    lladdy authored Jul 31, 2023
    Copy the full SHA
    d0294f6 View commit details
Showing with 691 additions and 596 deletions.
  1. +18 −18 .github/workflows/rust.yml
  2. +19 −15 Cargo.toml
  3. +1 −1 README.md
  4. +1 −1 rust_ac/requirements.txt
  5. +12 −1 rust_ac/supervisor.py
  6. +1 −1 src/config/race.rs
  7. +138 −190 src/controller.rs
  8. +1 −0 src/errors/mod.rs
  9. +5 −0 src/errors/proxy_error.rs
  10. +5 −10 src/handler/game.rs
  11. +49 −42 src/handler/lobby.rs
  12. +8 −5 src/handler/mod.rs
  13. +202 −201 src/handler/player.rs
  14. +1 −2 src/lib.rs
  15. +18 −2 src/main.rs
  16. +4 −4 src/portconfig.rs
  17. +113 −29 src/proxy.rs
  18. +32 −20 src/sc2process.rs
  19. +63 −54 src/server.rs
36 changes: 18 additions & 18 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -18,19 +18,19 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-dev-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-dev-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
target
@@ -48,12 +48,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

@@ -63,17 +63,17 @@ jobs:
pip install maturin
pip install -r rust_ac/requirements.txt
- name: Cache cargo registry
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-dev-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-dev-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
target
@@ -91,7 +91,7 @@ jobs:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
@@ -107,7 +107,7 @@ jobs:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
@@ -126,12 +126,12 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

@@ -141,12 +141,12 @@ jobs:
toolchain: stable
override: true
- name: Cache cargo registry
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-${{ steps.rustup.outputs.rustc_hash }}-index-${{ hashFiles('**/Cargo.lock') }}
@@ -176,7 +176,7 @@ jobs:
if: matrix.os != 'windows-latest'
run: pip install target/wheels/rust_arenaclient*.whl

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
name: upload-wheel
with:
name: wheel-many-linux
34 changes: 19 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-arenaclient"
version = "0.1.21"
version = "0.2.4"
authors = ["Daniel <danielvanschoor1997@gmail.com>"]
edition = "2018"
readme = "README.md"
@@ -19,28 +19,32 @@ requires-dist = ["portpicker", "aiohttp"]


[dependencies]
sc2-proto = { git = "https://github.com/UltraMachine/sc2-proto-rs.git" }
protobuf = { version = "^2.20.0", features = ["with-bytes"] }
sc2-proto = { git = "https://github.com/aiarena/sc2-proto-rs.git" }
protobuf = { version = "=3.2.0", features = ["with-bytes"] }
log = "^0.4.13"
env_logger = "0.9.0"
shellexpand = "^2.1.0"
regex = "^1.4.3"
portpicker = { git = "https://github.com/aiarena/portpicker-rs" }
portpicker = { git = "https://github.com/aiarena/portpicker-rs" }
tempfile = "3.1.0"
crossbeam = "^0.8.0"
crossbeam = "^0.8.1"
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
bincode = {version="^1.3.1", optional=true}
bincode = { version = "^1.3.1", optional = true }
csv = "1.1.3"
pyo3-log = {version="^0.4.0", optional=true}
pyo3-log = { version= "0.7.0", optional=true }
tokio = { version = "1.19.0", features = ["time","macros","rt","rt-multi-thread"] }
futures-util = "0.3.21"
anyhow = "1.0.58"
chrono = "0.4.22"

[dependencies.websocket]
git = "https://github.com/aiarena/rust-websocket"
default-features = false
[dependencies.tokio-tungstenite]
version = "0.17.2"

[dependencies.pyo3]
version = "^0.14"
version = "0.17.3"
optional = true
features=["auto-initialize"]
features = ["auto-initialize"]

[features]
extension-module = ["bincode", "pyo3", "pyo3-log", "pyo3/extension-module"]
@@ -52,13 +56,13 @@ build = ["bincode", "pyo3", "pyo3-log"]

[profile.release]
opt-level = 3
debug=false
panic="abort"
debug = false
panic = "abort"
lto = "fat"
codegen-units = 1

[profile.release.package."*"]
opt-level = 3
debug=false
debug = false
codegen-units = 1

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rust-arenaclient

rust-arenaclient was created for [ai-arena](https://ai-arena.net/) to act as a proxy between
rust-arenaclient was created for [ai-arena](https://aiarena.net/) 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](https://github.com/pyo3/pyo3).

2 changes: 1 addition & 1 deletion rust_ac/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
portpicker==1.4.0
portpicker==1.5.2
aiohttp>=3.7.4
13 changes: 12 additions & 1 deletion rust_ac/supervisor.py
Original file line number Diff line number Diff line change
@@ -40,12 +40,23 @@ def __init__(self, ip_addr: str, config: Optional[GameConfig] = None):
else:
self._config: GameConfig = config

async def shutdown_request(self):
"""
Connects to address with headers
"""
headers = {"shutdown": "true"}
addr = self._parse_url()

session = ClientSession()
await session.ws_connect(addr, headers=headers)
return

async def connect(self):
"""
Connects to address with headers
"""
ws, session = None, None
headers = {"Supervisor": "true"}
headers = {"supervisor": "true"}
addr = self._parse_url()
for i in range(60):
await asyncio.sleep(1)
2 changes: 1 addition & 1 deletion src/config/race.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::sc2::Race;

#[derive(PartialOrd, PartialEq, Debug)]
#[derive(PartialOrd, PartialEq, Eq, Debug)]
pub enum BotRace {
NoRace = 0,
Terran = 1,
Loading