Skip to main content

Interact with OpenRCT2 from python!

Project description

pyrct2

Python client for OpenRCT2. Launches the game in headless mode, connects to the openrct2-bridge plugin over TCP, and sends game actions.

Setup

pip install pyrct2
pyrct2 setup

setup finds your OpenRCT2 installation and installs the bridge plugin. Requires OpenRCT2 to be installed.

Usage

from pyrct2.client import RCT2

# Launch a headless game and send commands
with RCT2.launch("path/to/scenario.SC6") as game:
    game.get_status()
    game.execute("ridecreate", {"rideType": 1, "rideObject": 0, "colour1": 5, "colour2": 10})
    game.advance_ticks(100)

# Or connect to an already-running instance
with RCT2.connect() as game:
    game.get_status()

Known Limitations

Windows: Headless launch crashes on rapid succession

OpenRCT2's headless mode on Windows crashes approximately about 1 out of 3 times when launching and terminating instances in quick succession. Probably an issue with cleaning up and allocating space for the next game instance. This might automatically resolve itself when port discovery/assignment is added.

Exit codes seen over a few trials:

  • 3221356611 (0xC0020043) — RPC_S_NO_INTERFACES, COM/RPC resource cleanup failure
  • 3221225620 (0xC0000374) — STATUS_HEAP_CORRUPTION, heap corruption during startup
  • 3221226505 (0xC0000409) — STATUS_STACK_BUFFER_OVERRUN, stack buffer overrun

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

pyrct2-0.3.1.tar.gz (39.2 kB view details)

Uploaded Source

Built Distribution

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

pyrct2-0.3.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file pyrct2-0.3.1.tar.gz.

File metadata

  • Download URL: pyrct2-0.3.1.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrct2-0.3.1.tar.gz
Algorithm Hash digest
SHA256 bc9ae57b67363a36c12307ced92eb78dbe0f7656f50304a9bd08ff1e7ae68acd
MD5 06f3e864c30113c745d53bc0c469fb99
BLAKE2b-256 2800f530d5017c5be48a1b19382be2f5ca0c556e9ad70c11d6fc1f4acd320edf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2-0.3.1.tar.gz:

Publisher: publish.yml on MaukWM/pyrct2

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

File details

Details for the file pyrct2-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pyrct2-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyrct2-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5704e6a32f5fdd823cd0efbfc758be2a2a7a7a2f1aae65afcc66e5ddefdf10a2
MD5 feebf2581a4c1f22099c0ad49eac4dd9
BLAKE2b-256 8dcc87929057272557409b39cf193fdd3168c4e3f49b29d7c5eda7c729f6d4a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2-0.3.1-py3-none-any.whl:

Publisher: publish.yml on MaukWM/pyrct2

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