How To Make A Multiplayer Game With Unreal Engine and Amazon GameLift (Part 8 - Server & Backfill)

Ғылым және технология

Watch Part 7 here: • How To Make A Multipla...
This video is the eighth part of an extensive and informative tutorial on how to integrate Amazon GameLift with Unreal Engine, going over concepts such as adding simple game logic to the server, replicating GameLift matchmaking information on the server to the clients such as what team each player belonged to, rejecting or accepting incoming player connections, terminating player sessions when players disconnected from the server, recording match results and player wins/losses in DynamoDB through an http request to an API Gateway method that invokes an AWS Lambda function, terminating game sessions when games were "over", handling server process interruptions, and implementing backfill to match new players into existing game sessions if they did not have the max amount of players a match could have (4). In the process, we had to make changes to existing server code as well add new classes for the client and server, since not only did we have to add code for the server to handle GameLift specific scenarios and an actual "game" but also we had to add code for the client to receive replicated information from the server. As a result, we had to repackage the client once and the server twice. Each the time server was rebuilt, it had to be reuploaded to GameLift, a new fleet had to be made, and the fleet destination inside the queue associated with the matchmaker used throughout this tutorial series had to be replaced with the new fleet before we could test with new clients. Lastly, we tested the server modifications with different test scenarios using 4 clients.
Watch Part 9 here: • How To Make A Multipla...
How to support the channel:
Get a shirt or sweatshirt with free shipping (Use code "SHIP" at checkout): teespring.com/stores/flopperam
Become a member: / @flopperam
Support us on Patreon: / flopperam
Donate to our PayPal: www.paypal.me/flopperam
Sponsor us on Github: github.com/sponsors/chris-gong
Social media links:
Discord: / discord
Twitter: / flopperam
Instagram: / flopperam
Facebook: / flopperam
*********IMPORTANT LINKS*********
Github repository containing all the Unreal Engine project code: github.com/chris-gong/gamelif...
Github repository containing all the Unreal Engine project code without backfill: github.com/chris-gong/gamelif...
Github repository containing all the Lambda code used throughout this tutorial series: github.com/chris-gong/gamelif...
Matchmaker data example: docs.aws.amazon.com/gamelift/...
How do I associate a model with my API in API Gateway?: aws.amazon.com/premiumsupport...
How To Validate HTTP Requests Before They Reach Lambda: itnext.io/how-to-validate-htt...
VPC peering for GameLift: docs.aws.amazon.com/gamelift/...
Creating a private API in Amazon API Gateway: docs.aws.amazon.com/apigatewa...
Intro to replication in Unreal Engine: • Intro to Replication i...
UE4 Build Configurations Reference: docs.unrealengine.com/en-US/P...
Auto-scale fleet capacity with GameLift: docs.aws.amazon.com/gamelift/...
********IMPORTANT COMMANDS*********
To upload the server build to GameLift: aws gamelift upload-build --name GameLiftTutorial --build-version [build-version] --build-root [path-to-server-build-directory] --operating-system WINDOWS_2012 --region [region-code]
To size the game client to 500x500 (need to press F11 to change the game from full screen to windowed mode): GameLiftTutorial.exe ResX=500 ResY=500 WinX=500 WinY=500
********OTHER IMPORTANT THINGS********
Fleet naming convention: [build-name] [instance-type] [operating-system] [fleet-type] Fleet [build-version]
Port parameters for the server processes in the instances in a fleet: -port=[port-number] password=dummy
Music Creds:
Song: LAKEY INSPIRED - Chill Day (Vlog No Copyright Music)
Music provided by Vlog No Copyright Music.
Video Link: • LAKEY INSPIRED - Chill...
Song: Wonder - LAKEY INSPIRED
Music promoted by BreakingCopyright: • Video
#unrealengine #ue4 #gamelift

