Skip to main content

Introduction

Rewind is a server-authoritative lag compensation framework for Roblox games. It handles the complex task of validating player attacks (shots, projectiles, melee) by rewinding the game state to match what the attacker saw at the time of the attack.

Why Lag Compensation?โ€‹

In networked games, there's always latency between what a player sees and what's happening on the server. When a player shoots at an enemy, by the time that information reaches the server, the enemy may have already moved.

Without lag compensation:

  • Hits that looked perfect on the client get rejected
  • Players feel like the game is "eating" their shots
  • High-ping players are at a massive disadvantage

With Rewind:

  • The server rewinds player positions to the attacker's view time
  • Hits are validated against where targets were, not where they are
  • Fair gameplay regardless of connection quality

Key Featuresโ€‹

Core Lag Compensationโ€‹

  • ๐Ÿ›ก๏ธ Server-Authoritative - All validation on server, never trust the client
  • โฐ Clock Synchronization - Accurate time reconciliation between client and server
  • ๐ŸŽฏ Multi-Mode Validation - Ray, sphere, capsule, and melee support
  • ๐Ÿค– Automatic Rig Detection - Built-in R6 and R15 hitbox profiles
  • ๐Ÿ“ Scaled Avatar Support - Proper hitbox scaling for custom character sizes
  • ๐Ÿ”ง Debug Tools - Real-time visualization with Iris debug panel

Physics Replication (v1.1.0)โ€‹

  • ๐Ÿ”„ Custom Replication - Replace Roblox's default physics replication
  • ๐Ÿ“ก Entity Registry - Register players and NPCs for custom replication
  • ๐ŸŽฎ Client Interpolation - Smooth interpolation between network updates
  • ๐Ÿ“ฆ Bandwidth Optimization - Delta compression and proximity-based updates
  • โšก Configurable Tick Rate - Control network update frequency

Anti-Cheat & Vehicles (v1.2.0)โ€‹

  • ๐Ÿš— Vehicle & Mount Support - Register vehicles with custom hitboxes and weak spots
  • ๐Ÿ›ก๏ธ Armor System - Multiple hitbox layers with damage reduction and regeneration
  • ๐Ÿ“Š DataStore Abuse Tracking - Persistent abuse tracking with auto-kick/ban
  • ๐Ÿƒ Movement Validation - Detect speed hacks, teleports, fly hacks, and noclip

Quick Exampleโ€‹

-- Server Script
local Rewind = require(ReplicatedStorage.Rewind)

-- Initialize the server
Rewind.Start({
snapshotHz = 20,
windowMs = 1000,
})
Rewind.ClockSync.StartServer()

-- Validate a raycast hit
local result = Rewind.Validate(player, "Ray", {
origin = origin,
direction = direction,
clientTime = timestamp,
weaponId = "Rifle",
})

if result.hit then
if result.humanoid then
result.humanoid:TakeDamage(25)
end
end

Architecture Overviewโ€‹

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Client โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ Server โ”‚
โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ ClockSync โ”‚ โ”‚ ClockSync โ”‚
โ”‚ Input โ”‚ โ”‚ Validation โ”‚
โ”‚ Prediction โ”‚ โ”‚ SnapshotStoreโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Snapshot Store โ”‚
โ”‚ (Ring Buffer) โ”‚
โ”‚ โ”‚
โ”‚ t-1000ms โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
โ”‚ t-950ms โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
โ”‚ t-900ms โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
โ”‚ ... โ”‚
โ”‚ t-0ms โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Getting Startedโ€‹

Ready to integrate Rewind into your game? Head to the Getting Started guide!