Hitbox Network Replication Methods

Lately I have been experimenting with Hitbox replication for an ability system I am making for a multiplayer game, I’ve tested multiple methods and have found a feature that could make this even easier I want to get feedback on.

On the past I have been using a time based replication system that would basically take the hitbox origin CFrame, velocity and time variation (os.clock() - Server clock before firing remote) and based on that calculate the current position creating a whole new hitbox and setting all values manually once the client receives an event.

Now, I recently discovered that if you delay the firing of the remote a bit after creating the hitbox, as the networking replication system already creates the hitbox on the client I am able to send the reference to it through the remote without it being nil.

My current idea is to just clone the part from the client with constraints and everything as needed for the ability once the client gets the event and just parent it accordingly for it to be shown in workspace.

Now, the reason I am creating this post is because I want to ask developers more experienced about networking concepts than I am, if this method is accurate, efficient and secure. If not, I would love to read about some other methods that I could use to achieve this.
Thanks!

1 Like

I can’t speak for other developers, but me, personally, when reading a post such as yours, it helps if I know the ‘reason’ for the hitbox replication, such as what situation are you needing to do this.

A moving projectile hitbox, with body movers or different constraints, if other players are experiencing lag and they create the client hitbox at Caster’s RootPart while on the server it already is 50 studs away, there you have a problem, I am planning to use a client hitbox for hit effects and server hitbox for damage and other things, but I need it to be accurate.

From what I have read about doing this in other games outside of Roblox, they create the projectile on the client, and tell the server the weapon was fired, and at what time.
If the server has no problem with the weapon being fired (or projectile being created) the server creates it, but accounts for the delay in time, while checking to see if anyone was hit during that duration.

then the server updates the client, every few ms, saying where the projectile is, and at what time
the client updates the projectile based on the server time.

I am by far, no expert on doing that, and have never tried it myself, however, I noticed you did not get any responses, so I figured I would share what I have read, as to how most games do it.

Hope that give you some help.
Also… Roblox has a command that you can call on the client and it will give you the best estimate time on the server. This can help with timing things.

Using server reconcile method is by far a great solution, sadly, my framework is just able to support one time caster → server and one time server → clients communication, it is just linear projectiles so it still should be fine with a time based prediction, however my doubt is if I should continue to recreate the hitbox on the client manually or if just cloning server hitbox on each client (I know I could just use the server hitbox for hit detection on the client but that could actually be innacurate and also the effects wouldn’t look smooth) is a good method