-
What do you want to achieve? Keep it simple and clear!
When players join the game, all HingeConstraints and AlignPosition attachments should be pre-loaded and ready to run (for Hinges, with ActuatorType of Motor with it’s intended AngularVelocity value and AlignPosition attachments to be run with it’s intended MaxVelocity and Responsiveness values) -
What is the issue? Include screenshots / videos if possible!
When a player joins the game, all HingeConstraints and AlignPosition are running in what I’d call ‘slowmotion’ (There are easily over 50 individual Hinges and about 15 AlignPosition constraints) I believe it might have something to do with the amount of these constraints that are meant to be running at the same time, possibly causing a bottleneck or the game prioritizing other game objects to be loaded first (although I’m not sure what that order would be with constraints),
From my testing and observing this issue, it usually takes 1 to 2 minutes for the constraints to load and operate as intended on a stationary device, mobile seems to take 2 to 3 minutes, and when I put my character model close to the parts that are being manipulated by the constraints, they seem to load quicker than the other ones in the distance, which makes me believe that constraints physics are managed on client side.
Here’s a link to a mov video showcasing the issue (couldn’t upload the video on this platform due to the 10MB file size limit):
In Roblox Studio, all of these constraints load instantly without any issues, but that may be because Roblox Studio manages both Server side and Client side traffic, making it load seamlessly.
Extra information I thought could build a better picture of the place:
- The place itself has around 5k Parts, there are no meshes and a small number of Unions.
- There are a few scripts re-parenting the attachments for AlignPosition and AlignOrientation between 2 parts every 5 or so seconds to change the direction of where movable platforms are going (I stopped using legacy body movers, and this is the only way I could make the platforms work with Align constraints) (I’m aware that re-parenting objects is quite expensive in terms of resource consumption, but there are only a few scripts doing this)
- All assets I want pre-loaded are located in folders containing Models, Parts, and unions (alongside other small scripts)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I couldn’t find any performance related topics on this platform related to constraints,
I think this has something to do with the priority order of the download queue, so I have tried to use the content provider service (which I have not used before) to try and prompt the constraints to be loaded first with the following local script found in ReplicatedFirst, but it doesn’t seem to be doing what it’s meant to (no errors, so it’s likely doing something unintended and I’m misunderstanding the syntax):
local ReplicatedFirst = game:GetService('ReplicatedFirst') -- getting this service just to ensure it's there
local ContentProvider = game:GetService("ContentProvider") -- getting ContentProvider service
local MovingObjects = game.Workspace:WaitForChild("AllMovingObjects") -- waiting for the folder containing all assets I want pre-loaded
local Assets = MovingObjects:GetDescendants() -- putting all objects that are constraints including parts they may be parented to in a table
for i = 1, #Assets do -- for loop to go through each asset
local asset = Assets[i] -- assigning each individual asset to a variable
ContentProvider:PreloadAsync({asset}) -- executing PreLoadAsync method to pre-load each individual asset
end
repeat wait() until game:IsLoaded() -- waiting for client to load all client side content from the server
I am quite new to development in Roblox (about 6 months in), so any feedback would also be greatly appreciated.
Please let me know if any more information is required, thanks.