DynaLight – Dynamic Lighting engine

You can check out the source there (it’s written in Haxe, but AS3 users should be able to understand most of it anyways), and also I have a .swc up for download if you are planning to use straight up AS3 with it!
Haxe users will need to install polygonal-ds ( haxelib install polygonal-ds ) to use the source!

Please check it out, and let me know if anything goes wrong, or if you have any questions!

Post navigation

10 thoughts on “DynaLight – Dynamic Lighting engine”

hi,I like your great light engine in haxe
can you comine your engine into flambe to cross platform as use stage3d render ?https://github.com/aduros/flambe
current NME do not support stage3d but flambe can
thanks

Unfortunately, the method I’m using isn’t tailored to triangle based rendering systems, since it uses per pixel operations. I’ve been looking into shaders a bit, in which case it would definitely be able to run on Stage3D, but I haven’t done any benchmarking or performance testing. Right now I just plan to finish a few of my game projects with this current engine, and later on I’ll revisit the lighting engine to run on Stage3d and NME :)

Hey man.
First off, let me tell you that I love your hxDynaLight engine.
It’s beautiful, and awesome, and yay. I’ll definitely tell you once I release this game.
So, let me get to the point, my question:

I keep trying to define rectangular occluders, like in the live demo, but they all end up being just points that shoot thing shadows off into the sky. Is it possible to make, for instance, my flashlight’s light stop once it hits this wall or something of the sort? Does that make sense?
Image:http://imageshack.us/a/img153/9992/n7g0.png

One more question:
Surely you’ve used the haxe-based game engine HaxeFlixel?
If so, would you know if there is any way to implement this lighting system as a part of the haxeflixel state, so, for instance, the debugger would not be darkened due to this engine?

Sorry for not replying yet. From what I had seen from your code, everything is fine, so I’m not entirely sure what might be going on. Is the screenshot video you sent me based on that code fragment? If not, then you should show how you set up all of the block lighting. Also, try switching the order in which you pass the points in to the Occluder object. Is your code directly from the sample code? Since that covers lots of lighted blocks with several moving lights.

I have not used Flixel or HaxePunk. You should only be adding this engine’s bitmap above the elements you want hidden…so…it’s simply a matter of addChilding at the right point/index.

Btw, I will continue to reply directly in these comments for consistency.

TECHNICALLY it will work, but be very slow, since this is BitmapData based. Working on native targets using OpenFL would need to transfer to a different system that uses triangle drawing rather than flood filling.
There is an existing outline here: http://simblob.blogspot.com/2012/07/2d-visibility.html This would need to be optimized, but should work better than this system.