Framerate Dips

Does anyone else get large framerate dips (from 60 -> 45) or something similar?

I don’t know if it’s that I need to optimize my code further, but it’s been happening with setups much less complex.

It’s worth noting that my logic % is at an average between 4% - 8%. When the framerate dips, the logic % spikes up.

Anyways, if there’s some kind of fix that’d be great.


Is there any cases where the logic calculations spike due to a convergence of various conditions in the game?

You might want to check that, also, an easy method to optimize logic is to set some of it to only execute once every N-frames instead of every frame. So if you have logic that you can afford to have executed only 20 or 30 times a second rather than 60, it can give a pretty noticeable speedup.

Logic spiking up means it’s your code.

You’re doing something expensive, somewhere.

I guess you have some Python controllers eating processing time.

First thing to check: console

If there is a lot of output (e.g because of errors) it slows down. I/O operations are slow.

I guess I’ll have to look over my code.

Even so, I still get logic spikes on setups that don’t even run code and have very few logic bricks, which is why I’m confused…

Having errors thrown slows it right down, like monster says, also near sensors are very heavy, also the more items in a scene the slower a scene object list check is, so group things using many smaller lists like enemies, or powerups etc.

Neo = own.addObject(arguments)
If Neo is not inThinglist:
_____Thinglist =+Neo

Does your logic by chance slightly creep upward? I’ve had a problem where: out of nowhere my logic would go to 4ms and steadily climb to 25ms and, I assume further. I’ve not checked for any further increase because at that point the game would become un-testably slow.

Maybe you have a lot of dynamic objects in the scene so the logic spikes up while they are active and gets back to normal when they settle.