How can I optimize my game? Such as higher FPS?

Lights. How many lights do you have in the scene? They are a big processor drain, not only shadow lights, but also regular ones. A trick included by default in many comercial engines is to only render lights close to the camera. You’ll have to impliment this yourself though. I’ve been working on a solution for this for a whilem and hopefully will finish it soon.

He said he has 128 lamps. I would take a wild guess and say that’s the cause. In my experience not the polygon count but big textures and many materials combined with many lights are recipe for really big slowdown.

No, he says that the buffer size iirc. How many lamps do you have, though?

Better still provide a demo.

Having linked things, especially armatures with linked ipos, data, etc… slows everything to a crawl. I don’t even link materials. I pick the ob option then assign a shared material. I don’t pick the default linked option and it runs 60fps, same scene. Otherwise it goes 15 fps.

Linking slows down? This sounds strange as it is necessary at loading time only. Finally it would not effect render time.

I have done some testing, and the main problem is the lighting, how can I Optimize the lighting?

I applied all modifiers, I have the box hit boxes, I only have physics for what the player comes into contact with. There are 14 lamps, 3 of which are spots, and the rest are point. I do not; however, know what LOD is, can you explain this?

There are a multitude of different textures, all of which are UV mapped accordingly. I have cut down the resolutions, but that only adds one frame. I like GLSL better for the lighting, and turn off the additional settings doesn’t help, I tried to only have one room in the scene, but that has the same amount of frames, so no the trees have no affect when not in view.

I was thinking the same thing, like have a bit of code for each lamp that forces it to turn off when the player is so far away.

Yeah, it’s probably the lamps. For example, you can setup a simple scene with simple geometry but as you add lights the framerate goes down rapidly; the max is 8 I believe. Essentially, with forward rendering (what the BGE uses), for every lamp it has to render the scene that many times; this is where deferred rendering comes in where you can have like hundreds of lamps. Turning off unused lights should help save framerate :smiley:

Can you provide some more screenshots of your scene, both in and out of game engine, some in wireframe. I don’t think 14 lights should cause too much lag. Having a blend to look at would be great.

In my experience, the BGE’s GLSL mode supports as many lights as your GPU supports.

You can indeed go over 8 if you have a decent GPU, but not a whole indoor level’s worth at one time. In this case, writing a simple light managing script is important.

-Try to limit texture size in blender by going to the User Preferences -> System -> Texture Size Limit. Drop it to something like 512.
-Use Level Of Detail, or LOD
-Reduce the amount of lights, I’m reading 14 lamps.
-Apply all modifiers, if you can. Modifiers render frame by frame so, for example, a subdivision surface would be rendered each frame at a time.
-Do not set a camera clipping range of something too high.

Do you really need so many lamps? Is it a dynamic lamp? Try baking.

I already did 4 and 5, I will eventually use LOD, but not for indoors, when you switch rooms the items are not rendered… Same thing with lights, but mziskandar said something about baking, so That may help. Thanks for #1 though, that one seems really useful.

Like I said to TheKingDweeb, The number doesn’t matter, even the two int eh first room by themselves are just not very optimized. I can bake most of the lights, but I simply don’t know how… I’ve tried before, but everything turns white, so… yea… Can you provide instructions?

I see a lot of polygons there. Each log in the log cabin has how many polies? Then there’s things like the light-bulbs and the statue. There’s a good place to start optimizing. Any chance for a wireframe of the log cabin.
Bump maps as well. A lot of those can be cut down.

On a side note:

  • The players spot light should be mounted somewhat down and to the right of where the camera is. It looks like a hole cut in a piece of paper currently. I’d also suggest making it a little smoother, or use another light to give it a bit more ‘shape’

Basically, how to bake.

  • Assign texture (Generated image)
  • Unmap UV and assign UV (Mapping properties) - then, disabled it (untick)
  • Go to UV editing, select texture for that UV map/model.
  • Go to render properties, tick the ‘selected to active’.
  • Click ‘Bake’.
  • Enable the texture (you can save and use that baked texture as normal texture) - you can use multiple bake to simulate multiple light (blending texture)

baking.blend (465 KB)

Attachments

baking.blend (113 KB)

I already posted a wire-frame on previous page, And like I said, only the visible polygons matter. I’ve reduced all of the logs down to 4 per section, reducing them more would seriously affect the quality…

Thanks!

all polygons on a object matter, unless the object is split into a outside object, and inside object…

The first room only has 2700 tris, and most of them are not even visible at any given time…

I don’t think 14 lights should cause too much lag

…cough…really?

Did you turn off V-sinc? That can cause problems. If you don’t know how, try Googling it

Otherwise you should remember that anything that’s in your scene will be rendered if it is not invisible and is in the viewing pyramid of your camera, even if otherthings are being rendered in front of it. Turn the main view to wireframe to see what is being rendered, you may be surprised.


Anyway, I did some test of my own (I’ve got a fairly modern computer with a good GPU) and I found the following:


  • Alpha has a big impact. if you have any objects with alpha enabled, such as the trees I’d recommend either getting rid of them, or finding another way to make them. if you’re using Alpha blend mode, switch to Alpha clip.
  • Full screen is a huge multiplier or resource drain. 1080p resolution will make a fast game run a little slower. It’ll make a slow game crawl. If you can make your game run faster you’ll be able to use 1080p.
  • Shadow casting lights will cause big problems if you have a lot of them. I’d recommend one or two at most. 14 lights will cause a lot of drain. If just 6 of them are shadow casting lights your game will probably crap out like mine did.
  • On their own high numbers of polys and triangles are not a problem, look at test #2 above, it has more than 100k triangles and 14 lights but has no lag. But when you combine high numbers of triangles with other things such as multiple shadow casting lights or large numbers of transparent objects, you get big problems.

In my tests, I found that objects out of veiw didn’t affect anything… I don’t know what you’re doing differently, but that’s how it worked for me… I already knew the alpha and shadow thing, but some things just need shadows and alpha. I do try to limit any given object that can be viewed at one time, so as to limit one viewing angle to 2k-3k poly.

In any case, your material advice will be greatly appreciated, thanks!