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!