Beam v0.1.6 is out, check it out! Read more →
← All projects
Roblox SystemCompleted2024

Replication Engine

Delta encoding and interest management that took replication from 900 KB/s down to 2 KB/s.

View liveGitHub
3.2k
Stars
184
Forks
11
Contributors
2024
Since
replication - main
+ video
Overview

A high-traffic Roblox experience was saturating client bandwidth. I rebuilt the replication layer around delta encoding and interest management, sending only what changed and only to players who needed it.

The problem

Naive state replication broadcast full snapshots to every client every tick - roughly 900 KB/s per player, enough to cause stutter and disconnects on weaker connections.

The solution

I introduced delta encoding (send only changed fields), interest management (replicate only to nearby/relevant players), and a priority scheduler for bandwidth budgeting. The result was a 450× reduction to ~2 KB/s.

Architecture

A server-authoritative state store diffs each tick, a relevance graph decides which entities each player sees, and a serializer packs deltas into compact buffers prioritized by a per-player bandwidth budget.

architecture diagram

Features

Delta encoding
Only changed fields are sent each tick.
Interest management
Players only receive entities relevant to them.
Bandwidth budgeting
A scheduler caps and prioritizes per-player traffic.
Snapshot fallback
Full resync on join or packet loss.

Technical decisions

Field-level diffing
Tracking per-field dirtiness beat whole-object diffing for both CPU and bytes.
Relevance over radius
A graph of interest beat a naive distance check for complex maps.

Challenges & lessons

Balancing CPU spent computing deltas against the bytes saved - too aggressive and the server melts; too loose and bandwidth creeps back up.

Measure first. The 900 KB/s number is what made the whole optimization legible and worth doing.

Tech stack

LuauNetworkingSystems

Timeline

2024
Shipped to production
2024
Interest graph + budgeting
2023
Delta encoding prototype

Changelog

v2.02024
Interest management + bandwidth scheduler.
v1.02023
Delta encoding core.

Roadmap

Open-source the serializerPLANNED
Production rolloutSHIPPED

FAQ

Is this open source?
Parts live in lua-netkit; the full engine is game-specific.
How was bandwidth measured?
Per-player outbound bytes sampled server-side over representative sessions.
Related projects
Roblox Game
Drop A Box
A physics sandbox multiplayer game with custom networking and an RNG reward system.
Desktop App
Beam
Fast, private, peer-to-peer file transfers over your local network. No cloud, no accounts.