Löve "Light vs. Shadow" Engine v2

Showcase your libraries, tools and other projects that help your fellow love users.
SNK1337
Prole
Posts: 16
Joined: Sun Jan 05, 2014 2:30 pm

Re: Löve "Light vs. Shadow" Engine v2

Post by SNK1337 »

drunken_thor wrote:
SNK1337 wrote:Thank you for doing this! I've been wanting to create a game with that engine for a while now, and this will probably make the process much more painless.

I'm having an issue however: Am I doing something wrong, or is the translation of the light source somehow buggy? For example, when setting it to exactly (500, 500) and moving the camera in the example "short.lua", the shadows act as if the light was stationary (meaning they stay the same when translating, which is what they're supposed to do), but the glow of the light moves with the camera. This also results into some weird bugs with the default "short.lua", since the glow and the shadows start not fitting together when pressing the arrow keys.
I am not sure what you are setting to 500,500. I just tried setting the conf.lua to 500,500 and it worked fine. Do you have the updated code? How are you running the project? can you post some screen shots of bugs? or post the bugs on the github issues?
Sure, sorry for being a bit vague. Basically, all I do is change

Code: Select all

lightMouse:setPosition(love.mouse.getX()/scale, love.mouse.getY()/scale)
to

Code: Select all

lightMouse:setPosition(500/scale, 500/scale)
in "short.lua", and then open it normally by dragging the folder with main.lua, the examples etc. onto love.exe. This is the result:

http://puu.sh/cGQUw/a5cb0aabf0.jpg
http://puu.sh/cGQWg/2f3333cb2a.jpg
http://puu.sh/cGQWN/66d3a12423.jpg

As you can see, the shadows act just like they should - As if the light source was constantly at 500, 500. However, the glow moves with the camera.
User avatar
PriorBlue
Prole
Posts: 43
Joined: Fri Feb 28, 2014 3:46 am
Location: Munich, Germany

Re: Löve "Light vs. Shadow" Engine v2

Post by PriorBlue »

Hi and sorry for the long inactivity,

yes, the code was a little bit too long and messy in the end and my biggest mistake was to put all features (shadow, glow, pixelshadow etc.) in only one (shadow-)body object. The translation functionality was horrible and incomplete, too. :)

The problem at the moment is, that i splitted the engine a while ago in it's basic parts and included it in my Entity Component Engine, so its much more flexible. For the actual engine it is for example nearly impossible to create a tile set map with shadows, because of performance issues. Maybe i will publish a totally different solution in the future.

@drunken_thor: thank's, that you advance the code by yourself, this was the spirit to put it open source :). Because of the mentioned reasons, i think i don't spend to much time for this library anymore. Maybe i will publish a more flexible library in the future, where all effects are separately usable. And sorry that i ignored your requests, i haven't checked github for a while. But i will look at your changes the next days.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by Jeeper »

PriorBlue wrote:Hi and sorry for the long inactivity,

yes, the code was a little bit too long and messy in the end and my biggest mistake was to put all features (shadow, glow, pixelshadow etc.) in only one (shadow-)body object. The translation functionality was horrible and incomplete, too. :)

The problem at the moment is, that i splitted the engine a while ago in it's basic parts and included it in my Entity Component Engine, so its much more flexible. For the actual engine it is for example nearly impossible to create a tile set map with shadows, because of performance issues. Maybe i will publish a totally different solution in the future.

@drunken_thor: thank's, that you advance the code by yourself, this was the spirit to put it open source :). Because of the mentioned reasons, i think i don't spend to much time for this library anymore. Maybe i will publish a more flexible library in the future, where all effects are separately usable. And sorry that i ignored your requests, i haven't checked github for a while. But i will look at your changes the next days.
You write that for the "actual engine" its not possible to have a tile map with shadows, I just wonder if you had fixed it in your splitt version of the engine? I have planning on having my tiles cast a shadow, so It would be awesome if that would actually be possible :)
User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor »

PriorBlue wrote:Hi and sorry for the long inactivity,

yes, the code was a little bit too long and messy in the end and my biggest mistake was to put all features (shadow, glow, pixelshadow etc.) in only one (shadow-)body object. The translation functionality was horrible and incomplete, too. :)

The problem at the moment is, that i splitted the engine a while ago in it's basic parts and included it in my Entity Component Engine, so its much more flexible. For the actual engine it is for example nearly impossible to create a tile set map with shadows, because of performance issues. Maybe i will publish a totally different solution in the future.

