ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

Fastest 2D Dynamic Lighting System in GMS2

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ส.ค. 2024
  • 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:
    grizzliusmaximus.itch.io/ultr...
    Blog post:
    forum.yoyogames.com/index.php...
    Tutorial Part 1:
    • Ultra-Fast 2D Dynamic ...
    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:
    FatalSleep's QRT - forum.yoyogames.com/index.php...
    Mike Daily's Realtime 2D lighting -www.yoyogames.com/blog/419/re...
    - www.yoyogames.com/blog/420/re...
    Noel Berry's Remaking Celeste Lighting - / remaking-celestes-ligh...
    Red Blob Games' 2D Visibility - www.redblobgames.com/articles...
    Nicky Case's Sight and Light - ncase.me/sight-and-light/
    Music by Mewmore - Twinleaf Town (Pokémon Diamond & Pearl Remix)
    • Mewmore // Winter in L...
    Itch.io:
    grizzliusmaximus.itch.io
    Instagram:
    / grizzliusgames
    Twitter:
    / grizzliusm

ความคิดเห็น • 108

  • @GrizzliusMaximus
    @GrizzliusMaximus  3 ปีที่แล้ว +14

    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 :)

  • @oliverlanzilli
    @oliverlanzilli 3 ปีที่แล้ว +12

    I am so glad this popped up on my recommended!!!!!!! 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 ;)

  • @deadchannel-d8u
    @deadchannel-d8u 3 ปีที่แล้ว +28

    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 : )

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +5

      Ill take note of that :) I was worried I would come out boring so the music was a bit loud. I think I lowered the music a bit in my later videos. Thanks for listening!

  • @karlstenator
    @karlstenator 3 ปีที่แล้ว +2

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

  • @coxyofnewp
    @coxyofnewp 3 ปีที่แล้ว

    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 ..

  • @ToastGhost26
    @ToastGhost26 3 ปีที่แล้ว +4

    This looks spectacular, great work!

  • @misterr3083
    @misterr3083 3 ปีที่แล้ว +8

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

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +1

      Thank you for your kind words! It is my pleasure to share my discoveries :)

  • @Sand_the_Lazy_sand
    @Sand_the_Lazy_sand 2 ปีที่แล้ว

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

  • @wayfinderofficial
    @wayfinderofficial 3 ปีที่แล้ว +1

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

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      Thank you! I am also looking forward to making the next video. Hope you will like it!

  • @davidmc971
    @davidmc971 ปีที่แล้ว

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

  • @pixeqla
    @pixeqla 2 ปีที่แล้ว +2

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

  • @jackisgoofingoff5510
    @jackisgoofingoff5510 2 ปีที่แล้ว +2

    My brain starts to explode

  • @yaazarai
    @yaazarai ปีที่แล้ว

    Bro this is awesome, good job!

  • @jarrodmuddyman7892
    @jarrodmuddyman7892 2 ปีที่แล้ว

    Very nice work here!

  • @idedary
    @idedary 3 ปีที่แล้ว +1

    Underrated gem! Subbed.

  • @andrescisneros4453
    @andrescisneros4453 3 ปีที่แล้ว +1

    God, this looks awesome, great video man

  • @israelmourahigino8520
    @israelmourahigino8520 ปีที่แล้ว

    BRO THANK YOU, IT HELPED SO MUCH AAAAA

  • @jameschappfillmore
    @jameschappfillmore ปีที่แล้ว

    Thx for the video!!! good Job!

  • @enzomedina3118
    @enzomedina3118 3 ปีที่แล้ว

    So interesting !!!! Thx a lot !!!

  • @kn-ki4637
    @kn-ki4637 2 ปีที่แล้ว

    Thank you so much! You have my sub😄

  • @zarata3840
    @zarata3840 2 ปีที่แล้ว

    Legendary content like this are extrimly rare ♥

  • @junhakang333
    @junhakang333 3 ปีที่แล้ว

    Nice work!

  • @sabriath
    @sabriath 3 ปีที่แล้ว

    Looks similar to my work.....good job.

  • @nasser_404
    @nasser_404 3 ปีที่แล้ว +1

    Part 2 when, this is so useful

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +1

      Part 2 is out and there is still more to come!

  • @ovientar
    @ovientar 10 หลายเดือนก่อน

    Highly illuminating

  • @imresoveny5868
    @imresoveny5868 2 ปีที่แล้ว

    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!

  • @bluemelonhead2698
    @bluemelonhead2698 3 ปีที่แล้ว

    that.was.EPIC

  • @rml1064
    @rml1064 3 ปีที่แล้ว +1

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

  • @mudasugo69
    @mudasugo69 6 หลายเดือนก่อน

    Instant sub

  • @badwrong
    @badwrong 2 ปีที่แล้ว +1

    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;

    • @GrizzliusMaximus
      @GrizzliusMaximus  2 ปีที่แล้ว

      Interesting. I will look into this. Thanks!

    • @badwrong
      @badwrong 2 ปีที่แล้ว

      @@GrizzliusMaximus holler if you need the code, but you'll probably figure it out. Once you have circles, you can do ellipses too with fairly low amount of vertices.

  • @kyonas6047
    @kyonas6047 2 ปีที่แล้ว

    ur vid is soo good i saved it twice by accident LMAO

  • @thirdworldrider6991
    @thirdworldrider6991 7 หลายเดือนก่อน

    thanks!!!

  • @ericreptile2803
    @ericreptile2803 2 ปีที่แล้ว

    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 ?

  • @zedmanul7472
    @zedmanul7472 3 ปีที่แล้ว +2

    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!

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +2

      Thanks! My focus is on performance. Unity does have great lighting but it could get laggy pretty quick if not handled properly. I am not trying to compete with Unity in 3D lighting. In fact, I don't think anybody should be using GMS for 3D nowadays sadly. But there are many Unity games that are 2D but use 3D lighting, like Enter the Gungeon. This renders it almost unplayable on low end laptops

    • @zedmanul7472
      @zedmanul7472 3 ปีที่แล้ว +2

      @@GrizzliusMaximus 3D was never in the question either way, honestly, cmon, this is *GMS* XD
      But yes, unity is laggy unless you handle it like the most fragile thing ever.
      Either way, you are making a great contribution to the library of gms resources we have ;)

  • @lambdasun4520
    @lambdasun4520 3 ปีที่แล้ว +2

    Dude this is amazing! thank you a lot!
    If it helps turn my projects in something profitable I will make sure you get your part too ;)

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      Awesome! Thanks! I wish you good luck on your project! I do hope you can show me once it's done :)

  • @teemon8580
    @teemon8580 2 ปีที่แล้ว

    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)?

  • @oscarlopezfabregas3602
    @oscarlopezfabregas3602 2 ปีที่แล้ว

    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?

  • @BorbsJSKF
    @BorbsJSKF 2 ปีที่แล้ว

    Hey, I set up the engine and was wondering what is the best method for having a sun-like light source across the whole scene, I tried using the basic light system but couldn't figure out how to do it, any help would be appreciated ^ - ^.
    Also sorry if my English is bad I'm still learning.

  • @LXZ
    @LXZ 2 ปีที่แล้ว

    Would this work with collision tiles rather than solid objects?

  • @Cuewotted
    @Cuewotted ปีที่แล้ว

    thank you :D
    really
    THANK YOU :DDDDDDDDDDDD

  • @TheApm11
    @TheApm11 3 ปีที่แล้ว +2

    Nice dude xD

  • @ipotrick6686
    @ipotrick6686 2 ปีที่แล้ว

    yo what would you say when i told you i had a lighting system that is the same speed no matter the lightcount and runs a lot faster than 60 fps?

  • @thomasbuffler6041
    @thomasbuffler6041 3 ปีที่แล้ว

    Hey, I want to get this, please let me know if it will work with my tilemap!
    Thanks

  • @guillaumeclimentygarcia8143
    @guillaumeclimentygarcia8143 3 ปีที่แล้ว +2

    I am just starting to use GMS2 you light effect look great, maybe you could contact yoyogame to collaborate and get it include in the software basics ?:)

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +2

      That's a nice idea. Not so sure how yoyogames will think. Good luck with your GMS2 journey!!!

  • @kosto_magmus
    @kosto_magmus 3 ปีที่แล้ว

    Dude, you are cool

  • @ionut-cristianneamtu-tirdo6596
    @ionut-cristianneamtu-tirdo6596 2 ปีที่แล้ว

    Can anyone help me with this error? Trying to set a surface target that does not exist.

  • @alexykozhanov1153
    @alexykozhanov1153 3 ปีที่แล้ว

    Hello, I've got a problem using your dynamic lighting described in DynamicLights-Part2.yyz. Using lights until you've got

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      My hunch is there is vsync turned on by the GPU itself. I encountered that problem with my old laptop running on an Intel HD graphics card. fps_real only accounts for CPU load so if there are lots of GPU load, it will not show. What I find weird though is it gave up at 5 lights. My old laptop can handle 30 lights at 60 fps.

  • @Kromsalovo
    @Kromsalovo 3 ปีที่แล้ว

    will it be possible to make shadows go below or above the character depending on object height(small box below and tall wall above)?

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +2

      Unfortunately, no. This lighting works best for top-down or side-view but 3/4 view is still a bit of a problem. There is a way I'm sure. I've been constantly thinking about it, but it definitely seems to require more math and algorithms that would slow down the game. Pretty sure a slow down is inevitable. I'll try my best to find a way how and I'll be sure to share my findings when I do :)

    • @Kromsalovo
      @Kromsalovo 3 ปีที่แล้ว

      @@GrizzliusMaximus i shoud've specified that i was talking about top down, but i guess its the same problem of not being able to render shadows over and under some sprites at the same time, thank you anyways

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      @@Kromsalovo If that's the case, it would be easier. The hard part is properly lighting walls which wont be a problem anymore. Sorry, I assumed it was 3/4 top down. This system does not have that feature yet but I think it could be expanded to fit your needs.

  • @prowokator
    @prowokator 3 ปีที่แล้ว

    Can this handle more than 1 active cameras that produce the view? I use 3 cameras in my project, 2 of them handle the transition from end of the room back to beginning (its a looping room).

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      I haven't tested it to work with multiple cameras. You could repeat the same procedure but on a different surface I guess. if I have the time, I try to look into it :)

    • @prowokator
      @prowokator 3 ปีที่แล้ว

      @@GrizzliusMaximus That would be very cool of you! :) I've been testing with another lighting solution but so far I haven't been able to fix this problem of multiple cameras. I would assume it is rare problem, but IMO it isn't anything unheard of to use more than one camera, so I was kinda surprised that it was an issue.

  • @daviio
    @daviio 6 หลายเดือนก่อน

    woah thats really cool but what's with the copyright free inspiration music in the background, its too loud

  • @FM39hz
    @FM39hz 2 ปีที่แล้ว

    I know gms 1 is pretty old but i have some reason to stick with it, so i wanna ask that if that dynamic system works with the gms 1?
    I kinda want to have it on my game, thx

    • @GrizzliusMaximus
      @GrizzliusMaximus  2 ปีที่แล้ว +1

      It's possible. I did it originally on GMS 1 but some of the steps I share in my tutorial are exclusively for GMS2.You will need to find some way to work around those.

    • @FM39hz
      @FM39hz 2 ปีที่แล้ว

      @@GrizzliusMaximus thx for the information, im gonna give it a try!

  • @MichaeltLoL
    @MichaeltLoL 3 ปีที่แล้ว +1

    Very good job! Just finished(but still some optimization will be needed in future) my own 2D dynamic shadows(not with GM2) and then saw this and was like "oh no i'll have to do it in way he did because he can handle 5k on 60fps", but then found you run it on RTX 2070 and not some shitty gpu like me 😂

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      My system is bottlenecked by my CPU although if I had a worse GPU, then it is possible my GPU will cause a bottleneck. To make you feel good, my pentium, Intel HD laptop can only handle 90 lights, GPU bottleneck. My GT 730, I3 3rd gen build could handle 2000 lights, CPU bottleneck

    • @MichaeltLoL
      @MichaeltLoL 3 ปีที่แล้ว

      @@GrizzliusMaximus also comparing these algorithms is nonsense because we don't have exactly same enviroment. The scene I'm using is far away from what i'm going to have so the FPS are much higher than they are going to be, but on my Intel UHD 630 it runs 256 lights on 40-60 fps, it's not stable for some reason. And GTX 1060 goes on stable 60FPS with 1024 lights, but as I said, my scene is extremely far away from what i'm planning to do, though there's still big number of things to optimize, including things that aren't related to lighting

    • @MichaeltLoL
      @MichaeltLoL 3 ปีที่แล้ว +1

      @@GrizzliusMaximus I'm using polygons to determine these shadows. So I set up 1300 sprites and each contains 1 "shadow polygon" that is actually just a line and with 1024 lights it runs on 15FPS on GTX 1060. But it's heavily CPU bottlenecked because I recalculate these 1300 sprites every frame, as i said lots of things to optimize

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว +1

      ​@@MichaeltLoL Your system seems to work really well. Good Job! If you want to try out how well my lighting system works on your computer, I do have a demo with all the features already added. There is a link in the description. Just press F3 to bring the debugger and right click to spawn 100 lights or left click for just one.

    • @MichaeltLoL
      @MichaeltLoL 3 ปีที่แล้ว

      @@GrizzliusMaximus wow that's so fast! On Intel UHD 630 it runs 60FPS on 1000 lights! And on GTX 1060 60FPS with ~2800 lights. That's really good

  • @jordan_private
    @jordan_private 3 ปีที่แล้ว +1

    Hi! This looks great, would the code translate well to GM 1.4?

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      Most of it will. I've been using 1.4 till last summer when I finally bought gms2. There are things like local functions and using functions with "gpu" in front that do not exist in 1.4 but there are alternative ways (scripts and d3d functions). If you watch my second tutorial, in the beginning I showed an alternative way of depth sorting. That one uses a function not available in 1.4 (blendmode with separated alpha). 1.4 only has regular blendmode and blendmode extension fucntion. But this is very much possible to be done in GMS 1.4 with a few adjustments.

    • @jordan_private
      @jordan_private 3 ปีที่แล้ว

      @@GrizzliusMaximus Cool, I might try an implementation. Interesting to see that the resources you reference at the end are the exact same ones that I used in making my lighting system.

  • @frankdrawsnear9995
    @frankdrawsnear9995 2 ปีที่แล้ว

    you need to do some audio mixing, great video though

  • @fusionfury4437
    @fusionfury4437 3 ปีที่แล้ว

    Does this work on GameMaker Studio 1.4? I really hope so but I have a feeling it doesn't :(

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      There are some things where I utilized the cool features of GMS2 but I'm sure there are ways to do it in GMS 1.4. I just bought GMS2 mid last year so and I did make an early version of this system before in GMS 1.4

    • @fusionfury4437
      @fusionfury4437 3 ปีที่แล้ว

      @@GrizzliusMaximus What did the early version look like (compared to the version shown in the tutorial)?

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      @@fusionfury4437 I made a game called Rhythm Castle. I have video of the gameplay here on youtube :). It's not the fastest but the shader techniques I applied works well on GMS 1.4.

  • @webplace8268
    @webplace8268 3 ปีที่แล้ว

    shwibbedy shwabbedy swoop ur code is now mine

  • @zakisellami8899
    @zakisellami8899 4 หลายเดือนก่อน

    I love you

  • @who-sf7oz
    @who-sf7oz 2 ปีที่แล้ว

    *video says less then 500 lines of code
    Me "My bests 66"

  • @sebaVRarg
    @sebaVRarg 3 ปีที่แล้ว

    how it works in android games?

    • @GrizzliusMaximus
      @GrizzliusMaximus  3 ปีที่แล้ว

      I haven't tested it on android so I am not sure if it will work.

  • @jojusche1820
    @jojusche1820 ปีที่แล้ว

    cooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooool

  • @jameschappfillmore
    @jameschappfillmore ปีที่แล้ว

    what is the name of the game in minute 4:58 please

  • @WitherSkell
    @WitherSkell 2 ปีที่แล้ว

    gt 710, amd fx 6300
    2500 lights, 60-70 fps
    nice

  • @dougie_dev
    @dougie_dev 9 หลายเดือนก่อน

    Anyone here mess with multiple "normal" layers and this system?