Cpu spikes when moving camera fast

My game has an estimated 14 * 3 * 8 * .5 + 24. (168 + 24 = 172 roughly) All unanchored. But but most are welded together just like in the video. I’ve optimized scripts a lot so I don’t think cpu spikes are caused of that.

Btw the cpu spikes go up to 100. If there is any other information that is needed I’ll happily give. This is the first time I’ve encountered such lag making things so I’m close to clueless on what to do.

How can I stop these cpu spikes tha cause lag?

3 Likes

Hi,
Am not really a good developer but here are some quick tips to reduce CPU spikes when moving the camera fast:

  • Try anchoring more parts if possible. Even welded unanchored parts can cause heavy physics calculations.
  • Reduce the number of unanchored/moving parts visible during fast camera moves (use culling or LOD).
  • Check if any scripts run heavy calculations on RenderStepped or camera events and try to throttle them.
  • If your game is large, enable StreamingEnabled to limit loaded parts.
  • Also consider lowering graphic effects or shadows during fast camera movement.

If spikes remain, share more details about your weld setup or scripts affecting the camera or try to ask some chatbot.

4 Likes

I unfortunately can’t do the first one. And I thought occlusion culling was already built in? I have throttled render stepped and streaming is enabled.

And right now I don’t have my special effects going on. And I’ve even cut down on 90% of all cast shadow parts.

Each block you see is made up of 14 surfaces for the 3d maze generation. They are 24 blocks. Eah block is made of the shell. A visible non collidable union. And under it are the 24 transparent precise collision parts and union surfaces. All welded together and unanchored.

The game is simple in idea and th only major scripts and thing tht could tinker performance is these blocks. But I don’t know how to optimize these more

2 Likes

turns out this was actually the reason. I was running a heavy function in one of my scripts with out noticing. Putting it in a task.spawn fixed it.

1 Like

Update frame stutters still happen but the are no more cpu spikes

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.