Debugging
Rewind includes powerful debugging tools to visualize hitboxes, shot traces, and validation results.
Iris Debug Panel
The built-in debug panel uses Iris for real-time visualization.
Enabling Debug Mode
-- Server
Rewind.Start({
debug = { enabled = true },
})
Rewind.ClockSync.StartServer()
-- Client
Rewind.ClockSync.StartClient()
Panel Features
The debug panel shows:
- Clock Sync Status - Offset, RTT, lock status
- Snapshot Stats - Buffer size, oldest/newest timestamps
- Validation Stats - Hits accepted/rejected, reasons
- Performance - Validation time, memory usage
Toggle Keybind
Press F6 to toggle the debug panel (when debug mode is enabled on server).
Visual Debugging
Drawing Hitboxes
Visualize hitboxes for a character:
local Draw = require(Rewind.Debug.Draw)
-- Draw hitboxes for a character
Draw.Hitboxes(character, Color3.new(0, 1, 0)) -- Green
-- Draw for a specific duration
Draw.Hitboxes(character, Color3.new(1, 0, 0), 2) -- Red, 2 seconds
Drawing Shot Traces
Visualize validation rays:
-- Draw a raycast
Draw.Ray(origin, direction, Color3.new(1, 1, 0), 1) -- Yellow, 1 second
-- Draw a capsule sweep
Draw.Capsule(origin, endPoint, radius, Color3.new(0, 1, 1), 1) -- Cyan
-- Draw hit point
Draw.Point(hitPosition, Color3.new(1, 0, 0), 0.5) -- Red, 0.5 seconds
Drawing Melee Cones
-- Draw melee attack cone
Draw.Cone(origin, lookVector, angle, range, Color3.new(1, 0.5, 0), 0.5)
Debug Events
Enable debug mode to see validation details in the output:
-- Server-side with debug enabled
Rewind.Start({
debug = { enabled = true },
})
-- Validation results will be logged automatically
-- Example output:
-- [Rewind] Hit accepted: Head, position: (10, 5, 3)
-- [Rewind] Hit rejected: out_of_range
Console Logging
Enable verbose logging:
Rewind.Start({
debug = { enabled = true },
})
Output:
[Rewind] Validation request from Player1
[Rewind] Mode: Ray
[Rewind] Timestamp: 1234567.89
[Rewind] Rewind delta: 0.15s
[Rewind] Checking targets
[Rewind] Target Player2: HIT (Head)
[Rewind] Result: Hit accepted
Performance Profiling
Rewind includes internal performance tracking. Check memory and validation performance in the debug panel when enabled.
Common Issues
Hitboxes Not Showing
- Ensure
debug.enabled = truein config - Check that Iris is installed:
Packages/_Index/sirmallard_iris - Verify the debug panel is toggled on (F6)
Clock Sync Issues
Check sync status:
local ClockSync = Rewind.ClockSync
print("Has lock:", ClockSync.HasLock())
print("Offset:", ClockSync.GetOffset())
print("RTT:", ClockSync.GetRTT())
Validation Always Failing
Enable debug to see rejection reasons:
local result = Rewind.Validate(player, "Ray", params)
if not result.hit then
warn("Rejected:", result.reason)
end
Testing Tools
Simulate Lag
Test with artificial latency using Roblox Studio's Network Simulator (View > Network Simulator) or by adding delays in your hit validation code.
Best Practices
- Disable in production - Set
debug.enabled = falsefor release - Use sparingly - Debug visualization impacts performance
- Log suspicious patterns - Track rejection reasons
- Test with lag - Simulate high ping to verify compensation