@drunken_thor: thank's, that you advance the code by yourself, this was the spirit to put it open source :). Because of the mentioned reasons, i think i don't spend to much time for this library anymore. Maybe i will publish a more flexible library in the future, where all effects are separately usable. And sorry that i ignored your requests, i haven't checked github for a while. But i will look at your changes the next days.
I don't know exactly what you mean by "nearly impossible to create a tile set map with shadows" because that is what I am doing for my game please see screenshot for example. I made the world using Tiled, and wrote a custom loader for it.
Attachments
game screenshot
game screenshot
Screen Shot 2014-11-08 at 11.51.41 AM.png (130.85 KiB) Viewed 7945 times
Light_world.lua for all your lighting needs
Talkies for all dialog needs
Github
twitter
User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor »

SNK1337 wrote:
drunken_thor wrote:
SNK1337 wrote:Thank you for doing this! I've been wanting to create a game with that engine for a while now, and this will probably make the process much more painless.

I'm having an issue however: Am I doing something wrong, or is the translation of the light source somehow buggy? For example, when setting it to exactly (500, 500) and moving the camera in the example "short.lua", the shadows act as if the light was stationary (meaning they stay the same when translating, which is what they're supposed to do), but the glow of the light moves with the camera. This also results into some weird bugs with the default "short.lua", since the glow and the shadows start not fitting together when pressing the arrow keys.
I am not sure what you are setting to 500,500. I just tried setting the conf.lua to 500,500 and it worked fine. Do you have the updated code? How are you running the project? can you post some screen shots of bugs? or post the bugs on the github issues?
Sure, sorry for being a bit vague. Basically, all I do is change

Code: Select all

lightMouse:setPosition(love.mouse.getX()/scale, love.mouse.getY()/scale)
to

Code: Select all

lightMouse:setPosition(500/scale, 500/scale)
in "short.lua", and then open it normally by dragging the folder with main.lua, the examples etc. onto love.exe. This is the result:

http://puu.sh/cGQUw/a5cb0aabf0.jpg
http://puu.sh/cGQWg/2f3333cb2a.jpg
http://puu.sh/cGQWN/66d3a12423.jpg

As you can see, the shadows act just like they should - As if the light source was constantly at 500, 500. However, the glow moves with the camera.
I see what you mean but I think you are still doing something wrong. first off if you want a stationary light you should just set the position when you create it like this

Code: Select all

-- create light at 500,500
lightMouse = lightWorld:newLight(500, 500, 255, 127, 63, 300)
also I tried the exact same code

Code: Select all

lightMouse:setPosition(500/scale, 500/scale)
and the light stay positioned overtop of the rectangle even when translated. Can you upload a .love file of the current status of the code you are working on?
Light_world.lua for all your lighting needs
Talkies for all dialog needs
Github
twitter
User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor »

Jeeper wrote:
PriorBlue wrote:Hi and sorry for the long inactivity,

yes, the code was a little bit too long and messy in the end and my biggest mistake was to put all features (shadow, glow, pixelshadow etc.) in only one (shadow-)body object. The translation functionality was horrible and incomplete, too. :)

The problem at the moment is, that i splitted the engine a while ago in it's basic parts and included it in my Entity Component Engine, so its much more flexible. For the actual engine it is for example nearly impossible to create a tile set map with shadows, because of performance issues. Maybe i will publish a totally different solution in the future.

@drunken_thor: thank's, that you advance the code by yourself, this was the spirit to put it open source :). Because of the mentioned reasons, i think i don't spend to much time for this library anymore. Maybe i will publish a more flexible library in the future, where all effects are separately usable. And sorry that i ignored your requests, i haven't checked github for a while. But i will look at your changes the next days.
You write that for the "actual engine" its not possible to have a tile map with shadows, I just wonder if you had fixed it in your splitt version of the engine? I have planning on having my tiles cast a shadow, so It would be awesome if that would actually be possible :)
Also I forgot to thank you for the hardest stuff worked through! It was all good code I just moved it around a bit and refactored duplicate code.
Light_world.lua for all your lighting needs
Talkies for all dialog needs
Github
twitter
SNK1337
Prole
Posts: 16
Joined: Sun Jan 05, 2014 2:30 pm

Re: Löve "Light vs. Shadow" Engine v2

Post by SNK1337 »

drunken_thor wrote:I see what you mean but I think you are still doing something wrong. first off if you want a stationary light you should just set the position when you create it like this

Code: Select all

