I’m making a guy who can swing a chain to attack players. This chain is a bunch of unions connected together via BallSocketConstraints to simulate a chain’s movement. It works fine when I view from run mode or view from the server’s pov on a test, but when I view from client’s pov, the chain looks really glitchy. I want to see if there’s a quicker fix before I try to just have each client simulate its own chain.
Try setting the networkownership to Nil (sorry if im possibnly wrong because this is what i know after seeing those devforums posts like this)
Hi, I already tried setting the NetworkOwnership of all of the chain segments to nil, but the problem’s still there.
Oh,
I just got a solution on my mind for some reaosn, but if you can try to set the network ownership to the player because the client’s pov looks glitchy as your perspective. You can try it. If it doesn’t work, I am probably out of solutions
I do believe this would work if the game was single player. Since there’s gonna be multiplke people, the chain would likely work fine for the one player I set the network owner to, but for the others the chain would still look bad.
This is because of replication issues. Personally if I had to deal with it I would break it down to two problems:
- Hitbox problem - Collisions with the chain, must be mostly server-sided so exploiters can’t move the chains in unnatural ways.
- Visual problem - the visual positions of the chains themselves and the related animations, can be implemented on the client.
A way to deal with this is to send “data points” of the chain location from the server to the client through a script, along with a timestamp of that moment (so you can sync it after). On the client you have another script that picks up this data point packets, and basically calculates a small animation (less than a second) that “smooths out” the movement between the two measured states.
For example if a client has ping 250ms, the distance between two consecutive states is 0.25 seconds, so in between that, instead of watching a frozen chain, the client gets to see a smoothed out movement from the first state to the second state. Now that smoothed movement is obviously fake, but since it receives the real location every 0.25 seconds, it should closely mirror the real chain movement. Luckily for you most clients have much less ping than that.
In a way what you have to do here is like having a few data points of a function or a signal, and having to predict the underlying function, so you can fill-in the missing gaps.
Yeah, I figured I’d have to do something along those lines. The hitboxes are based on the direction the arm is facing in the animation, so the chains are mostly just visual, meaning a fake visual would be fine to use. I actually used this method a while ago in a projectile system I made, and it works very well, so i think this will work well too. Thanks