Home▸Physics & Mechanics▸Real-Time Sync Engine: Latency & Conflict Resolution (2D)

🔄 Real-Time Sync Engine: Latency & Conflict Resolution (2D)

A genuine distributed-systems model of the mechanic the 3D original only implied: up to eight replicas edit a shared grid over a simulated network with adjustable latency, packet loss and edit rate, resolving conflicts with last-writer-wins and retrying dropped packets with exponential backoff — watch convergence recover after every burst of loss.

Physics & Mechanics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-interactive-real-time-collaborative-3d-engine ↗ Open standalone

The 3D original showed a scene labelled "real-time collaborative engine" but drove nothing from its engine, responsiveness and teamwork sliders beyond three cosmetic percentages — there was no actual synchronization to observe. This 2D companion builds the real mechanic the title promises instead: a shared grid is edited independently by up to eight simulated collaborators, and every edit is replicated to the others as a network packet with its own randomly jittered latency around the latency slider's base value. Raise the packet-loss slider and some of those packets never arrive on the first try — a dropped packet triggers an exponential-backoff retry (100 ms, then 200 ms, then 400 ms, capped at 2 s, each with its own jitter) exactly as a real sync client would. When two collaborators edit the same cell before either edit has propagated, the replica that receives both simply keeps whichever carries the newer logical timestamp — last-writer-wins conflict resolution, the same strategy behind most real-time collaborative editors. The live panel tracks per-cell convergence across all replicas, the rolling average delivery latency, a running count of dropped packets and current throughput, so you can watch the system visibly desynchronize under heavy loss and then converge again once the retries land.

⚙ Under the hood

2D collaborative-sync lab: adjustable network latency, packet loss and edit rate drive a real last-writer-wins replication model across up to 8 peers — watch exponential backoff retry drops and per-cell convergence in real time.

real-time collaborationnetwork latencypacket losslast-writer-winsexponential backoffeventual consistency

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)