Skip to main content

Headless, vectorized Haxball physics core (RocketSim-equivalent for Haxball).

Project description

haxball_core — headless, vectorized Haxball physics

This is the RocketSim-equivalent for Haxball: a standalone physics core with no game engine and no rendering, designed to run thousands of matches in parallel for reinforcement learning.

It replaces the Ursina/Panda3D-based simulation in Ursinaxball, which made every disc a 3D-engine Entity and capped throughput at low-thousands of steps/sec for a single game. The physics math is identical — this is a faithful port of Ursinaxball's pure-numpy fn_base.py, verified bit-for-bit (see Fidelity below).

Why this design

RLGym is "a million times faster" than a naive Python clone for one reason: the physics lives in a headless native core (RocketSim, C++) behind a single TransitionEngine interface, and is stepped in batches so the Python↔native boundary is crossed once per batch of envs, not once per game step.

haxball_core copies that win:

  • Rust core, f64 math — same numbers as the original numpy, native speed.
  • Batched VecEnv — N matches stepped in parallel with rayon, GIL released. One step(actions) call advances all N envs.
  • One source of truth — the same crate compiles to a Python extension (for training) and, next, to WASM (so a human can play the bot in-browser — Haxball is a browser game, so the renderer and the human-play client live there).

Measured (Apple Silicon, single process)

Mode 1v1 3v3
Raw sim (no Python in loop) ~50M env-steps/s ~18M env-steps/s
Full env.step (obs + reward + done numpy I/O) ~12.5M env-steps/s ~6.5M env-steps/s

Ursinaxball reference: a single game at low-thousands of steps/sec → this is a ~1,000–10,000× speedup, and it scales to 2v2 / 3v3 (the regime that was out of reach before).

Fidelity

tests/test_fidelity.py imports Ursinaxball's fn_base.py directly (it has no ursina import) and feeds 25,000 random inputs through both implementations:

disc_disc OK
disc_vertex OK
disc_plane OK
segment_no_curve OK
segment_curve OK
ALL FIDELITY TESTS PASSED — Rust port matches fn_base.py to 1e-9

Build & run

This crate is the haxball_core member of the repo's uv workspace. From the repo root:

uv sync                                              # builds this crate (maturin) + deps
uv run rust/haxball_core/tests/test_fidelity.py      # fidelity (1e-9)
uv run rust/haxball_core/bench.py                    # throughput

Iterating on the Rust? uv run maturin develop --release rebuilds in place faster than a full uv sync.

Status / what's ported

  • All 5 collision resolvers (disc-disc, disc-vertex, disc-plane, segment straight + curved, segment bias) — verified vs fn_base.py
  • Integration (update_discs), player movement + kick (resolve_movement), goal detection (check_goal), spawn/reset.
  • Classic stadium (planes + straight ball-area segments + goalposts + goals).
  • Batched VecEnv with rayon, obs/reward/done numpy I/O.
  • Curved goal-net arcs + kickoff-barrier semicircle (math is ported and tested; not yet wired into the classic World — minor, affects only in-net ball behavior).
  • .hbs stadium loader (currently the classic stadium is built in code).
  • WASM target for in-browser play.

Next (the RLGym playbook, in order)

  1. Wrap VecEnv in an RLGym-v2-style API: TransitionEngine (this core) + StateMutator / ObsBuilder / ActionParser / RewardFunction / DoneCondition — composable, the env design HaxballGym already half-has.
  2. PettingZoo-parallel multi-agent + a single shared, permutation-invariant policy → 1v1/2v2/3v3 from one network.
  3. Train with PufferLib (highest SPS) or CleanRL PPO, self-play vs a past-policy pool.
  4. Compile to WASM; export the policy to ONNX; play it in the browser.

Project details


Download files

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

Source Distribution

