GameMaker Studio 2 - Jobo's "Lighting System 2d" - Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 252

  • @SaraSpalding
    @SaraSpalding  5 лет назад +13

    Todays Livestream of viewer games is over at: www.twitch.tv/shaunjs !

    • @mythology100
      @mythology100 5 лет назад

      How is this Lighting System with 2D platformer games? It seems this demonstration is best fit for Top-Down projects.

    • @enelestudioconfede
      @enelestudioconfede 4 года назад

      a question it support android?

    • @Baleur
      @Baleur 4 года назад +1

      Update link for description of this video
      thecode.cafe/foss/lighting-2d

  • @SorchaSublime
    @SorchaSublime 4 года назад +8

    whenever I have a vague concept of something I wanna do in gamemaker youre always here with the appropriate solution!

  • @JadenGoter
    @JadenGoter 5 лет назад +25

    Wow! I've been looking for a good solution to a 2D lighting system in GMS2 for some time now, thank you!

  • @meganoob9281
    @meganoob9281 5 лет назад +12

    Thanks Shaun, perfect timing for me.
    I'm going to try and combine this with my lighting system I already have in place, to see if I can create anything cool from it...or break my game, of course.

  • @menik6575
    @menik6575 5 лет назад +23

    EDIT--I figured it out. By setting the shadow intensity in the "draw_shadow_map" script to 0.
    Under "shader_set_uniform_f_array", if you set the 1.0 values to 0.0(or any value under 1), you'll get rid of the "X" effect on small range values.
    Messing with the light enum values trying to get a small-scale circular light around the Player. I keep getting a "X" effect where light crosses through the light circle around the Player to make an X. This happens when I set eLight.Range to a small value such as 64. Otherwise the engine is great.

    • @e44-y9s
      @e44-y9s 3 года назад +1

      ur a fucking god dude. you saved me.

    • @menik6575
      @menik6575 3 года назад +1

      @Check I'm not sure. I haven't played around with the engine in a long time, but I understand your approach. If I pick it up again I'll try and explore this.

    • @FetaSCG
      @FetaSCG Год назад

      did you ever figure out how to create the circular light?

    • @robinhorst706
      @robinhorst706 Год назад +2

      Wow, even after three years your comment just saved my project!

  • @juxtor9539
    @juxtor9539 4 года назад +70

    Just found this and used it in the game I'm playing around with and I love it! However, how do you make the ambient light level lower so it's darker in the room if not lit by any light sources?
    EDIT: I found the variable that handles this in the lighting_global script: global.ambientShadowIntensity = 0.85;
    Changing this value to something closer to 1 makes it much darker. Thought I'd edit this in case anyone else hadn't found that yet

  • @d0nk_
    @d0nk_ 2 года назад +15

    does anyone know how I could decrease or increase the brightness of the rest of the room when using a light. I would like everything outside the light source to be pitch black
    edit: I figured it out. You just change the global.ambientShadowIntensity variable in the lighting_global script if anyone else wants to know.

    • @Luke-op2rw
      @Luke-op2rw 11 месяцев назад

      Thanks for letting me know

    • @macmilambh
      @macmilambh 7 месяцев назад

      I needed this information! Thanks!

  • @FetaSCG
    @FetaSCG 2 года назад +1

    HOLY £@¤% THANKS SHAUN IVE BEEN LOOKING FOR SOMETHING LIKE THIS IN PROBABLY ABOUT A WEEK

  • @Hikkikomoru
    @Hikkikomoru 5 лет назад +12

    Okay, to anyone as stupid as me: if you need to move shadowcaster put polygon = polygon_from_instance(id); in the step event. I spent 3 damn hours trying to figure that out.

    • @BenAitkenhead
      @BenAitkenhead 4 года назад +1

      omg thank you

    • @Kazgrin
      @Kazgrin 3 года назад +1

      You're a lifesaver

    • @misticloud_real
      @misticloud_real 2 года назад +1

      Oh god you're goddamn right! thank you

    • @MiniMeGaming
      @MiniMeGaming 6 месяцев назад

      you are a life saver my friend!

  • @stuartnulty7237
    @stuartnulty7237 4 года назад +2

    fantastic tutorial, fantastic asset. took 10 mins to implement max. Thank you Sean and Jobo!
    Edit: Cant seem to make a non-square shadow. for a round ball for example. Digging through the code now,

    • @adventurousgamer9435
      @adventurousgamer9435 7 месяцев назад

      Ever figure it out?

    • @vitobiliti
      @vitobiliti 6 дней назад

      I am also trying to figure out how to cast the shadow of a round object. Any ideas?

    • @vitobiliti
      @vitobiliti 6 дней назад

      solved with polygon_from_path, just make sure to set the origin to -x,-y, I don't understand why but I got it working thanks to a comment below.

  • @dexterousfish
    @dexterousfish 10 месяцев назад

    Hullo I have a problem whenever I run my game no sprites are actually being drawn, not the lights nor the shadow casters. I'm not really sure why. Help me. Help me.

  • @mydream8934
    @mydream8934 5 лет назад +20

    Could you explain how these shaders work? I love the way you teach things.

    • @NStripleseven
      @NStripleseven 4 года назад +2

      I would watch that, that's actually what I came here expecting to see.

  • @JshPerky
    @JshPerky 4 года назад +7

    I'm trying to create a game that has this lighting system and has enemies that are only visible in the lit area. How would you go about detecting if an object other than the light source is lit by another light source? I'd like the visibility of the object (lit by the light source) to be a function of the amount of light where it's at, so if it is just barely lit, it will be barely visible (low opactiy).

    • @FetaSCG
      @FetaSCG Год назад

      I know this answer is very late, but you could just make the shadows overlap the enemies.

  • @Baleur
    @Baleur 4 года назад +2

    3:10 so, not ENTIRELY a foolproof tip then to say "always put at the top"?
    Because if you have a "oInitialize" object that changes and SETS resolution / viewport / camera size, ratios, appsurface scaling etc.
    Surely you want the lighting object to load AFTER that one?

  • @b1rdm4n22
    @b1rdm4n22 4 года назад +2

    Great tutorial, but how to use different shape shadow casters instead of square boxes. I created a barrel (circle shape shadow caster) but it still had a square shadow?

    • @Digital33Studios
      @Digital33Studios 4 года назад

      im trying to figure this out myself, there is very little documentation on this system... what good is it if no one knows how to utilize its abilities?

    • @b1rdm4n22
      @b1rdm4n22 4 года назад +1

      I figured out to use polygon_from_path and then create a path with the circle shape you need. But for the origin i worked out (by trial and error) needs to be the negative of the objects X and Y position. But thats as far as i got. I dont know how to resize or move the object (with path attached) in game.

    • @vitobiliti
      @vitobiliti 6 дней назад

      ​@@b1rdm4n22 thank you for the -x -y tip. I got round shadows working with polygon_from_path. Looking great!!!

  • @michaelcapone175
    @michaelcapone175 Год назад +3

    Does this still work in 2.3?

  • @pancakesandsyrup1233
    @pancakesandsyrup1233 5 лет назад +1

    This is freakin' awesome, especially since it's totally free!

  • @oleksiiliaskovskyi5381
    @oleksiiliaskovskyi5381 5 лет назад +4

    Help me please. FPS fell down after inputing lighting in the room. How can I fix it?

  • @HenrikoMagnifico
    @HenrikoMagnifico 5 лет назад +1

    How to I update the shadows when an object moves in the scene that is affected by shadows?

    • @smily7040
      @smily7040 5 лет назад

      Do u have the solution?

    • @HenrikoMagnifico
      @HenrikoMagnifico 5 лет назад

      @@smily7040 Put it in a step event :)

    • @Saltshaman
      @Saltshaman 5 лет назад

      @@HenrikoMagnifico put what exactly in a step event?

  • @LevelPixelLevel
    @LevelPixelLevel 5 лет назад

    Great tutorial Shaun, thanks for sharing. I've been looking for something like this for my projects!

  • @Palpus_X
    @Palpus_X 8 месяцев назад

    How do I properly set shadowcaster flags? .Dirty doesn't seem to update the shadows

  • @teemon8580
    @teemon8580 2 года назад +1

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

  • @kaspax00
    @kaspax00 5 лет назад +2

    Works, when i run on windows, but when i run on android, lights and shadows are not working, evrything is just really dark, anyone know soulution?

  • @AGoodBean
    @AGoodBean 10 месяцев назад

    Can you have a light sprite that acts as a torch from a player object to the mouse?

  • @marzz6210
    @marzz6210 4 года назад +3

    Just a quick question, I need some help would be greatly appreciated!:
    How would I check the light levels/intensity at an x,y coordinate
    Thanks

    • @marzz6210
      @marzz6210 4 года назад

      Please if anyone has a spare moment it would really help, trying to make my first real project outside of tutorials and struggling

  • @GiampaoloRenzi
    @GiampaoloRenzi Год назад +1

    which functions or scripts should I modify to have a less dark screen or a more powerful light?

    • @GiampaoloRenzi
      @GiampaoloRenzi Год назад +3

      i solved problem. i founded in script lighiting_global the variable global.ambientShadowIntensity change it and darkness intensity change

  • @GameBroJimmy
    @GameBroJimmy 5 лет назад +1

    this is freaking awesome, im gonna put this into my project

  • @MrPolyPS3
    @MrPolyPS3 7 месяцев назад

    I get an error whenever I destroy an object that's a child of obj_shadow_caster. It's related to the polygon it creates. How do I fix this?
    ERROR in
    action number 1
    of Draw Event
    for object obj_light_renderer:
    trying to index a variable which is not an array
    at gml_Script_polygon_get_area (line 15) - var px = pt[eVertex.X];
    ############################################################################################
    gml_Script_polygon_get_area (line 15)
    gml_Script_lighting_pre_composite (line 19) - cached_polygon_area = polygon_get_area(polygon);
    gml_Script_composite_shadow_map (line 10) - lighting_pre_composite();
    gml_Object_obj_light_renderer_Draw_0 (line 8) - exists = composite_shadow_map(global.worldLights);

  • @AGoodBean
    @AGoodBean 10 месяцев назад

    How do i get extensions in game maker? Do i need to buy a licence?

  • @hidoimusic6184
    @hidoimusic6184 4 года назад +2

    Sorry if someone already asked but there is an issue with light leaking through adjacent tiles(obj). Does anybody know how to fix this?

    • @Oliwarder
      @Oliwarder 3 года назад +1

      Hi! Did you find the solution? I have the same issue.

    • @Oliwarder
      @Oliwarder 3 года назад +3

      Got it) By setting the shadow intensity in the "draw_shadow_map" script to 0^:
      shader_set_uniform_f_array (global.u_TexelSize_ShadowMap, [0.1 / surface_get_width (surface), 0.1 / surface_get_height (surface)]).
      Also, play with this line (set numbers between 0.0 and 1) and obj_light (parent object. like in the video) variable definition to get the smoothest result.

    • @hidoimusic6184
      @hidoimusic6184 3 года назад +1

      @@Oliwarder great. I tried to "fix" it by making the collision mask 1 pixel larger but your solution is probably best.

    • @Oliwarder
      @Oliwarder 3 года назад +2

      @@hidoimusic6184 Glad I helped) After 5 month) I mean, I just found this tutor. Actually, I'm creating a game too. There is a teaser on my channel)

  • @Montigorable
    @Montigorable 5 лет назад +1

    Nice engine, unfortunately with complicated shapes shadows start overlap on each other, not sure if it is possible to solve.

  • @jordanottesen1186
    @jordanottesen1186 2 года назад +1

    Doesn't work on my mac, not even the demo rooms :(

  • @patatopeeler3005
    @patatopeeler3005 2 года назад

    my god this is awsome, and it still works for me, which is also awsome

  • @stal2496
    @stal2496 5 лет назад +1

    You're the reason i use gamemaker studio

  • @joshuavadrot4324
    @joshuavadrot4324 4 года назад

    it is possible to create a little shadow caster ? because with downing the shadow_lenght variable, when i am to close to the object, the shadow of the point near to me create a shadow on the object and it's soooo ugly

  • @TionardChaster
    @TionardChaster 5 лет назад +2

    I've started using this system, and It has a huge potential. Would love to see more videos about this system.
    Especially about how to optimize room with a lot of light sources.
    This system has comments everywhere, but I don't really understand how it works with cameras?
    Is there a way not to cast shadows if an object is outside of your camera view to save computing resources?

    • @xea7844
      @xea7844 5 лет назад +1

      I would also like to know if anybody finds a good optimization for this.

    • @MaxSkaw
      @MaxSkaw 5 лет назад +3

      @@xea7844 Use light_ignore_shadow_caster() when it's out of screen. In the demo you can find an example of this function

    • @xea7844
      @xea7844 5 лет назад +1

      @@MaxSkaw oh sweet I'll have to try that. Thanks!

    • @adog3129
      @adog3129 3 года назад

      @Check Old comment but could you elaborate? I'm desperate lol

  • @enru2251
    @enru2251 5 лет назад +1

    Good lecture introducing awesome resource. By the way, I am curious about how you scaled the code- without scaling the code editor- like 6:36~6:38 Is there any command key for doing that?

    • @charKT-7461
      @charKT-7461 4 года назад

      F7 and F8 zoom in/out respectively. (Or it's reversed I don't remember)

  • @LeeGod
    @LeeGod 5 лет назад +3

    can you make something like tile based lighting? it's should be helpful if you made it!

  • @josephkalfyt6778
    @josephkalfyt6778 2 года назад

    hey man i got a question i use this for my player but the light isnt big enough so it makes most of the room dark how can i make the radius bigger?

  • @vesk4000
    @vesk4000 5 лет назад

    Just when I was thinking that it would be nice if you did a lighting tutorial

    • @RUMPshit
      @RUMPshit 5 лет назад

      Vesk well he didnt he just showed how to work with his precoded system

  • @okami2.004
    @okami2.004 5 лет назад +2

    On the Mac Creator version of gms2 the shadows seem to work perfectly but the individual lights don’t seem to render
    Do you have any idea why this happens?
    Edit: I followed your tutorial step by step not sure why it doesn’t wrk

    • @BeingFriends
      @BeingFriends 4 года назад +2

      Hey! I found the answer in one of the reviews on the YoYo Games marketplace page.
      "In all vertices shader (sh_blend_light.vsh and sh_shadow_map.vsh), replace all references "in_Texcoord" with "in_TextureCoord" and it'll work."

    • @CopyCopyOriginal
      @CopyCopyOriginal 3 года назад

      @@BeingFriends hm, maybe I didn't do this right, but I did a find and replace all for in_Textcoord --> in_TextureCoord and I still don't see anything. :(

    • @Spario
      @Spario 2 года назад

      same here

  • @AAAAGamesGames
    @AAAAGamesGames 3 года назад

    the shadows only works with cube? or have a way to use the shadows in more complex images?

  • @Spario
    @Spario 2 года назад +2

    anyone having a problem with lights not wworking on mac???
    (dont tell me about the in_Textcoord or smth i tried it and it still doesnt work)

    • @kidnamedfinger6306
      @kidnamedfinger6306 Год назад

      Yes mine do not work

    • @Spario
      @Spario Год назад

      @@kidnamedfinger6306 that was like a year ago 💀💀

    • @kidnamedfinger6306
      @kidnamedfinger6306 Год назад

      @@Spario your point?

    • @Spario
      @Spario Год назад

      @@kidnamedfinger6306 i dont use mac anymore sorry

  • @studioprema4791
    @studioprema4791 3 года назад

    Hello, thank you for the tutorial, I have a question, there is a polygon for the shadow, the problem is, my object is a tree, how can I use the sprite to do the shadow? thank you

  • @gunghoblazes
    @gunghoblazes 3 года назад

    does anyone know how to affect individual lights. I was trying to create a flickeriing on and off light and when i created it. it would affect all the lights.
    I have a Test light with an alarm in the create
    that alarm looks like this
    light[| eLight.Intensity] = 0;
    then i have another alarm that goes off after another 10 frames but again this affects this object and even other different light objects.
    So theyre all going off which is cool but id like to affect individual lights.

  • @db65559
    @db65559 3 года назад

    So I already have a day and night system for my game and was wondering can this be used strictly for my dungeons? I know I can use it but would it have any major downfalls if I don't make it persistent and call it in the rooms I need?

  • @metalmoltres8031
    @metalmoltres8031 3 года назад

    I can't make a new create event because there already is one what do I do?

  • @redswanstudios
    @redswanstudios 2 года назад

    Does this work in Game Maker 8.1 Professional Edition?

  • @peremoyaserra2749
    @peremoyaserra2749 5 лет назад +1

    Is there any way to use it with tilemaps? Something like generating a bunch of polygons with the tilemap data

    • @l0m-dev
      @l0m-dev 5 лет назад

      Did you figure it out?

    • @HaMeRoNLive
      @HaMeRoNLive 2 года назад

      @@l0m-dev have interes too

  • @loot6
    @loot6 3 года назад

    But how do you make a lighting system that doesn't have infinite shadows? A system where the shadow length is based on a given height value for each object.

  • @InsaneGamers1003
    @InsaneGamers1003 4 года назад

    hi shaun I'm using this asset, and would like to ask how I would go about adding layer based lighting, the issue I've been trying to solve with this engine, is disabling the lighting effect for the background layers or a specific layer in general.

  • @BubblesGMD
    @BubblesGMD 3 года назад

    the only thing making light rn is my screen because its 3am and ive been doing this for 4 hours and it still isnt working

  • @destiny5741
    @destiny5741 4 года назад

    How can I use this in android? Light not working normally. Sometimes room being darkness, sometimes room being lighter.

  • @andersduus3605
    @andersduus3605 5 лет назад +1

    Any way to make the sprites cast shadows, instead of the collision boxes?

    • @trapsimpson2630
      @trapsimpson2630 5 лет назад

      make a sprite collision layer and use the same collision as the sprite

  • @nathan08085
    @nathan08085 5 лет назад

    Wow! I’ve always wanted this :)

  • @MultiMarcsOfficialChannel
    @MultiMarcsOfficialChannel 5 лет назад +5

    how can I make it work with tiles?

    • @peremoyaserra2749
      @peremoyaserra2749 5 лет назад +1

      Have you found out? I also wanna know

    • @noisynixx
      @noisynixx 5 лет назад

      @@peremoyaserra2749 My solution would be to make a shadow caster as an invisible object, then place it over any tilemap you want to have cast a shadow.

    • @peremoyaserra2749
      @peremoyaserra2749 5 лет назад

      @@noisynixx It's what I ended up doing but it's not very elegant

  • @PadreGamer
    @PadreGamer 5 лет назад +1

    Why don´t just move the x and y of the object oTestLight ?

    • @SaraSpalding
      @SaraSpalding  5 лет назад +4

      Because while the original light is *placed* at oTestLight it doesn't follow it. oTestLight simply creates the light. Technically you could make and manage many lights from one object, this is just a convenient way to track them.

  • @AlfredPros
    @AlfredPros 4 года назад

    How do you save object with lighting with JSON?

  • @adman123
    @adman123 3 года назад +1

    Just found if you don't have any shadow casters, the lighting system doesn't do anything.
    I wanted lights without shadows (for my own reasons), so solved this by creating an off-camera shadow caster dummy object.

  • @TjuserX
    @TjuserX 5 лет назад +1

    I've run into a problem with my game where it gives me an error saying it can't create a surface with a width or height of 0. I have no idea what causes this. When I make an entirely new room as in the video everything works just fine, but with my older rooms the game crashes right away. Any ideas what might cause this?

    • @jacobfauston6837
      @jacobfauston6837 5 лет назад

      I'm having the same issue

    • @TjuserX
      @TjuserX 5 лет назад +1

      @@jacobfauston6837 I just figured out it has to do with the viewports. When I turn them off it works perfectly, but with them turned on the game crashes. Now I just need to figure out how to set the window size without having viewports. Any ideas?

    • @jacobfauston6837
      @jacobfauston6837 5 лет назад +1

      @@TjuserX Alright, I found a way to fix it! Re enable viewports first of all. Then you'll need to change your object camera, in that object is probably camera_create(). But as it turns out you need to change it into camera_create_view(). I never used that yet, but it fixes the crash.

    • @TjuserX
      @TjuserX 5 лет назад +1

      @@jacobfauston6837 Fantastic, thanks man! I'll try that right now.

    • @TjuserX
      @TjuserX 5 лет назад +1

      Ah it sort of works right now, except the shadows aren't appearing where they should. They are now disjointed from the actual shadow casters.

  • @TionardChaster
    @TionardChaster 5 лет назад +1

    Hi Shaun! Thanks for all of the tutorials that you're making! I must say that's a gorgeous free 2 use lightning system.
    I'm also in search of information or video about initializing/loading rooms.
    When should a user create one, and how to define if all is loaded and ready
    to be shown inside of actual game world?
    Any good sources of info for that? Would also love to see a video from you on that topic one day.

  • @that_challenge1956
    @that_challenge1956 5 лет назад

    Everything is just dark and no light is being cast. Any help?

  • @LitoralTrading
    @LitoralTrading 4 года назад

    Amazing bro, congrats!

  • @GMGuru
    @GMGuru 5 лет назад

    Great tutorial as always! Keep it up :)

  • @plexim1591
    @plexim1591 3 года назад

    Would this work with tiles?

  • @SorchaSublime
    @SorchaSublime 4 года назад

    I have an issue. The child object always has the same sprite as the child object for some reason

  • @yungyeetist1996
    @yungyeetist1996 5 лет назад +1

    Can this lighting be used for comercial use?

  • @prowokator
    @prowokator 3 года назад

    Does this work with multiple cameras? I have situations where my view consists of 2 camera views combined into the actual view, is this flexible enough to work in a situation like that?

    • @prowokator
      @prowokator 3 года назад

      I tried and it doesn't work straight out of the box with multiple cameras. Any idea if adding support for 2 or more active cameras is possible?

  • @NStripleseven
    @NStripleseven 4 года назад

    I was looking for a tutorial on how to make this kind of thing, could you do one of those?

  • @that_challenge1956
    @that_challenge1956 5 лет назад

    ya im doing everything exactly as you say and its not working, my room is now dark but there is no light being cast anywhere.
    any help?

    • @arthurgameryt1525
      @arthurgameryt1525 4 года назад

      with me too :( I'm searching, but not found any solution for this. have U found?

  • @mrcuddles100
    @mrcuddles100 3 года назад

    This just doesnt work for mew on my mac. I get no lights even with one of the bundled demo rooms. Shame.

  • @alexcolins2675
    @alexcolins2675 5 лет назад +1

    how to show the shadow of a round object?

    • @DiamondWolfX
      @DiamondWolfX 5 лет назад +1

      Make sure it has a round bounding (collision) area in the sprite. Alternatively there should be polygon creation functions (i.e. polygon_create(set) where set is a 1d array of eVertex, though you'd have to look to find out what an eVertex is).
      *Edit:* Turns out that it actually uses the square collision box. So you'll have to use the alternative method.
      Thankfully I found out how to set up your vertex array:
      set[0] = [x,y];
      set[1] = [x,y + 16];
      //Continue for all points - it shouldn't take too many to create a decent circle
      *Edit 2:* For a visual editor just create a path and use polygon_from_path(path,xOrigin,yOrigin).

    • @xaxelpx
      @xaxelpx 5 лет назад

      @@DiamondWolfX Thank you so much man! And where did you found info on eVertex? Google seem to know nothing.

  • @eggnog9230
    @eggnog9230 5 лет назад +1

    Certain variables apparently aren't defined for me. I had to manually add them in.

    • @SaraSpalding
      @SaraSpalding  5 лет назад +2

      This implies quite strongly you did something wrong or have your instance creation order off. Everything is handled by the main object as demonstrated in the video. I'd be careful about patching this over yourself instead of working out what went wrong.

  • @ElleKelsheimer
    @ElleKelsheimer 4 года назад

    Very good looking lighting system, but it's very slow on version GM 2.3, both in a stand-alone demo project and integrated into my existing game. Any ideas on how to fix this?

    • @CopyCopyOriginal
      @CopyCopyOriginal 3 года назад

      I was ready to download and try this until I read this comment--do you think this makes it unusable? were you able to figure this out at all?

    • @ElleKelsheimer
      @ElleKelsheimer 3 года назад

      @@CopyCopyOriginal I think it was my machine. Apparently the surface pro chokes graphic speed to make up for the fact it doesn't have a proper fan. 🤔

  • @Temzy
    @Temzy 5 лет назад +14

    This is lit👌 I hope you can play my game when it's finished

    • @HomeofLawboy
      @HomeofLawboy 5 лет назад +6

      "Lit"
      Ha, I get it

    • @Temzy
      @Temzy 5 лет назад +3

      Lince Assassino loooooool that was accidental pun, I was just being myself 😂😅

    • @DrJurdenPeterbergsteinlerwitz
      @DrJurdenPeterbergsteinlerwitz 5 лет назад

      @@Temzy I wanna see your game.

    • @Temzy
      @Temzy 5 лет назад

      Kaare Withersmann lool You're gonna have a wait a year

    • @DrJurdenPeterbergsteinlerwitz
      @DrJurdenPeterbergsteinlerwitz 5 лет назад

      @@Temzy Niieeeeeaaaaaooooooo !!!! Well, gonna sub *in case you post some dev vids at some point. gl with the game.

  • @JonPFS
    @JonPFS 5 лет назад +1

    cool very cool, i had already tested the lightSystem2D but my graphics card vents would fire up, iam on a ATi raedonR9 msi overclocked by factory. But using this method and adding it to the game all the GPU fans are quiet. ( iam guessing the lightSystem2D default room is made to stress the gpu )

  • @jgordon9022
    @jgordon9022 4 года назад

    Is it possible to make the light follow an object instead of the mouse?

    • @arnarkarlsson9916
      @arnarkarlsson9916 4 года назад

      yes. "light[| eLight.Y] = oPlayer.y;"

    • @jgordon9022
      @jgordon9022 4 года назад

      @@arnarkarlsson9916 I have tried it, but for some reason it did not seem to work for me tho; the lighting system would not appear to be working, I would still get the same character on a plain map. And after moving it around for a bit, the game would just crash for some reason.

    • @antoniotorres6249
      @antoniotorres6249 4 года назад

      @@jgordon9022 Did you find a solution? I have the same problem with the SpotLight

  • @matthewbadger8685
    @matthewbadger8685 5 лет назад

    does this apply to particles?

  • @ofaca1429
    @ofaca1429 5 лет назад

    I'm getting an error that says: "Can't create a surface with either a width or height of 0" at gml_Script_shadow_map_ensure_exists (line 24) . Line 24 is "shadowMap = surface_create(vw, vh);". If anyone already had this error, can you tell me how to fix it?

    • @ОпустошенныйСон
      @ОпустошенныйСон 5 лет назад +1

      Hey. I have the same problem. Appeared after I started using "cameras" instead of "views". I don’t have a solution yet either

    • @ofaca1429
      @ofaca1429 5 лет назад

      @@ОпустошенныйСон i don't know if i'm using cameras or views, i'm a beginner at gms2. If you find a way to fix this, can you tell me?

    • @ОпустошенныйСон
      @ОпустошенныйСон 5 лет назад +1

      @@ofaca1429 I think I found a solution. I apologize for possible errors and other stuff - I am not a native speaker and used Google Translate
      Our problem is that the lighting system is designed to work with the old camera system. The script "lighting_get_active_camera" uses functions of the type "camera_get_view" which work only with cameras created in the room settings, or through the function "camera_create_view()". Cameras created through "camera_create()" do not support these functions.
      So we need to replace all these functions with the actual values ​​used for our camera. In my case, the script "lighting_get_active_camera" now looks like this:
      if(global.worldCustomCamera == undefined) {
      // Get active view camera
      var camera = co_cam.vcam_cam // camera_get_active();
      var cameraX = co_cam.vcam_cam_x-co_cam.vcam_width/2 //camera_get_view_x(camera);
      var cameraY = co_cam.vcam_cam_y-co_cam.vcam_height/2 //camera_get_view_y(camera);
      var cameraW = co_cam.vcam_width //camera_get_view_width(camera);
      var cameraH =co_cam. vcam_height // camera_get_view_height(camera);
      return [cameraX, cameraY, cameraW, cameraH];
      }
      return global.worldCustomCamera;
      Where object "co_cam" controls all my cameras. The meaning of the remaining variables should be clear. With this fix, lighting now works for me

    • @ofaca1429
      @ofaca1429 5 лет назад +1

      @@ОпустошенныйСон You don't need to apologize. I'm not a native speaker neither.
      Thank tou for your help. I can't wait to make this work in my games. Thanks :D

  • @jonathanorr5878
    @jonathanorr5878 5 лет назад

    How do you make the shadow casters non-static so that the shadow can move with the object

    • @BenAitkenhead
      @BenAitkenhead 4 года назад +1

      try putting ' polygon = polygon_from_instance(id); ' into Step Event instead of the Create Event

    • @indieklem
      @indieklem 2 года назад

      @@BenAitkenhead thanks for this tips. It work well. I will now check the perf if I got too many moving obj :)

  • @ninjafe8310
    @ninjafe8310 5 лет назад

    Very easy, nice and beautiful, but, i can't use that with the Camera And ViewPort. Why?

  • @user-main-locked
    @user-main-locked 4 года назад +2

    Does anybody know how to fix the errors that appear? I cannot run the game. Please help!

    • @joeljames8591
      @joeljames8591 4 года назад

      What errors appear?

    • @uwwwu9954
      @uwwwu9954 4 года назад

      @@joeljames8591 ERROR in
      action number 1
      of Draw Event
      for object obj_light_renderer:
      Can't create a surface with either a width or height of 0
      at gml_Script_shadow_map_ensure_exists (line 25) - shadowMap = surface_create(vw, vh);

    • @adog3129
      @adog3129 4 года назад

      @@uwwwu9954 fuck, i'm getting the same thing. the fact that both of us are getting this now probably means it's a new issue with 2.3...

    • @adog3129
      @adog3129 4 года назад

      @@uwwwu9954 ok, i traced the issue to these variables for the height and width it wants to draw the surface. it tries to pull them from the camera width and height, but the way it's trying to do that is honestly way over my head and i have no idea how to troubleshoot that. setting those variables to a high number can get the game to run without crashing, but things don't really render properly...

  • @volkanklnc532
    @volkanklnc532 2 года назад

    how can I change the intensity of the light?

    • @indieklem
      @indieklem 2 года назад

      You can try to play with the variable in lighting_global script: "global.ambientShadowIntensity = 0.85" line 25

  • @dakotasanches9058
    @dakotasanches9058 3 года назад

    So I know this is an old video but I was wondering if anybody could help me out? Whenever I put more than one light in my room it absolutely TANKS my FPS. Any Ideas?

    • @adog3129
      @adog3129 3 года назад

      it's super resource-intensive. optimize, use fewer lights, reduce their range, and even then you're probably out of luck.

  • @trgveyffhesu7906
    @trgveyffhesu7906 5 лет назад

    after following this exactly my game doesn't launch and the error message "Script: light_cull at line 20 : unexpected symbol "[|" in expression" pops up.
    please help

    • @rafaell14_8
      @rafaell14_8 5 лет назад

      mine too, give the same mistake

  • @ToastGhost26
    @ToastGhost26 5 лет назад

    Would this work with 3D GMS2 projects as well?

    • @csaki01
      @csaki01 5 лет назад +1

      It's 2D for a reason...

  • @wangsoft
    @wangsoft 4 года назад

    how do you change the colors of the lights?

  • @TheOnlyMassey
    @TheOnlyMassey 5 лет назад

    Hey, I'm having an issue where multiple light sources in different rooms are massively impacting on the performance, anyone have any idea what it could be?

    • @gelatinousgames3810
      @gelatinousgames3810 5 лет назад

      same issue here anyone figure out why? its causing alot of lag

  • @dajoroz7511
    @dajoroz7511 4 года назад

    there is a a way to change the color of the light?

    • @pillow855
      @pillow855 4 года назад +2

      look at variable definitions of obj_light
      2nd variable is Light_color, you can change it there.

    • @dajoroz7511
      @dajoroz7511 4 года назад

      @@pillow855
      Wow thank you!!

  • @gelatinousgames3810
    @gelatinousgames3810 5 лет назад

    its throwing an error for "flags not set before reading" ??

    • @stijnd.6320
      @stijnd.6320 5 лет назад

      I had the same problem, you probably have some child objects of your Crate who do not inherit the creation event from the parent. So to solve this issue, make sure every object that is a child of a shadow caster has the 'event_inherit()' script in the creation event

  • @ronburnett8634
    @ronburnett8634 5 лет назад

    Hey Shaun could you make a video on how to do physics like king Arthurs gold? Im really honestly stumped on how to do it and I dont see any of your videos show anything like it

    • @mitchellbachtold6386
      @mitchellbachtold6386 4 года назад

      Lol, I don't think KAG's code serves as any type of example on what to do when it comes to code.

  • @HX-uq2gr
    @HX-uq2gr 5 лет назад

    Is it possible that this dose not work on Mac OS X?

    • @BeingFriends
      @BeingFriends 4 года назад

      Hey! I found the answer in one of the reviews on the YoYo Games marketplace page.
      "In all vertices shader (sh_blend_light.vsh and sh_shadow_map.vsh), replace all references "in_Texcoord" with "in_TextureCoord" and it'll work."

    • @Spario
      @Spario 2 года назад

      @@BeingFriends its not working ;/

  • @MexLuthor1970
    @MexLuthor1970 4 года назад

    Anyone else getting a cleanup error?
    Variable oTestLight.light(100465, -2147483648) not set before reading it.
    at gml_Object_obj_light_CleanUp_0 (line 3) - light_remove_from_world(light);

    • @FelipeDevGames
      @FelipeDevGames 3 года назад +1

      Change the name of this variable "light". Apparently there is a global variable called light, this variable should be private in the object

  • @Sand_the_Lazy_sand
    @Sand_the_Lazy_sand 2 года назад

    how to use a yymp file?

    • @Sand_the_Lazy_sand
      @Sand_the_Lazy_sand 2 года назад

      can you please convert it into compatible with gamemaker 1.4?

  • @stkemp1982
    @stkemp1982 5 лет назад

    Somehow it will not work for me, no stranger to these tutorials and they always have worked like charm! But this time I have no idea what I could be doing wrong. I followed everything step-by-step, tried it first in an existing project, then in a fresh new project just to see if anything was conflicting with my pre-existing code etc. I tried it with the parent-child objects and without (using the included objects) to check if anything there was going wrong. Still everything just goes dark (but still visible) as if the lights wont "turn on". If I pump up the light intensity then everything just goes light. Anybody have any suggestions? Double checked the instance creation order and layer orders... no idea why I cant get it to work :-S

    • @stkemp1982
      @stkemp1982 5 лет назад

      Even weirder: just imported the tool again WITH the demo components and ran the demo rooms. They don't work either. Could there be anything regarding the shaders that perhaps would only work on Windows? I'm on GameMaker for Mac (paid Creator license, should that be of any importance). Or am I just not seeing something?

    • @DankerAnimation
      @DankerAnimation 5 лет назад

      me too. It not work,Mac gamemaker studio2

    • @stkemp1982
      @stkemp1982 5 лет назад

      @@DankerAnimation Thanks for your comment, looks like it's a Mac thing then (brace yourself: mac jokes are coming) Hope there's a way to bypass the issue as to why it wouldn't work. It looks so awesome. I have no idea myself unfortunately. Praying for a quick fix, because this looks so awesome :)

    • @LastNightofApril
      @LastNightofApril 5 лет назад +1

      Same problem with Desktop license on Mac. :-(

    • @stkemp1982
      @stkemp1982 5 лет назад

      Ward Crockett bummer! :( looks like we’re just excluded from this awesomeness then.

  • @SAKamal-so5hb
    @SAKamal-so5hb 4 года назад +1

    My light seems to grow dimmer with every room... and I don't know why

    • @Hikkikomoru
      @Hikkikomoru 3 года назад

      That could be a core gameplay mechanic :3

  • @ionut-cristianneamtu-tirdo6596
    @ionut-cristianneamtu-tirdo6596 3 года назад

    followed it step by step and I've got this: global variable name 'lightDefaultExtensions' index (100012) not set before reading it.

    • @RyanDrawsStuff
      @RyanDrawsStuff 3 года назад

      Double check to see if obj_lighting_init is the first instance created in your room.

  • @Vincentsgm
    @Vincentsgm 5 лет назад +1

    I can't download the project since I'm using the evaluation version of GMS2
    Lighting System 2D
    Jobo
    You need a paid GameMaker Studio 2 licence in order to have access to this asset.
    Contact Publisher | Support

  • @enlil06peacemaker
    @enlil06peacemaker Год назад

    Maybe not working anymore or not working on the javascript builds. But currently not working like in the other comments.

  • @NoLootStudios
    @NoLootStudios 5 лет назад +1

    Boo'ya! :D Thanks, buddy :D