I’m making a pretty good map with a lot of parts over a small area. The problem however is the LAG, and I haven’t been able to find ANY good forum posts about how to prevent lag or anything.
My map right now is around 2000x2000 studs, and around 60k assets. There is one spot in particular, the main point of interest of the game, that I believe has around 10k assets in about 100x100 studs.
PLEASE please share your secrets devs, I really would love to know how to eliminate lag.
In more detail, It’s mostly FPS lag not caused by scripts. It’s whenever anything in the workspace gets updated, a new instance(object) is made, and especially any time I have to load the points of interest. (It has gotten so bad that I decided to keep StreamingEnabled off, so I would never have to reload parts of the map. Obviously this is not a good solution)
So my game is still lagging even though I turned off cantouch and castshadows for everything it doesn’t matter with. Nobody has any other tips or anything?
Yep so the problem is I don’t really wanna spoil my map, so I’ll explain in detail.
With streaming enabled
I spawn in at 60 fps, whenever I walk to the main point of interest (The super detailed part) it has to load in, I will go from 60 fps to 20 fps for a few seconds. Then my performance there is usually 60 fps. If I walk too far away then it unloads causing 20 fps for a few seconds again. This is a huge problem because of the design of my game, you will need to walk to this point and away from it for most things.
Without streaming enabled
I spawn in with 10-ish fps for a few seconds, then my fps stays consistant 55-60. Anytime anything in the workspace gets added or removed, the server has to refresh the whole workspace causing me to go down to 50-40 fps for a moment.
You should look at optimizing the super detailed part of your map then.
Make sure to try it on a lower end (mobile) device. Without streaming, it probably crashes due to memory. Streaming is also very useful for quickly joining a game. Faster join times.
Checking network send/recv might also be useful. But the lag you’re experiencing is probably rendering-related (check micro profiler).
I have a similar situation as you do; there is a small point of interest on the map with thousands of parts in the area.
From what I found, if there are a lot of small unions in the area, it will drop frames a bit. For example, if you have 100 different small parts and you decide to union all of them and make the size of the union small, it will drop frames a lot, especially if there are many small unions like that in the area. Also, if there are a lot of parts in a very small area that will also drop frames. For example, if there are around 1000 parts crammed into a small area.
A solution that kind of works is to just lower the part count and get rid of as many unnecessary parts and unions as possible. What you could also do is add a low-graphics mode that would get rid of non-important buildings and other things around the map. Overall try to avoid having very detailed buildings in a small areas as that causes the most fps drop.
i suggest you use a microprofiler removing aspects of this area one by one, exclusively, and noting when it gets better; after making a list of at least 5 aspects which affect your performance the most, work on those and try to optimize them by merging into a single mesh, billboarding, reducing polycount, and reducing texture sizes
Update : It was a humanoid in the workspace. Not assigned to anything, an accidental object that got added.
No clue why it was causing so much lag, I’m pretty sure it’s because it was checking repeatedly for a humanoid root part, but there was none since it was unintentionally added.