A downloadable asset pack

Download NowName your own price

This is a 2D Dynamic Lighting System made in GameMaker Studio 2. It is simple to implement compared to other lighting systems, has great quality and great performance, handling more than a thousand lights with no lag! 

Video Tutorials:

Blog Tutorial on GameMaker Community Forums:

https://forum.yoyogames.com/index.php?threads/ultra-fast-2d-dynamic-lighting-sys...

Demo:

  • left click to add light
  • right click to add 100 lights
  • F3 to display Debugger 
  • Q to restart
  • Directional keys  to move camera
StatusIn development
CategoryAssets
Rating
Rated 4.8 out of 5 stars
(6 total ratings)
AuthorGrizzliusMaximus
GenrePlatformer
Tags2D, Tutorial

Download

Download NowName your own price

Click download now to get access to the following files:

DynamicLightsDemo.zip 1 MB
DynamicLights-Part1.yyz 15 kB
DynamicLights-Part2.yyz 33 kB
DynamicLights-Part5.yyz 60 kB

Development log

Comments

Log in with itch.io to leave a comment.

(1 edit) (-3)

Doesn't work out of the box so it is pretty much useless, unless you watch his tutorials and spend hours trying to figure it out which I don't want to do.

(-2)

Yeah I like this engine a lot but it seems like he intentionally made it hard to implement in a real game. I really can't think of a reason why any competent programmer would hard code a random screen resolution and not even make it easy to change it. So much wasted potential, it's easier to use a worse engine just because this one is so unnecessarily frustrating to understand.

Is there a way to have the lights affect an object (such as the player) if the object is within the light's range? For example, if the object is being lit up it would then get destroyed or damaged.

Quick question, could this be modified to support multiple viewports for a 4 player split-screen game? (Or does it already support split screen multi-viewport?). If it's relatively easy to do, I'll definitely be donating some cash for this project!

Hello, I really like it!. 

Im creating a CRT effect and Im looking for a Glow (or Bloom) for or the screen. Is that possible with your library? Can you give me a tip? thanks!!!

Hi! I love this system! And thank you for doing a tutorial series on it! Do you have any plans on continuing the tutorial series in the future? :)

(-2)

Why the event draw is bad ?

I'm going to draw something... quality is bad.

I'm loving the lighting engine but I a finding some performance issues with the quad() function. My levels create a shadow map in code by creating loads of little collision boxes (invisibly). The problem is that when the number of shadow boxes gets high (on one level I have 600+ shadow casters) the frame rate drops quite a bit. Is there anything that can be done?

(1 edit)

one last question, why is my mouse position thrown off? seems odd doesnt it? also when i finally got them to work, it draws everything below it in black

i have a room size of 2048,1500. it makes the camera very zoomed in on one spot. if i resize the application_surface to a lower value my game becomes pixelated. any help?

Same

part one worked so i guess ill try that

You will need to change the viewport properties and the draw_surface_ext scale in the post-draw.  Anything that says 320,180 should be changed to the value you want like 2084,1500

Deleted 1 year ago

thanks so much for the reply and putting this system out, i'm having a hard time getting it to work but i'm sure ill figure it out eventually

Deleted 1 year ago

I was hopping to contact you about hiring you to implement this lighting system into my current project, Steampunk Abyss. It would need to be modified to work around a ds_grid based system. Is that something you possibly would be interested in? 

I was wondering if you had any idea on how to adapt this to a 2D style game of the Pokemon/Stardew Valley variety where the Z dimension is implicitly tied to the Y dimension.  In other words, where objects with a lower Y coordinate are "behind" objects with a higher Y coordinate.

I had some ideas about shadows being cast on a different layer than the light so that textures with a lower Y coordinate would not have shadows cast on them and would illuminate if the light source had a greater Y value but I was hoping to see if you had any ideas on the matter since you understand the systems fundamentally on a much better level.

Thanks again!

(2 edits) (+1)

I had an issue but I resolved it with some tinkering.

