Löve "Light vs. Shadow" Engine [0.4.3]

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Ranguna259 » Sat May 31, 2014 10:22 pm

I haven't used this lib in a while but I think that the shadows are stored in a canvas, try checking the coordinates against the shadow canvas and see if it's alpha is bigger than 0 if so then it's not visible else it is
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

Muris
Party member
Posts: 131
Joined: Fri May 23, 2014 9:18 am

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Muris » Sun Jun 01, 2014 10:42 am

Ranguna259 wrote:I haven't used this lib in a while but I think that the shadows are stored in a canvas, try checking the coordinates against the shadow canvas and see if it's alpha is bigger than 0 if so then it's not visible else it is
This is the impression I got from trying to understand the code, that it doesn't do calculation for visible objects, rather than just draw shadows from all of the objects. I guess one way to solve it would be going through all of the edges and seeing if any point in the edge has alpha over 0. I shall think about this, I was kind of hoping there would be easy way to store the data about which objects edges it would draw but I suppose it is not possible due to having to clip some edges so the corner points might not be same anymore.

Anyways thank you for the answer, it kind of confirmed what I thought the engine was doing. I might try to roll something on my own to clip the shadow areas against objects, but it might be slower than just doing simple get.point comparing

uberlemming
Prole
Posts: 3
Joined: Fri Jun 20, 2014 5:21 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by uberlemming » Fri Jun 20, 2014 5:33 pm

I am relatively new to love2d and have just implemented this awesome library into a little game project of mine. I am using a home-made entities system (a bastardisation of Goature's tutorial one) to deal with the multitude of projectiles and other such things. Many of these entities have a short lifespan in game, so I looked for a function to remove a specific shadow body, but all I found was clearBodys() which just removes all of the shadow casting bodies from the lightWorld they are in, yet no one has raised this as an issue so I must assume I missed something fundamental.

Do I really have to recreate every shadow casting entity every time one of the projectiles on screen hits a wall and has to call Die()? It seems incredibly inefficient, but like I said I am new to love2d, new to lua and so digging through the light.lua file and making my own function to do such a thing is difficult without a good understanding of it. I tried, but I don't properly get how the thing works and so my attempts were just aping clearBodys() and trying different things.

Oh, also the two functions related to this on the wiki are dead links.

Sorry if this is banal, but I just can't seem to find the answer on my own!

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Ranguna259 » Sat Jun 21, 2014 7:35 pm

Funny, no one has actualy talked about that yet.
But yeah there is a way to remove objects, use the clear() function:

Code: Select all

object.clear()
By the way PriorBlue how's translation and scalling going ? Because I just tested them and they're still a little messed up :P
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

uberlemming
Prole
Posts: 3
Joined: Fri Jun 20, 2014 5:21 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by uberlemming » Sun Jun 22, 2014 5:15 am

Thank you! I knew I was missing something ridiculously simple, for some reason my searches of the light.lua file didn't find that.

AlexYeCu
Prole
Posts: 20
Joined: Fri May 30, 2014 4:08 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by AlexYeCu » Sun Jun 22, 2014 9:41 am

Great job! One question: is it possible to get lights with height = 1/2 of light`s range? Any easy way to get all light and shadow effects squeezed vertically?

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by Ranguna259 » Sun Jun 22, 2014 5:20 pm

Where is per-pixel Shadow ??? When I do newImage it just creates a rectangle shadow wut? :?
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

User avatar
qaisjp
Party member
Posts: 489
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by qaisjp » Wed Jul 02, 2014 2:01 am

This is... brilliant.
Lua is not an acronym.

User avatar
megalukes
Citizen
Posts: 91
Joined: Fri Jun 27, 2014 11:29 pm
Location: Brazil

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by megalukes » Thu Jul 03, 2014 1:32 am

Did someone have any luck solving the love.graphics.scale issue? I'm developing a game that allows the player to change the screen size anytime they want, but the scale function seems to mess with everything. Thanks in advance!

uberlemming
Prole
Posts: 3
Joined: Fri Jun 20, 2014 5:21 pm

Re: Löve "Light vs. Shadow" Engine [0.4.3]

Post by uberlemming » Sat Jul 05, 2014 11:26 am

Ok, firstly thank you for the prompt reply to my previous question, I still can't believe I didn't see it earlier myself, but there we go.

Now I have three more questions :)

Firstly, is it possible to generate sources of negative light? The game I am creating (and have spent years planning and designing) needs bolts of light and bolts of darkness as projectiles. Ideally they would both emit their own 'light' source (or anti-light in the case of the dark one), creating a really cool aesthetic. So I would like to know if it is possible, if not can the engine be jury-rigged to allow it, and and how one would go about doing so.

Secondly, my game is from a totally top-down perspective, that is the camera is sitting aligned to a normal to the 'plane' of the world at all times. Because of this I can and have been using rotation on my characters and things that move. Is it possible to rotate the shadow-bodies and their respective maps in real-time? If so, how?

And finally a derp question, but I seem to ask a lot of those: How do I get objects that cast shadows to be affected by shadows cast by other objects but not their own. For example: I have two apples on my screen and a lightsource, both apples have circular shadow bodies, and the shadow of one apple falls on the other, yet the brightness of the shadowed apple is not effected by that shadow. How do I fix this? It doesn't seem to work in the complex demo either, but it seems like a simple feature, if the shadow body did not produce a dark circle where it is, I could simply draw the shadows after the apples and so have the apples affected by shadow just as the background textures are.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests