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

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody I'm Sean Spaulding and this is an awesome free open-source lighting system for gaming studio to to put together by my friend Joe bow and I'm making this tutorial to show you how you can get started using it and how to build a scene that looks something like this it's completely free to use you can grab it on the mark place right now for $0.00 0 pounds I highly recommend doing so so once you've acquired the extension by whatever means the first thing you're going to want to do is actually bring it in to your project I'm going to assume you've done it through the market place because that's where I'm gonna go get us on the other market place my library if you added it to your account a while you still had gaming studio to open you might want to hit this button and refresh your library which will just get the latest list of all the things that you own let's come over to L lighting system 2d and once you've downloaded it by the download button you'll just see this button here ready the import button so just click that again will extract it and then you can choose what you want to add to the project now the extension comes with a demo setup if you just want to dive in and see like all the different kinds of things you can do with it feel free to just add everything to a test project that you save out it's like a demo but we don't if we're just working with the system we just want to add the system to a project all we need to do is and the things that are in the lighting folders ok everything is stored nicely in folders for you you just want to add all of the lighting folders so I'm just gonna ctrl click in sprites lighting and scripts lighting shaders lighting objects lighting and a note lighting as well it's an important license stuff and so on in there hey and once you've got all those things selected and just make sure those raw they're all coming in and as I say we don't need to down at once and then just hit import ok and then I'll bring it in I should talk about what was in this project before you get started I've got one room with nothing in it just the basic sort of instance backgrounds and a simple tiled floor that we're gonna be using and a crate texture okay just to create great that we can use about some lights off and custom shadows okay and then obviously all the lighting stuff we don't need to unfold these really stay tuned we'll look everything now you can do that your own letter just here to show you how to set it up but if we're going to objects lighting you can see we've got four objects that this whole system is based around and then all these tap into the various shaders and scripts and sprites and so on but work under the hood to create the lying engine so the first thing we need to do to set this up is we need to put two of these objects into the game okay and that's object lighting in it which will set up the whole lighting engine you might want to do this in a previous room like an initialization room or something it is a persistent object so it will carry across from room to room but if you're in a hurry what you can do is just make sure once you've placed it on whatever layer it is just a first room in your game just make sure that an instance creation order and your room just make sure object laying in it is at the top because it needs to establish loads of like important global variables and stuff that the rest of the system needs to use so it needs to be correct before you do anything else all right next thing we do is I'm going to try a second instance layer on core light render or link or whatever you want but what's important is layer is it's gonna be a layer that sits on top of everything else and I'm gonna drag an object I'm just go light renderer into here okay and this is the object what controls actually rendering the shadows and the lights into the game so you want to make sure that it's above any object that you want to involve in that lighting system okay if you've got dewy and then you maybe want that stuff for both the renderer but anything actually affected by the lighting in any way needs to be below this object okay so once that's in your room we can go ahead and start entry setting up some shadow Katz's and lights okay now that we've got those two things in they won't actually do anything by themselves until we hire some lights and shadows like if it doesn't find any lights to cast and no no objects to cache shadows they won't do anything because there's not really a whole lot of point right so we're gonna make some lights and shadows and get them set up in here to show you the basics of things so what I could do for lights is I already have obj underscore light in here I could just drag that into the instances layer because it says it's already got a bunch of default value set up but what you probably want to do instead is essentially create a child object I'll pass so I'm gonna go into object right click coulis just oh test light for now go not the physics to parent and make this a child of aubergine school I can see inherits all those scripts and inherits all these variable definitions and we can modify these to our hearts content but we're just gonna leave it out all the defaults thanks now I'm just gonna plunk just a bike a couple of these in the room just like like there and there or whatever you might even want to set them to have that same sprite if that's helpful for you as well just like this little light sprite that comes with a Lang and adjusting you see these little light bulbs and remind you what they are Abdul you doesn't matter it's not gonna show this for any the way so we've got a couple of lights in there they still won't do anything because we still don't have anything casting shadows you can see in a lighting we've got obj disc or shadow caster so what we want to do now is make children of this object so again an object hit create object and call this oh great so that the sprite to be s crate and then make it a child of object shadow caster okay you can see in the great event it's inherited all those things but we need to do some more things to tell it kind of what types of shadows we actually wanted to cast okay so let's just give ourselves a bit of space here I'm gonna add a new creative enemy now we don't want to overwrite the create event that's coming from OB a shadow caster but we want to just add to it so in order to make sure we don't get rid of a spoken 1:5 event inherited as the first thing in here so it'll just pull a full code directly from the create event from okay shadow cast Oh now the next thing I want to do is define a polygon for the crate okay my polygon equals now well I'm you know polygons just an arbitrary shape defined by a number of points and we're defining the shape of the represents the shape of this instance in order for the lighting engine to know how to cast shadows from this instance right you know what a shape is the object that's going to define our shadows and this gives instance it's just a simple box and so we have a function in the engine that's built specifically for this we just polygons from instance ID so the I'm just gonna passing the ID of this instance to the script and it's gonna take its bounding box even if it's light rotated as well it'll work that out and create a nice four-point polygon from which to cast shadow and that's all we actually need and that's all we need to really get started so if we come back to our room now and you'll remember these two lights that we've got set up here if I oh one thing to remember if you are gonna use this icon for these lights and you probably want to untick the visible from the object just so it doesn't show it's the head show that actual sprite again so we've got these two lights let's just place some crates around no okay it's a handful of these around the place will rotate a couple a nice little more interesting seed just put them nice and close places where these lights actually gonna hit them and then run that the first thing you'll notice when you run this when you've got lights and casters in the scene is everything just gets way darker right there's a global level of ambience that's applied when the system's running which will apply global level of darkness which you're gonna just as one of the main variables of the engine very easily so you can make it brighter or darker if you need to Bob C 1 some level of darkness in order to actually create light and cast shadows right so as you can see this is working we've got two lights here in here and casting shadows on these crates pretty nice you see it balances out with the lights as well their wines mix and match very nicely and evenly then a little it looks super good so the next thing I'm gonna do is show you how to move the light around the scene so we can see how the system dynamically reacts to moving lights and so on which is pretty cool so I close this down now I'm gonna get rid of one of these lights so we're just gonna have one light that we just sort of move around the scene and let's come to ou test light or I'll light object which is just a default lights just inheriting from lights on the way to work if you go to the Korea event that you've inherited you can see that how the sense of working is it creates a [Music] there's a variable called light in here that you can see gets assigned are a whole bunch of properties from a script like create point now how you manipulate those properties in real time let's so that's out of step event to this because we're gonna move that around the mouse move light with Matt is that light actually seems to be a TS list so we can access element to the D s list by opening a square bracket typing this vertical line and then a space and then typing the name of the element that we wish to access if you type e light which I presume is for enum light to ring and ya select that and a dot and you can see there's all different kinds of fields that you can attach to you like this you know so this reference is all the different entries of of the DS list the sorts of properties about light and what we want to change is the X&Y otherwise you've seen a little all kinds onion change the intensity ranges so on all the things that you can define the variable definitions of the object so if I just change the X so you like dot X I'm gonna set that to equal males X okay and I'm gonna do the same thing with Y so light light dot Y square bracket equals Mouse why okay and that's pretty much all there is to it so if I run that now that's every step is just gonna modify the X&Y the light to be wherever the mouse is can you see all the shadows folk dating nice and cleanly the matching to follow now you have it guys there's how you use the very basics of this system there's so much more to it as well there's different flanks that you can set the shadow counters to have those different colors of lights you can do you can create polygons the different shaped objects rather than just squares obviously you can create your shadows for us shadow casters from paths and all kinds of different things but the codes all really well commented so I recommend you just dive in there and take a look at it as I take completely free to use it's there to be used so go ahead and pick this up thanks for watching guys catch guys next time thank you to all my patrons for supporting what I do and thank you in particular to the following boughs of the dog Bert et daca donned ago Erik Matthew Hibbs jaggus Jason McMillan Joseph went more Kemosabe Lampe mark linz.martin Barris ethic mat coat Michael Ward Howe and Morgan Patrick goofy relentless Rex robert churches Rovin darlin run Stephen Hagen and Zen an may thank you all so much I can do any of this without your support I'll catch you all next time
Info
Channel: Shaun Spalding
Views: 42,668
Rating: undefined out of 5
Keywords: Game Maker (Video Game Engine), Tutorial, GameMaker Tutorial, GameMaker, Game Development, Indie Games, Tutorial Series, Game Maker Studio, Making Games, How to make games, GameMaker Studio 2, GMS, GMS2
Id: RFRV3lhVOhg
Channel Id: undefined
Length: 12min 28sec (748 seconds)
Published: Fri Feb 08 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.