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 StaffType, AdvertisingCampaignType, ResearchFundingLevel

with RCT2.launch(Scenario.CRAZY_CASTLE) as game:
    # state queries return typed Pydantic models
    park = game.state.park()
    print(f"{park.name}: rating {park.rating}, cash ${park.cash}")

    # actions take typed enums — no magic ints
    game.actions.staff_hire_new(auto_position=True, staff_type=StaffType.MECHANIC, costume_index=0, staff_orders=0)
    game.actions.park_marketing(type=AdvertisingCampaignType.PARK_ENTRY_FREE, item=0, duration=4)
    game.actions.park_set_research_funding(priorities=0xFF, funding_amount=ResearchFundingLevel.MAXIMUM)

    # tick-step the simulation forward
    game.advance_ticks(100)
    print(f"Rating: {game.state.park_rating()}")
# or attach to an already-running instance
with RCT2.connect() as game:
    print(game.state.scenario_name())

Requirements

  • Python 3.13+
  • 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.3.3.tar.gz (42.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.3.3-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrct2-0.3.3.tar.gz
  • Upload date:
  • Size: 42.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.3.3.tar.gz
Algorithm Hash digest
SHA256 f2ac4953bdc949dff7dedd06ddff2da864f0b652a14a504129650b023a71b24d
MD5 321a649c58e7f863ba270631844426a2
BLAKE2b-256 3ee43599e1f10cf308f1625b902198b9bf0c8a0a4e21428190dcfec002c35fa3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyrct2-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 30.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7d39cebbfbb6f8b48c2f8b7bd007fd3a5e5a557f0c8cae18fc5239e3da103428
MD5 e3edccaa4ff988dd1ab4f1c92aa1e2a0
BLAKE2b-256 a8015acbe12f8dcf13b3a8a6593b1351ddd3b4ce08ef54f78689edf1d3592a1c

See more details on using hashes here.

Provenance

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