Roblox animations slowing down game

I was working on my game and noticed that my FPS started to drop, while few seconds ago my FPS was stable 58.

After a while I found out that this problem is caused by roblox animations. After some more investigation, I found out that AnimationTracks cannot be stopped, which probably is reason for this sudden performance loss.

You can try to reproduce this by yourself in this place:

In that place, just spam Insert key to spawn particle explosion. Each explosion contains 50 particles, and by spamming insert key, you can end up with 500 concurrent particles. Before animating a character the FPS stays pretty much constant, but after animating, FPS will drop fast, by spamming same particle explosions.

Edit: Step by step repro, because of unclear instructions:

  1. Get the place.
  2. Play solo it, and spam Insert key. FPS shouldn’t drop much.
  3. Press ‘Animate dummy’.
  4. Spam Insert key again. Do you get different FPS?

I can’t seem to reproduce this issue. My fps is staying at ~60 the entire time.

Any while true do loops in there? I remember having an infinite loop in a place one time that oddly didn’t crash the test game, but instead gave really low FPS.

The issue here is that my code handles 500 particles without a problem, but after you play animation it starts struggling with same ammount of particles.

And sparker, did you just hold mouse button or spam insert?

Well, the first problem is that you’re using AnimationTrack::Stopped(), which is depreciated, and I don’t believe will ever work. You want AnimationTrack::KeyframeReached(string keyframeName).

But… even if you use that, it doesn’t work. Maybe some kind of throttling is going on? But that shouldn’t interrupt the events. I also can’t reproduce the degradation of performance even running it in a fast loop in the script. But, regardless, something funny is going on, I’ll look into what exactly is up.

[quote] Well, the first problem is that you’re using AnimationTrack::Stopped(), which is depreciated, and I don’t believe will ever work. You want AnimationTrack::KeyframeReached(string keyframeName).

But… even if you use that, it doesn’t work. Maybe some kind of throttling is going on? But that shouldn’t interrupt the events. I also can’t reproduce the degradation of performance even running it in a fast loop in the script. But, regardless, something funny is going on, I’ll look into what exactly is up. [/quote]

Hmm strange, because that happens every time to me. Probably something to do with rendering, as I only have nvidia GT 620. And also one not space specific, since at first I faced this issue in other place.

Edit: Also yeah, even more sure that it has something to do with roblox internals, as my overall FPS drops, so it’s not my game loop that just get’s slower.