hey hope you are doing well. I was trynna understand roll back systems and sorta went in dept with it. I know people are gonna straight away complain about client side hitboxes. But please take your time to read it carefully on what purpose the hitboxe does and has.
Rollback System with Client Prediction (recorrected the flow).
• Client presses attack key.
• Client immediately plays local attack anim/sfx/vfx for instant response (not replicated).
• Client sends a StartAttack request to the server, using ZAP.
• Server receives StartAttack:
- Validates if the attack is allowed (cooldown, stunned, etc).
- Records attacker's current position + timestamp (authoritative moment of attack).
• Client detects a hit locally via hitbox logic (spatial query).
• Client sends a HitRequest to the server with:
- Target that was hit.
- Attack data (type, direction, not position).
- Optional: Relative animation phase (not a raw timestamp).
• Server receives HitRequest:
- Ignores client timestamps (can't be trusted).
- Estimates latency (e.g., ping / 2).
- Rewinds target’s position from a position buffer using (now - latency).
- Uses interpolation between past frames to get precise rewind.
- Skips interpolation if teleportation or warping occurred.
• Server reconstructs the hitbox:
- Uses attacker’s recorded position from StartAttack.
- Uses known attack shape, direction, and timing.
• Server checks if the reconstructed hitbox intersects with the rewound target.
• If valid:
- Applies damage and core status effects (e.g., ragdoll, stun) on the server.
- Sends ConfirmedHit to attacker, victim, and observers with info (e.g., knockback vector, VFX ID).
- Clients apply knockback and effects locally based on server-approved data.
• Clients play synced hit reactions, VFX, SFX only after ConfirmedHit.
• Meanwhile, server tracks all players' positions:
- RunService.Heartbeat logs CFrame every 0.05–0.1 seconds.
- Stores last ~2 seconds of frames per player.
- Structure: PositionBuffers[player] = { {time, cframe}, ... }
- Interpolation used to get in-between positions on rewind.
- Teleport detection disables interpolation when needed.
Mainly for combat/projectiles. I just wanna make sure it’s a good concept. I never trusted client side hitboxes before so I see the potential in having it. But I was just wondering if you could validate the concept?