Dedicated Servers with Playfab along with Matchmaking || Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay so welcome to be tied in this video we are going to work on the playfab server sdk that means we will add server playfab servers to our game this is the most difficult video i ever made on my channel that means it took more than three weeks to finally get to this point that i am able to record this video because it absolutely has most rubbish uh documentation you can ever have plus the support is just saying check the website and the website doesn't have anything anyways there would be a custom plugin i would be providing for the gsdk because if you download that from the playfab's github then that won't build i don't know why i built this plugin like using that github one it took me three days to do so but i will save your time but in future they have promised to fix that so if if you are visiting this video after three to four months of this videos uh publishing then you can just go to their github and download that because they are constantly updating their plugin which is a nice thing so yeah and i'm not talking of the plugin and i'm not talking of the plugin which you use to login it's the server plugin and it's available from the github the link for them is in the description and one more thing this video will require you to have uh because you have to pack dedicated server so you will have to have the in unreal engine source code that means source code build that means uh that means you will have to download that from the github a video for that how you you can download that is in the description so that should not be a problem so yeah let's get started okay so okay uh yeah okay so welcome back to this video yeah i'm just continuing this is my seventh time recording this video and i hope i do that right in this one so basically this is the playfab menu project which i released a few days ago i don't know if that video has come out till now or not the link for this download would be in the description so you don't need to follow my old videos you can just directly download this project because i have lost the old project files that's why i'm providing this so the first thing which you need to do is open this project and we need to add a c plus plus class now if you had followed the old videos and you have the files the process is exactly the same it has exactly the same code except uh except that menu style except except that everything is same and the code is exactly same so that should not be a problem so firstly you will need an unreal engine source build as i told in the starting of the video you will need that and rest we will get on the way so the first thing which we need to do is we need to go to tools and new c plus plus class because this is a blueprint to do a blueprint uh project we need to add a c plus plus class to make us this a c plus project if your project already has a c plus plus class that's great and if it doesn't and you are keeping it completely blueprint project then you need to add a c plus plus uh class to continue like i'm doing so let's add none and just create class with the default team so after the build has completed you just need to press ok and press this no and just close this the work for it has now completed because we now have the playfab menu sln file so the next thing you need to do is you need to download the playfab gsdk that means the server sdk now let me just go to chrome here so you have this playfab gstk and it has been constantly been updated uh so yeah so the first thing which we need to do is you need to go to this file and download the code now when you use this code that means you have this unreal engine plug-in you will use it will give you a fake error that means fake error saying that this project is uh cannot build because the module is blessing and things like that so to solve that i created a few changes to this and i will provide the direct link to this server fixed uh server plugin you need to download that from the description so in your project menu so just close this so in your project folder right click create a new folder for plugins oops yeah right click rename and name this plugin open this and drag this here so we have this plugin playfab gsdk and the playfab plugin here server plugin now the next thing which we need to do is because if you open this with notepad this says engine association 5.0 that means it is currently uh the launcher version of the unreal engine is being used now we need to make it the source code version so you need to right click on this and then show more options switch unreal engine version and you need to select source build at c and read engine release and make it okay sure lock and it's generating the project files for it now the project files are generated but we need to do one more thing because we are using the playfab plugin and now we are on the source build of unreal engine we don't have that main playfab plugin which we installed from the launcher so we need to get that for that you need to just let me yeah you need to bring your oops yeah you need to go you will have an unreal engine sign is somewhere you can right click and open file location then go to the ue 5.0 engine plugins marketplace and here's the playfab sdk right click copy and paste it in the plugin folder here okay so the error is that we have named this plugin but the name of this folder should be plugins a single s is missing so you need to add as and now rebuild now just generate the project files for it generate visual studio files and now open this you see it says the following modules are missing or built with the different religion version would you like to rebuild them now just press yes now i have incredible installed so it will show up here it has not started building but if you don't have incredible it's not a problem just that it will not show up the building process but in my case it will show up because of incredible although i don't have the license it's just a free version yeah the build has now started let me just monitor it um so yeah the build is going on i will be back oh sorry i will be back when the build finishes thank you okay so yeah then the build has now completed so let's close everything and wait for it to open up okay so now just to verify if we have the plugins go to settings and then plugins and other so you have this playfab gstk that means the server sdk and we also have in the installed tab the playfab marketplace plugin so great we now have the two plugins so the next thing which you need to do is you need to go to settings and project settings maps and modes and you will find your game instance class it's set to none but we have a playfab game instance already which we created in the last videos also and we also have it in the free project which we released so search press on this browse button and open this i don't know why it's lagging a bit uh my mouse but no it's not working fine no it's lagging so get to the playfab graph and this is the match making logic if you remember we made this in the last video and we left it what was it yeah and we left it on this execute console command so now what we need to do is uh just let me check yeah now what we need to do is we need to right click and search for event initialization where we set the set playfab settings so we have provided the secret api key and game title id although you will be able to look at and copy my values yeah copy them if you can so from here what you need to do is you need to call register gstk delegate now don't ask me the reason why i am doing that because it's i'm also doing it like for the seventh time and i still don't know why i'm doing it it's just given in the documentation a very bad documentation but it still it has a documentation so you don't need to create a custom event i believe here you just need to delete this now the next thing you need to do is register gstk health check delegate and for this you need to create a event dispatcher and then create a new create a matching function and this automatic created function needs to be ticked just press the written value through tick now get back to the event graph where was event initialized okay so we need to create a function so let's create a custom event and name this gstk shut down delegate so on shutdown we need to close our uh menu like for instance the server needs to be shut down so we will just quit game if the engine if the server shut downs i don't think that will work on the clients but will only work this will only work on the server that means the server which is running on the cloud now the next thing you need to do is register gstk maintenance delegate and you need to call custom event register estk main lens next next thing you need to do is you need to register gstk active active server active delegate register active kit and then you need to register gstk ready for players that means if the player it is ready to take the players in it is ready for players and then you need to just call ready for players done this was the event initialized function which you need to do now the next thing is we need to include the module of this playfab uh server sdk in our build so that when we build this project we can have a server sdk so you just need to close this get to your the server uh folder and then into source playfab menu and playfab menu.build.cs if you have a different project name that's all right you just need to go to the source folder and then the name of the project and name of the project dot build.cs yeah now here you just add this colon i believe it said and then this one i don't know what it's called and then add playfab gsdk then save this and now just close it get back here right click generate visual studio files done now let's open it now let's open our game instance so get to the playfab thing and here one get matchmaking it will now return the server details and this will open up the ip address this is already completed so we don't need to do anything but uh if you haven't followed my old videos then you need to add just this bit of code which is just easy uh we are just getting the ip address of it and we are also getting which port we have to use so yeah now the next thing which we need to do is we need to add a server build to this so that we can build server for our game so again close it go to the source folder and you have this playfab editor.target.cs file you need to just duplicate this so you can just copy this and paste it here so you have now this copy file you need to rename this remove this copy from here and remove this editor from here add server open it and replace all the edited words by server so server and server then compile and save save all just close this and now open the browser build this oh sorry just generate the visual studio files you don't need to go to the playfab menu and build it we don't need that thing then now open the project and from here when you go to platforms windows you will see we now have two build targets playfab menu and playfab server so select shipping because the size of it would be less and then select playfab menu server and now just package content now you can pack it anywhere you want i will just create a new folder here oops sorry on the desktop play fab build and just select folder now it has started building and it will take i believe an hour to build it because it has more than 700 tasks to do so just let me confirm it from it has not yet come and now it has build monitor uad so this is only available for incredible users i believe so it's currently 116 tasks but it's increasing as you can see now it's 258 now it's 268 so it will go about 700 and it will take an hour to build it so yeah let's meet after it's built okay so now the build is completed finally so yeah let's move on so yeah we saved this in desktop and playfab built here we have the windows server file now you need to go to engine binaries uh third party i believe no uh playfab menu binaries win64 and this is the playfab menu server uh this is our server binary file which we need to run so the next thing you need to do is of course go to playfab and open it let me just open it and i will be back okay so now we are in our dashboard then you need to go to multiplayer so yeah welcome to the slowest website of the year it's already 30 seconds and it's still loading okay so it's now open so you see it says all built basically if you have not added uh your account details that means uh you have not read your credit card then this screen would not be visible to you it would ask you to add your credit card or debit card so you can add that uh yeah it will send you a lot of emails before cutting money and it's free for 754 hours so for testing purposes and till slow release it's perfectly okay so you need to press on new build and just name the build name to be uh be tied test build virtual machine should be of course i believe for complimentary tk okay it's nice and we don't need to do anything uh we can enable this and now it's asking for the asset so you need to upload the zip file but we have not made the zip file so let's make it and go to this and just just just go to 7-zip and add to 7 windows server. [Applause] nice and this will be used as the serve file so you need to go to desktop play fab build windows server windows support whatsapp now it's uploading now the start command should be to engine oh sorry go to playfab menu go to binaries go to 164 and this is the file name so from here copy this part copy and paste this here and then one more stash or whatever itself then right click this rename copy the whole thing paste it here then reason we don't need to put that yeah we don't need to put that i believe and port is seven seven seven seven oh sorry ue4 wife port and it's 7777 udp that's the only thing i believe we need to put and the windows server file is uploading i will be back after it's uploaded okay so welcome back to the screen now it has uploaded the windows server and it says it will mount it to like it will unzip to this assets folder so in this assets folder what we need to do is copy this and paste this here and add this so that's the thing you need to do you don't need to put the folder name or things like that remember this is the most tricky part that is the start command you will have numerous times problems so just try to be online just let me show so you see the this from this this these files would be put in the assets so from there we will go to the playfab menu then from binaries win64 and then the server will start this file i don't think we need to do anything else let's just add second port this should also be 777 and tcp i don't think this is required but the udp folder is only required but we will do that and standby servers should be 2 max servers should be 4. let's make this one and east us is correct rest we don't need anything just let me check just add build and it's it says maximum remaining quota oh it's deploying so yeah it's now deploying uh hope for the best hope it just pushes it correctly and i will get back as soon as it it's get it gets deployed that's a bit english so yeah as soon as it gets deployed i will be back okay so now we if we go in uh i'm very happy because finally this is my first out of the my seventh eighth tries that the server has finally been deployed so you know how happy i am so yeah let's go to multiplayer and it says deploy that means it's working but i made a small small very small like very small mistake if we go to unreal engine and project settings we have not set the server default map so yeah we made a mistake so let's do it let's sorry once again let's create a new level uh let me check if we have any so we have main menu intro map and so let's create a new level uh let's keep it in open world where is it oh it's creating and save this in plp menu maps and make it play april map yeah now the level is ready so let's go to world settings and game mode override should be so we don't have a game mode over right nice so just add a feature or content back select third person template and just add to project done now go to the playable map now you can see a bb third person game mode that's great save all now go to your content browser oh no project settings and select the server map for you so if you have a different server map just select it here nothing else has to be done this is the map which the server will open on it what is the name of it will map it so this and this are the most important thing so let's go to packaging and yeah uh yeah check this also this should be ticked always if you have not ticked it then uh you will receive a very bad word from epic games i believe so so now go to advance and let me check if we have bit list of maps so this is not required so let's now go windows shipping playfab menu server and sadly we have to do it again but it will not take an hour because it has already built so it will only take two to three minutes now if it's taking long on your pc to build it again like for you instance you are building it again and it's taking a long time then you just need to go to packaging i believe and then disable uh it would be ticked here so you just need to disable this it should not be ticked rest everything is okay someone is just doing something okay so yeah i will be back as soon as it finishes the packaging okay so the playfab has finally completed it so sadly we have to remove this build uh delete build qe for deletion and now get to play five build go here right click seven zip and add to seven windows server dot ship sorry some construction is going on over some place so you would hear some bad voice but yeah now press on new build can we just copy the code from here yeah we can copy it so just let's copy this because this will be same now press on new build press the build name to be b tied studio test east i don't know what that means but test now this should be focused uh yeah virtual machine metrics preview windows container upload zip files and just select the zip file which we just a second ago recorded i made made made um so we need to delete all this so yeah that's the proof that i did that many times thanks so we need to delete these oops it is already in construction let me just check if it is being removed uh it's deleting so let's do one thing we just rename this windows server right click rename and name this main and from here let's just select that windows server main did we save that yeah windows server mint and now it's doing and just pre put no put the thing this this uh thing here so i will be back in about nine minutes i eight minutes i believe oh seven minutes uh six minutes so yeah i will be back uh sorry for the voice once again so yeah now we have this and let's add reason east us standby server is one maximum server is three for now because we have remaining two so let's make it two for now and port name is ue five port 7777 udp ue 4 port and this is also 7777 tcp and just add this so now it's initialized let's go to build and what does initialized means uh why is it why is it not deploying please deploy for me let's check the server oh it's deploying so yeah as soon as the deploys deploys deploy is finished i will get back now i am back because i just wanted to do something for you uh let's open the project go to your playfab map and let me just go to maps and modes and set the game default map to this intro map nice let's check if it works log in here it logins start matchmaking finding match finding match waiting for match and yeah it works uh it's working so let's go to platforms window playfab menu package product playfab build and select now it's packing the client build so i will be back after the client build is finished okay so now the build is successful and now we have the project files in this playfab build windows and here we have the playfab menu now let's go to our servers and we have this deployed also so let's open check if everything is running perfectly fine and we have this running and this is on standby so the next thing which we need to do is we need to go to matchmaking because we have the matchmaking logic so we need to assign the currently made server go to test queue and enable this i don't know why it's coming in chinese but yeah enable server allocation and just enable this and save this has now saved now let's check if it works oh my god it's opening let's login now we have this demo 315 let's start matchmaking finding match waiting for match uh i hope it comes up let me just open play five on my second computer yeah so basically one more thing which we need to do you see uh sorry so we have not provided the server the latency so we need to provide the latency of the server also so what we need to do is uh we have the entity value already so i will give this project uh we need to copy this thing here copy this you can just ctrl c to copy then go to your unreal engine who is it yeah and now here where we pass the entity key settings here we pass the entity key so here just paste that thing which we copied let's drag this up here right click entities create entity so it's uplife json and also for attributes do we need yeah we need attributes and like this now creator setting we don't require because we are already passing this creator settings so what we need to do is we need to go to uh yeah playfab variables and get this creator settings and put it on here now that's nice and now we need to hook up it so drag this up this way detach this and this up here yeah now right click create latency and target must have yeah so in this target we will just get the creator settings and put it as the target this should work now and let me just check from our website if it works because i found this there were a bunch of errors and then i found the solution of it on the playfab's official website so that's the place where you need to find things data object where is the data object should be oh one more thing which we need to do so drag this uh firstly disconnected disconnect this yeah and disconnect this so this apparently should be the uh so the drag the creator settings here i know it's becoming a bit confusing but yeah this is a confusing thing drag the creator settings here and then drag latency here and attributes here drag this attribute here like this we just change their positions and then drag this up at set object field so here you can have a look at the code i believe this is now fine uh it's just given on the forum that this has to be done i believe nothing else is required so let's play in the editor and check if it is assigning us a value start matchmaking nice very nice let's just restart oh we didn't construct the latency variable so let's open this again uh one more thing to go one more thing to do i think i should have said we need to construct uh latency latency item and attributes so let's make this up here track this and on construct latency get the latency item get attributes and get a latency item and get latencies so we need to initialize these three things drag this up here and from here completed like this here now this should not crash login yeah now it works let's press on start matchmaking it's finding a match waiting for match yeah it's not working okay so welcome back and finally we have uh fixed everything and i will let you know what has to be done let me just open the playfab project uh yeah this is the project there was just a small mistake due to which we could not uh like i have spent more than three hours just trying to fix it yeah so yeah just give me a minute until then let's go to playfab build and remove our windows build because now we can just build it in few seconds so it's not required because we will be doing minor changes and then go to your game instance so this this thing is all right we even constructed the json but here it says gave up after seconds increase this time uh in my case it was very low but the most important thing is this set timer by event don't make this timer very less that means and make don't make it one two three seconds make it at least 10 seconds because uh give him at least 10 seconds or else the if you ping the server a lot of times in its making process it will just fail and then it won't give you a matchmaking id and if you don't get uh you won't get married to the server so yeah one more thing after i tested is that we need to go to the playable map and here we need to put a the most basic thing that means a play start clear start and let's just put a text also so that we can know we are on server and it may make it over this should be on the center yeah and x scale should be a world size let's increase this nice and rotated okay so i have now packed the game for both windows and server so now we have to update our server again because we made changes into the main map so you can just do that by following the first part of the video where we just uploaded the server that has to be done again you have to pack the games back the server and then re-upload it now we have this uh match and now this is the clan new client copy which i just packed and i have provided it to my second pc so i have started matchmaking on my second pc it's finding match now on for the first one it's finding match on my second one it's now showing waiting for match uh i think it this should also update yeah now it also updates if you want to decrease the waiting time you can set that uh timer to five where we changed it to ten you can set it to five not one two because that would be two less you can set it to five but yeah it's taking a bit time yeah on both the pcs now the game has opened up congrats so the server is now working perfectly fine so yes i can control the part i believe uh yeah there was a big delay but yeah i can now control the character easily if you want to make it more optimized you can just increase the service speed and location that means you can keep it more near to you like in asia or something if you are living in asia yeah now let me check and let me control my second character connect the keyboard yeah give me yes i can control my second character also let me bring it in front of this character yeah you can see uh we can control what there is there was a bit lag at some points but it's completely okay okay because the basic things are for exactly working you just need to increase the server allocation and purpose of it if you want to make it work yeah both are working perfectly fine so that is it for this video i know this was the most requested video of my channel and it was a bit late but now it is here so enjoy and more videos coming soon and i believe this is the first video which doesn't use any paid plugin and things like that uh so yeah thank you meet you in the next one
Info
Channel: Betide Studio
Views: 83,013
Rating: undefined out of 5
Keywords: unreal engine 5, ue5, ue5 playfab, ue5 api, unreal engine online, unreal engine shop, ue5 matchmaking, ue4 matchmaking, playfab matchmaking, unreal engine matchmaking, unreal engine server, ue5 aws, ue5 server, ue4 epic online services
Id: Mv_42lVGw4Y
Channel Id: undefined
Length: 45min 6sec (2706 seconds)
Published: Fri Jul 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.