So I’m working on a fighting game and for knockback, I’m trying to accomplish something that feels as smooth and instant as possible.
I’m creating BodyVelocities on the server and putting them inside of the victim’s RootPart, and for the most part it works okay but on the attacker’s screen, it’s kind of delayed:
On the victim’s screen though, everything is smooth and instant. I’m pretty sure this is because the physics of the BodyVelocity are being calculated by the victim’s client, since the BodyVelocity is inside of the victim’s RootPart, which is under their Network Ownership.
Is there any way for me to get it to look smoother than this, and on both sides, though?
The only other idea I have is using BasePart:ApplyImpulse(), but:
The physics are still calculated by the NetworkOwner of the part the impulse is applied to (Assuming that because you can only use this function on the part’s Network Owner’s side)
I’d have to use FireClient to tell the client to apply the impulse (reason mentioned before), and I’m pretty sure it’d be just as slow if not slower
The problem might be just the studio built-in-lag: It tries to simulate an actual game server lag but its waaay too overpowered. You should try this is the roblox client and see if its still that laggy… I don’t see any other solutions if this doesn’t work.
This is actually a clip of a live server. The second player is my alt on mobile, I thought what you said was the problem so I tried a live game and it persisted
I know it’s possible to accomplish smooth and instant knockback because Grand Piece Online has done it:
On the client on successfully hit clone the enemy and do the effects on the local clone while making the server side invisible.
Simultaneously do a remote function by the server if it’s ok then continue else cancel it and interpolate tween the local clone to the server sided enemy and make the original server sided one visible.
Something about doing client sided effects.
Luckily knockback should be predictable and describable both on server and client through projectile motion equations which can be time synced.
Doubt any game with heavy combat does that (opens up too much extra work, also you’d be able to see if the character is getting cloned) but thanks for your suggestion
Do you have any other ideas? I’ve been stumped on this for about 3 days now.
I’ve switched to BodyPositions which gave me a better result, but the delay is still there, and it’s only smooth on the victim’s client like before
You can prevent this by cloning the character ahead of time.
Maybe you are just lucky to have good enough internet. In my olden fighting game experience on roblox, it’s usually what I remember from these two videos below, perhaps a better test would be to stand far away from your router so your internet is 1 MBps and then play grand piece online and see what happens:
Maybe you are overthinking this problem, It should be good enough for people with good internet, maybe focus on other areas of your game instead.
Otherwise, go for the completely client sided and custom replication approach, no other way.
Maybe even @octav20071 set network owner with sanity checks should work especially for the attacker, if the character gets flinged with abnormal velocity or destroyed then you know something is sus. Might even be the simpler method.
That’s what I thought too, but my internet is fast and my ping is always really low, but this problem happens consistently only in my own game. It’s a widely known problem with BodyMovers and using them for things like this, I’m just trying to find a fix (no actual fix info I’ve found yet).
I’m going to keep trying (probably going to try setting .Velocity next) , because thanks to these games, I know that it’s possible. (And I’m positive the client clone method isn’t the way although thanks for the suggestion)
Getting this right is crucial to how the game will feel, hence why I’m trying so hard
I don’t think that is true. BodyVelocity is an outdated object I strongly advise not to use it.
FireClient then ApplyImpulse on the client. SetingNetworkOwnership to Server is not recommended as not only do you have to detect when the player landed and set the networkownership back to the player. You will always have latency. It’s something unavoidable.
The problem with tweening is that it gets abit glitchy especially if you’re being moved around while tweening and it has a kinda laggy jittery effect on players. I don’t experience the same issue as these guys but I wouldn’t recommend using tweening to fix it tbh.
So I have done some testing since this is a frequent recurring and interesting topic. So I have done testing with the server network ownership method, the only cons I see is that it’s not smooth for the victim perspective.
Video testing, with 0.25 seconds incoming network replication lag:
That’s true but it seems to be overcome able by setting an arbitrary time like 0.2 seconds. The only major issue is as aforementioned with the victim client perspective being not that smooth.
Plus the fire client method seems odd for the responsiveness of the attacker
attacker client → server → victim client → server client → attacker client
Compared with the server method
attacker client → server → attacker client and victims client
However it seems to guarantee to be more smoother for the victim got a test file or video to share?