Looking for class properties and methods?

Mereb is an ultra-lightweight (13 kB gzipped), zero-cost multiplayer netcode and matchmaking engine designed specifically for modern web games, web game portals (Poki, CrazyGames), mobile web browsers, indie game engines (Godot 4, Unity WebGL, Three.js, Phaser 3), and React applications.

The Economic Problem Mereb Solves
Dedicated server platforms (Hathora, AWS GameLift, Agones) cost $150 to $1,000+/month in continuous container uptime and bandwidth fees. For indie and web games monetizing via ad impressions ($1.50-$3.00 CPM), dedicated server bills bankrupt games. Mereb streams 60Hz gameplay directly P2P over WebRTC UDP, reducing server bills to $0/month.

High-Level Network Topology

Mereb utilizes a Host-Authoritative WebRTC Mesh Topology coordinated by Cloudflare Workers and Durable Objects:

NETWORK ARCHITECTURE TOPOLOGY
                      [ Cloudflare Edge Mesh ]
            (Workers + Durable Objects + SQLite Storage)
                Global Presence, Matchmaking & Signaling
                           ▲              ▲
                 WebSocket │              │ WebSocket
                (Signaling)│              │ (Signaling)
                           │              │
     ┌─────────────────────┴──────────────┴─────────────────────┐
     │                                                          │
[ Host Player ] <════════════════════════════════════════> [ Client Peer ]
• Authoritative Physics               WebRTC DataChannel   • Local Input Capture
• 60Hz Binary State Broadcast           (Sub-15ms UDP)     • Client Prediction
• Damage & Collision Check                                 • Hermite Interpolation
• Fallback Bot Simulation (if solo)                        • RTT Ping & Jitter Probe

Dual DataChannel Architecture

Unlike standard WebSockets that suffer from severe head-of-line blocking when a single packet drops on mobile Wi-Fi, Mereb initializes two independent WebRTC channels between peers:

Channel Protocol Reliability Use Case
unreliable UDP-like (SCTP) Ordered: false, MaxRetransmits: 0 60Hz entity transforms (x, y, z), rotations, health, aiming vectors, input streams.
reliable TCP-like (SCTP) Guaranteed Delivery Match start, player deaths, kills, round timers, game over, chat, and scoring.

Smart Bot Fallback (Eradicating Empty Lobbies)

If matchmaking exceeds botTimeoutMs (default: 8,000ms), Mereb automatically activates a local offline AI bot. The queue never feels empty, and players never bounce from your game.