Ambient light.

I don’t know how relevant can be an ambient light in a 2D Engine, but can be useful in Game Develop.
With ambient light we could set how dark or bright we want the whole scene to be.

I know we can use lights as global lights but that’s not nice.
I made an example:
drive.google.com/file/d/0B1sXiY … sp=sharing

Global light make the scene dark, and you can move an other light with the mouse that makes brighter.
This is the best I was able to achieve, as you can see the boxes is dimly visible under the mouse light, but I want them to be visible clearly under the mouse light. I know I could use two different layers, and blend the layers to make something like this without lights, but I want to use pure lights nothing else because that way I could easily effect the visibility. For example, If I want a fog effect somewhere I can set the light intensity lower if I want to make something more clear I can set the light intensity higher.

Anyway, here is a screenshot of what I would like to achieve in terms of light visuals in Game Develop.
drive.google.com/file/d/0B1sXiY … sp=sharing

To achieve this in my opinion the best way to use ambient light to make the whole scene darker and use point lights (and hopefully directional lights too) to make some places brighter, more visible or even less visible.

I did some search and I have found this.

code.google.com/p/box2dlights/

It contains all light features we ever need in a 2d game. Beautiful.
@4ian:What do you think, could you make a GD extension out of this?
I’m also asking in terms of licencing too.

It’s a Java library so I won’t be able to use it without rewriting it entirely :slight_smile: License was ok though.
Note that I also need a Javascript library ( or write a light renderer it by myself ) so that the feature is also available for html5 games :slight_smile:

I found these
C++ library: sourceforge.net/projects/letthebelight/
JavaScript library: greweb.me/2012/05/illuminated-js … lications/

for C++ I also found open-source 2D game engines with very nice dynamic lighting features.

Ethanon Engine: ethanonengine.com/
Frank Engine: frankforce.com/?page_id=1733

Both is an open-source 2D Game Engine under MIT licence, written in C++ and both has very nice 2D Dynamic Lighting feature.
I guess you can’t use any code of these game engines but if you don’t mind you can learn from them maybe.

I also found an other engine called Open Game Maker 2D lin.is-programmer.com/
It is an open-source 2D game engine under GPL licence written in C++ it also mention 2D dynamic lights in feature list, but I could not find screenshot or demo to proof, even no example projects but maybe it possible to find the relevant source code if it exist.

I think, it worth to implement nice dynamic lights and shadows into GD because nice lighting can make a lot of different in visual experience. Even the most terrible graphics can look cool with nice lighting and shadows. Some nice lights and shadows seriously can benefit a game.
Anyway, if you could add some directional light and ambient light at least, would be great.

Thanks.

I’ll take a look at it. I heard that Illuminated.js was quite slow when there was a lot of lights.
Note that there is already supports for lights for native games even if only one global light is supported for now. :wink:

Yes but only point light, no directional light and ambient, and the objects don’t cast shadows :neutral_face:

Yes maybe the Illuminated.js is quite slow but a few lights and nice dynamic shadows here and there is still better then nothing :unamused:

Anyway.Thanks to take a look-

Of course objects can stop light, you just have to tell Game Develop which ones! Just set objects as being obstacles to light ( It’s an automatism : Right click on an object > Properties > Add an auomatism ) and they will stop the light :slight_smile:
You could have seen this by trying the example using lights. :slight_smile:

Yes but no shadow or Am I do wrong something :confused:

I have attached pictures, the first is GameDevelop dynamic lights example, as you can see no shadows.
The second is the let there be light C++ library example project and there is shadow.
Not only the light stoped, also cast shadow.


Yes, only the light being set as global light ( = ambient light ) are able to cast shadow :slight_smile:

:astonished: That’s great :laughing:
Thanks.

But I have to say I like the Let There Be Light better because it uses different hue for the shadow and ambient colouring :smiling_imp:
As you can see on my previous screenshot, it more dark where less light reaches, more realistic and 100% free. :unamused:

Yeah, I think I’d like some shadows. But change of library used for lighting would be needed. It’s wrth it though.