BodyMovers become slow when there are a lot of them

The slowing down seems to be proportional to the number of parts and not caused by some number being reached. I tried uploading a place from studio and it crashed and now I’m trying to do it on the website and nothing is working because everything is timing out and roblox doesn’t want me connecting to it anymore right now. I’ll try again once it stops being angry.

Okey, thank you! Looking forward to the upload!

chefdeletat, do you mind me asking what your roblox profile is? I don’t think I’ve seen you before. :open_mouth:

@1waffle1: Thanks for the upload! I’ll be investigating

@1waffle1: This level is an empty level with some scripts. Can you provide instructions or otherwise make it easy to reproduce?

Go in studio and press play with character. A part spawns every render frame. Click and hold to make all of the parts follow your mouse. They should move at a constant speed of 50 studs/sec (you walk at 16) but eventually they slow down. You will notice just how much they’ve slowed down when you start walking faster than them, which should only take a few seconds.

This seems to be a performance issue due to the sheer number of blocks that are spawned. Can you reproduces your issue with 1 block behaving differently from 2 blocks?

In Laser Tanks, there is one bodyvelocity (and bodygyro) object per tank. There can be up to 11 tanks per player and 12 players, but that is the max; there’s usually around say 40 tanks in the server. print(wait()) sometimes gives over 10 seconds per frame. Two parts probably won’t be different from 1 because two parts don’t really make the game slower than 1. The slowness in speed is related to the slowness of the game.

That makes sense. This issue is related to the FPS of the game. If the FPS is too small, the BodyMovers will move objects more slowly because well the game can’t handle the load (this happens when the FPS is ‘REALLY’ slow because otherwise we would have synchronization issues). I would say try to reduce the load on your game.

If you upload a level we can run a performance analysis and identify the issues.

1 Like

How does your performance analysis work? Is it something I can do online/something other developers can run in their own games? Just looking at the dev console, I know what part of my game is causing the majority of the lag and the little color label next to the script is a frightening color with a high percentage:

Unfortunately our game profiling tool is not accessible to the devs - it requires access to the code base.

You can use the Stats group in Studio under the View tab.

This will give you a breakdown of different systems.

I’ve had the same problem, I’d have two-three parts with BodyVelocity moving them, after the first part reached a point the second part had its body velocity enabled and every part with bodyVelocity got slower. Fps remained at 60 though.

Can you provide us with repro steps and a model? Thanks

I have this issue too, but it’s only apparent on low-end hardware:

These red “bullets” are supposed to fire much faster, and they work fine on my own computer. However, they slow down immensely to the point where the level is unplayable if you use a slower computer.

Also sorry if this is a necro bump but I didn’t think it was necessary to make a new thread.

Are you using body movers, or the new PGS constraints?

Using BodyVelocity, is that why?

Body movers are no longer being supported – they were made for the old spring physics solver, and the new PGS constraints generally work a lot better. Can you try implementing the bullets using VectorForce or AlignPosition?

Implementing this with PGS constraints will be more difficult because there’s no PGS equivalent to BodyVelocity, but this will either 1) demonstrate that this is still an issue with PGS or 2) yield you a solution in the end anyway. In the case of the latter, you can make a feature request for more intuitive PGS constraints.

1 Like

I will try as soon as I have time, thank you.