HeadlinesBriefing favicon HeadlinesBriefing.com

How RuneScape Ran Multiplayer on 56k Dial-Up in 2004

Hacker News •
×

In 2004, I played RuneScape on a 56k modem that died whenever my mother picked up the phone. A 3D world with up to a couple thousand players ran entirely in a browser. It worked because of a sustained exercise in not wasting bytes.

When clicking a tile north, every byte travels from click to server to another player's screen. Central fountain, Varrock Square. The detail comes from a decompiled 2004 RuneScape 2 client.

Constraints were strict: a 56k modem syncs at 56 kilobits per second downstream, roughly 5 KB/s, with less upstream. Broadband was available by 2000, but most UK households stuck to dial-up through the late 2000s. Java applets ran in a security sandbox, blocking raw native sockets and UDP.

Every byte travelled over a single TCP connection, in-order, with per-segment overhead. The game server advances in discrete cycles of roughly 600 milliseconds. After the login handshake, a small encryption layer is set up.

Every packet begins with an opcode byte, enciphered with a stream cipher called ISAAC. Two streams exist - one client-to-server, one reverse. Both sides need both streams.

The client generates two seed integers; the server provides the other two as part of the handshake. The server-to-client stream adds 50 to each word to keep directions separate. On the way out, one line enciphers the opcode: put Opcode(int opcode) { this.put Byte(opcode + this.outbound Cipher.value()); } On the way in, the mirror image retrieves it: current Opcode = (current Opcode - this.inbound Cipher.value()) & 0xFF; Only the opcode is encrypted, protecting against third-party parsers.

Sending a walk request triggers a breadth-first search before any networking occurs.