-- create light at 500,500
lightMouse = lightWorld:newLight(500, 500, 255, 127, 63, 300)
also I tried the exact same code

Code: Select all

lightMouse:setPosition(500/scale, 500/scale)
and the light stay positioned overtop of the rectangle even when translated. Can you upload a .love file of the current status of the code you are working on?
Yeah, as I said it's entirely possible that I'm just misunderstanding something, I'm still fairly new.
I didn't modify anything except that one line (though I now commented out the setPosition and only set it once when creating the light, as you recommended), but sure, here you go:
lightbug.love
(1.14 MiB) Downloaded 256 times
(The short example is what I modified, though complex also has some weird behavior for me even though I didn't do anything with that.)

If that file works fine for you, I guess it may be a hardware issue? For reference, I have a Nvidia GeForce GTX 680.
User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor »

SNK1337 wrote:
drunken_thor wrote:I see what you mean but I think you are still doing something wrong. first off if you want a stationary light you should just set the position when you create it like this

Code: Select all

-- create light at 500,500
lightMouse = lightWorld:newLight(500, 500, 255, 127, 63, 300)
also I tried the exact same code

Code: Select all

lightMouse:setPosition(500/scale, 500/scale)
and the light stay positioned overtop of the rectangle even when translated. Can you upload a .love file of the current status of the code you are working on?
Yeah, as I said it's entirely possible that I'm just misunderstanding something, I'm still fairly new.
I didn't modify anything except that one line (though I now commented out the setPosition and only set it once when creating the light, as you recommended), but sure, here you go:
lightbug.love
(The short example is what I modified, though complex also has some weird behavior for me even though I didn't do anything with that.)

If that file works fine for you, I guess it may be a hardware issue? For reference, I have a Nvidia GeForce GTX 680.
You have old code with a bug in it please pull the new code.
Light_world.lua for all your lighting needs
Talkies for all dialog needs
Github
twitter
User avatar
PriorBlue
Prole
Posts: 43
Joined: Fri Feb 28, 2014 3:46 am
Location: Munich, Germany

Re: Löve "Light vs. Shadow" Engine v2

Post by PriorBlue »

drunken_thor wrote:
PriorBlue wrote: I don't know exactly what you mean by "nearly impossible to create a tile set map with shadows" because that is what I am doing for my game please see screenshot for example. I made the world using Tiled, and wrote a custom loader for it.
When i used my original engine with for example 256x256 tiles, i had a draw call for every tile and for every effect (like glow, pixelshadow, refraction etc.), with my ECS i fixed that problem with separate batch draws directly in the canvas buffer. In the old engine it was only possible with an ugly "hack".

This Tileset for example was very very slow with all the technics:
Image

I watched the last days over your code and i was surprised how much work do you put in the changes, i think the new direction of your system is very good, you have even added new postshader and improved the others like the scanline shader, awesome! I don't know, if you really need my help in the future, your changes look really great. :)

Oh and by the way, you can add your name in all files of the project or you can remove/change the MIT licence, if you want. The project is now officially yours ;).
User avatar
drunken_thor
Citizen
Posts: 75
Joined: Wed Oct 01, 2014 12:14 am
Location: Toronto, Canada
Contact:

Re: Löve "Light vs. Shadow" Engine v2

Post by drunken_thor »

PriorBlue wrote: When i used my original engine with for example 256x256 tiles, i had a draw call for every tile and for every effect (like glow, pixelshadow, refraction etc.), with my ECS i fixed that problem with separate batch draws directly in the canvas buffer. In the old engine it was only possible with an ugly "hack".
This is what I was already working on myself. I already managed to group like tiles together to for faster collision calculations and I was trying to figure out how to do the same for the lighting. I was thinking I could repeat the normal map and other image data making it into one larger image so that the calculations and drawing are on one large object rather than each tile. This was all in my map loader though not the lighting library. I would love to figure out a way to include it in the light library as well but I cant figure out how.
PriorBlue wrote: I watched the last days over your code and i was surprised how much work do you put in the changes, i think the new direction of your system is very good, you have even added new postshader and improved the others like the scanline shader, awesome! I don't know, if you really need my help in the future, your changes look really great. :)

Oh and by the way, you can add your name in all files of the project or you can remove/change the MIT licence, if you want. The project is now officially yours ;).
I really appreciate it! I consider it largely a refactor because you code was already awesome I just touched it up!
Light_world.lua for all your lighting needs
Talkies for all dialog needs
Github
twitter
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests