Page 1 of 2

Dynamic Lighting

Posted: Sun Sep 12, 2010 7:07 pm
by vrld
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:
A cave
A cave
dynlight1.jpg (16.8 KiB) Viewed 8277 times
Painting
Painting
dynlight3.jpg (25.62 KiB) Viewed 8277 times

Re: Dynamic Lighting

Posted: Sun Sep 12, 2010 8:07 pm
by Taehl
Can you handle multiple light sources? If so, you, hands down, have beaten my two methods for dynamic lighting.

Re: Dynamic Lighting

Posted: Sun Sep 12, 2010 8:16 pm
by thelinx
Doesn't work on this bad bad computer. :(

Just darkness.

Re: Dynamic Lighting

Posted: Sun Sep 12, 2010 9:48 pm
by Adamantos
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...

Re: Dynamic Lighting

Posted: Mon Sep 13, 2010 12:44 am
by VideroBoy
Dude. This would be perfect for real-time roguelike games.

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

Re: Dynamic Lighting

Posted: Wed Sep 15, 2010 10:11 am
by vrld
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.

Re: Dynamic Lighting

Posted: Wed Sep 15, 2010 10:53 am
by Tesselode
Shadows are pretty unrealistic.

Re: Dynamic Lighting

Posted: Wed Sep 15, 2010 11:01 am
by vrld
Tesselode wrote:Shadows are pretty unrealistic.
Elaborate, please.

Re: Dynamic Lighting

Posted: Wed Sep 15, 2010 1:28 pm
by nevon
Toss some guns and some zombies in there, and you've got a game!

Re: Dynamic Lighting

Posted: Wed Sep 15, 2010 5:20 pm
by Jasoco
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.