Skip to content
/ RS2-C Public

RuneScape 2 Implemented in the C Language (Protocol #225)

Notifications You must be signed in to change notification settings

khan-u/RS2-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RuneScape Emulation Server (C Implementation)

Protocol #225 (May 18, 2004)
Language: C99

Multiplayer


Overview

An educational RuneScape client–server prototype written in portable C99, featuring multiplayer support, persistent state management, and authentic protocol #225 compatibility.

The project includes both a custom game server and a cross-platform client. The game server is a clean-room implementation developed strictly for educational and research purposes, with no intent of monetary gain or commercial use. The cross-platform C client was independently reverse-engineered, refactored, and ported by Lesleyrs and contributors to the Client3 project: https://github.com/lesleyrs/Client3

This project uses the original game cache and assets without modification; all such assets remain the sole property of Jagex Ltd.

This project is not affiliated with, endorsed by, or sponsored by Jagex Ltd. "RuneScape®" and "Old School RuneScape®" are registered trademarks of Jagex Ltd.

Educational Purpose

Through extensive code documentation, this project studies:

  • Network protocol implementation
  • Client-server architecture
  • Game loop design
  • Binary serialization
  • Cross-platform C development
  • Non-blocking I/O patterns
  • Memory management strategies

Project Structure

├── C-Server/           # Game server implementation
│   ├── src/            # Server source code
│   ├── data/           # Game assets/cache and player data
│   └── bin/            # Server binary output
├── C-Client/           # Multi-platform game client
│   ├── src/            # Client source code
│   └── rom/            # Client assets and cache
└── shared/             # Shared code between client/server
    └── src/            # Common data structures and utilities

Features

Server

Multiplayer • Supports up to 2048 concurrent connections with synchronized player state
Persistence • Binary save/load system with CRC32 integrity checking
Movement • Delta-encoded pathfinding with walk/run mechanics
Security • ISAAC cipher for packet obfuscation
Protocol • Bit-packed viewport updates for efficient bandwidth usage

Client (lesleyrs/Client3)

Cross-Platform • Windows (95+), Linux, macOS, FreeBSD, Web (WASM), and various game consoles
Rendering • SDL1/2/3 support with software rendering
Audio • MIDI playback with TinySoundFont
Portable • Runs on 32-bit systems with 64MB RAM (lowmem mode)

Technical Specifications

Coordinates • 14-bit X/Z (0-16383), 2-bit height (0-3)
Network • Big-endian TCP, non-blocking I/O
Tick Rate • 600ms game loop (~1.67 ticks/second), 1ms network poll
Memory • Minimal heap usage, efficient stack allocation
Platform • POSIX-compliant (Linux, macOS, FreeBSD, WSL), Windows via MinGW

Quick Start

Server

Build (Linux/macOS/FreeBSD/WSL)

cd C-Server
./build_server.sh

Or with make:

make clean && make -j4

Build (Windows)

mingw32-make clean && mingw32-make -j4

Run

cd C-Server
./run_server.sh

Or directly:

cd C-Server
./bin/rs225

Default port: 43594

Client

Build

cd C-Client
./build_client.sh

Run

cd C-Client
./start_client.sh -u username -p password

Development

Server Scripts

C-Server/ contains the following scripts:

  • build_server.sh - Build script with compiler options
  • run_server.sh - Launch server (builds if needed)
cd C-Server
./build_server.sh -h          # Show build options

Server Make Targets

cd C-Server
make                          # Build server
make asm                      # Generate assembly/preprocessed files in temp/
make clean                    # Remove build artifacts and temp files
make clean-temp               # Remove only temp files
make run                      # Build and run

Client Scripts

C-Client/ contains the following scripts:

  • build_client.sh - Build script with compiler and SDL options
  • start_client.sh - Launch client with connection parameters
cd C-Client
./build_client.sh -h          # Show all build options
./start_client.sh -h          # Show launch options

The client supports multiple compilers (gcc, clang, tcc, emcc) and SDL versions (1/2/3).

In-Game Commands

Type in chat:

::tele <x> <z> <height>   - Teleport to coordinates
::perf                    - Show FPS and cache stats (client)

Directory Structure

Server Paths

C-Server/
├── data/
│   ├── players/        # Player save files
│   ├── maps/           # Map region data
│   ├── archives/       # Game cache archives
│   └── songs/          # MIDI music files
└── bin/rs225           # Server executable

Client Paths

C-Client/
├── rom/
│   ├── cache/          # Client cache files
│   └── Roboto/         # Font files
├── client              # Client executable
└── config.ini          # Client configuration

Architecture

Server

  • Single-threaded event loop with 600ms tick rate
  • Non-blocking I/O for network operations
  • Fixed player slots supporting up to MAX_PLAYERS (2048)
  • Modular subsystems: world state, cache, items, NPCs, objects

Client

  • Fixed timestep game loop (20 ticks/second, 50ms per tick)
  • ISAAC cipher for secure packet encryption
  • BFS pathfinding for click-to-move
  • Platform abstraction via SDL or native APIs

Libraries

Client Dependencies

Server Dependencies

  • Standard C99 library
  • POSIX sockets (or WinSock on Windows)

Platform Support

The client supports an extensive range of platforms:

  • Desktop: Windows 95-11, Linux, macOS, FreeBSD
  • Web: WebAssembly (via Emscripten or wasmlite)
  • Consoles: Wii, Dreamcast, Xbox, PSP, PS Vita, 3DS (via devkitPro)
  • Embedded: Custom ports for various platforms

Connection

Connect the client to the server:

  1. Start the server (default port 43594): cd C-Server && ./run_server.sh
  2. Launch the client: cd C-Client && ./start_client.sh -u username -p password
  3. Optionally specify server IP/port: cd C-Client && ./start_client.sh -u username -p password -i 127.0.0.1 -P 43594

The client can also be configured via config.ini file instead of command-line arguments.

About

RuneScape 2 Implemented in the C Language (Protocol #225)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published