Пікірлер: 102

  • @Flopperam
    @Flopperam3 жыл бұрын

    Hey guys, when making the new fleets at around 4:35:38 and 6:45:08, don't change the fleet type from On-Demand to Spot unless you have used all of the 125 free tier hours (per month) this month that come with the first 12 months of making an AWS account, because the free tier hours for GameLift only apply to c5.large instance usage in an On-Demand fleet. However, it is still true that when not on the free tier, that EC2 instances of a certain type are cheaper in a Spot fleet than in a On-Demand fleet. Also, don't forget to manually scale down your fleet when you are not testing your game. Otherwise you will get charged, even for when the instances in your fleet are idle, meaning they are not hosting any game sessions, but are still running with active server processes on them! You can manually scale down the fleet to zero instances by going to your fleet's page in the GameLift dashboard, specifically the "Scaling" tab, under where it says "Auto-Scaling Policies", set the number to the right of where it says "Manually adjust the desired instance count to " to 0 when you know that you are not testing your game. Next, constantly check how many hours you have left in the free tier for GameLift by checking the "Bills" section in the Billing Management Console, console.aws.amazon.com/billing/home. You should be able to check your free tier hour usage in the free tier chart here, console.aws.amazon.com/billing/home?#/freetier, but currently GameLift c5.large instance usage is not being tracked. I am not sure why but I made a forum post about this here, forums.awsgametech.com/t/gamelift-isnt-showing-up-on-the-top-aws-free-tier-services-table/9349. Note that the "Bills" section and the free tier chart are both delayed by a day or two, meaning that the usage statistics listed on there do not accurately reflect the most up-to-date free tier usage statistics in real-time. In case you aren't constantly monitoring your free tier usage, go to the "Billing Preferences" section in the Billing Management Console and make sure the "Receive Free Tier Usage Alerts" option is enabled so that you get email alerts for when your AWS service usage is approaching, or has exceeded, the AWS Free Tier usage limits.

  • @-agx-9490
    @-agx-94903 жыл бұрын

    Your tutorials are so good...

  • @mdwecht
    @mdwecht3 жыл бұрын

    I just finished working through Part 8 with back fill! Wow! What an awesome tutorial series. As you pointed out at the beginning of Part 1, I did learn a lot about Amazon GameLift, Unreal Engine, and the many other services and tools you introduced me to. Having access to all the versions of your code in github was a tremendous asset. Thank you for taking the time to create this tutorial series, explain your design decisions, share your implementation, and walk through unit test and integration test.

  • @majingari
    @majingari3 жыл бұрын

    Awesome Tutorial series, taught me a lot!!

  • @hillstudios1
    @hillstudios12 жыл бұрын

    Thanks for tutorial bro

  • @kevinwu7892
    @kevinwu78923 жыл бұрын

    Eyyyy look who's back

  • @Flopperam
    @Flopperam3 жыл бұрын

    Just another reminder for when testing multiple clients at once, please make sure to not log into the same account on multiple clients. There could be issues that are not accounted for since this tutorial series assumes that each client is logged into a different account.

  • @Amer-ti5sc
    @Amer-ti5sc3 жыл бұрын

    you are the best

  • @Flopperam
    @Flopperam3 жыл бұрын

    Note that AWS has recently changed the interface for Lambda, meaning that instead of clicking the "Save" button to save your code changes, you have to click the "Deploy" button to save your code changes as the "Save" button is no longer there.

  • @bioblazepayne
    @bioblazepayne3 жыл бұрын

    Let me find a ounce and i'll start watching this.

  • @jaytvids
    @jaytvids2 жыл бұрын

    I got about halfway through this (where you test the blue/red colors for teams) and encountered an error where, upon spawning with another client in a match, both characters were stuck in place. I could run and the animation would present on-screen but my character would not move anywhere. Interestingly, on the alternate client, when I did that animations would not show but relative movement like a jump up and down would. Another thing I noticed would be if I disconnected one of the clients the one remaining would then gain the ability to move. Not sure if this is a totally strange bug or if you can help at all but figured it can't hurt to ask! Can't seem to find the root of the problem.

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Hey, my guess is that it's a bug caused by clients spawning in the same spot very quickly. I've had similar issues caused by that but I'm also not sure if that's the case with you here.

  • @alextsangaris9670
    @alextsangaris96703 жыл бұрын

    I was wondering if there is a way to turn all the functions we made in the past videos into blueprint callable events. I already have an almost complete game and I want to take a lot of this and combine it with playfab. Blueprint callable would be the easiest for me to do. Do you know how I would achieve this?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    Hey, great question. I believe that all the functions can be made into blueprint callable events. I'm sure you know about the different function specifiers but you can find all of them here , docs.unrealengine.com/en-US/Programming/UnrealArchitecture/Reference/Functions/Specifiers/index.html, in case you need a reference. The thing that can be tricky to convert from C++ to Blueprints are the delegate functions. For example, the function that gets called when a response is received from an http request made to an API endpoint. Here are a bunch of links that lead to useful resources on how to go about that: answers.unrealengine.com/questions/134046/delegates-as-parameter.html docs.unrealengine.com/en-US/Programming/UnrealArchitecture/Delegates/index.html forums.unrealengine.com/community/community-content-tools-and-tutorials/13915-tutorial-creating-and-using-delegates-c-and-accessing-them-in-blueprints forums.unrealengine.com/development-discussion/c-gameplay-programming/1445632-c-delegates-call-a-blueprint-defined-user-function unreal.gg-labs.com/wiki-archives/macros-and-data-types/delegates-in-ue4-raw-c++-and-bp-exposed www.reddit.com/r/unrealengine/comments/4q4fhf/combine_blueprint_and_c_delegates/ stackoverflow.com/questions/56821209/unreal-engine-4-c-delegate-not-being-called

  • @alextsangaris9670

    @alextsangaris9670

    3 жыл бұрын

    Flopperam I’m still trying to finish this part of the tutorial but once I do it I’m going to remake this tutorial with blueprint callable so I can implement it to my actual game

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    Sounds good, please let me know if you have any other questions!

  • @alextsangaris9670

    @alextsangaris9670

    3 жыл бұрын

    @@Flopperam Been working on implementing all this into my game. I use playfab for a lot of the storing of stats. One of those being wins and loses. I was wondering instead of deleting everything I wrote to implement aws as the holder of those two stats. I could I just instead make cognito get the info from playfab? Also with the blueprint callable should I make a seperate c++ header and cpp file and call it blueprint callable. Then re write all the code from this series and build it in bps in new widget, gamestate, and game mode classes?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@alextsangaris9670 making cognito get the info from playfab is touch since cognito relies on a social identity provider like cognito, Google, Facebook, etc. So you're best bet with regards to connecting playfab data with aws is to just call API endpoints in your lambda functions to read data from or modify data in playfab. Playfab could be a potential replacement for dynamodb in some cases. As for the blueprint implementation, that is more up to u since I'm not too familiar with blueprints unfortunately.

  • @unknownmystics7175
    @unknownmystics7175 Жыл бұрын

    It look like my newest struggle is with the poll matchmaking. I wanted to stop before the backfill section for now. But when i run the client, it just searches and searches. on the lamdba cloudwatch logs it looks like im erroring in poll matchmaking but im stuck beyond that. any ideas would be greatly appreciated and rewarded with a high five

  • @Flopperam

    @Flopperam

    Жыл бұрын

    What's the error you're getting? Also have you looked at the cloudwatch logs for the TrackEvents lambda function as well?

  • @gseric565
    @gseric5653 жыл бұрын

    Excellent tutorial! The demo works perfectly. I was thinking to migrate content from another project into this one, like maps for example. I migrated my project into the content folder for the tutorial, and then replaced some of my files with the gamelifttutorial content folder that I moved to the desktop (so they wouldnt be overwritten when I migrated initially). Then I packaged the build with my new 3rdpersonmap - both the server and the client. Uploaded the serverbuild, but the fleet doesn't create. It gives the following error: SERVER_PROCESS_SDK_INITIALIZATION_TIMEOUT : Server process started correctly but did not call InitSDK() within 5 minutes, launchPath(C:\game\GameLiftTutorial\Binaries\Win64\GameLiftTutorialServer.exe), arguments(-port=7777 -password=d.... after it says FLEET STATE ACTIVATING. Is there a procedure for migrating content that you think would work?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    I would suggest testing your project with gamelift local before uploading the server build to AWS. In your case it seems like you're missing code in your server's game mode class, specifically the function calls to InitSDK and ProcessReady.

  • @gseric565

    @gseric565

    3 жыл бұрын

    @@Flopperam ok thanks, I think I fixed it. I packaged my project in client and server mode and uploaded and it works with the fleet and matchmaking all set up. However, I have been adding new assets to my map for a new build, and when I try to login, and click the Join Game (for 2 individual players) it says Now connecting to server like usual.... but then briefly loads the map for a split second and then kicks me back to the Join Game Screen again. Although once in a while the map loads and I can play. Do you have any ideas about why that happens? I didnt change the code, just adding assets one by one and testing the build, creating the fleet, matchmaking...

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    The best way to debug this is to check the server logs by remotely connecting into an instance on your fleet, which we cover in parts 9 and 10 of the tutorial series. Either the server process is shutting down unexpectedly right when players try to join the server or the client is getting rejected by the server when trying to join. In the latter case that's usually due to a valid player session id and player id not being passed to a call to OpenLevel, which leads to the PreLogin method in the server's game mode class to return false.

  • @HS-zk5nn

    @HS-zk5nn

    Жыл бұрын

    @@gseric565 Hi, just wondering if you were able to figure out why you were getting kicked back to the Join Game Screen. I am having the same problems after incorporating backfill. it works fine w/o backfill, so trying to troubleshoot/ thanks!

  • @philip9611
    @philip96113 жыл бұрын

    Why is multiplayer so hard Dx

  • @luiszavaleta6398
    @luiszavaleta63982 жыл бұрын

    Greetings! When I load another version of my project into GameLift, what happened to the other versions? Can I delete them?

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Hey, I believe that you're saying that you uploaded multiple builds to gamelift, each referring to a different version of your game. If you don't have an active fleet associated with a certain build, then it should be safe to delete that build off gamelift. Hope that answered your question!

  • @luiszavaleta6398

    @luiszavaleta6398

    2 жыл бұрын

    @@FlopperamThanks for the answer! That was what I wanted to know. Great videos! I'm learning a lot thanks to you

  • @Flopperam
    @Flopperam3 жыл бұрын

    Hey everyone, we are very sorry about this, but if you try building/compiling the project for an editor or client solution configuration after adding all the backfill code at around 6:39:00 after repackaging the client the first time at 4:42:20, then you will get an error along the lines of 'AGameLiftTutorialGameMode::StopBackfillRequest': must return a value 'AGameLiftTutorialGameMode::CreateBackfillRequest': must return a value The reason that this will happen is that code wrapped in the #if WITH_GAMELIFT and #endif compiler directives will not be built for any non-server configuration. Therefore, the two functions outlined above don't have a return statement when the project is being built for a non-server configuration, and that is syntactically wrong in C++. I didn't notice this while filming the video, because I did not need to rebuild/repackage the client after the first time we repackaged the client, since the only things that changed since then was stuff involving the GameLiftServer SDK and the GameLiftTutorialGameMode class, which are both only used in the server, not the client. In order to fix this, just add a return statement to the end of both those functions, outside of the #if WITH_GAMELIFT and #endif compiler directives. They can return anything and nothing will be affected because those return statements will be unreachable by the server, and the game mode only exists on the server, not the client. Here's a link to an issue on Github, github.com/chris-gong/gamelift-example-ue4/issues/10, as well as a pull request on Github, github.com/chris-gong/gamelift-example-ue4/pull/11,that both better explain the error and the two lines of code that you have to add to fix the error. Thank you for understanding!

  • @HS-zk5nn

    @HS-zk5nn

    2 жыл бұрын

    Hi Flopperam, I got these two errors and I added the two snippets of code for the return statements from your source on git. Does the Development Server have to be built as well as the Development Editor in VS after making these two changes? I built the Development Server and the Client packages fine without the errors in Unreal, but when I press the Join Game button, the world starts to load but then kicks the client back to the Main Menu Level. I added multiple player starts to make sure that the clients dont clash with each other but that doesnt seem to be the problem

  • @HS-zk5nn

    @HS-zk5nn

    2 жыл бұрын

    just wanted to add that I checked the Game Sessions Tab (ID) under the Fleet and it says Timed out. And then when I press Join Game again, it says Completed. Do you think my level is taking a long time to load and the match is timed out before the player enters the 3rd Person Map? Thanks!

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Hey I would suggest skipping to part 9 or 10 and remote connecting into an instance in your fleet to look at the server logs to find out why your server is kicking the clients out. It could also be that the server is crashing upon the player joining.

  • @HS-zk5nn

    @HS-zk5nn

    2 жыл бұрын

    @@Flopperam ok will do. btw, before this backfill part, I did get the clients to join the 3rd person map (my own one as opposed to the default one from unreal) after I clicked the Join Game button, so that was a good sign. so close :)

  • @HS-zk5nn

    @HS-zk5nn

    2 жыл бұрын

    @@Flopperam I feel like that the error has something to do with the fact that it seems to exit at about 60 seconds, but I am just not sure if that's the case. Can I increase the time? I am not sure where I would have to though... just guessing at this point

  • @alextsangaris9670
    @alextsangaris96703 жыл бұрын

    Finished everything up to no backfill because I don’t want people to join once the match starts. Only problem is when I try to join it says joining then goes back to the main menu never joins the server

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    hmmm, right after a player fails to join a game, is there still an active game session for that player's match? Or does it terminate right away? If it doesn't terminate right away, then there's probably an issue with the player not sending the right player session id and player id when trying to connect to the server. If it does terminate right away, then the server process may be crashing and you may have to rdp into one of the instances in your fleet to better debug what's happening. Rdp'ing is covered in the next part of the tutorial.

  • @alextsangaris9670

    @alextsangaris9670

    3 жыл бұрын

    Flopperam the game session stays active never terminates until I do it manually.

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@alextsangaris9670 Interesting, is your Options string that you're passing into a call to the OpenLevel function formatted correctly with the player session id and player id?

  • @alextsangaris9670

    @alextsangaris9670

    3 жыл бұрын

    Flopperam I will check would it be in the game mode or game state?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@alextsangaris9670 should be in the main menu widget cpp file

  • @killonater
    @killonater3 жыл бұрын

    When trying to create a fleet from a build, I recently ran into the following error: "Server process exited without calling ProcessEnding(), exitCode(3), launchPath(C:\game\GameLiftTutorial\Binaries\Win64\GameLiftTutorialServer.exe), arguments(-port=7777 -password=dummy), instanceId(i-034e07ff0f9411d25), publicIP(35.166.175.156), gameSessionId(none), occurrences(297 for this instance in a 5 minute period) ". I was able to build the fleet in the past, and ran into no problems building the server via Visual Studio and packaging the server. The only changes I made from my last iteration of building the fleet was adding some blueprint code to a game mode, which has its parent as the "GameLiftTutorialGameMode" cpp class. Does anyone have any idea of where I should start looking to fix this error?

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    Hey, would it be possible to run the server against GameLiftLocal like we did in part 3 of the tutorial? Also, make sure in your packaged build that you didn't accidentally get rid of the install.bat and vc redistributable files. And make sure that the GameLiftServerSDK was packaged with your server build. Please let me know if any of these were the case.

  • @killonater

    @killonater

    3 жыл бұрын

    @@Flopperam Thanks for the response! Unfortunately, I was unable to run the server against GameLiftLocal. When I try to run the server through CMD, I have a couple of LogStreaming errors pertaining to the blueprints I implemented with the C++ classes parented. I tried to repackage the server with the original parented C++ classes, and I still get the same errors -- I'll be looking into how the child blueprints are affecting the server build. It seems like a common denominator has something to do with "Package_ExportsSerialized". The attached link are the errors via cmd. cdn.discordapp.com/attachments/738430451353649172/738430496177913938/unknown.png

  • @killonater

    @killonater

    3 жыл бұрын

    @@Flopperam Update: I was able to run the server against GameLiftLocal when I went into the project settings and disabled the "Event Driven Loader". I've read that this, however, should be a temporary workaround, as the Event Driven Loader is very beneficial. I will try to create a fleet from this build and keep you posted.

  • @Flopperam

    @Flopperam

    3 жыл бұрын

    @@killonater thank you, really appreciate the updates!

  • @killonater

    @killonater

    3 жыл бұрын

    @@Flopperam And everything works! Again, in the future I'll have to find a workaround for disabling Event Driven Loading, but this is a HUGE step up! Thank you so much!

  • @user-wh3cs9tc6h
    @user-wh3cs9tc6h2 жыл бұрын

    can you put subtitles? I want to learn this.

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Hey, what language?

  • @user-wh3cs9tc6h

    @user-wh3cs9tc6h

    2 жыл бұрын

    ​@@Flopperam I want Korean. It is difficult because I am not good at English. I would appreciate it if you could do 5 copies if possible.

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Just curious, how are the KZread auto translated subtitles? I don't know Korean so it will take a while if I can ever get to it.

  • @user-wh3cs9tc6h

    @user-wh3cs9tc6h

    2 жыл бұрын

    @@Flopperam Automatic translation is possible if you can add subtitles. I think you should do subtitles.

  • @user-wh3cs9tc6h

    @user-wh3cs9tc6h

    2 жыл бұрын

    ​@@Flopperam

  • @Anoberia
    @Anoberia2 жыл бұрын

    Hey man, I made a comment but it's not showing up for some reason so I'm writing this again. Do you suggest using Amazon SDK? Without Lambda-Cognito-API. I read your forum comment about deploying Access key-Secret key on Client. AWS doesn't suggest it but is there a way to produce Keys just for clients? And my last question is about Lambda permissions. When we need to reach a service, we need to give a permisson for this service. Are there examples of every service permisson? Thanks a lot for tutorials.

  • @Flopperam

    @Flopperam

    2 жыл бұрын

    Hey, I think it all depends. Personally, I wouldn't recommend adding the AWS SDK for C++ directly to an Unreal project since it can be annoying at times to compile the client and separate the library files from the server. Also, as you mentioned, you have to embed secret keys into your client if you choose to do this. However, you can make it so that the keys give the clients limited permissions, but with APIs you have more control over who and how often people can make calls to the AWS SDK. Also, there are examples of various IAM policies here, docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_examples.html, not for every single service but once you get the hang of it, it shouldn't be too bad to write policies for other services. Let me know if you have any other questions.

  • @unknownmystics7175
    @unknownmystics7175 Жыл бұрын

    This line of code is preventing me from building the game in Development Server. Any ideas how to fix? int Count = DescribePlayerSessionsResult.GetPlayerSessionsCount();

  • @unknownmystics7175

    @unknownmystics7175

    Жыл бұрын

    its in the prelogin function

  • @jlm2957

    @jlm2957

    Жыл бұрын

    Try this: int Count = 0; DescribePlayerSessionsResult.GetPlayerSessions(Count); This is the definition, you can see it sets your INPUT variable Count to the current m_playerSessions_count, thats in this file: GameLiftServerSDK\Source\GameLiftServerSDK\Public\aws\gamelift\server\model\DescribePlayerSessionsResult.h inline const PlayerSession* GetPlayerSessions(int& count) const{ count = m_playerSessions_count; return m_playerSessions; }

Келесі