How To Make A Multiplayer Game With Unreal Engine and Amazon GameLift (Part 5 - Cognito)

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

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

  • @eddysouth2023
    @eddysouth2023 4 года назад +9

    What I love most about your tutorials is that you don't just teach us the methods needed to accomplish the goals of the tutorial, you give us all the reasons and even links or explanations for the parameters you don't use. This feels like a college course rather than a free RUclips tutorial. Seriously, bravo.

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

      Yep, this is EXACTLY right. I'm even doing it in loose 1hour chunks so that I've got time to absorb it. Well, that and with a 2 year old boy, I'm lucky to even GET an hour at a time

  • @davemcgrath8936
    @davemcgrath8936 3 года назад +3

    Man, I've been following along for a little personal project for a few hours, I had it all planned but didn't have the code, and it's like "The Joy of Painting", I've been so zen just typey-typey :) And I only have to pause sometimes. Thank you!!

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

    Note that in Unreal Engine version 4.26, in order to create a C++ class through the editor like at 1:41:04, you have to do it through File -> New C++ Class. In Unreal Engine 4.26, the option to create a new C++ class through the green "Add New" button seems to have been removed.

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

      Wow! you're still active on this old video! Thanks so much for this series!!

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

    Again Awesome tutorial series! I finished working through (Part 5 - Cognito) with your much appreciated assistance and will start (Part 6 - Client Service) after I catch my breath and do some backups :-)

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

    Thank you to the person in the comments of another video who pointed this out but you no longer need to use a layer in your AWS Lambda functions as the AWS SDK is now automatically included!

  • @twinsassink8745
    @twinsassink8745 4 года назад +6

    Finally DONE!!! Great tutorial

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

    I love your video, it is great to explain the AWS in detail.

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

      Glad it was helpful!

  • @andreasilia285
    @andreasilia285 3 года назад +11

    HttpModule error fix on UE4 4.26
    TSharedRef GetResponseTimeRequest = HttpModule->CreateRequest();

  • @carlosreyes8443
    @carlosreyes8443 Год назад

    Hi, this time my problem is very simple, but I do not find the answer, at point 4:32:06 i don't see any access token and i have UE_LOG
    UE_LOG(LogTemp, Warning, TEXT("access token: %s"), *AccessToken);
    UE_LOG(LogTemp, Warning, TEXT("refresh token: %s"), *RefreshToken);
    can you help me? what should I check again to solve this problem? Thank u!

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

    finally done!! nice job

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

    AWESOME, Best Tutorial ever!!!

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

    Keep in mind that if you are experiencing errors with the TrackEvents Lambda function related to batchWriteItem not having enough items passed to it (requestItems must have a length less than or equal to 25 but greater than or equal to 1) when testing the MatchmakingSearching and PotentialMatchCreated test events, this is actually normal behavior because we modified the TrackEvents function to only write items to the MatchmakingTickets table for final result matchmaking notifications, which include: MatchmakingFailed, MatchmakingCancelled, MatchmakingTimedOut, and MatchmakingSucceeded. Looking back, I should have handled the MatchmakingSearching and PotentialMatchCreated cases more gracefully, but the outcome is still okay.

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

    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.

  • @Marius-vw9hp
    @Marius-vw9hp 3 года назад +1

    lol getting a web browser into the game, didnt even know it was possible X) very cool!

  • @ravartd.9846
    @ravartd.9846 3 года назад +1

    Great Tutorial! I would be interested in websockets!!

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

    Hey guys, now when you add a layer to a lambda function, it now looks a little different than how it looks in this video. By default, you will see an option called "AWS layers" selected by default. Make sure to select the option labelled "Custom layers" instead. Otherwise, you won't see your custom layer when you select a layer from the drop down menu.

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

    Hey guys, although I did not do this in this tutorial series, a lot of lambda functions that we write include if statement checks on parameters in the request body. However, I just found out that you can perform request body validation through API Gateway. Note that not every Lambda function that we write throughout this tutorial will be attached to a resource on our REST API. Therefore, for some lambda functions, you won't be able to do request body validation via API Gateway. So if you have time, then I would highly encourage you guys check out this article, itnext.io/how-to-validate-http-requests-before-they-reach-lambda-2fff68bfe93b. Keep in mind though that the original code in this video and for all of our lambda functions will still work. But if you do request body validation through API Gateway instead of in the lambda function itself, that can reduce code in your Lambda functions. However, then you have to write a model for each api method. All in all, either approach you take, wherever you validate the request content, whether it's in the lambda function or on the API side, will work.

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

    This is super long but its amazing thank you!

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

    Also, when you test your Lambda functions, if you are still getting an error message related to access permissions despite having modified the policy attached to your lambda function's role, then add a harmless edit to your lambda function like a comment or new line character, save the function, and test it again. This glitch happens from time to time in which the modification of your lambda function's permissions doesn't get applied right away.

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

      I don't know why but it still showing access denied and can't able to write to dynamodb table. Any suggestion what should i do about this?

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

    First, Great tutorial! Awesome job of paying attention to all the details and not assuming anything! I have learned a lot so far and I am looking forward to the remaining sessions...
    Question: When building the editor during this tutorial (#5) after adding the initial few lines of code, I am getting a few errors related to “MainMenuWidgetClass”. Is this just a variable defined in MainMenuHUD.cpp? Is there a definition in a .h that I might be missing? If related to the reparenting, how does one know if the reparenting worked and what actually happend as a result?

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

      Hey, thanks for the kind words! The MainMenuWidgetClass is a custom property that we define at 1:47:45

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

      @@Flopperam Thanks :-)

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

    3:37:06 JsonUtilities.h doesnt load when building. 'Code E196 : cannot open source file "JsonUtilities.h" ' Did I miss a download or a latest version?

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

      Hey, can you make sure in your build.cs file that you added the json and jsonutilities dependencies like seen in this file, github.com/chris-gong/gamelift-example-ue4/blob/master/Source/GameLiftTutorial/GameLiftTutorial.Build.cs
      Also, you can try to regenerate your visual studio solution files for your project and then rebuild.

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

      @@Flopperam Hi, thanks Flopperam. yes I have it exactly the same in my build.cs file. Looks like I will have to regenerate my visual studio solution files :/

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

      @@gseric565 alright, please let me know if that does or doesn't work!

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

      @@Flopperam Hi, I ended up redoing the tutorial from the beginning and it worked this time around. I might have missed something before. Thanks :)

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

    Hi! me again, This time my problem is very simple, but I do not find the answer :( at point 4:32:06 i don't see any access token and i have uelog
    UE_LOG(LogTemp, Warning, TEXT("access token: %s"), *AccessToken);
    UE_LOG(LogTemp, Warning, TEXT("refresh token: %s"), *RefreshToken);
    can you help me? what should I check again to solve this problem?

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

      There's a lot of things that can cause this. Make sure your url in ApiUrl.txt is correct. Make sure that your ExchangeCodeForTokens lambda function is working through Postman, Lambda testing, and even API Gateway testing. Check cloudwatch logs for the ExchangeCodeForTokens functions to make sure that the Lambda function is even being invoked.

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

      @@Flopperam it's all okey, what else can I do?

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

      @@clash5074 in your unreal engine logs, does it actually print out the words "access token" without the access token value or do you not even see that in your logs?

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

      @@Flopperam I don't see any log of both sides, there is no log with access token.

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

      @@clash5074 make sure that the ExchangeCodeForTokens function is even being called.

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

    At 4:26:38 The page is loading and loading, did u add anything in UI_MainManu > WebBrowser_log > initial ( At 2:03:21 ), in my case is blank should blank or I have to add UI Link fron user pool?

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

      Hey, so after that second timestamp you referred to, we start taking the steps needed to set the URL, read from a text file, of the web browser widget in the MainMenuWidget.cpp class, specifically inside the NativeConstruct method.

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

      @@Flopperam I don't know how to thank you, as soon as I finish work I will go and look

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

      @@Flopperam Hi, Me again, I just came home and double check it, it looks everything fine becoz I make Urls folder in Content, so i believe that this line is fine;
      **LoginUrl = TextReader->ReadFile("Urls/loginUrl.txt");**
      I thought the mistake was in Typo so I take your code from github, since my project have same name as yours "GameLiftTutorual" I don't have to change anything, right? But still got infinity loading...
      I apologise once again for disturbing. And believe me if I will finish this project before end of this week, I will share 10% with you.

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

      @@clash5074 can you add a UE_LOG statement to check whether or not the URL is being read? There could be a typo with the path of the file passed to the ReadFile function.

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

      @@Flopperam So I got
      PIE: Warning: UI_MainMenu_C_0
      PIE: Server Logged in
      PIE: Play in editor start time 0,057 second.

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

    First of all, thank you so much for these tutorials. They're my only hope to actually get my job done lol
    I do have one question, though. On the OnRetrieveNewTokensResponseReceived, I've been getting the content "{message: Forbidden}". It works for the first time, but then that happens when I try to refresh the token.
    Would you have any idea what I'm doing wrong or pointers on what to look for?
    thank you so much for everything in advance.

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

      Hey, could you add some console.log('your string value here') statements in your retrieve new tokens lambda function and then as the API method gets invoked by your client, can you check the cloud watch logs for that lambda function to make sure that it's not an issue on the lambda side?

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

      @@Flopperam Thanks for the fast response! the second call wasn't happening so I was able to narrow that the problem was in my request's url!
      On to the next video now! Thanks once again!

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

    Thanks bro

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

    Hey to the point where you click the "Launch Hostet UI" button everything works for me. But if I click the button I'm getting an error message:
    This site can’t be reached
    mygametestapi.auth.eu-central-1.amazoncognito.com’s server IP address could not be found.
    Try running Windows Network Diagnostics.
    DNS_PROBE_FINISHED_NXDOMAIN
    Any idea why this fails for me?

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

      Okay it works now. Seems that it took quite a long time for me until the UI has been deployed.

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

    hmm in RetrieveNewTokens, shouldn't the response assignment in the then-function of initiateAuth be performed inside the if(data && data.AuthenticationResult) ? What would happen if that condition is false and the if-block is never run (might be that can't happen - but in that case the condition shouldn't have to be checked...)

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

      Hey, this is a good question. If the if-block condition doesn't return true runs then the token values in the response would be blank strings/null values. I agree that this is not the best way to handle this scenario, albeit this case is very rare, hence I decided not to handle it better for the sake of getting the tutorial out at the time. A better way would be to return a response that indicated an error if the if-block condition doesn't return true. You could also argue that this scenario may not even be worth adding an if-check or that the response assignment could be done in the if-check as you mentioned. Looking back, I may have added a lot of redundant if checks throughout the tutorial series, because I wanted to be extra safe since I was and am still learning AWS + UE4.

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

    What would we have to do if we put the game on steam and want to use that instead of the custom login?

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

      So I haven't quite explored that myself yet, but someone in our Discord server has begun taking a look at that. Here are some his findings so far,
      discord.com/channels/535222908818030613/625989588552253450/867980819791216660
      and
      discord.com/channels/535222908818030613/625989588552253450/882729980130381854

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

      @@Flopperam yeah its a topic thats not really talked about anywhere. You can see a lot of people asking but no one has answers. Would be cool to have a video explaining it.

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

    @Flopperam The Google link that you provided for the step at min 59 looks to not work anymore, and it is being discontinued, Since I am following your tutorial to the dot this creates quite a problem, what should I / We do instead? (if i am mistaking and just did sometehing wrong please forgive my stupidity). Love the series and the channel content overall

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

      Hmmm, thank you for pointing this out. You could skip the Google step and just use cognito for now for user accounts. We'll have to stop procrastinating and actually remake this tutorial.

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

      @@Flopperam great tutorial anyways, can't immagine how much effort and time went into it, thank you a lot

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

    Finally 😲 does this tutorial contain matchmaking?

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

      Next two parts will! This video is all cognito and integrating it with unreal engine.

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

      Flopperam ok cool thanks man ! 😀 keep up the good work 👍🏻

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

      @@WalidtheNoematicsguy thank you! Also want to mention that we make a modification to something we did in part 4 at the beginning of this video.

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

      Flopperam ok thanks 😀

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

    Watching the entire series before I sit down and implement, but I do have a question. Can authentication/cognito be skipped over (so no login) and still progress through the tutorial series properly or will further implementations fail because of a missing step?

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

      Hey, so I would suggest going through the authentication/Cognito step only because it involves more than just login. It also involves user accounts and player data that are used for showing how matchmaking and API authorization works. Although theoretically you can make dummy/mock data for matchmaking requests and remove auth checks on API endpoints, it's better in my opinion to not leave anything out in order to better learn how all the concepts in the tutorial series work together. Also, this video (part 5) is a good introduction/precursor to making HTTP requests in Unreal Engine to APIs made in Amazon API Gateway, which gets done again later in the tutorial.

    • @MaMa-rc4eo
      @MaMa-rc4eo 7 месяцев назад

      whoever wants to know: yes i think its no problem to skip these 4 hours if youre not interested in authentication. i did it and it worked for the following part. its also way easier to test without the annoying token stuff. of cause you need to adjust some code but its no big deal. @flopperarm explained everything so well in the previous videos that you should already have a feeling for how AWS works

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

    Did you ever do Websockets? if so, I'll see when I get there, else, here's my comment down below requesting it.

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

      Not yet, but I hope to visit websocket very soon as I do find them interesting and Unreal Engine does have native support for them.

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

      @@Flopperam this has been a really solid tutorial series, thank you for putting the time into it and sharing your knowledge with the broader dev community. much appreciated.

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

    Hey sorry to bother you, but I made in the first tutorial some builds and I tried to host it on a fleet. It worked so I turned it off. But now AWS tells me that I have something to pay (I'm in the free tier, wtf ?) and he expect the price to go higher, meaning that he thinks the servers are still online... Have I done something wrong ?

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

      Hey, make sure that you're using on-demand instances instead of spot instances since only on-demand instances are covered under the free tier. When making the tutorial, I didn't realize this at first. Also, make sure to scale down your fleet capacity to zero instances when you're not testing. The reason for this suggestion is that you are billed for instance usage time (by the hour for Windows and by the second for Linux) regardless of whether or not the instances are hosting active game sessions. You can do this at the bottom of the scaling section of your fleet. Lastly, open a support case at console.aws.amazon.com/support/home?#/ and explain your situation/misunderstanding because AWS is usually pretty lenient when it comes to refunds. Really sorry about the trouble as I didn't learn these things until later on, and I hope this all helps. Let me know if you have more questions.

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

      @@Flopperam I was indeed using spot instances, but it was written that it was free so I thought it was okay. Also the problem here is that I have 0 fleet active, but AWS tells me that the price is going to go up by the end of the month. Either this is predictions, and he thinks that I will be using a server when in reality I wont, or servers are still active.
      But it's only 1€ for this month so this isnt a big problem ^^
      Thanks again for your help and your amazing tutorial !!

  • @novacaine_.5108
    @novacaine_.5108 3 года назад

    Hey there, when testing the TokenGeneratedEvent in ExchangeCodeForTokens Lambda, the response is always "request to oauth token endpoint failed" everytime. I tried so many different tokens that the sign in generated but it just keeps giving me the incorrect output each time. The other tests like InvalidGrant and NoCodeEvent work fine but its just the TokenGeneratedEvent

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

      Hey, could you reply with the full response for the TokenGeneratedEvent? Just trying to better deduce what's happening exactly.

    • @novacaine_.5108
      @novacaine_.5108 3 года назад

      @@Flopperam
      Response:
      {
      "statusCode": 400,
      "body": "{\"error\":\"request to oauth token endpoint failed\"}"
      }
      Request ID:
      "4b713b6c-ab48-4992-bcc8-901ad544e8cd"
      Function logs:
      START RequestId: 4b713b6c-ab48-4992-bcc8-901ad544e8cd Version: $LATEST
      END RequestId: 4b713b6c-ab48-4992-bcc8-901ad544e8cd
      REPORT RequestId: 4b713b6c-ab48-4992-bcc8-901ad544e8cd Duration: 9.29 ms Billed Duration: 10 ms Memory Size: 128 MB Max Memory Used: 71 M
      Not Really much help is it... I cant work out why its doing this, been stuck on it for hours

    • @novacaine_.5108
      @novacaine_.5108 3 года назад +1

      @@Flopperam worked it out.... it was really stupid but i had "" in the host name

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

      @@novacaine_.5108 Nice, glad you figured it out. I was wondering what caused that, and don't worry, that mistake has stumped more people than you would think.

  • @THEALLIANCEZERG
    @THEALLIANCEZERG 2 месяца назад

    Has the setup gotten easier

    • @Flopperam
      @Flopperam  2 месяца назад

      It's slightly different but I'm not sure about easier.

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

    Hey I am not sure if it is a good question but I will ask it anyway, do you recommend Amazon GameLift for MMO server architecture or EC2 would be a better option?

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

      Hey, that's a very good question. In my personal opinion, it seems that GameLift is better suited for match-based games. Although it is definitely possible to do MMO games on GameLift, I would recommend using and customizing your own EC2 server architecture for that.

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

      @@Flopperam Thanks for the reply! I will check it out.

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

    Hi! I have a problem with retrieve new tokens, message says unauthorized pls can you help me! 😰😰

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

      This issue was resolved on discord. It had to do with scopes not being defined in the cognito authorizer.

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

    Hello again, when I test with the FlexMatch Matchmaking Event example, MatchmakingTimedOut, it does not appear in the database table, any idea why this happens? Thanks in advance

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

      Hey, is this after you applied the modifications to the lambda function and remade the dynamodb table? And also, is this when testing in the Lambda console or publishing a test message to the SNS topic?

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

      ​@@Flopperam yes, I already made the change the lambda function, I created the table again. MatchmakingSucceeded test works fine, but timeOut doesn't

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

      is publishing a test message to the SNS Topic

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

      Are you getting any errors in the response returned?

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

      @@Flopperam no, all look good

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

    When i run ExchangeCodeForTokens with the code from the log in screen in Postman. I get error incoming request did not have code. Everything works with the tests in lamba.

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

      Did you pass the code through the request body in Postman?

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

      Yes i did the code just like you wrote but with my url. It was using raw and Json.

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

      @@alexbobob8951 can you join our discord? link is in the description. It would be more convenient because I may ask for pictures to help debug the situation.

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

      If you can't discuss on discord, can you try testing the API method in API gateway? You can do so by clicking the test button that appears when you click on POST below ExchangeCodeForTokens in API Gateway.

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

      Flopperam I’ll try to get on discord soon. I will try the api version when I get time too. I did mess around with postman where I tested exchange tokens online then took the access token from there to test the other functions and the all worked.

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

    you are special place in haven dude, maybe you sell market you project?

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

      Sorry for the late reply. It's on github currently but I could also try putting it on the marketplace for free sometime in the future.

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

    Horrible programming, why use async await, when you just tack on promise chaining? Pick one and program it right please. This is such bad practice for everyone.

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

      Thank you for the criticism, looking back I wasn't the most familiar with JavaScript, Unreal, or AWS, and I was trying to rush this tutorial series. I'm hoping in the future that I can learn and improve on this by letting people in our community review the project before making the tutorial series. Again, apologies for any mistakes or bad practices I've made.

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

      @Keanu Reeves your mom is mine

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

    Note that the UI for DynamoDB has recently changed and enabling the Time to Live attribute in a table may be a little different now. Please check out this link on how to enable TTL. docs.aws.amazon.com/amazondynamodb/latest/developerguide/time-to-live-ttl-how-to.html