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.2.0.tar.gz (87.3 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.2.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyrct2_agent-0.2.0.tar.gz
  • Upload date:
  • Size: 87.3 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.2.0.tar.gz
Algorithm Hash digest
SHA256 a1f5245aadcc08a08e67300c4b0b3be8736008c8a270d3429b10b898010a04e9
MD5 e1d4376b7858fb36fb558aedc05056e4
BLAKE2b-256 e6e0ad38899813b0b346a6c3150e155120ab899d3278e1158be7035098ef8a9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2_agent-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyrct2_agent-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4cf558ce5cbb936d830df98fb2c67f393fda3c0c97b49f4d8760a0663e285405
MD5 7e7128c1ebb36a2532a27f940697d3d3
BLAKE2b-256 5f78e42a48e74ad722a7117d3614d841ee0b57dac60bb752cb3305159f727190

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrct2_agent-0.2.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