Lights parented to added objects not affecting the scene? (Except for the first one)

In the game I’m working on I dynamically add and remove lights from the active layer (because the scene is huge due to me wanting the game to have a completely seamless feel and it helps the frame rate). The light is basically just a simple mesh with a point lamp parented to it. In my main scene I have a series of empty objects which I cycle through, each time adding that lamp object at its position. The call is something like this:

scene.addObject(scene.objectsInactive['Light_White'], currentObject, 0)

This works fine for the first light, the mesh and light are both added to the scene correctly. After that however, only the rest of the meshes are visible and the lamps seem to have no effect on the scene. The lamps are technically in the scene, as I can access them through scene.objects, and read/modify properties etc. but only the first lamp that was added actually illuminates anything. I know they’re in the right place, because I can print their positions to the console.

So all the lamps technically exist, all have the right energy, are all in the right place but are not affecting the scene. I have checked, and they are not set to illuminate only their layer, so shouldn’t they be lighting up the scene?

Is this a settings issue or a limitation that I am not aware of? Thanks in advance!

with gsl, a lamp can only be used once, calling it again just moves the active light, and leaves a ‘dead’ lamp

Darn, I was afraid it was going to be something like that. Is there any (relatively simple) alternative to what I’m trying to do then? Is it possible to create more lamps while the game engine is running?

no, but luckely many people have had their own dynamic lighting managers,

as lights are expensive as well as not duplicatable,

sensor= cone parented to camera that stretches out side draw using collision mask layers so it only collided with empties, on their own physics layer.

the vision cone colliding with the ‘lamp hooks’ grabs lamps off a list,
and puts them on the hooks, and pops them from the unused list, and adds them to a used lamp list.

every frame check to see if some of the list is used, but outside the players vision, and then move them to the unused list, to get used again.

in sensor
collision ------- python

do you know any python and anything about lists?

I have a version of this here in a discussion, but I used the lamps being added, to check to see if they were used anywhere else, to delete the old copy… it is not as good, becauze you cant have the same lamp object adder anywhere near each other, so it takes a lot more planning and it was not any better.

probably going to take a crack at the lighting manager tonight again…

Yes actually I do, I’ve been using a lot of python for this game so far. That seems like a fair solution except doesn’t that require all the lights to already exist in a background layer? I’ve tried moving all the lights in my scene to a background layer already and it didn’t improve the frame rate at all, so I must be missing something. All the overhead stats stayed the same, as if the lights were never moved int he first place.

Am I missing something, is there a way to just completely disable and enable lamps so that they’re not being taken into account by the rasterizer?

no, this is is why its imparative to only use x, and use them everywhere,

for instance, projectiles could grab a lamp for glowing projectiles, explosions can use lamps, etc, these would be added to used while live, and when the effect ends go right back into unused.

So then let’s say I have a very large map with interconnecting hallways which requires for example’s sake 500 lamps. At any given time, I really only need like 20 visible in the scene and the others are useless. If I’m understanding correctly, there’s no way to just completely shut them on and off, so if I didn’t want to move any lamps around I’d have to have all 500 on a background layer and then pull whichever ones I needed at any particular instant. But that would still make things slow right?

So then you’re suggesting that I just have some 30 lights I keep track of, and rearrange them according to where I’m looking?

yes, exactly. also dont remove lamps that are very close to the player, and not in view(so lights dont die when they are near you)

Alright awesome, thank you. I’ll definitely be giving this a try!