Files
rs-sdk/DEVELOPERS.md
max bittkerandClaude 3bdb46329b Track sdk/collision-data.json again; add refresh script
716a9375f removed collision-data.json from tracking and gitignored it as
"regenerable", but sdk/pathfinding.ts imports it statically -- so a fresh
clone hard-failed on import with no way to know why. Nothing fetched it.

Re-track it. The anti-bloat rationale was already sunk cost: that commit
never rewrote history, so all 12 prior collision-data blobs remain reachable
and every clone already pays for them. One more version costs ~3.4MB packed
(23MB raw, but it's highly repetitive), against a 259MB .git.

Add sdk/fetch-collision-data.ts to regenerate it from a running server,
replacing the bare curl in DEVELOPERS.md -- it buffers before writing so an
interrupted download can't leave a truncated file that breaks the import,
and needs --force to clobber. The committed copy is a fresh export: 123,648
zones (= 483 mapsquares, full coverage), 1,068,791 tiles, 2,603 doors.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-17 09:27:47 -04:00

4.9 KiB

This repo contain: A game server (hosted by default at https://rs-sdk-demo.fly.dev/) A browser-based game client (hosted by default at https://rs-sdk-demo.fly.dev/) A gateway service for connecting bot clients to SDK agents A BotSDK library for writing automation scripts in TypeScript

By default you can build bots by only writing scripts that use the botsdk library, without modifying the server or client code, but if you want to develop deeper changes to the stack or host your own server, all the source code is included in this repo to do so.

Directory Structure

Directory Description
sdk/ BotSDK library for writing automation scripts
sdk/test/ Test scripts for bot automation and shop interactions
server/engine/ Game server - handles world state, players, NPCs, game logic
server/content/ Game assets - maps, models, scripts, sprites, music
server/webclient/ TypeScript web client with BotSDK for automation
server/gateway/ WebSocket relay for bot clients to connect to SDK agents

server/{engine,content,webclient} are vendored copies of upstream LostCity with local modifications. server/PATCHES.md is the canonical checklist of every monkeypatch and how to verify it after a vendor sync — read it before touching vendored code.

Engine (server/engine/)

The game server handling world simulation, player logic, and network protocol.

engine/
├── src/           # Server source code
├── public/        # Static assets (soundfont, wasm). Built clients are served
│                  # directly from webclient/out — do NOT copy client.js here,
│                  # it would shadow fresh builds (see commit 6569364d2)
├── view/          # EJS templates (bot.ejs for bot interface)
├── data/          # Runtime game data
├── prisma/        # Database schema and migrations
└── tools/         # Build and pack tools

WebClient (server/webclient/)

Browser-based game client ported to TypeScript.

webclient/
├── src/
│   ├── client/    # Standard client code
│   └── bot/       # Bot-specific modules (BotSDK)
├── out/           # Built client bundles
│   ├── standard/  # Standard client output
│   └── bot/       # Bot client output
└── 3rdparty/      # Third-party dependencies

Gateway (server/gateway/)

WebSocket relay service connecting browser game clients to SDK automation scripts.

gateway/
├── gateway.ts         # WebSocket router for bot ↔ SDK communication
└── types.ts           # Gateway message protocol types

Root Level

Command Description
bun run server/start.ts Interactive menu

The interactive menu provides options to:

  • Start the game server
  • Update all subprojects
  • Run web or Java client
  • Build clients
  • Change game version (225, 244, 245.2, 254, 274)

Engine (cd server/engine)

Command Description
bun start Install deps and start server
bun run dev Start with hot-reload (watch mode)
bun run quickstart Start without installing deps
bun run build Pack game content
bun run clean Clean build artifacts
bun run setup Configure server environment
bun run lint Run ESLint

Database commands:

Command Description
bun run sqlite:migrate Apply SQLite migrations
bun run sqlite:reset Reset SQLite database
bun run db:migrate Apply MySQL migrations
bun run db:reset Reset MySQL database

WebClient (cd server/webclient)

Command Description
bun run build Build client bundles (standard + bot)
bun run build:dev Build in development mode

No copy step is needed after building — the engine serves the built bundles directly from webclient/out.

Collision data (sdk/collision-data.json)

Used by sdk/pathfinding.ts, which imports it directly. It's ~23MB but compresses to ~3.4MB in git, so it's tracked — a clone works without any fetch step.

Regenerate it after map changes, or pull from a different server:

bun run fetch-collision-data -- --force
bun run fetch-collision-data -- --force --server=http://localhost:8080

The server can also be set with COLLISION_SERVER. Commit the result — a stale tracked copy is how the 442-vs-483 mapsquare drift crept in previously.


Workflow

Use the start script provided - it handles a lot of common use cases. We're trying to reduce the barrier to entry by providing an all-inclusive script.

Content Development

cd server/engine && bun start
# Server watches for script/config changes and auto-repacks

Engine Development

cd server/engine && bun run dev
# Server restarts on .ts file changes