So, I’m working on a project similar to Super Smash Brothers, with abilities, dodging, air-jumps, knockback… etc. I have the current game structure as:
- animations, hitboxes, and visual effects are done on the client
- hit validation, cooldowns, etc… are done on the server
As far as I know, Rollback Net-code seems to be the best method for most of combat games that are somewhat fast paced. I have a basic implementation of rollback net-code in my project, but it seems to be inaccurate…?
I have the client create the hitbox and check for characters inside of that hitbox, once it detects a character, it sends a signal to the server and pass in the time of when that client detected a character (using workspace:GetServerTimeNow
, I have no idea if it’s the best approach, but it works). The server takes snapshots of every single player ingame, recording their positions, bounding boxes, etc. After receiving the signal from the client, the server will get the closest snapshot to the one that the client sent, check if the hitbox from the client is intersecting with another player’s bounding box, if it intersects; deal damage and broadcast it to every player to simulate visual effects. The issue is; when playtesting on 100ms ping (or 0.04 “Incoming Replication Lag”) since that’s about the average ping I usually play at, the validation just keeps missing when either player is moving fast and is playing on high ping (shown in the gifs below).
BLUE IS SERVER HITBOX
RED IS CLIENT HITBOX
PINK IS DUMMY HURTBOX
[1]:
[2]:
Now because Super Smash Bros is a fast-paced game, this might happen a ton of times.
I was wondering; is there a better or more efficient method to validate client hitboxes?