Thank you so much for sharing your knowledge with the world.  It has been so helpful.

Really fantastic tutorial and with brevity and wit on top of it all.  I know you put a lot of time and effort into making it so thanks and great job again, you really deserve it.

(1 edit)

Hello,
What an amazing tutorial. I don't get why it pop so late in my quest for "how to do normal mapping lighting" .... XD
I play a little with your example to see if I could use it with the way I'm drawing stuff onscreen and I have a question :
You use the Setup object to draw the robo with draw_self() but what if I assign my character's sprite dynamically, using draw_sprite and a Finite State Machine ? Is there a way to not have this normal bug and keep using my character's own draw-event ?

(+1)

Hello. This seems like the simplest and at the same time best lighting engine ive seen for gamemaker. Is there any way to support you and do you have any idea when a ready for use version will be available? Id also like to know if you are planning to make entities (characters and non solid objects) cast shadows too.
Thank you very much for making this.

(30 edits) (+1)

How do you fix this issues? 

 Main Problem :

  • Backwall moving  when left, right, up, down key is pressed.
  • Edit: found that it happens when object is following camera!

  

Other Problems:

Running game at 1080p, 8x8 textures is fine.  Running game at 1080p, "640, 360" 16x16 textures it breaks a lot of things... 

  • Backwalls are moving.
  • Player Stops following camera.
  • Mouse hover light is gone to oblivion and not centered around mouse.

I would really love to use this ~ best  lighting system ever, hands down!!! Thank you!!! (Lol don't mind the player sprite).

Your tutorials are great!  Is it possible to do tutorial with shaders/dynamic lighting with a 2.5 perspective like in your Beartopia game?  That would be really wonderful

(+1)

Do you know if this could be converted to use a a ds_grid instead of objects?  

I'm sure there is a way to use ds_grids. There is a part of the code where it iterates through every object. you can replace that code with ds_grids. It might make the game faster as empty objects still increase the lag. I used objects for ease of use.

(+1)

hello m8!! Sorry to bother you but i have been implementing your lights in gms2 and it is amazing btw! But i have 1 question. Where is the lights alpha set? I want to change it to a variable changeable in the object.

Hello there! Sorry I took me a long while to update this page. I have just uploaded a new version that covers everything till part 5 of my tutorial. To change the strength of the light, go to the obj_light variable definitions. You can also change each light individually in the room editor. 

thank you very much!!

This version does not work for me at all tho haha.

I have no idea what is wrong and i can not get it to work xD

The old version from tutorial 2 works fine but i can not change the alpha of the lights :-/

Somehow the alpha i set in the light color does not work in the game. any way to make this work?

Hello ! thanks for this engine ! 

I have little problem with tiles and layer, i download demo but light cast like this image : 

Not like your video, i think you understand the problem with this picture ;) 


Can you help me ? 


Thanks again very good job and perf :o 

Something wrong happened with the order of room layers. Try moving the layers around. The layer with object setup should be below the wall tiles.

Yes i see but look :

All is good for me i think in order because if i move the configuration instance layer like that :


With instances containe light and blue wall , and instance_1 contain : obj_setup.

with that configuration you can see light no render, tiles is directly lite at 100%.


Do you know why ?

Sorry for not responding to this for a month. I don't know what's gotten to me forgetting about this itch page. I really don't know what's wrong because it works for me. I have uploaded a new version with more features, maybe you want to check that one out :)

(2 edits)

That happens because the tile layer needs to be above the setup layer

The tiles appear lit in this case because Grizzlius still has yet to put part 6 of the tutorial where it goes over this exact thing, how to apply the shadows to the tiles

(+1)

thanks!!

(+1)

Awesome stuff! Any plans for sloping / triangle shaped tiles?

If you want, I will try to add those in as well

(+1)

WOAH, thanks for sharing! 🙏 

If is possible, can you share also the tileset?

I may do that later when I release the second tutorial :)

Oh, fantastic, thanks, I can’t wait 😁 

(+1)

Thank you very much!!!

your welcome!