Random lag spikes

Heyy! So, in the game The Garrison we are right now expiriencing lag spikes after we’ve added chess & an expansion to our memory wall. We have disabled chess to see if it resolved that but it doesn’t. We have also removed the memory for now if thaat resolved it but it doesn’t either way. How can that come? We never had such lag spikes. This is how the micro profiler looks when such lag spikes happens:

Does anyone know a solution perhaps?

Depends on the internet obviously, but also: it could be poor script optimization, unnecessary collisions, something that uses physics.

If not, plan B, Roblox updated something.

Well 1. as I have said above that those lag spikes appeared randomly after we did the update. So it can’t really be the internet. 2. We also haven’t added much other scripts except the chess and when we disabled it, like all the script from chess, it still persits. Everything which shouldn’t move got anchored on and we don’t really use the physics.

Our proximity prompt’s are kinda buggy too. They don’t disappear sometimes and I haven’t touched it so do you think it could be Roblox fault?

So, expansion of your memory wall? How would you do that? Did you use a plugin? If so that may be the reason.

Since it seems the issue is with script/building, please adhere to the following:

Building:

Do not use duplicate assets (assets that are the same but have been uploaded with different asset IDs can hurt performance)

Use built-in roblox material whenever possible and minimize the amount of custom textures you have. These use far less memory than custom textures.

Avoid using transparencies other than 0 and 1.

MeshParts:

If you are using meshparts, meshparts have a collisionfiledity property, which determines how precise collision will be. If you still need collisions to be enabled then change the collisionfiledity property of the meshpart to “Box”.

Works well for small parts that do not really need precise collision detection.

Make sure to set a meshpart’s render filedity to either automatic or performance aswell…

Scripting:

Frame rates:

Try not to use expensive operations such as while loops or runservice events. Since these run so often they take longer to process and can thus impact frame rates.

Intensive operations on tables such as deep cloning have a high performance cost.

Memory usage:

Disconnecting events when they’re no longer required frees up memory since events connected to functions are never collected by the garbage collector until someone manually disconnects them or uses :Destroy() on the instance.

Arrays can take up alot of memory usage, so keep their size as low as possible and try to clear the table whenever possible.

One thing many developers forget is that the engine does not automatically destroy player/character objects once their respective events are fired (character removing, player removing). You don’t need to worry about manually destroying instances that aren’t characters or player objects since the engine DOES automatically destroy them and free their memory usage.

Unless you manually use the destroy method the events, attributes, and any sort of thing stored to the player/character object will remain and their memory usage will not be free’d. Which can overtime lead to memory leaks as more users join and leave.

To stop this, make sure to destroy the player object manually when the player leaves. Same for the character.

Since your problem seems to be related to frame rates, i’ll just go over frame rate improvement techniques instead of memory:

Physics:

For parts that do not require physics, anchor these parts and turn canquery, cantouch, and cancollide to false if they do not need these.

1 Like

I do appreciate your response but we have not really added a lot except a memory wall & and chess. Since then, weird lag spikes came and prior updates we’ve bun are not causing lag. Whenever a lag spike happend, I had my script activity open and there were no suspicious responds. We do have frames for the decals yes, however they have not caused issues in the past. Do you think it can be a roblox update?

Possibly, I remember a bug report not too long ago complaining that the a new update has caused an increase in lag. I’m not too sure though.

1 Like

Check your workspace for an ungrouped Humanoid. This has caused so much lag for my games.

1 Like