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

Поделиться
HTML-код
  • Опубликовано: 29 дек 2024

Комментарии • 102

  • @Flopperam
    @Flopperam  4 года назад +5

    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-9490 4 года назад +8

    Your tutorials are so good...

  • @mdwecht
    @mdwecht 4 года назад +3

    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
    @majingari 4 года назад +1

    Awesome Tutorial series, taught me a lot!!

  • @Flopperam
    @Flopperam  4 года назад +2

    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 года назад +1

      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

  • @kevinwu7892
    @kevinwu7892 4 года назад

    Eyyyy look who's back

  • @Flopperam
    @Flopperam  4 года назад +3

    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.

  • @hillstudios1
    @hillstudios1 2 года назад +1

    Thanks for tutorial bro

  • @Flopperam
    @Flopperam  4 года назад

    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.

  • @philip9611
    @philip9611 3 года назад +2

    Why is multiplayer so hard Dx

  • @gseric565
    @gseric565 4 года назад +1

    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  4 года назад +1

      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 4 года назад +1

      @@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  4 года назад +2

      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 2 года назад

      @@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!

  • @jaytvids
    @jaytvids 2 года назад

    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.

  • @Amer-ti5sc
    @Amer-ti5sc 4 года назад +1

    you are the best

  • @unknownmystics7175
    @unknownmystics7175 2 года назад

    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  2 года назад

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

  • @alextsangaris9670
    @alextsangaris9670 4 года назад

    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  4 года назад

      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 4 года назад

      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  4 года назад

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

    • @alextsangaris9670
      @alextsangaris9670 4 года назад

      @@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  4 года назад

      @@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.

  • @bioblazepayne
    @bioblazepayne 4 года назад +2

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

  • @luiszavaleta6398
    @luiszavaleta6398 3 года назад

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

    • @Flopperam
      @Flopperam  3 года назад +1

      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 3 года назад

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

  • @killonater
    @killonater 4 года назад

    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  4 года назад +1

      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 4 года назад

      @@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 4 года назад +1

      @@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  4 года назад +1

      @@killonater thank you, really appreciate the updates!

    • @killonater
      @killonater 4 года назад +1

      @@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!

  • @alextsangaris9670
    @alextsangaris9670 4 года назад

    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  4 года назад

      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 4 года назад

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

    • @Flopperam
      @Flopperam  4 года назад

      @@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 4 года назад

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

    • @Flopperam
      @Flopperam  4 года назад

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

  • @한주헌-n1b
    @한주헌-n1b 2 года назад

    can you put subtitles?
    I want to learn this.

    • @Flopperam
      @Flopperam  2 года назад

      Hey, what language?

    • @한주헌-n1b
      @한주헌-n1b 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 RUclips auto translated subtitles? I don't know Korean so it will take a while if I can ever get to it.

    • @한주헌-n1b
      @한주헌-n1b 2 года назад

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

    • @한주헌-n1b
      @한주헌-n1b 2 года назад

      ​@@Flopperam

  • @unknownmystics7175
    @unknownmystics7175 2 года назад

    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 2 года назад

      its in the prelogin function

    • @jlm2957
      @jlm2957 2 года назад

      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; }