I’m wondering because whenever an object in my game gets added from a hidden layer for the first time (via Add Object actuator), there is a noticable delay in the framerate until the object gets added. Usually it’s about half a second. If the same object is added again, there is no delay. I don’t have a very good graphics card, so it could just be my system, but I think it would help if blender would preload the whole scene before starting the game instead of just the visible/active layers. Any responses are appreciated.
Make it no Visible on the same layer.
ALLWAYS(tap)------AND------VISIBILITY:no
As far as I know, Blender loads the complete scene at start-up. You can even access and manipulate inactive game objects (game objects in hidden layer).
When adding an object gets duplicated. Surly this eats some overhead. I never noticed a delay. Half a second is really long.
The question is if that is really a GPU problem.
Maybe you could see at the profiler output (I know it is hard to see).
From you description you should get the “delay” effect if you add multiple (different) objects within subsequent frames.
e.g.
frame t: add Cube
frame t+1: add Sphere
frame t+2: add Cone
…
this alone should eat 1,5 seconds ;).
juancarlospaco, I could do that, but for logic and physics purposes it’s easier to use the Add Object actuator.
Monster, thanks for the response. I did some more testing and I found that the rasterizer is the process that spikes when these objects get spawned. It goes from ~12ms to ~40ms. I have the game set to 120 fps, but in blender the game runs at ~50 fps (with no other programs except Firefox running). The frame rate seems to be a little better on a standalone .exe, although I can’t be sure.
Also, I didn’t really mention it specifically, but if I play the game and the object gets spawned at least once (with a delay the first time) and then I stop the game, when I play it again there will be no delay on the first spawn. I have to restart blender and load the .blend again to get the delay on the first spawn. This also occurs in a standalone .exe.
It is not just one specific object that this is happening with, but a few objects. These objects have (different) materials with either an Emit (light) value or Z-Transparency being used.
All this leads me to believe that it is indeed my computer’s (lack of) graphics capabilities. Although if there’s a way to prevent this from happening, I’m open to ideas.
Are you using a libLoad script?
I know that it happens on my game, when you use an object from a linked blend initially. For my game the only noticable one is the explosions. The first time you use an explosion it lags for a 1/5th second or so.
Try adding the object and deleting it as part of your loading procedure.
sdfgeoff, no I’m not using a libLoad script. I don’t have any objects that are linked from other blends. I think I will have to create a loading procedure at startup to add the objects, then end them before the game starts. Although, on a computer with a better graphics card, the game should run fine.