Unreal Engine Dedicated Server #1: Setup Dedicated server and Client builds

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey this is cody with nikki kitty game dev and in this series we are going to be covering basically the basics that you need to know for dedicated servers and dedicated server programming now in this video specifically all we're going to be doing is getting a dedicated server up and running so we can launch that as a separate application and then launch two client applications that will connect to the dedicated server and allow us to see each other moving around and playing all that kind of stuff now the other stuff that i do want to cover in this series is going to be more smaller stuff so if you're familiar with my youtube channel my videos are ready you know that basically everything i do feature wise is multiplayer ready so that means it's ready to go for listen servers which his player hosted as well as dedicated servers however with dedicated servers if you're going to be specifically using that as a method of connecting clients i want to show you some really cool tricks so there's some things that you can do to make you know things like cheat development a little bit harder so for people that are trying to decompile and reverse your game what you can actually do is wrap your code around certain if defines and compile your code out of the client build so what i mean by that is you'll have your server build that'll contain all of your logic all of your code everything you've typed and then you'll have the client build that you send and you know people download on steam that build will have stuff stripped out of it that runs on the server so that way people as they're going through and stepping through it you know something like let's say they're trying to read it out in something like ida pro or something like that that logic is not going to exist because it has been compiled out of your own machine or of the own that build so let's go ahead and begin now before we fully get started one thing you have to be aware of the way i'm going to show you you must be using it the source build of unreal engine so that means the build that you get from github you have to download it compile it and then you'll be good to go so i already have two videos on it and the first one is the one that i would recommend you watch it's just very straight and to the point it is unrelated to chaos or anything like that as you can see here which i'm doing in the second video so this should just get you up and running to where you have the source build compiled and ready to go now i am on 4.27 this is on 4.26 however the method is the exact same and it's the exact same even if you're on the source build oven real engine 5. however as of this state unreal engine 5 is still in early access and i have tried two different branches and both of which any of my package default projects including just the default third person you know template project i have gone untouched they have not been changed and the package builds through with the server and the client both just keep crashing and i haven't dove into it to try to figure out why so that is the reason we're on ue4 right now but anyways watch this video if you don't know how if you don't already have it and then you'll be good to go and up to speed now that you have the source both launched your project made we are ready to actually start working so as you can see here i'm just on the example third person project that comes with the engine and the only thing we're going to do here is add a file make some small changes to it compile well we're going to be compiling twice and then we'll be good to go so if this is not obvious this is the c plus plus project so if you build a blueprint project what you need to do is actually add a c plus pl or a c plus plus file to it to be you know have access to the solution and all that kind of stuff so you can actually make these changes so what you can do is go to add and let's see it's been a long time since i've done this one moment okay found it so you just go to file for unreal engine 4 new c plus class add literally any class that you want and you should be good to go that should create the c plus classes section should allow you to have a source folder as well as your solution so once we are there what we need to do is go to source and here you will see your build target so what we're going to do is we want to duplicate this so let's copy it and paste it then after your project name right here we want to add server and then remove the copy at the end just like so now we want to bring that into our ide so with visual studio it is very similar so you can see the original build target right here we just want to right click on source add add existing here's would be the exact same in visual studio and then add the project name server.target so let's go ahead and bring that in and close out of our editor next up we need to rename this this and change this to server so we're going to have diddy server tutorial or your project name server target same thing here project name server target and the type is going to be target type dot server once you have that you're pretty much good to go the only thing we want to do now is go ahead and right click on our you project here generate the visual studio project files then we can come over here and go ahead and build our project okay now once that's done we're going to change from development editor in your case it would be over here in visual studio and scroll all the way down until we find development server and in my case i'm on a 64-bit windows machine so i'm going to choose development server 164. select that let it do all its stuff that it needs to over in the solution okay after about 10 or 15 seconds we're good to go so now we can right click and build our project once more now this is going to take a little bit and depending on how many files you actually have in my case originally this was at about i think 750 files you will be good to go so i will see you in a few minutes okay now because i've already done this before i only have four so the way you can also check is if you go to binaries 164 you will see your own dedicated server application right here so once we have all that we're all built up let's go ahead and change this right on back to the development editor 164 and go ahead and run our project alrighty now we are pretty much done the only thing we really need to do is make a simple entry map and then connect the clients so we just have to make the entry map set up the white listed maps that we want to be exported with the pack you know with the build and set the entry map for the server and for the clients and we're good to go so what i'm going to do here is for the time being i'm just going to duplicate this third person example map like so and just name it entry level so entry level is going to be where the clients load up so that's going to be what they load the server is going to load up the actual example map so this is what we're seeing right here so go ahead and load that up and i'm gonna go ahead and quickly build the lighting already just so i could generate all the stuff that i needed so anyways i'm gonna go ahead and save after you made the map and this is basically where you would have your main menu so we're gonna go to settings project settings maps and modes and the editor startup and game default map let's go ahead and change that to the entry level that we just made then click this little drop down tab here and the server default map you want to be the third person example map so mine's already correct by default then we want to go to packaging and under this first section hit the little drop down and we want to scroll down until we find a list of maps to include in a packaged build so we want to add one and here we want to select the entry level.umap we're going to add the other one this is going to be our third person examplemap.umap once we're done with that we can close there file save all and now we're ready to actually package this out so we're gonna go to file package project go to build whoops go to build target and here you can see we have the project itself and the server target that we made so that is this guy right here so what we're going to do is we're going to go ahead and build out the client first just to make sure that it's working so i'm going to select my non-server build target come down here to make sure i'm done for now i'm just going to be on development you can be on really any of these go to windows 64-bit i'm going to go to my project root right here and i'm just going to create a new folder call it tutorial packaged and i'm going to select folder and this is where i'm going to build out my project too okay mine is completed so i'm going to go ahead and go to tutorial packaged windows no editor and launch up the project so this should just launch up on the map here i just wanted to make sure that i can actually run around and stuff so i'm going to press f11 so i'm automatically minimized and alt f4 to close now i want to build a server so i'm going to go to file package project build target change it to the server and then do the same thing for windows 64-bit same folder and build it alrighty so that is done now we have windows server so let's go ahead and get that started first let's open that up and here we see our application now i want to launch this with the log so i can see it and it makes a lot easier just for me to actually close it so i'm going to right click create a shortcut and go to properties of the shortcut and to the target i'm just going to append hyphen log just like so so now when i run it we actually get the output log and it did not mean to click on it sometimes that has a tendency to freeze everything up so there we go yes go ahead and allow and we should be good to go so now i'm going to go ahead and run one of the clients like so and it's not going to connect automatically i'm staring at the guy's crotch let's see how can i try to tab out get that at a better view there we go all right so what i want to do is i want to connect to myself so my loopback address so that is going to be 127.0.0.1 so i'm gonna type open 127.0.0.1 and press enter and there we go here you can see i'm connected so i'm going to launch up here and you can also see that i have join from my desktop so i'm going to launch another one of these let's try to shrink this down come on there we go so here we have another one and i'm going to do the exact same thing so open 127.0.0.1 and press enter and there we go so we now have two clients connected through our dedicated server and it's really as simple as that so now that we have that out of the way we have the basis that we need for pretty much everything moving forward so we can easily build out both client and server builds for testing or you know sending to whatever host you're using now in the next video i want to dive a little bit further into depth on this and we're going to be covering some basic things like auto connecting you know to the host if you want to and that's going to be through blueprint and then we're going to move on to the more advanced side of things and learning how to use if defines to compiler code outside of the client build so that way it's just not included with whatever you know application that the client receives just to make it a little bit harder for them to reverse it and possibly write cheats for it in the future so that would be the main thing the other thing would be security so in cases where the server only needs to know you know the url of something specific you can package that or compile that out of the client build so if they go through in like ida and search for strings they're not going to find that however if they do get a hold of the server which they shouldn't you will be able to see it in that application but not the clients so that is going to be all for now if you like what i'm doing and want to help support me you can find like my patreon in the description below or have a team death match series just for patrons as well as get early access to pretty much all my videos such as this one so i'll see in the next video
Info
Channel: Sneaky Kitty Game Dev
Views: 45,265
Rating: undefined out of 5
Keywords: unreal engine, unreal engine 4, dedicated server, unreal engine 5, unreal engine dedicated server, unreal engine 4 dedicated server, server, unreal, unreal engine server, unreal engine local server, unreal engine tutorial, dedicated, unreal engine how to setup a server, how to set up a unreal engine server, unreal engine dedicated server linux fix, unreal engine 4 inventory dedicated server test, unreal engine 4 - inventory dedicated server test, unreal engine 4 tutorial
Id: ad5MZLSDAZk
Channel Id: undefined
Length: 12min 39sec (759 seconds)
Published: Sun Apr 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.