In my game, a tower defense game, as soon as I begin spawning creeps, the framerate drops suddenly. It begins at about 33, and reaches 5fps after adding only a few creeps. My first idea was there may be some inefficient scripts, but the profiler claims the massive framerate decrease is due to “physics” This is strange, because I use very few dynamic or rigid body objects, and those primarily so that they can be detected by near and collision sensors. Can anyone give me any leads as to the source?
I created a second test .blend that shows that the physics engine can handle a fairly large number of dynamic objects without lagging, so why would my physics-less game suffer from the physics? Is there some secret setting that would cause the engine to lag? Or are scripts actually included in the physics profile.
Post a screen shot of the blend file while lagging with the “show profile” enabled so we can see what causes the lag.
Well, constant checking of the Near Sensor used to slow down the game engine, I’m not sure if that’s been fixed or not.
A bunch of clones all doing the same thing at the same time could do it. This also could just be Blender running slow on you. Save your game as a runtime and then play THAT and see if it lags.
Try changing the pulse rate for the near sensors. Its the little number with the f next to it. Also, I don’t think an object has to be dynamic or ridged body for near and collision sensors to work, just make sure the actor option is on. It should work then. Maybe they all have a Triangle mesh collision box. That might slow it down. Or, in world options, you can change the number of physics steps per frame. If your game has no physics in it, setting that lower should help the frame rate with no effect. Last thing is maybe saying, screw what the profiler said, and make the creepers super low poly, see if that helps.
Do you have some complicated terrain geometry at play? Are you using complex bounds for all your objects?
Try simplifying your scene down to basic geometric primitives, with simple bounds like “box” or “sphere”.
It could be anything. The best is to post a file for checking. You could remove the textures to keep the filesize down.
if all ideas dont work:
a time management system for your objects is useful. i solved that with randomized sensor frequencies.
If 100 units are spawned, and every unit creates a pulse every 10 frames;
every 10 frames, the will be a short bottleneck.
if you randomise the frequenzies, it could probably help