As a Roblox developer, it is currently impossible to make visual changes to a player’s character during gameplay without causing lag spikes due to invalidated fast clusters.
This has been an ongoing problem for years and it is making my game unplayable. I’m doing everything in my power to avoid invalidating these fast clusters but there are cases where it just can’t be helped.
My problem
I have a character that can switch between two forms, a humanoid form, and a form that can swim. When the player switches between forms their avatar is first made invisible and a transitionary form is made visible (boom, invalidated fast cluster,) a transition animation is played, and then the transition form is made invisible and their final swim-form is made visible (again, invalidated fast cluster.) This means there are two lag spikes for a single transformation and players are expected to use this mechanic as often as you might use a sprint function in other games. The transition takes less than a second in total.
Additionally, in this swim-form, when players enter the fluid they can swim in it makes their swim-form invisible (lag spike,) and visible again when they exit the fluid (lag spike,) and then every time they start or stop moving within the fluid a sort of “wake” mesh appears or disappears (lag spike.) This means every time a player starts moving there is a lag spike, every time a player stops moving there is a lag spike, every time a player presses left shift there is a lag spike, every time a player releases left shift there is a lag spike, every time a player enters a certain region there is a lag spike, every time they exit this region there is a lag spike, jumping out of and then back into this region causes two lag spikes, and this is just the basics of the problem.
The lag spike is made significantly worse the more complex the player’s avatar is. Layered clothing and lots of accessories make these lag spikes absolutely massive. The lag hasn’t been as bad for me in testing since my game’s AI characters have very simple appearances and my own character’s appearance is also fairly simple with no layered clothing. Once we’re in the real world with real players, however, the lag gets unbearable.
I could work around this issue by moving the swim-form out of the player’s avatar and into its own model in the workspace and then welding it to the player from there so it wouldn’t share a fast cluster with the player’s avatar but that seems like a very messy and poor practice to follow and would only solve the issue of the lag spikes occurring when a player starts and stops moving and enters and exits the swimmable fluid. It wouldn’t help with the transformation lag spikes or any other sources of invalidated clusters I’m experiencing.
Proposed solution
Here’s where I get to my proposed solution: placing parts of the player’s avatar outside of the player’s avatar seems like a very bad practice and would add a lot of mess since this external model wouldn’t automatically get destroyed along with the player’s avatar. Instead, I propose models within the player’s avatar should not share the same fast cluster as the player’s avatar. This would mean I could keep things relevant to the player’s avatar within their character but still ensure that changes to them won’t invalidate the entire cluster.
Additionally, it would be nice if models had a boolean property named DisableFastClusters
which would prevent a fast cluster from being made of its descendants that aren’t themselves in a sub-model so visual changes could be made to the contents of this model without worrying about invalidating any fast clusters.
I understand Roblox doesn’t want things to get too complex and for new developers to have to worry about weird properties like this but I truly wish Roblox would show some faith in its developers and occasionally give them the tools to enable and disable some performance features depending on their game. The current system is very opaque and encourages bad practices like welding things to the player’s avatar from outside their character in order to avoid invalidated fast clusters.