Lots of Lag When Running Robot Based on Constraints

You can write your topic however you want, but you need to answer these questions:

  1. My goal is to make a game for the FRC 2019 season because I am bored and it sounds like fun. I modeled it after 254’s “Backlash” and it is made using constraints.

  2. I am using many constraints and one remote event where it fires when a key is pressed and a robot whose pilot matches the sender of the remote event does things according to what key is pressed. However, there is significant lag and robots will randomly “explode” where all or most of the parts will fly off and not come back.
    Below: image of exploded constraints


    Below: image of what it is supposed to look like

![RobloxScreenShot20200321_224516159|690x388(upload://cWUbnPHm6vJdC5kJ56YxjjcHmmn.png)

  1. I have tried condensing the code and making as few constraints as possible. Also the original system was that the key pressed remote event would do all of the “function deciding” and say, for example, that W was detected in a localScript. That localScript would send a move forward remote event and the robot itself would take that and move.
    However, I changed this so that when you press W, the localScript just sends a remote event that uses the key pressed in a tuple argument. Then the robot code will say “hey, W was pressed so go forward”

I need suggestions for a smoother actuation. You can view any lag/glitches for yourself at the place itself: FRC 2019 Season - Destination Deep Space - Roblox

I would suggest using CollectionService in case you are running a lot of scripts that are doing the same. Anyways, I do not really understand your problem.

I’ve found two things

  • This seems like overconstraining to me. Either, one constraint is trying something that another doesn’t allow, or parts from another robot are colliding. You can reduce the impact of this by making sure all your Constraint.ReactionForceEnabled properties are set to true, where applicable.
  • The robots always suddenly fling. You could consider a heartbeat loop, checking if the velocity suddenly changed or is very high, and reset the robot.
  • The RemoteEvents cause input lag. Handle things in a LocalScript, but add server checks. Make sure the client is the network owner of their robot.

Should I set the client to the owner of just the robot they are controlling or all of the robots?

A part can only be network owned by one client. Thus, having all robots network owned to one client is not possible. Only network own the robot the client is controlling. Make sure to release ownership when they stop controlling.

What should I do when nobody controls the robot? Or should I spawn them in as people are using them?

Network parent it to the server.

That’s your own design choice.