(BGMC) Light Level of detail?

Hello! the game I’m making for BGMC has many lights for atmosphere and such, resulting in poor performance. I tried adding an empty as a LOD for a light, but it doesn’t work. And when I searched the internet for “Light LOD Blender Game Engine”, I didn’t get anything useful. I could use logic bricks to create the light when I’m near it, but I want to keep my logic as optimized as possible. Does anybody have a solution for light LODS? Thanks!

Well, you can use the light LOD which sets light energy to 0.0 if it is far away and back to it’s original when closer:


from bge import logic

cont = logic.getCurrentController()
own = cont.owner
playerObject = logic.getCurrentScene().objects["Player"]

dist = own.getDisctanceTo(playerObject)

if dist > own["distance"]:
    own.energy = 0.0
else:
    own.energy = own["energy"]

IDK how effective is this, but execute this on all the lampos you want to LOD and make sure they have properties “energy” and “distance” in them.