What do you want to achieve? Trying to fix the frame rate issues, maybe get some help on how to investigate further.
What is the issue? Frame rate drops in my game, my similar games have 60+ fps but this one (which is more efficient in part count and script design) gets far less.
What solutions have you tried so far? Tried setting the render fidelity to performance for all unions and mesh parts, removing post processing effects, using a chunk loading system, searching for high memory and frequently running scripts (with no luck on causes), etc.
Basically my train simulator game has horrible frame rates. My other train sim games I have made have worked better than this, but my current game which has far less parts and is more simplistic script wise than the others too. But for some reason I am getting only 30 fps tops. others have reported similar issues, some even getting less than 10. I have done a lot of investigating using the dev console, but not much luck on finding the cause. Not many scripts are running often or using high activity. Typically just a couple scripts running at a time with minimal usage. Sometimes the frames randomly drop to sub 10 fps randomly just from idling.
It can be from any unanchored or moving parts, if not then most likely something contained in one of the scripts that contains GUI or part or particles and is making the client lag.
Open up the microprofiler with Shift+F6. When the game starts to lag, pause the microprofiler with Control+P. Click on a laggy frame to inspect it. It should look something like this:
From there you can see every single process and how long it took for those processes to complete. The longer the bar, the longer it took for that process to process. It should then be easy to piece together the problem.
You can also inspect another debug panel. Use Shift+F4 to open up the physics panel and check the “Moving parts” amount. It should not be ridiculously high.
I have my other train games at 90k+ and they run at 60 fps. We use a chunk loader to only make small portions of the map visible at a time, and SetNetworkOwner() for all trains and moving parts.
Looking at the micro profiler, this is what appears. Do you have any leads on the cause based off this?
ya
This pretty much confirmed that it’s a UI problem. You can get a sense of scale of how laggy it was by comparing its length to the physics process (circled yellow).
That “UpdateUILayouts” process is taking longer than everything else to finish, which is what’s dragging the frame behind
what could be causing this though? I have no clue why the ui would be breaking things this badly. Are we possibly not following standard practices? Are there common mistakes with ui development?
It literally says “UpdateUILayouts”, which is referring to the UILayout class of instances. This class includes UI modifiers such as UIListLayout and UIGridLayout. It’s definitely an optimization problem; either you’re not using them correctly or you accidentally left in a useless infinite loop of some sort.
You can try to trace the problem by searching for all localscripts that interact with UI, specifically with those aforementioned UI modifiers. If you’re not sure whether or not something is being used correctly, you can look around the DevForum for sample code/opensource projects to compare and contrast.
btw, other people also seem to be having a problem with this. You’re heavily encouraged to look around, maybe they have the solution you need.
I’ve looked around at a lot of dev forum posts. It might be a roblox issue with the place itself. This post highlights the issue exactly. Will try it in a new place and see if it improves.
It looks like you’re doing something every frame that has heavy calculations. I would look into any code that runs every render step and go from there.
I have resolved the issue! This little guy was sitting at the bottom of Workspace just breaking everything for some reason. Deleted it and it works 60 fps no matter what now! This is a huge stress off my shoulders, thank you all for your help!