Skip to main content

LLM agent that plays RollerCoaster Tycoon 2 via pyrct2

Project description

pyrct2-agent

LLM agent that plays RollerCoaster Tycoon 2 via pyrct2. Give it a scenario and an LLM — it builds rides, places paths, and tries to meet the objective.

Install

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

Quick start

from pyrct2_agent import Agent
from pyrct2.scenarios import Scenario
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gpt-5",
    model_kwargs={"parallel_tool_calls": False}, # If you don't disable this, it can result in weird or incoherent map states (sometimes)
)
result = Agent(Scenario.CRAZY_CASTLE, llm=llm, max_actions=50).run()
print(result)

Modes

The agent loop supports three timing strategies:

Mode Behavior
TickPerAction() Game advances N ticks per tool call. Ticks run in background while LLM thinks. (default)
PauseAndAct() Game paused during thinking. N actions per turn, then M ticks advance.
RealTime() Game runs continuously. LLM latency = real game time passing.
from pyrct2_agent import Agent, PauseAndAct

result = Agent(
    Scenario.TEST_PARK,
    llm=llm,
    mode=PauseAndAct(ticks_per_turn=2000, actions_per_turn=10),
).run()

Tools

12 builtin tools across three categories:

Category Tools
Observe get_park_status, show_map
Paths place_path, place_path_line, remove_path
Rides list_available_rides, place_ride, place_stall, set_ride_price, get_rides, check_ride_connectivity, demolish_ride

Custom tools

from langchain_core.tools import tool

def my_tools(game):
    @tool
    def hire_handyman() -> str:
        """Hire a handyman."""
        game.park.staff.hire(StaffType.HANDYMAN)
        return "Hired"
    return [hire_handyman]

# Add alongside builtins
Agent(scenario, llm=llm, extra_tools=my_tools)

# Or replace all builtins
Agent(scenario, llm=llm, tools=my_tools)

Configuration

Agent(
    scenario,
    llm=llm,
    mode=TickPerAction(ticks_per_action=200),   # timing strategy
    system_prompt="custom prompt here",         # override default
    game_speed=4,                               # 0-7
    headless=True,                              # hide game window
    end_on_scenario_complete=True,              # stop when objective met
    max_ticks=100_000,                          # tick limit
    max_actions=200,                            # action limit
)

Requirements

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_agent-0.1.0.tar.gz (83.8 kB view details)

Uploaded Source

Built Distribution

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

pyrct2_agent-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file pyrct2_agent-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for pyrct2_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 16a1a5375aee58ded89fa96805aaa1e62a3d399d2d9641934c90bfbe495c9e55
MD5 3dc9a717ce7e7590c4fd931273d60dde
BLAKE2b-256 f15fb8c7392c162052666e2fa55e65ed3212b0fd5335dc83b35729d02c63cb1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2_agent-0.1.0.tar.gz:

Publisher: publish.yml on MaukWM/pyrct2-agent

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_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyrct2_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyrct2_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f697c8b57f9a81c86d8213933bf25088abb5606cdde8f0eda167e5a480f6a746
MD5 fed7353ae02a39daaee82f4b43a5b4f2
BLAKE2b-256 45fca595bf8729e542776607c7b81cf561b9049b8aaf224561c3d69f7aa6a297

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2_agent-0.1.0-py3-none-any.whl:

Publisher: publish.yml on MaukWM/pyrct2-agent

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