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
- Python 3.12+
- OpenRCT2 with RCT2 game data
- pyrct2 (
pip install pyrct2-agentpulls it in) - An OpenAI API key (or any LangChain-compatible LLM)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16a1a5375aee58ded89fa96805aaa1e62a3d399d2d9641934c90bfbe495c9e55
|
|
| MD5 |
3dc9a717ce7e7590c4fd931273d60dde
|
|
| BLAKE2b-256 |
f15fb8c7392c162052666e2fa55e65ed3212b0fd5335dc83b35729d02c63cb1a
|
Provenance
The following attestation bundles were made for pyrct2_agent-0.1.0.tar.gz:
Publisher:
publish.yml on MaukWM/pyrct2-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrct2_agent-0.1.0.tar.gz -
Subject digest:
16a1a5375aee58ded89fa96805aaa1e62a3d399d2d9641934c90bfbe495c9e55 - Sigstore transparency entry: 1339879956
- Sigstore integration time:
-
Permalink:
MaukWM/pyrct2-agent@3384f66e4dc8f6e5001438af3a4b7419ff1487a5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MaukWM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3384f66e4dc8f6e5001438af3a4b7419ff1487a5 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f697c8b57f9a81c86d8213933bf25088abb5606cdde8f0eda167e5a480f6a746
|
|
| MD5 |
fed7353ae02a39daaee82f4b43a5b4f2
|
|
| BLAKE2b-256 |
45fca595bf8729e542776607c7b81cf561b9049b8aaf224561c3d69f7aa6a297
|
Provenance
The following attestation bundles were made for pyrct2_agent-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on MaukWM/pyrct2-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrct2_agent-0.1.0-py3-none-any.whl -
Subject digest:
f697c8b57f9a81c86d8213933bf25088abb5606cdde8f0eda167e5a480f6a746 - Sigstore transparency entry: 1339879958
- Sigstore integration time:
-
Permalink:
MaukWM/pyrct2-agent@3384f66e4dc8f6e5001438af3a4b7419ff1487a5 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MaukWM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3384f66e4dc8f6e5001438af3a4b7419ff1487a5 -
Trigger Event:
release
-
Statement type: