[Suggestion] Dynamic Lighting plugin/behaviour

0 favourites
  • 9 posts
From the Asset Store
Immerse your quiz games with our 6 unique music loops, ranging from acoustic chill guitar to cute and upbeat style.
  • Edited: Better title, and check my latest post for more thoughts on this. I'm mainly advocating polygon-based dynamic lighting now, due to computational reasons and it's kinda how the old lighting stuff worked in Classic.

    I know you guys have a massive to-do list, but I don't think one more can hurt, really. Lighting can do a lot for mood and atmosphere, and while there are methods to create lights manually, as seen in the lighting example that comes with C2, there could be much more in the way of options, especially with WebGL.

    In Construct Classic, lights were objects of their own, not I think they would work better as a behavior. Not only because sprites themselves can act as light sources, but also to allow particles to emit light, as well. While this could theoretically be done with making additional sprites as lights, like in the lighting example, it results in more objects to take up CPU usage. There also needs to be options that are more friendly to side-scrolling games, where shadows work differently to how it works in a top-down environment.

    For an example, I'm gonna have to pull out Terraria. As a game, it's decent, but it's not that great. For the most part, I'd rather look at its engine rather than its game design, mainly due to how it can have two layers of potentially thousands of individual tiles on-screen at once, and its lighting system. For those who don't play Terraria, I'll throw up a couple of screenshots to demonstrate.

    <img src="http://dl.dropbox.com/u/919275/Screenshots/2011-12-16_00003.jpg" border="0" />

    <img src="http://dl.dropbox.com/u/919275/Screenshots/2011-12-16_00005.jpg" border="0" />

    Terraria's lighting is designed around a side-scrolling environment. When light hits an object, it passes through it, and for every consecutive object it passes through, it gets dimmer until it reaches pure black. Certain lights also have their own colours, which go onto other objects, including not-solids. During the day, the above-ground world is lit by the sun. Many engines call this type of light a 'directional light', as sun's light shines down on the world from a certain direction depending on the time of day.

    Until recently, dynamic lighting in 3D and top-down environments could have a problem of shadows being pure black, if a single light source is produced. This is unrealistic, as light bounces. Even trying to emulate the effect of indirect lighting would go a long way for more natural lighting.

    A list of features for Lighting/Shadow behaviors that I'd like to see, on top of features already in the Construct Classic equivalents:

    • Multiple options for light colours (white, RGB, using the object's own colours, etc)
    • Transitioning between two light colours over time (times of day, etc.)
    • Options for allowing light to pass through multiple objects
    • Directional lighting for emulating the sun/moon's rays
    • Light strength and range
    • Emulating indirect light for top-down lighting

    I'll add more things as I think of them. I hope we get to see something like this in a future build... Eventually. :)

  • There's many ways to simulate lightning. I don't know how it works in terraria but it seems that it's a highly tweaked system specific for their case. Seems not to be shader based but more like an alpha blending based one. It's not difficult to implement in the simplest form. Now that we have WebGL this is all doable without framerate drops, shader based or not. Canvas is just too slow for this. Great lagging on Chrome and Firefox, even with HWA enabled. Smoother in IE9 but IE9 is broken right now , i don't know if it's on C2 side or on IE side.

    Anyway i think we are all waiting for the day when Construct2 will be on par with Classic supporting effects, color tint, advanced blending etc.

  • Is there a way for me to make Lighting like this? I know this is an old post but i really need lighting for my project that is similar to terraria.

  • Terraria lighting is definitely possible using WebGL, even possible without WebGL. But Actual shadow casting like in the game Gish, I don't think that's currently possible.

    You MAY be able to pull this lighting off using the Pathfinding plugin/behaviour (I haven't looked at Ashleys pathfinding myself so much), as everything is gridbased, though I'm not entirely sure.

  • Looking back on this thread, I've been playing Mark of the Ninja lately, and what strikes me is how it uses dynamic lighting. Finding examples is pretty easy, google images has plenty. The lighting itself is somewhat cone-based and has a 'textured' look, but it can be 'blocked' by solid objects, like the lighting from Construct Classic.

    Remember how the light object and the shadow behaviour from Construct Classic worked? I've already stated how I think they could be greatly expanded upon in concept in Construct 2, but I also think Using polygon-based lighting instead of cell-based is a reasonable compromise. Since sprites in Construct 2 already use polygons for collisions, it would probably be far less computationally expensive and much easier to do than cell-based lighting.

    I know I like to keep bringing up Starbound, but this is incredibly cool stuff:

    <img src="http://www.abload.de/img/starsrourw.gif" border="0">

    <img src="http://i.minus.com/dpYoU9h0gaF98/Starbound%20Day%20Cycle.gif" border="0">

    <img src="http://i.minus.com/dtzx3VUL8rfnu/Starbound%20Lighting%201.gif" border="0">

    <img src="http://i.minus.com/djWrYgW05S0kL/Starbound%20Lighting%202.gif" border="0">

    And you don't really need cell-by-cell lighting to replicate the same results (aside from the way the light 'penetrates' into the ground, but still).

    Now, the thing is with such lighting solutions, good luck trying to make them work with just events. I think it would be a good idea for an official or unofficial plugin to be developed for polygon-based lighting, with as many options as possible for what developers want with lighting in their games, whether it be pitch-black darkness in absence of light, or just low light for stuff like stealth-based games.

    I'd also like stuff like specifying image points for the 'origin' of the light itself, like a light attached to a gun, for example (as shown in Mark of the Ninja), and also being able to adjust the angle of the light without changing the angle of the object itself (those last two suggestions I also want to see applied to the Line of Sight behaviour).

    So, yeah. Polygon or grid-based, I don't mind as long as it works well, I just want a good lighting solution, dangit.

  • I posted this before, but basically you are looking for a shader that does shadow casting.

    greweb.me/2012/05/illuminated-js-2d-lights-and-shadows-rendering-engine-for-html5-applications

    This guy has a head start on it.

  • Jase00

    There's multiple examples on shadowcasting , if you do a small search

    They've been possible but there is no plugin to make it simple.

    Here is a way to implement it using the canvas object to draw the shadows.

    http://dl.dropbox.com/u/5426011/examples14/shadow_cast.capx

    Cheers !

  • I posted this before, but basically you are looking for a shader that does shadow casting.

    http://greweb.me/2012/05/illuminated-js-2d-lights-and-shadows-rendering-engine-for-html5-applications/

    This guy has a head start on it.

    Okay, Illuminated.js looks amazing. Considering it's an open-source plugin, I imagine all Ashley would have to do is integrate it into how Construct 2 does things. If he doesn't already know about it, he should.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Whiteclaws Wow that's awesome! I never understood how they worked but I assumed they were difficult. Still, awesome :P

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)