haxball_core-1.0.0.tar.gz (29.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

haxball_core-1.0.0-cp313-cp313-win_amd64.whl (329.6 kB view details)

Uploaded CPython 3.13Windows x86-64

haxball_core-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (473.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

haxball_core-1.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (462.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

haxball_core-1.0.0-cp313-cp313-macosx_11_0_arm64.whl (416.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

haxball_core-1.0.0-cp313-cp313-macosx_10_12_x86_64.whl (430.9 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

haxball_core-1.0.0-cp312-cp312-win_amd64.whl (329.6 kB view details)

Uploaded CPython 3.12Windows x86-64

haxball_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (473.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

haxball_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (462.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

haxball_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl (416.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

haxball_core-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl (431.1 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file haxball_core-1.0.0.tar.gz.

File metadata

  • Download URL: haxball_core-1.0.0.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for haxball_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 26b5cc83de00d5850fe02954324a2cd7e6d1a63d580bc66c6b40365693c03578
MD5 68219341d3223cac6b9cc96315728ef6
BLAKE2b-256 34a024e591b1c4c68309a4991eac83b87e858ba78fa87ef76c7d46658a3b8d60

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0.tar.gz:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c8fc4194e6ebefb3f35816627675a3168d3b08c1e14d24211837f55fdce5579c
MD5 00fab5f6c7e27aa1b55c54cb0e6591ac
BLAKE2b-256 90b25ed127ad17b0f1cc7c3e63f97f0b1e48aa63a03e9ced5c255d85f75126d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 abfe86ef42636c9664f8e27c0042e48dbaa740838ea872ccf8f28f18358d93d7
MD5 e85a1fd43175225eb3be2c5bbdc1134c
BLAKE2b-256 f30db2ac8b481ad371ccba7db84a993ba922d36841a9f9047c03dad2faa52825

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 37e2ab180f4c3be0351139997d55888f4dba58dea912188d6a0087c02c79f77a
MD5 c11c570eabbc300bdf6bfa28c55cb874
BLAKE2b-256 084371686e720a4013e3a8aead01336019cd14addce3be81b2ab57a19a6f6c66

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20a7405e4f5cc66cd679cdb5879dee0fb8959646440d0c5a655981796d77189d
MD5 94f6cd9c5c5dd54c13dced67ba00a8ae
BLAKE2b-256 c0a35e2007c9aed1e736bdd714ec012d8d9b982e10198f3bf224ff0b794d8443

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ca35c97ab3cbf6db90d2b662e05307ebd75c579c11baff6df2af84aa30be697
MD5 f9483d3e24c370241326b29a93b36147
BLAKE2b-256 7f0c83ab9b2a334468c0abb3388c2d10f2061dc8237f0d2cf8be979ad48cef6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a42128d71659d06e7194f1e402b30aea5e515837b7f68abfbb0b9893f90b7c31
MD5 c578a2b79a2beaa0b2130a3b6d6ced20
BLAKE2b-256 2b6031d97b23c464ba1682c23111c6e7fbaa660431f6e59d2842d27ea289f8f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b4f639a91d3aefaae765ba7803addeda34212a8861654943ee79eddeac6c01c
MD5 369e00a217abe0fbf1de8e9f5e37fb3f
BLAKE2b-256 939f1fc3cc9f692f2a9df56e1e5f4be21cd2e35b34222a4226d7cec053e02f17

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 00fd8199d2bf0f048bd145bef6a8062f2ba8809d47a8ba2e357d456580ac7f2d
MD5 2ed9564230dbff915499ea1f1b9f2e7c
BLAKE2b-256 918e9f7e558651e2356560b7bb1be53fc2fad1580139dbbb86cdaa965854289f

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 720eae89a4e9a68832e78066bb52460ec87786f2b9bc5c39c767e47e6609b094
MD5 e065facbce5757c1743c42c18e59046b
BLAKE2b-256 c597fd1b107c4ac69a92c223eaa06e2e29d24d899002db06756cec23a70e1a3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file haxball_core-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for haxball_core-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9bf89bb786dbc5a4c7040408561c7dc57a133484d8c9c89131e86155be666045
MD5 4551f6889626b25eda276966c8b7c74e
BLAKE2b-256 f94677f656ecdadaf5f91c26530235fb44b3d75c390a9ed9b3a59576caade3a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for haxball_core-1.0.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on HaxballGym/HaxballGym

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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