so before we start creating our plugins it's I think it's worth just talking about why we're using plugins and we need to talk about modules to talk about plugins so we're going to talk about modules and plugins so what is a module a module is essentially an encapsulated library of code so it generally has a single purpose doesn't have any dependencies on anything else it's just a a standalone piece of code and you'll see I'll show you Unreal Engine in a minute but the you can see Unreal Engine is completely made up of hundreds of modules everything's in a module this is good coding practice really it enforces good code separation and limits those dependencies uh modules also give benefits to projects when they start getting large so you can separate the compile out so if you make a change in a module you don't need to recompile the whole product you just need to recompile that module or you can filter what modules are loaded at what time so you can have modules you know loaded only for platform that you're developing on so you might be developing say on PC and Xbox or something like that and you only want to compile the Xbox plugins when you're building the Xbox version so you know it just cuts out all the other modules and modules only contain code so that's probably the main between a module and a plugin the the plugins the a plugin has a content and a source folder like you would in your your project plugins can contain assets as well as code so you can have things like player models and materials and textures and whatever else in a plugin whereas generally modules are just you know C++ classes and code and plugins can also contain modules if you have a module that you want to use with plugin you can place it inside the plugin and then it's obviously available to use so let's have a look at unreal quickly if we come to our project which we haven't done much in yet we haven't done anything in yet you can see you've got the game directory and that's where our project will be but you've got the Unreal Engine so in here you're going to start seeing all the modules that make up Unreal Engine and if you come into developer you there's a blank module template here you can see the structure what's required in a module when you create a module here you need a build. CS you need a module name H and a module name CPP and if you have a look in these it's all it's a pretty familiar setup that you'll see in a plugin you got your dependency links and there'll always be there always needs to be one link otherwise the module won't be included so I'm not going to go into actually setting up a module we're mostly going to be using plugins I'm not sure if we'll even use modules at all if I see the opportunity to use one I will but if you were to create a a module this is these are the files you need to get started and then you can do like you normally would create classes under the public and private cpps under the private and you can just go on from there with folders else and then when it comes to your project you just go to your build. Cs and add that module as dependency and you've got access to those that code or whatever is in the module so the other thing I want to have a look at before we start is just the how we're going to structure RTS framework Plugin or plugins the framework of plugins so there's going to be a core and I'll go into the detail of each plugin more as we get to that plugin but at the moment I'm going to focus on core core is going to be the plugin that we use to decouple the other plugin so they don't have dependencies on each other so for example if we have the RTS player it might have a dependency on core but core won't have a dependency on RTS player so if you want to use just RTS player then you you'd need to include core and player RTS player is know the player camera like we've created before and it's it's an independent thing so it it you can just drop that into a project and then you've got an RTS player camera all ready to go with key binds and everything set up and you don't have to touch anything so some of the other plugins that we'll probably have is RTS entities RTS AI RTS teams and we'll probably have some sort of default character so I can show you how to set up a character for this framework and then some there will be some dependencies ac across the uh the plugins but we'll try and limit them in One Direction so for example there's probably going to be a dependency between RTS entities and RTS AI cuz entities essentially is the units in the RTS yes the purpose of RTS entities is to get all the functionality we need for our our units and entities in the game no matter what they are whether they're a character or a vehicle or spaceship or whatever they are RTS entities is to make that so you can use that with anything obviously RTS is something that's going to need to be used by the units so that it's it's logical that it's going to have a dependency so there might be a dependency one way so that means if we wanted to we're working on another project and we just wanted to use the RTS AI tools which AI tools will be things like you know Blackboard and you know AI tasks and eqs queries and just tool basically a toolbox of it for AI that we're going to make as we go but maybe we want to bring it into another project just for the AI tools nothing to do with RTS maybe even then we can still use RTS AI on its own because it has no dependency backed entities so we can just use core and RTS and put it in another project and we've got access to all that AI tools that you know in a drag and drop for other projects that you do in the future you might just want a couple of add-ons and you can you know I want the ability to have teams and you just drop your RTS teams in the way it goes but the the purpose of core will be is if I want to talk to say I want to use the teams functionality in RTS then I'll have an interface or a component or something that will be based in RTS core that will allow that conversation happen without the dependency and the other thing that RTS core will will have will be base classes so all the Unreal Engine framework classes like you've got game mode game State player controller player State all those things will have a base class in core and then the modules down further can add to those as they need to by just inheriting from that so generally how it will work is you'll have a base class say say it's a player controller and we have a base player controller in RTS core and then maybe in entities we need to add some uh something in the player control you know interface to the entities or whatever so we might inherit from that RTS core player controller and then in our actual project we'll have a final version of of these files and so we rather inherit from RTS core We'll Inherit from RTS entities and we get both plugins functionality and that's sort of the chain of how you add the functionality to the different plugins and then use it in the end game that's just a quick rundown of the of the frame work setup obviously extend that to more and I've got some other ideas to add to it but the that's the the guts of it for now let's get started with making a first plugin same ID I'm going to start with rer and I'm just going to change straight away to debug game and generally that's the build that you want to be using it's going to give you the most debug information it does take a little longer to build so um I I'll leave that up to you but I'm just doing it now straight away because it's going to build the project and I generally use the debug to build just going to be debugging as we go so it seems like the most logical way this allows me to add break points from the engine uh from the IDE and and stuff like that so now we're in the editor all we have to do is you can either go to edit plugins or the settings menu just here go plugins and just go to add you'll get a popup like this we want a blank plugin there is some other templates here to be honest I haven't use the other templates I think content owning is just when you just got some assets you want to put in a plugin but yeah I've only used the blank I can't really comment on those too much and the first one we're just going to do is I'm just going to call it RTS core put in an author here you can fill out this information later descriptions and things it's just like an XML file or file or something that's all we need and we're just going to create the plugin takes a little while to create but and then we can go back to the ID and have a look and log eras here but I don't think that's anything to worry about now we need to go let's this and we'll go into our project and we have now have this plugins folder we go in here and here's our new plugin now if you don't have developer don't worry that's just a ride I think so that's what rer installs to link to the uh you should have this RTS core here and then we've got a source directory we got a resource so this icon here you can swap that out and it's just the icon that comes up in the editor so go it's this icon here change that to whatever you want it just has to be a certain size but I'll link the plugins documentation page it tells you what size it has to be guess maybe 128 by 128 but I don't know for sure I have changed it before I just can't remember but now that we got our plugin here what we need to do is tell the project to use it we'll come into our actual project source and this is where it can get confusing right so we got our we got a plug-in source and we got a source folder for our project and then when we have multiple plugins we're going to Source folders for them so I highly recommend whatever plugin you're working on have that folder open and and none no others and try and keep the private folder closed cuz you'll if you add uh classes in here it'll add the H file the CC CPP in the same directory and know it should still work but it's going to be weird so start to look out for cuz I've done it so many times anyway in our project we want to come into our project folder this is our RTS framework for me and then you've got the build. Cs so you can see the plugin's got a build. CS the projects got a build CS but what we want to do is tell the project to use the plugin come in here and uh I generally like to put these down on a new line just I know find it easy to read and find what's in there and what's not we're going to add it into the private dependency modules here so we're just going to add uh RTS and that that's now going to tell it that it's got access to this so like we created a class in our source directory here and wanted to reference some class we don't have any at the moment but we wanted to reference some class in our project it knows where it is and where it lives all right so I just want to relaunch our project because there's just some stuff I want to show you in the editor about plugins as well so here in the editor you might be able to see plugin info info here or not depending what you've previously done in the editor and if it has save settings and if you can't you just need to come over to settings and do show plugin content now at the moment there there's only a Content folder there's no C++ folder but there will be as soon as we create our first C++ class so you'll have access to both here you can create C++ classes from that folder in here when you do go to create a C++ class like the uh if if you come up to tools and go new C+ class I'm just going to create a none because I it's just to get to here I'm look going to create it so you can see here it's that's the project and then you've got the you'll all your plugins will come up here and you can choose to create the class in there and then once you know once you choose core then you can put the directories in here but once they're existing and you'll see them you can just go in and do right click corre you know create C+ class or as I do I do it from W from Rider so I'm going to be using the public and private so when you go to create a new class make sure you click on public so it adds that public to the to the directory that that setting for show plugin content that's something to remember too later on when you're like when you say you're you're in something and you're trying to find some asset or something that when you actually choose something here so in in all of these boxes here there is also show plug-in content it's not always on like sometimes you you know you'll have some stuff in the core say the core content directory and you're trying to find it and it's not coming up that that's what it will be keep that one in the pack of your mind for when you're losing your mind trying to find something that's not coming up it's a pretty brief introduction to to what plugins and modules are they can get quite in depth and complex but we'll be creating a few plugins and and repeating over the process so you'll get a good idea later as as we progress through if you're following the series the series is going to be available on my patreon at the moment there's two levels on my patreon I've added a third which is uh called products at the start of next year it's only the product uh patreon level that will have access to this framework project the other levels will have access to all all the other projects and and small projects or episodes that I that I do but the the plugin's going to be quite a lot of extra work I just I just think it's worth more than than what's on the patreon at the moment anyone that's signed up on the patreon though before the end of the year will get access to the framework project if you've signed up this year or or you sign up before the end of the year you you'll get access to at least the first part anyway otherwise uh all patreon support is greatly appreciated hoping to get a new mic with the with the funds that I'm getting on there getting there so yeah thank you to all the existing patreons that have supported me this year it's been awesome and uh looking forward to another year making content the next episode is going to be where we start actually building out our first plug-in with some classes so the first classes that we're going to go through are all the framework class es for unreal going to cover what they are and uh how we're we're setting them up I'll see you in the next episode