2D Dynamic Lighting Tutorial

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Firzen
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 23
Joined: Mon Jul 20, 2009 7:13 pm
Current Project: Space Game
Favorite Gaming Platforms: PC, Gamecube, Pandora
Programming Language of Choice: C,C++,C#

Re: 2D Dynamic Lighting Tutorial

Post by Firzen »

Just to be clear and make sure that you understand my point.

A tutorial is not ment to be dropped into your code, it just illustrates the idea.

Now, I don't know about how you code, but I actually prefer to write code myself than "dropping it in".
You can surely optimize the code and I won't say that that's not a valuable discussion, but for those that just want to learn it surely is a bit of a distraction and on top of that, your wording on that "critique" is not really constructive.
pubby8 wrote:It is very nice of you to write such an example, however I wanted to point out that there are numerous flaws in your method and that this code should not be used in game.

You should spend some time and optimize it.
All your posts sounds pretty much the same, it's always like: "Yeah, pretty nice what you did there. Oh, also, fuck you"
But that's not how a forum or real life works. Pointing out that the code can be optimized and all is not a bad thing. But the way in which you do it is.

Also, like I said before, optimizing tutorial code is just bad, because it easily obfuscates the basic idea. While you might want to point out ways to optimize the method you don't want to actually include them in the same tutorial about basic lighting techniques. So at least start a new topic if you want to discuss optimization issues.
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: 2D Dynamic Lighting Tutorial

Post by N64vSNES »

We should all take bets on how long it'll be before pubby8 gets banned :lol:

The tutorial was great, very well explained. I'll probably have to play with this later. ;)
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by dandymcgee »

N64vSNES wrote:We should all take bets on how long it'll be before pubby8 gets banned :lol:
Honestly, I think he's funny.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: 2D Dynamic Lighting Tutorial

Post by GroundUpEngine »

dandymcgee wrote:
N64vSNES wrote:We should all take bets on how long it'll be before pubby8 gets banned :lol:
Honestly, I think he's funny.
LOL
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by dandymcgee »

GroundUpEngine wrote:
dandymcgee wrote:
N64vSNES wrote:We should all take bets on how long it'll be before pubby8 gets banned :lol:
Honestly, I think he's funny.
LOL
Told ya so. Even GroupUpEngine is laughing.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
dnxviral
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 51
Joined: Tue Dec 14, 2010 6:49 pm
Favorite Gaming Platforms: PC
Programming Language of Choice: Everything... and C#
Location: dnXstudios
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by dnxviral »

dandymcgee wrote:
GroundUpEngine wrote:
dandymcgee wrote:
N64vSNES wrote:We should all take bets on how long it'll be before pubby8 gets banned :lol:
Honestly, I think he's funny.
LOL
Told ya so. Even GroupUpEngine is laughing.
Haha the whole thing was funny

Besides that irrelevancy. The tutorial is freakin awesome. Impressed, I applaud you. :) I'll be sure to keep this in mind!
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: 2D Dynamic Lighting Tutorial

Post by MadPumpkin »

Wow... This is completely amazing, I'm very impressed with the whole thing :worship: I've honestly never seen anything that made me awe for longer than just even the screen shot of the dynamic light in action. And hey, why can't I be a Jealous Self-Righteous Prick? I demand that I be changed to a Jealous Prick!!

EDIT: Not exactly what I had in mind, but still fitting.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
TheAustech
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 96
Joined: Fri Sep 03, 2010 4:38 pm
Current Project: BeatTapper
Favorite Gaming Platforms: PC
Programming Language of Choice: C++, C#
Location: Maryland
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by TheAustech »

Whoa, lots of posts since I've been gone.

Thanks for kind of standing up for me, but to be fair pubby8 was only addressing that it was unoptimized. And looking back at my tutorial, there are some things that should of been taken care of for optimization.

Like storing the trig value, it would help a lot.

Maybe pubby didn't say it in the..."nicest" way possible, but still he did bring up that it was unoptimized a bit. :P

Thanks again for all the support though, it means a lot ;)
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by Falco Girgis »

TheAustech wrote:Whoa, lots of posts since I've been gone.

Thanks for kind of standing up for me, but to be fair pubby8 was only addressing that it was unoptimized. And looking back at my tutorial, there are some things that should of been taken care of for optimization.

Like storing the trig value, it would help a lot.

Maybe pubby didn't say it in the..."nicest" way possible, but still he did bring up that it was unoptimized a bit. :P

Thanks again for all the support though, it means a lot ;)
It wasn't just this post. He spent all of his time trolling around looking for any little place to bitch to prove his superiority.
MadPumpkin wrote:And hey, why can't I be a Jealous Self-Righteous Prick? I demand that I be changed to a Jealous Prick!!
Thank you so much, whoever changed his rank to "Dumbass." Very fitting.
qwerber
ES Beta Backer
ES Beta Backer
Posts: 4
Joined: Wed Nov 30, 2011 1:32 am

Re: 2D Dynamic Lighting Tutorial

Post by qwerber »

Err, I know this thread was from May, but I wanted to contribute something.

Instead of using the trigonometric functions, you can simply extend the x and y distances between the light and the vertex you are computing. Maybe a little code will explain things:

Code: Select all

castedPoint->x = (light->x - vertex->x) * 5 + light->x;
castedPoint->y = (light->y - vertex->y) * 5 + light->y;
For each vertex you compute a casted point, and then used those points to render shadow geometry. There is a slight advantage because you avoid the trig functions, but unless this is performance critical code, any trig overhead can be neglected...

I also noticed that multiple light blending was not mentioned... don't know if I should bring that up... this seems to be a very strict forum;

Anyways, C++ isn't my "main" language so forgive my if I coded wrong, I think it's pretty much understandable.
HeadClot
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 7
Joined: Sat Aug 02, 2014 12:35 pm

Re: 2D Dynamic Lighting Tutorial

Post by HeadClot »

Just thought I would reply to this as some images in the stickies are broken/borked. :\
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: 2D Dynamic Lighting Tutorial

Post by dandymcgee »

HeadClot wrote:Just thought I would reply to this as some images in the stickies are broken/borked. :\
Probably not going to be fixed unless Google happens to have them cached and someone is bored enough to go find them.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
Aido97
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 2
Joined: Fri Nov 08, 2013 5:53 pm
Programming Language of Choice: C#
Location: Ireland

Re: 2D Dynamic Lighting Tutorial

Post by Aido97 »

Oh man great tutorial. Been looking for something like this :shock2:
Signature signature = new Signature();
signature.isFunny = true;
otherUsers.LaughAtSignature();
Post Reply