Skip to main content

Interact with OpenRCT2 from python!

Project description

pyrct2

Python client for OpenRCT2. Launch headless games, read state, execute actions, all in Python!

Connects to the openrct2-bridge plugin over TCP. Every game action, state query, and enum is auto-generated from OpenRCT2 C++ source by openrct2-codegen.

Install

pip install pyrct2
pyrct2 setup        # finds OpenRCT2, installs the bridge plugin

Usage

from pyrct2.client import RCT2
from pyrct2.scenarios import Scenario
from pyrct2.enums import ResearchFundingLevel, ResearchCategory

with RCT2.launch(Scenario.CRAZY_CASTLE) as game:
    # high-level API — read properties, call methods
    print(f"{game.park.name}: rating {game.park.rating}, cash ${game.park.finance.cash}")

    game.park.finance.set_entrance_fee(50)
    game.park.cheats.sandbox_mode()
    game.park.research.set_funding(ResearchFundingLevel.MAXIMUM)
    game.park.research.set_priorities([ResearchCategory.ROLLERCOASTER, ResearchCategory.THRILL])

    # tick-step the simulation forward
    game.advance_ticks(100)
    print(f"Weather: {game.park.climate.weather}")

    # raw API always available as escape hatch
    game.actions.staff_hire_new(auto_position=True, staff_type=0, costume_index=0, staff_orders=0)
    park = game.state.park()  # full Pydantic model
# or attach to an already-running instance
with RCT2.connect() as game:
    print(game.park.name)

Requirements

  • Python 3.11+
  • OpenRCT2 installed with RCT2 game data

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.5.0.tar.gz (56.1 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.5.0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyrct2-0.5.0.tar.gz
Algorithm Hash digest
SHA256 d88968a4cc21bed4fe5a8c5a7efa5e2d6a443eda4ab3f6d1b9297c9af150c4ea
MD5 6d7a2da286c633b96810eb084b1dd5c4
BLAKE2b-256 15c57c73ee8f024e5b9f0cd14ec04746addfb08b01680617c762460396647b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2-0.5.0.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.5.0-py3-none-any.whl.

File metadata

  • Download URL: pyrct2-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 39.0 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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39c1575826fd824629d8aab92a82b0143d94000430168f34fd1c1f2739b26467
MD5 a8cd76360d7ea66111fd38bbacc34a57
BLAKE2b-256 7c25dc452dc0bc54763f6074aba43ef1d9bd6361965a928befe4d1e7d19d4213

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2-0.5.0-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