02 | Configure Git LFS Source Control with Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so following on from the previous video we've now got our first person shooter template set up all using the unreal engine source code from github the next job is to set up a bit of a folder structure and also to set up our github repository so that we can add source control to the project so looking at the folder structure that we currently have we have a folder for project verses and in there we have all the unreal source code we're just going to add some folder structure to this just because you know long term you know staying organized is super important these projects get very complicated very quickly um so having a nice folder structure from day one uh always helps so the first folder i'm gonna create is one to actually hold the game itself i'm going to call it game and we're going to move these files and folders into that game folder with that one done i'm going to do another folder in fact and we're going to call it unreal again we're going to pop in all of these files and folders and lastly we'll create one more folder here called art and this is basically going to store all of our source um our assets that we end up importing into unreal i find it gives a good separation uh between the sort of unreal game that obviously imports these assets and the art assets themselves when they're being worked on the other thing i'm going to do is also create a couple of placeholder folders that won't be used in this video but um ultimately this structure will be for later videos infrastructure will hold provisioning code um using terraform which we'll go into in a later video and the ci folder will hold some sort of helper functions um and some manifests for kubernetes as we move forward with this project but yeah i'm just going to put those in place for now just so you can get an idea of the full structure as it stands so we have versus the three folders game unreal and that's where our project now resides okay so we generate this project using the fps template there's a couple of things just a couple of tweaks that i want to do with the source folder um so if we go into here and go to versus you'll notice we have a c plus plus code in here um i tend to like to split these up into public and private folders so we create a new folder called public and then another folder called private we can then put in the header files into the public folder and the cpp all the cpus files into the private folder and then leaving the sort of main project uh header file and sql plus file in the root of this folder so the other thing we're going to need to do once we've done that is going back to the unreal folder we can right click on the project and just generate visual studio files again just to make sure that that they get up to date with the relevant paths and all the folder structure that we've just done okay so now the folder structure's out of the way it's time to set up the git repository to do this we go to the root of our folder uh unreal guide versus and we do git bash here and the following command will initialize the repository we just do get in it and it initializes us an empty git repository which is all good to go what i'm going to do is open up this folder in visual studio just so that we can start adding a couple of configuration files that are needed so i'm going to open a local folder unreal guide versus select folder and let that think about it for a little moment just while it opens it up and then i will show all files just so that we can see everything we can see a dot get folder which is basically where git stores its history and the first file we're going to need is a get ignore in the root and what i'm going to do in here is just ignore yes which is basically visual studio settings because if i go back here you can see a ps folder has been created for us when we open the solution and we don't want to include that into git there's no need um for the actual unreal configuration we're going to set up something called lfs so in game unreal i'm going to create a new file and this one's going to be called dot get attributes and what this is going to do is going to hold a configuration that uses something called get large file storage it's configuration that tells uh get not to store certain file types that are big in size like your model assets or maybe some huge images um potentially uh don't store those in the main git repo but store them on the large file storage repository um but they do end up sort of you know it ends up being as part of your repository as a whole it knows about them so when we go to the unreal guide folder i've created i've i've already created an example file so what i'm going to do is i'm going to copy that and we can go through that so in the game unreal folder i've created dot get attributes and this is the config that i'm currently going to use and it basically tells that you asset umap fbx 3ds and all the others basically shouldn't be stored in the main repo but they should be stored in large file storage instead we're also going to need a git ignore file within here and i'm just going to get the one i prepared earlier which i'll put in the description a link to some of the example ones that exist on git there's a whole library of them that are available and there's one for unreal and this basically has all the configuration you need to ultimately ignore stuff that's not required to be in the git repository such as builds and releases and things like that uh so let me just make sure that they all sync up so this should really be an obvious folder and then i think we're basically ready to then create our first commit so oh sorry one last thing i'm going to do actually in the ci folder is create a dot keep and another one in here keep this basically is just a placeholder file just so that it has something within these folders to keep the directory structure when uh people actually clone the repository so now that now that's all done it's time to actually create the repository in github and push up our changes so in github um i'm basically logged in with the account that i use to clone down the unreal engine source code in our previous video so i'm going to hit create repository put the repository name as versus and we'll just put this project vs we'll make it private and we'll create the repository it gives you a couple of helper commands which you can then use so the first thing we're going to do is actually run git branch dash m main and what that will do is rename the branch from master to main and set that to be the default branch this is just something that is now a sort of mainstream to uh to do this rather than using the term master for your for your default branch kit remote will basically set up the remote origin i.e the place where we're going to push our code to which is going to be github so we'll add that in there and then what we need to do is add our files so if i do add get add dot i then to get status it will now give you a long list of all the files that have been created and the folder structure um but it should be nice and clean in the sense that it's taken into consideration those docket ignore rules and only committing what it needs to commit uh you can typically tell something's wrong by if you do a get add dot and it's taking a little while that typically would mean that maybe this maybe there's a file in there that's a bit too big or a binary that potentially shouldn't be there so what i'm going to do now is create a commit message and we're going to call this initial commit so now that's all good if we do get log we can see we've got our commit here and now all we need to do is based on the command here is to use git push dash u origin main so i'm just going to paste in the push command into our terminal and then basically you should see that pushing up to lfs uh relevant objects that are configured in the dot git attributes file that we set up and then the rest of the codes such as the c plus plus files the other ones uh should then get pushed up to the main repo and now that's done we can refresh github.com and you should see everything set up so in our ci folder we just got the git keep and that's what we kind of the reason we added those files was for that reason just so that we can keep that structure and then within the unreal folder we can see that we've got our content folder our source folder and our relevant files all configured and that's basically it that gets us set up with version control using git using lfs for large file storage to make sure that our repository is optimized as we move forward in the project and we've also added a folder structure that should hopefully allow us to have a bit more of a manageable solution as the as the project gets more complex so in the next video we're going to be creating a build target that allows you to create and compile your own dedicated unreal engine game server and then also being able to connect your game client to that server so we can start building out our multiplayer game so stay tuned for those videos that are coming up
Info
Channel: trashart
Views: 1,451
Rating: undefined out of 5
Keywords: unreal engine, source control, unreal engine 4, git, unreal, unreal engine tutorials, version control, control, source, github and unreal engine, unreal engine project collaboration, game engine, unreal engine git, git project unreal engine, unreal engine (video game engine family), ue4 source control
Id: BN8yJ9R65rY
Channel Id: undefined
Length: 10min 32sec (632 seconds)
Published: Mon May 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.