LOD controller (Level Of Details) requested

Hello ^^

i’m still locked to my fps bottleneck, i tried to add to every object a simplest sensor set for detect the player position and change the mesh/material/texture (complete Obj in some case) .
this works fine if object are few.

But when the object are many this create a new bottleneck, due to computation of many scripts for many obj.

i wish to create a Radar sensor directly to camera, that switch LOD properties (HD,LD,OutZone)
i did this:
-indicitation is lost due to copy/paste-

import bge

def main():

cont = bge.logic.getCurrentController()
own = cont.owner
sens = cont.sensors['RadarLodHD']
sens2 = cont.sensors['RadarLod2']
if sens.positive:
    if 'LodLD' in sens.hitObject:
        sens.hitObject['LodHD'] = True
    if sens2.positive:
         if 'LodHD' in sens.hitObject:
             sens.hitObject['LodHD'] = False
             sens.hitObject['LodLD'] = True
        sens.hitObject['LodLD'] = False       


(if both HD & LD are false the OBj should have an OutZone definition (a cube very low pixeled) but the huge problem is that the Properties “triggered” dont return False!

there is some easy script for set a properties[False] to all the object in scene if the sensor dont detect them ?

Firstly, this is in the wrong forum subsection. It should be moved soon, hopefully.
Secondly, why attempt to implement what is already supported in the BGE (LOD is built-in).

If you want to do something besides replacing meshes, then you can use the lod level attribute that’s been exposed recently (either 2.74 or a test build of 2.75)

There are code tags for embedding code in your posts, please use those (advanced editor # symbol, or CODE in square brackets surrounding the code (with a backslash before the word in the final block)

they exposed lod level! I could cry!

I have been asking for that!

Thank you !

Ps is there a blender game development twitter? or? somewhere Where you can see the recent commits but not just code? like a bge,dev blog?

No, there isn’t. But you can read the release notes for next release (we are trying to have them sincronyzed with the changes). http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.75/BGE

Amazing how many (good) changes or additions will be made.

ty :slight_smile: i still work on 2.68 (sometime my executables in recent version crash so bad XD i will upgrade)

One thing to try,

Have an empty in place when nothing that spawns the item so if the cam/player cant see it then it takes up almost nothing rather then the lowest detailed item staying taking up data.

I have a Blender Game Design group on Face-book that anyone can share video tutorials they found that they like or share some your own work or problem that need fixed

The near sensor is a very heavy sensor as it checks the scene for faces. As more faces can be detected as more it seats processing time.

As you use quite a lot of such sensors it will multiply this processing time. So yes it is a bottle neck.

Isn’t it be more efficient to have one near sensor at the camera and detect for all the other objects?

Can we have the scene.lodCentroid be set in game?

using the camera is nice, but what if I use a sniper scope?
(I could use my own LOD for it, but then I would need to be able to turn LOD on/off)

waiting for the buildin,

i suggest to use ONE property with a integer , to make your code more simple .
then BPR is right, using a camera object , you are limitated to that camera (if the camera change the lod not work more)

this is my quik and dirty solution:

import bge
#running from some empty with always true

scene = bge.logic.getCurrentScene()
cam = scene.active_camera
for i in scene.objects:
    if "lod" in i:
        d = cam.getDistanceTo(i)
        i["lod"] = 2 if d>100 else 1 if d > 10 else 0

i am going in this solution, but the problem is that the Object dont come back to LowDefOfDetails when the camera is far :((

i am going in this solution, but the problem is that the Object dont come back to LowDefOfDetails when the camera is far :((

my sys load the first LowLowDef objct (an empty in some case) then, the sensor, or the ray, or the radar, of cam/player active at a certain distance the MediumLod, or the HighLod, withc a directly change of Status in the mesh of object. (the logic AI of objcet is chained to Armatures or directly to a Logic CUbe ,in this way the same Ai can change easily the “cosmetic” Mesh/armatures)

but when the mesh are far by camera they dont come back to LLow Lod :(((

the radar of the camera has only the objects inside the radar , to know the other you should do ALLOBJECTS-OBJECTSINRADAR :eek: (ALLOBJECTS = scene.objects)
for this, lod = poor

It works perfect ! TY so much ! (my sensor is an ALWAYS with Pulse true […])