Fastest 2D Dynamic Lighting System in GMS2

preview_player
Показать описание
A Simple, High-Quality and High-Performance lighting system made in Game Maker Studio 2. Learn how to make lighting systems like Celeste and Carrion! Understand how it was made through visuals of the algorithm and see how it compares with other implementations.

UPDATE: You can try out the Lighting system here:

Blog post:

Tutorial Part 1:

Note: performance results may vary from different setups. 5000 lights was achieved using a Ryzen 2600 with Nvidia RTX 2070 with the CPU being the bottleneck

Blog Links:

Music by Mewmore - Twinleaf Town (Pokémon Diamond & Pearl Remix)

Instagram:
Twitter:
Рекомендации по теме
Комментарии
Автор

Part 1 of the Lighting System Tutorial is now out! I have also released the code and a demo to play with on itch.io. Link in the description :)

GrizzliusMaximus
Автор

I am so glad this popped up on my I have made my own little lighting system for my platformer using a dark surface, and then drawing transparent circles over that surface to give a light effect, and I thought that was good... BUT THIS IS AMAZING!!!! I have never even dreamed of something like this being accessible to GMS2 users, and the performance you have gotten with this system as well!! Thank you sooo much for making this, and a tutorial as well! My game is inspired by Celeste, and that means that lighting is an important part of my game, and you have just made all of my lighting problems melt away! You are amazing, thank you so much! Instant sub ;)

oliverlanzilli
Автор

I know I'm late to the party, but this was so helpful! I'm making a plat former game and was trying to make my own lighting system. it didn't go so well. when I found this videos it was so helpful and I was able to get it working in a day! thank you so much.

CoachMeagan
Автор

this is a great video! explained quite well. maybe turn the music down next time though? it’s kind of hard to hear you sometimes with the music so loud. either way, great friggin work, subscribed : )

deadchannel-du
Автор

Wow, incredible work! Thank you so much for sharing your wisdom

misterr
Автор

Subscribed! You're video devblogs are amazing!!! Keep up this amazing work :)

karlstenator
Автор

I came up with a similar idea. The difference is that I use only 1 light source and don’t calculate a collision surface, so because of the fixed angles sometimes it looks spiky, but it has the effect. I only pull to the calculated distance from the direction of the objects that cause the shadow. I check the solid parts from tile to tile in a spiral order, so if a certain angle is already shaded, I don't have to check it further there. The silly idea come up from a Rubber-Nail-Board-Toy, but it works at usable speeds even in a 30-year-old Amiga program written in BASIC!

imresoveny
Автор

ive never seen any things like this! Incredibly awesome. I bet i cant even make this 10 years later!

Sand_the_Lazy_sand
Автор

You absolutely can do circle shapes with shadow casting like this. Including the shaders you are using.

Instead of passing a position 3D vertex, pass a float4 custom vertex format. Use the 4th float as the circle radius +/- depending on the vertex, with the "pushed" verts being like radius * 0.8 for the soft shadows. You only need two triangles btw.

Then in the shadow shader, if there is a radius != 0 you move the vertex perpendicular to the angle from light to vertex by distance of radius.

Something like, float theta = atan(dist.x/-dist.y); position.x += cos(theta) * in_Position.w; position.y += sin(theta) in_Position.w;

Dist is the vector from light to vertex as you already have, vec2 dist = in_Position.xy - u_position.xy;

badwrong
Автор

Love it, subscribed! Trying to adapt this technique into my own Java Game, thanks a lot for sharing!

davidmc
Автор

You are quite the pioneer! Great job. Looking forward to the next video.

wayfinderofficial
Автор

This is exactly what I need, and to see a step by step tutorial !! YES YES YES !!
Deffo worth a like and a sub ! Keep up the amazing work.. look forward to going back through your vids and the new to come ..

coxyofnewp
Автор

This series is incredible! Just wondering when we can expect a part 6?

pixeqla
Автор

God, this looks awesome, great video man

ande
Автор

I would love to addapt this system for a top down game RPG. With the actual system there are a few problems with layers and depth. Any idea?

oscarlopezfabregas
Автор

Very simple to make!
Me: Great!
Less than 500 lines of code
Me: Well I tried

rml
Автор

HI. firstly, really cool stuff. ive spent about 5 hours trying to get this to work correctly in my game. The issue seems to be that i dont want to force a smaller resolution with surface_resize as its too small for my game. But if i turn that off and run it natively like i always have, the surface that displays the light/level is super large. The larger the resolution the more zoomed in it is. Its really annoying, id love to use this system in a project im doing but im locked to running the app surface at a low resolution. Is there any way round this? Thankyou!

mrJoshSullivan
Автор

Ah, a new rising GMS star I see?
Quite nice indee~eed.
This lighting system is top notch, for what GMS actually is!
Actually, dare I say it, comparable to Unity's lighting system.
Of course, do not let that seem like I am belittling your work. quite the opposite:
This is some impressive stuff, keep it up, oh thy grande bringer of GMS wisdom!

zedmanul
Автор

This looks fantastical ! But, would this work with slopes? I'm using the same rectangles walls for slope, but i rotate them to get angles, so i was asking if it would still work, since diagonals would still be used in the same way, juste more... Diagonally ?

NutritionFacts
Автор

Hi, is it possible to make height of light (z coordinate) to achieve length of the shadow? Is it possible to use custom light type (custom light aplha sprite)? Is it possible to use global light? Have u seen old CBNA smart light (search in the youtube)?

teemon