Dynamic Lighting

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Dynamic Lighting

Post by vrld » Sun Sep 12, 2010 7:07 pm

I made a thing for a game of which right now I am not sure what it will become. But it has dynamic lighting. And that is the important thing.
The "game" might take some time to start and will probably not run very smooth if you have lot's of things in the screen.

Move the light with your arrow keys.
You can draw new shadow-casting objects with the mouse: left click sets a new point, and a right click sets a point and finishes the polygon.
Clear the scene with 'c'.
See some ugly stuff with pressing 'w', 'n' and 'd'.

Enough text, screenshots:
dynlight1.jpg
A cave
dynlight1.jpg (16.8 KiB) Viewed 4819 times
dynlight3.jpg
Painting
dynlight3.jpg (25.62 KiB) Viewed 4819 times
Attachments
dynamic-light.love
(5.75 KiB) Downloaded 736 times
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

User avatar
Taehl
Dreaming in associative arrays
Posts: 1024
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Dynamic Lighting

Post by Taehl » Sun Sep 12, 2010 8:07 pm

Can you handle multiple light sources? If so, you, hands down, have beaten my two methods for dynamic lighting.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.

User avatar
thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Dynamic Lighting

Post by thelinx » Sun Sep 12, 2010 8:16 pm

Doesn't work on this bad bad computer. :(

Just darkness.

User avatar
Adamantos
Prole
Posts: 27
Joined: Sun May 16, 2010 10:47 pm

Re: Dynamic Lighting

Post by Adamantos » Sun Sep 12, 2010 9:48 pm

I really love your demo ! :awesome: I was going to implement it by myself for my upcomming game... but this is just great!
My game uses a tile/grid based graphics engine, so I'm gonna rewrite your demo for tile based systems in the next days...

User avatar
VideroBoy
Party member
Posts: 102
Joined: Wed Mar 31, 2010 6:12 pm
Location: Canada

Re: Dynamic Lighting

Post by VideroBoy » Mon Sep 13, 2010 12:44 am

Dude. This would be perfect for real-time roguelike games.

Though it only seems to affect the ground. Walls in shadow are still visible.

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Dynamic Lighting

Post by vrld » Wed Sep 15, 2010 10:11 am

Taehl wrote:Can you handle multiple light sources?
Theoretically yes, but you would have to do a few adjustments.
thelinx wrote:Doesn't work on this bad bad computer.
Damn you, PO2 syndrome!. Should be fixed now...
VideroBoy wrote:Though it only seems to affect the ground. Walls in shadow are still visible.
This is wanted. Hiding walls in shadows would be possible though (but would require some additional code).


Apart from the PO2 fix, I added a hopefully more efficient collision (still buggy on slow computers) detection, a camera and did some other stuff.
Attachments
dynamic-light.love
(7.25 KiB) Downloaded 401 times
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Dynamic Lighting

Post by Tesselode » Wed Sep 15, 2010 10:53 am

Shadows are pretty unrealistic.

User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Dynamic Lighting

Post by vrld » Wed Sep 15, 2010 11:01 am

Tesselode wrote:Shadows are pretty unrealistic.
Elaborate, please.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine

User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Dynamic Lighting

Post by nevon » Wed Sep 15, 2010 1:28 pm

Toss some guns and some zombies in there, and you've got a game!

User avatar
Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Dynamic Lighting

Post by Jasoco » Wed Sep 15, 2010 5:20 pm

I think the shadows look fine. The collision is a little broken with some shapes. I was able to fall into the wall of a couple hand-made shapes. If I force myself I can get sucked in.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests