MCPcopy Index your code
hub / github.com/MaxBittker/rs-sdk

github.com/MaxBittker/rs-sdk @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
6,095 symbols 17,871 edges 806 files 506 documented · 8%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RS-SDK

Research-oriented starter kit for runescape-style bots, including a typescript sdk, agent documentation and bindings, and a server emulator. Works out of the box - tell it what to automate!

<img src="https://github.com/MaxBittker/rs-sdk/raw/main/server/content/title/promo.gif" alt="RS-SDK Demo" width="800">

Discord Hiscores

Build and operate bots within a complex economic role-playing MMO. You can automate the game, level an account to all 99s, and experiment with agentic development techniques within a safe, bot-only setting.

The goals of this project are to provide a rich testing environment for goal-directed program synthesis techniques (Ralph loops, etc), and to facilitate research into collaboration and competition between agents.

Task Length Distribution

There is currently a leaderboard for bots running on the demo server, with rankings based on highest total level per lowest account playtime.

See the benchmark comparing models for evaluation results across different LLMs.

[!NOTE] RS-SDK is a fork of the LostCity engine/client, an amazing project without which rs-sdk would not be possible. Find their code here or read their history and ethos

Getting Started:

git clone https://github.com/MaxBittker/rs-sdk.git

Out of the box, you can connect to the provided demo server, choose a name that is not already taken!

With claude code:

bun install
claude "start a new bot with name: {username}"

Manually:

bun install
bun bots/create-bot.ts {username}
bun bots/{username}/script.ts 

Chat is shown by default. Note that seeing other players' chat exposes the bot to scamming and prompt-injection attempts; opt out with SHOW_CHAT=false in the bot.env file (or bun bots/create-bot.ts <name> --no-chat).

Warning: The demo server is offered as a convenience, and we do not guarantee uptime or data persistence. Hold your accounts lightly, and consider hosting your own server instance. Please do not manually play on the demo server.

Gameplay Modifications

This server has a few modifications from the original game to make development and bot testing easier:

  • Faster leveling - The XP curve is accelerated and less steep.
  • Infinite run energy - Players never run out of energy
  • No random events - Anti-botting random events are disabled

Architecture:

rs-sdk runs against an enhanced web-based client (botclient) which connects to the LostCity 2004scape server emulator.

There is a gateway server which accepts connections from botclient and SDK instances, and forwards messages between them based on username. Once connected to the gateway, the botclient will relay game state to the SDK, and execute low-level actions (e.g. walkTo(x,y)) sent from the SDK through the gateway.

This means that the SDK can't talk directly to the game server, but must go through the botclient. It will attempt to launch the botclient on startup if one is not already running.

You don't need to run the gateway/botclient in order to run automations against the demo server, but you may choose to if you are fixing bugs or adding features to the rs-sdk project

Running the server locally

Running the server locally has many advantages, primary being the ability to set a high tickrate.

You can set tickrate in server/engine/.env via the TICK_RATE variable (default is 600ms, try 200ms or 30ms for faster gameplay, especially useful for headless testing).

You want all three of these running:

# Game engine
cd server/engine && bun run start
# Web client bundler
cd server/webclient && bun run watch
# Gateway (bridges SDK <-> bot client)
cd server/gateway && bun run gateway

The gateway listens on ws://localhost:7780 by default (configurable via AGENT_PORT env var).

2. Connect a bot to the local gateway

The SERVER variable in bot.env controls where the bot connects. To use your local gateway, leave SERVER blank:

bots/<botname>/bot.env BOT_USERNAME=mybot PASSWORD=test SERVER= SHOW_CHAT=true

When SERVER is empty, all connection paths (scripts, CLI) default to ws://localhost:7780.

When SERVER is set to a hostname (e.g. rs-sdk-demo.fly.dev), they connect to wss://{SERVER}/gateway instead.

Disclaimer

This is a free, open-source, community-run project.

The goal is strictly education and scientific research.

LostCity Server was written from scratch after many hours of research and peer review. Everything you see is completely and transparently open source.

We have not been endorsed by, authorized by, or officially communicated with Jagex Ltd. on our efforts here.

You cannot play Old School RuneScape here, buy RuneScape gold, or access any of the official game's services! Bots developed here will not work on the official game servers.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Extension points exported contracts — how you extend this code

InfoMessage (Interface)
(no doc) [32 implementers]
server/engine/src/network/rsbuf/messages.ts
Keyboard (Interface)
(no doc) [5 implementers]
server/webclient/src/client/MobileKeyboard.ts
BotSession (Interface)
* Bot Session - represents a bot client (browser) connected to the gateway. * * Only ONE bot session per username is a
server/gateway/gateway.ts
ItemConfig (Interface)
(no doc)
wiki/generate-items.ts
StockItem (Interface)
(no doc)
wiki/generate-shops.ts
NpcConfig (Interface)
(no doc)
wiki/generate-npcs.ts
PrayerStats (Interface)
(no doc)
scripts/prayer/script.ts
CraftingStats (Interface)
(no doc)
scripts/crafting/script.ts

Core symbols most depended-on inside this repo

push
called by 921
server/engine/public/maped/maped.js
getState
called by 474
sdk/index.ts
test
called by 431
server/engine/src/network/rsbuf/messages.ts
g2
called by 413
server/engine/src/io/Packet.ts
p1
called by 375
server/engine/tools/pack/config/PackShared.ts
find
called by 365
server/engine/public/maped/maped.js
check
called by 362
server/engine/src/engine/script/ScriptValidators.ts
g1
called by 282
server/engine/src/io/Packet.ts

Shape

Method 3,417
Class 1,214
Function 1,206
Interface 184
Enum 74

Languages

TypeScript99%
C1%

Modules by API surface

server/engine/public/maped/maped.js842 symbols
server/webclient/src/client/Client.ts232 symbols
server/engine/src/engine/entity/Player.ts118 symbols
sdk/index.ts112 symbols
server/engine/src/network/rsbuf/messages.ts100 symbols
server/engine/src/3rdparty/bzip2-wasm/bzip2-1.0.8/bzip2.mjs84 symbols
server/engine/src/engine/World.ts78 symbols
sdk/types.ts59 symbols
sdk/actions.ts58 symbols
server/webclient/src/dash3d/World.ts54 symbols
server/engine/src/engine/entity/Npc.ts52 symbols
server/engine/public/maped/ondemandworker.js52 symbols

Datastores touched

(mysql)Database · 1 repos

For agents

$ claude mcp add rs-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact