Page 5 of 15

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

Posted: Sat Dec 06, 2014 4:37 am
by drunken_thor
Jeeper wrote:Just a PSA to anyone who intends to use this library and is using STI, the v2 of Shadow vs light changed the way it uses canvases and does not like STI for that reason. After struggling for a long time with trying to implement this updated version to my current project, I spoke to "drunken_thor" (Who manages the library) and he confirmed that it is not compatible with STI.

The old Shadow vs Light does not have this issue however, so If you intend to use STI then I would recommend using it. A few major improvements made in this version are missing though, but I have managed to fix most of them (Such as scaling and translation, removal of shadow and light bodies etc). So if you intend to do like me and use the older version, feel free to ask for help in case you run into any issues.
Okay I worked with karai17 and he pushed a fix to STI so that it now works with this library. I also added an STI example to the examples!

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

Posted: Sat Dec 06, 2014 5:41 am
by Karai17
Whoa, I just checked out the STI demo and I am really impressed with how it turned out! I'm glad I fixed that right away instead of sitting on it for a few weeks, ha!

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

Posted: Mon Dec 08, 2014 10:01 pm
by Relazy
@drunken_thor, Thanks for including the examples for camera plugins! :awesome: However the translation inverted all of my camera movement(because I get the x and y of the drawn player which I use for camera movement), thankfully there is a simple fix for that:

Code: Select all

	tx,ty = love.graphics.getWidth()/(2*camera.scale), love.graphics.getHeight()/(2*camera.scale)
	tx = tx-camera.x
	ty = ty-camera.y
	LightMouse:setPosition(love.mouse.getX() - tx, love.mouse.getY() - ty)
	lightWorld:setTranslation(tx,ty)
	camera:lookAt(player.x,player.y)
Update: I found a bug(?) in the way that shadow rectangles are drawn, this bug can be replicated in the simple example. Its not related to the translations done above. Heres a gif:

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

Posted: Wed Dec 10, 2014 4:17 am
by drunken_thor
@relazy is that at the edge of the screen? I know there is some problems with the range checking for screen range I just havent had the time to fix it yet.

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

Posted: Thu Dec 11, 2014 2:44 am
by drunken_thor
@relazy, Okay the new code should be all fixed up, the reason I left it off was because I was initializing some shadow bodies by the center x, y and some by the topleft x, y and had to fix those first before range could be fixed

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

Posted: Thu Dec 11, 2014 4:40 pm
by giann
Do you think there's room for improvements in terms of performances ?
My FPS drops really quickly the more I add bodies and lights.

Edit: Another weird issue is that FPS seems to drops relative to the screen size regardless of the number of lights/bodies.

800x450: 50fps
1280x720: 20fps
with the same number of lights/bodies

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

Posted: Thu Dec 11, 2014 6:27 pm
by Relazy
drunken_thor wrote:@relazy, Okay the new code should be all fixed up, the reason I left it off was because I was initializing some shadow bodies by the center x, y and some by the topleft x, y and had to fix those first before range could be fixed
Awesome! :awesome: Its all fixed now, thank you.

Also:
giann wrote:Do you think there's room for improvements in terms of performances ?
My FPS drops really quickly the more I add bodies and lights.

Edit: Another weird issue is that FPS seems to drops relative to the screen size regardless of the number of lights/bodies.

800x450: 50fps
1280x720: 20fps
with the same number of lights/bodies
Its not really weird that the FPS drops when increasing resolution as the number of pixels increase. The shadow bodies/light are drawn 'on screen' and not 'off screen', so any of the shadow bodies located outside of the screen area ('on screen')are not accounted for. A clear example of this is the bug I described above whereby the rectangle was considered 'off screen' when it was actually 'on screen'.

When you increase the canvas(screen) size, you increase the amount of pixels to draw and therefore performance drops as the resolution of the shadows increases which means that there are more calculations to do.

There is more to this but I don't think I have a concrete understanding of it. If any of my points are incorrect please feel free to correct them.

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

Posted: Thu Dec 11, 2014 7:13 pm
by giann
I'm aware that off screen lights/bodies are not accounted for. The numbers I gave take that fact into account.

The drop should not be that drastic in my opinion. If I can't have 3 lights and 5 bodies at 720p at 30fps minimum, this is a performance issue, not a normal occurence.

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

Posted: Thu Dec 11, 2014 7:23 pm
by Relazy
giann wrote:I'm aware that off screen lights/bodies are not accounted for. The numbers I gave take that fact into account.

The drop should not be that drastic in my opinion. If I can't have 3 lights and 5 bodies at 720p at 30fps minimum, this is a performance issue, not a normal occurence.
True, although I doubt that it's optimized enough, what machine are your running on?
I get a stable 70 fps with AMD radeon HD 6450 and a quad core 3.4 ghz processor on a resolution of 800 x 600.

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

Posted: Thu Dec 11, 2014 7:29 pm
by giann
AMD radeon HD 6350. 800x600 is fine, > 1024 is far worse.