Constraints not replicating from the server to the client

I have a railroad crossing gate, it contains a cylindrical constraint, which is controlled by a server script. The network owner of the gate is the sever. When the server script updates the target angle for the cylindrical constraint the gate’s movement is not replicated as expected to the client.

The issue:

This is how the gate’s movement is coded in the server script:

--when train comes lower the gate
boomarm.Functional.Motor.CylindricalConstraint.TargetAngle = boomarm.Functional.Motor.CylindricalConstraint.LowerAngle;

--when train leaves raise the gate
boomarm.Functional.Motor.CylindricalConstraint.TargetAngle = boomarm.Functional.Motor.CylindricalConstraint.UpperAngle;

Here is the game which this issue occurs in:

A few things to note:

  • The video is recorded in studio to showcase the different between the server and the client but the same does occur in a live game.
  • This issue seems to apply to other constraints as well, having the server move the gate with an AngularVelocity, LinearVelocity, LineForce, or a VectorForce all reproduce the same issue.
  • Touching the gate will update the gate’s position to where it should be, but sometimes you have to stay touching the gate for a little bit before it updates.
  • Giving network ownership of the gate to the client/player does fix the gate’s movement and resolve the issue, however, since network ownership can’t be given to multiple players at once this only works for single-player games which my game is not.
  • I am enrolled in the beta channel and have all the beta features activated.

These are the solutions I’ve tried:

  • Changing workspace.PhysicsSteppingMethod to Adaptive and Fixed
  • Changing workspace.InterpolationThrottling to Enabled and Disabled
  • Having a different constraint move the gate (see notes above)
  • Changing the ServoMaxTorque of the cylindrical constraint in the gate every frame to keep the gate awake (see this post)

I’ve been at this all morning and afternoon so before I go cry in a corner or something I’d like some feedback or potential solutions on top of what I’ve tried already.

2 Likes

I have some questions.

  1. Which actuator are you using? Angular, Slider, or both?
  2. What actuator type(s) are you using.
  3. What are the limits of each actuator that you are using?
2 Likes

Here are the properties of the cylindrical constraint at server start.

1 Like

Part of the issue that I see is that you have limits enabled for the slider, but actuator type is none. Try disabling that. Basically, you have enabled an option for something that you are not using. With none selected, it might be confusing the engine.

Something else you might try is setting ServoMaxTorque to math.huge on the command line. It will show as inf in the field.

At this point, that’s all that I can think of.

2 Likes

I would clone the part localy for each player, physics should be handled localy in most case (tell me if i’m wrong). Otherway you can script the rotation without physics

3 Likes

Neither of these worked. Thanks for your input though.

1 Like

Constraints may need to have their NetworkOwnership set to the Server with the script, otherwise you can get physics lag (physics Constraints stutter or stop).
Why not Anchor it and CFrame the gate movement so it doesn’t have any lag issues because that’s done on the Server?
And why the heck are you using a CylindricalConstraint? A HingeConstraint does the correct job without the added physics of the slider.

1 Like

I’ll try this approach and will let you know how it goes.

1 Like

CFrame could cause the gate to clip through a car or something else that’s under the gate. I’ll replace the cylindrical constraints with hinge constraints and I will get back to you on that.

1 Like

Or Tween an Anchored Part with the gate welded to it.

1 Like

The hinge constraints didn’t resolve the issue, but I will still use them over the cylindrical constraints since they are simpler. I think Tween would have the same problem as CFrame but I’ll look into it after I try Temateite’s suggestion.

1 Like

The constraints don’t move at all if changed by a local script for some reason.

1 Like

I did some more experimenting and the server registers everything as expected but the client is very behind. Here are a couple new videos showcasing the issue:

Client:

Server:

In a live game the gates don’t update unless you’re literally standing on them. I get the feeling this is an engine bug. Surely the server can’t be on its knees with only 1 player, 2 hinge constraints, and 14 vector forces??? (vector forces are for train movement)

Tween won’t have the clipping issue.

The only anchored Part that’s tweened is the rotating hinge Part you weld everything else to.
The other gate Parts would be unanchored and welded to the tweened Part.

In your video examples what is are the gates NetworkOwnership set to?

The gates network ownership is set to nil (the server). I’ll get the Tween set up now that I tried Temateite’s suggestion.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.