Page 1 of 1

Dynamic light instances

Posted: Mon Dec 02, 2013 11:05 pm
by Rado1
It would be helpful if lights can be instantiated and destroyed dynamically in runtime. For now, I do not have a clear preference how to achieve this, just see some rough ideas:

- Place a Light as part of a Model (and ModelState?). Each instance of a model (model state) would have own instances of lights.

- Light can become a type in expression language, similarly to "model". They can be declared as types of variables and arrays + there would be a function/component to instantiate a light and another one to destroy it.

... you have maybe some better alternative how to specify dynamic lights.

Posted: Mon Dec 09, 2013 2:21 pm
by jph_wacheski
An interesting idea. I am using the GL lights dynamically in my current project,. by simply enabling and disabling a light and changing its position and color as needed. I just use an extra light for FX in short bursts, and this works very well.

I am considering implementing a differed rendering set-up for an unlimited light number,. anyone have an example of this in ZGE??

I just read a good tutorial for setting this up for a 2d game I will look for that link. . ,

Posted: Mon Dec 09, 2013 9:08 pm
by Rado1
jph_wacheski wrote:I am using the GL lights dynamically in my current project,. by simply enabling and disabling a light and changing its position and color as needed.
Yes I use the same technique of enabling/disabling and changing positions of lights for a live wallpaper I'm working on now. Apart of other animation, each touch should generate its own light. I have 10 lights included, but maybe some devices allow to have more than 10 touches... Anyway, the code is quite cumbersome and I wanted to have better support in ZGE.

Posted: Mon Dec 09, 2013 11:54 pm
by jph_wacheski
Here is that post I was talking about,.
http://www.wholehog-games.com/devblog/2 ... a-2d-game/

I intend to make use of more interesting lighting/rendering as I keep making games,. . depending on the gameplay needs and ease of implementing,. lots of interesting bits in there.