victris-arena-sim 0.90.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- victris_arena_sim-0.90.0/LICENSE +21 -0
- victris_arena_sim-0.90.0/NOTICE.md +54 -0
- victris_arena_sim-0.90.0/PKG-INFO +77 -0
- victris_arena_sim-0.90.0/README.md +42 -0
- victris_arena_sim-0.90.0/pyproject.toml +52 -0
- victris_arena_sim-0.90.0/src/arena_sim/CHANGELOG.md +1808 -0
- victris_arena_sim-0.90.0/src/arena_sim/__init__.py +26 -0
- victris_arena_sim-0.90.0/src/arena_sim/__main__.py +40 -0
- victris_arena_sim-0.90.0/src/arena_sim/_check.py +102 -0
- victris_arena_sim-0.90.0/src/arena_sim/_core.py +165 -0
- victris_arena_sim-0.90.0/src/arena_sim/_data.py +181 -0
- victris_arena_sim-0.90.0/src/arena_sim/_release.py +80 -0
- victris_arena_sim-0.90.0/src/arena_sim/_script.py +228 -0
- victris_arena_sim-0.90.0/src/arena_sim/arena-sim.js +12006 -0
- victris_arena_sim-0.90.0/src/arena_sim/arena-sim.js.map +1 -0
- victris_arena_sim-0.90.0/src/arena_sim/encoding.py +218 -0
- victris_arena_sim-0.90.0/src/arena_sim/envs.py +298 -0
- victris_arena_sim-0.90.0/src/arena_sim/examples/__init__.py +1 -0
- victris_arena_sim-0.90.0/src/arena_sim/examples/imitate.py +113 -0
- victris_arena_sim-0.90.0/src/arena_sim/examples/league.py +153 -0
- victris_arena_sim-0.90.0/src/arena_sim/examples/train_ppo.py +88 -0
- victris_arena_sim-0.90.0/src/arena_sim/examples/train_ppo_gpu.py +331 -0
- victris_arena_sim-0.90.0/src/arena_sim/fast.py +639 -0
- victris_arena_sim-0.90.0/src/arena_sim/multiagent.py +79 -0
- victris_arena_sim-0.90.0/src/arena_sim/sb3.py +90 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Victris AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The simulator in `sim/` and `python/` bundles these packages.
|
|
4
|
+
|
|
5
|
+
## obscenity 0.4.6
|
|
6
|
+
|
|
7
|
+
# The MIT License (MIT)
|
|
8
|
+
|
|
9
|
+
Copyright © 2025 Joseph Liu.
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person
|
|
12
|
+
obtaining a copy of this software and associated documentation
|
|
13
|
+
files (the “Software”), to deal in the Software without
|
|
14
|
+
restriction, including without limitation the rights to use,
|
|
15
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the
|
|
17
|
+
Software is furnished to do so, subject to the following
|
|
18
|
+
conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be
|
|
21
|
+
included in all copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
25
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
27
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
28
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
29
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
30
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
31
|
+
|
|
32
|
+
## zod 4.6.7
|
|
33
|
+
|
|
34
|
+
MIT License
|
|
35
|
+
|
|
36
|
+
Copyright (c) 2025 Colin McDonnell
|
|
37
|
+
|
|
38
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
40
|
+
in the Software without restriction, including without limitation the rights
|
|
41
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
42
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
43
|
+
furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all
|
|
46
|
+
copies or substantial portions of the Software.
|
|
47
|
+
|
|
48
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
49
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
50
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
51
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
52
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
53
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
|
+
SOFTWARE.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: victris-arena-sim
|
|
3
|
+
Version: 0.90.0
|
|
4
|
+
Summary: Victris Arena's simulator for Python: the ladder's own match code in embedded V8, with Gymnasium and PettingZoo environments
|
|
5
|
+
Project-URL: Homepage, https://victrisarena.com
|
|
6
|
+
Project-URL: Documentation, https://victrisarena.com/guide/simulator
|
|
7
|
+
Project-URL: Source, https://github.com/Victris-AI/victris-arena-sdk
|
|
8
|
+
Project-URL: Changelog, https://victrisarena.com/changelog
|
|
9
|
+
Author: Victris AI
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE.md
|
|
13
|
+
Keywords: bots,game-ai,gymnasium,pettingzoo,reinforcement-learning,simulator,victris-arena
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Games/Entertainment
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: gymnasium>=1.1
|
|
19
|
+
Requires-Dist: mini-racer>=0.12
|
|
20
|
+
Requires-Dist: numpy>=1.24
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pettingzoo>=1.24; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
24
|
+
Requires-Dist: sb3-contrib>=2.3; extra == 'dev'
|
|
25
|
+
Requires-Dist: stable-baselines3>=2.3; extra == 'dev'
|
|
26
|
+
Requires-Dist: torch>=2.3; extra == 'dev'
|
|
27
|
+
Provides-Extra: pettingzoo
|
|
28
|
+
Requires-Dist: pettingzoo>=1.24; extra == 'pettingzoo'
|
|
29
|
+
Provides-Extra: sb3
|
|
30
|
+
Requires-Dist: sb3-contrib>=2.3; extra == 'sb3'
|
|
31
|
+
Requires-Dist: stable-baselines3>=2.3; extra == 'sb3'
|
|
32
|
+
Provides-Extra: torch
|
|
33
|
+
Requires-Dist: torch>=2.3; extra == 'torch'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# arena-sim
|
|
37
|
+
|
|
38
|
+
Victris Arena's simulator for Python: the ladder's own match code (`arena-sim.js`, built from
|
|
39
|
+
`packages/sim`) run in embedded V8 through [mini-racer](https://pypi.org/project/mini-racer/),
|
|
40
|
+
with Gymnasium and PettingZoo environments. No Node.js needed.
|
|
41
|
+
|
|
42
|
+
- `Simulator(num_games)`: many games stepped in one call, any mix of Random and starter opponents and self-play.
|
|
43
|
+
- `ArenaEnv`, `ArenaVectorEnv`: Gymnasium environments, one match an episode against Random or the starter bot,
|
|
44
|
+
or (vector) against your own policies and scripted bots.
|
|
45
|
+
- `ArenaSelfPlayEnv`: batched self-play, both fighters of every match yours.
|
|
46
|
+
- `FastVectorEnv`, `FastSelfPlayEnv`: the same matches encoded inside the simulator and read in
|
|
47
|
+
place (no JSON), about 7 times faster a process, and split over worker processes with `workers=N`.
|
|
48
|
+
`scripts=` loads JavaScript that registers your own bots (opponents, teachers) and encoders;
|
|
49
|
+
`ScriptedOpponent`s (bots written in Python) play and teach there too.
|
|
50
|
+
- `ScriptEncoder`: an encoder from the simulator in a live Python bot; `check_encoder` checks one
|
|
51
|
+
reads the ladder's JSON as it reads the batch.
|
|
52
|
+
- `arena_sim.sb3.ArenaVecEnv`: the batched environments for Stable-Baselines3 and sb3-contrib's
|
|
53
|
+
`MaskablePPO` (the `sb3` extra).
|
|
54
|
+
- `python -m arena_sim.examples.train_ppo`: a complete PPO training run (curriculum against
|
|
55
|
+
Random, then the starter bot) to start from.
|
|
56
|
+
- `python -m arena_sim.examples.train_ppo_gpu`: the same curriculum in plain PyTorch, built for a GPU
|
|
57
|
+
(the fast environments, byte grids, rollouts on the device, CUDA graphs), training against
|
|
58
|
+
Random, then `ts-starter` (the `torch` extra, or a CUDA build of torch).
|
|
59
|
+
- `download_replays`, `replay_trajectories`, `replay_dataset`: ladder games as training data, each
|
|
60
|
+
fighter's observations and turns rebuilt from the replay, or encoded straight into arrays.
|
|
61
|
+
- `python -m arena_sim.examples.imitate` and `python -m arena_sim.examples.league`: imitation of the
|
|
62
|
+
ladder's strongest bots, and PPO against a pool of bots and copies of yourself.
|
|
63
|
+
- `arena_sim.multiagent.ArenaParallelEnv`: PettingZoo self-play (the `pettingzoo` extra).
|
|
64
|
+
- `Raw` passes the ladder's JSON through; `Basic` is a reference encoder to start from.
|
|
65
|
+
|
|
66
|
+
Players install the wheel the ladder serves (`GET /api` → `simulator.python`); see
|
|
67
|
+
`docs/SIMULATOR.md` (`/docs/simulator` on a ladder). `python -m arena_sim check <ladder URL>` says
|
|
68
|
+
whether an installed copy is the release that ladder runs. Without contacting anyone, it also
|
|
69
|
+
warns (`OutdatedSimulatorWarning`) when a live match's hello (`Basic`, `ScriptEncoder`,
|
|
70
|
+
`check_hello`) or downloaded replays were played on other rules.
|
|
71
|
+
`python -m arena_sim changelog` prints the release notes since this release, and
|
|
72
|
+
`python -m arena_sim source <dir>` the TypeScript it was built from (the wheel carries
|
|
73
|
+
`arena-sim.js.map` and `CHANGELOG.md`). The package's version is the game's `RELEASE`, read from
|
|
74
|
+
`arena-sim.js` when the wheel is built.
|
|
75
|
+
|
|
76
|
+
Developing: `bun run build:py` builds the wheel into `dist/`, `bun run test:py` runs the tests
|
|
77
|
+
(both need [uv](https://docs.astral.sh/uv/)).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# arena-sim
|
|
2
|
+
|
|
3
|
+
Victris Arena's simulator for Python: the ladder's own match code (`arena-sim.js`, built from
|
|
4
|
+
`packages/sim`) run in embedded V8 through [mini-racer](https://pypi.org/project/mini-racer/),
|
|
5
|
+
with Gymnasium and PettingZoo environments. No Node.js needed.
|
|
6
|
+
|
|
7
|
+
- `Simulator(num_games)`: many games stepped in one call, any mix of Random and starter opponents and self-play.
|
|
8
|
+
- `ArenaEnv`, `ArenaVectorEnv`: Gymnasium environments, one match an episode against Random or the starter bot,
|
|
9
|
+
or (vector) against your own policies and scripted bots.
|
|
10
|
+
- `ArenaSelfPlayEnv`: batched self-play, both fighters of every match yours.
|
|
11
|
+
- `FastVectorEnv`, `FastSelfPlayEnv`: the same matches encoded inside the simulator and read in
|
|
12
|
+
place (no JSON), about 7 times faster a process, and split over worker processes with `workers=N`.
|
|
13
|
+
`scripts=` loads JavaScript that registers your own bots (opponents, teachers) and encoders;
|
|
14
|
+
`ScriptedOpponent`s (bots written in Python) play and teach there too.
|
|
15
|
+
- `ScriptEncoder`: an encoder from the simulator in a live Python bot; `check_encoder` checks one
|
|
16
|
+
reads the ladder's JSON as it reads the batch.
|
|
17
|
+
- `arena_sim.sb3.ArenaVecEnv`: the batched environments for Stable-Baselines3 and sb3-contrib's
|
|
18
|
+
`MaskablePPO` (the `sb3` extra).
|
|
19
|
+
- `python -m arena_sim.examples.train_ppo`: a complete PPO training run (curriculum against
|
|
20
|
+
Random, then the starter bot) to start from.
|
|
21
|
+
- `python -m arena_sim.examples.train_ppo_gpu`: the same curriculum in plain PyTorch, built for a GPU
|
|
22
|
+
(the fast environments, byte grids, rollouts on the device, CUDA graphs), training against
|
|
23
|
+
Random, then `ts-starter` (the `torch` extra, or a CUDA build of torch).
|
|
24
|
+
- `download_replays`, `replay_trajectories`, `replay_dataset`: ladder games as training data, each
|
|
25
|
+
fighter's observations and turns rebuilt from the replay, or encoded straight into arrays.
|
|
26
|
+
- `python -m arena_sim.examples.imitate` and `python -m arena_sim.examples.league`: imitation of the
|
|
27
|
+
ladder's strongest bots, and PPO against a pool of bots and copies of yourself.
|
|
28
|
+
- `arena_sim.multiagent.ArenaParallelEnv`: PettingZoo self-play (the `pettingzoo` extra).
|
|
29
|
+
- `Raw` passes the ladder's JSON through; `Basic` is a reference encoder to start from.
|
|
30
|
+
|
|
31
|
+
Players install the wheel the ladder serves (`GET /api` → `simulator.python`); see
|
|
32
|
+
`docs/SIMULATOR.md` (`/docs/simulator` on a ladder). `python -m arena_sim check <ladder URL>` says
|
|
33
|
+
whether an installed copy is the release that ladder runs. Without contacting anyone, it also
|
|
34
|
+
warns (`OutdatedSimulatorWarning`) when a live match's hello (`Basic`, `ScriptEncoder`,
|
|
35
|
+
`check_hello`) or downloaded replays were played on other rules.
|
|
36
|
+
`python -m arena_sim changelog` prints the release notes since this release, and
|
|
37
|
+
`python -m arena_sim source <dir>` the TypeScript it was built from (the wheel carries
|
|
38
|
+
`arena-sim.js.map` and `CHANGELOG.md`). The package's version is the game's `RELEASE`, read from
|
|
39
|
+
`arena-sim.js` when the wheel is built.
|
|
40
|
+
|
|
41
|
+
Developing: `bun run build:py` builds the wheel into `dist/`, `bun run test:py` runs the tests
|
|
42
|
+
(both need [uv](https://docs.astral.sh/uv/)).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
# Installed as victris-arena-sim, imported as arena_sim (the package was arena-sim through 0.89.x).
|
|
3
|
+
name = "victris-arena-sim"
|
|
4
|
+
dynamic = ["version"]
|
|
5
|
+
description = "Victris Arena's simulator for Python: the ladder's own match code in embedded V8, with Gymnasium and PettingZoo environments"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [{ name = "Victris AI" }]
|
|
9
|
+
keywords = ["victris-arena", "simulator", "gymnasium", "pettingzoo", "reinforcement-learning", "game-ai", "bots"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Topic :: Games/Entertainment",
|
|
13
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
14
|
+
]
|
|
15
|
+
requires-python = ">=3.10"
|
|
16
|
+
dependencies = ["mini-racer>=0.12", "gymnasium>=1.1", "numpy>=1.24"]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://victrisarena.com"
|
|
20
|
+
Documentation = "https://victrisarena.com/guide/simulator"
|
|
21
|
+
Source = "https://github.com/Victris-AI/victris-arena-sdk"
|
|
22
|
+
Changelog = "https://victrisarena.com/changelog"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
pettingzoo = ["pettingzoo>=1.24"]
|
|
26
|
+
sb3 = ["stable-baselines3>=2.3", "sb3-contrib>=2.3"]
|
|
27
|
+
torch = ["torch>=2.3"]
|
|
28
|
+
dev = ["pytest>=8", "pettingzoo>=1.24", "stable-baselines3>=2.3", "sb3-contrib>=2.3", "torch>=2.3"]
|
|
29
|
+
|
|
30
|
+
# Tests and CI train small SB3 models on the CPU: take torch's CPU build, not the CUDA one.
|
|
31
|
+
[tool.uv.sources]
|
|
32
|
+
torch = { index = "pytorch-cpu" }
|
|
33
|
+
|
|
34
|
+
[[tool.uv.index]]
|
|
35
|
+
name = "pytorch-cpu"
|
|
36
|
+
url = "https://download.pytorch.org/whl/cpu"
|
|
37
|
+
explicit = true
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["hatchling"]
|
|
41
|
+
build-backend = "hatchling.build"
|
|
42
|
+
|
|
43
|
+
# The package's version is the release of the game it carries, read from the game itself.
|
|
44
|
+
[tool.hatch.version]
|
|
45
|
+
path = "src/arena_sim/arena-sim.js"
|
|
46
|
+
pattern = '\bRELEASE = "(?P<version>[^"]+)"'
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/arena_sim"]
|
|
50
|
+
# The game itself, built by `bun run build:sim` and copied in by `bun run build:py`, with its
|
|
51
|
+
# source map (the TypeScript it was built from) and the release notes; gitignored.
|
|
52
|
+
artifacts = ["src/arena_sim/arena-sim.js", "src/arena_sim/arena-sim.js.map", "src/arena_sim/CHANGELOG.md"]
|