Testing the Player Account Cloud Gem - Lumberyard User Guide

Testing the Player Account Cloud Gem

Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more.

To test the Player Account Cloud Gem, you can use the CloudGemSamples project that is included with Lumberyard. This sample contains a level named PlayerAccountSample. The player account sample level provides a menu from which players can create an account, verify their email addresses, sign in and out of their accounts, and recover their passwords by email.

The Player Account Sample Level

The following table describes the files for the player account sample level.

Location Description
\dev\CloudGemSamples\Levels\PlayerAccountSample A level that contains an entity with the Lua script component.
\dev\CloudGemSamples\Scripts\PlayerAccount The Lua scripts that manage the UI canvases and interact with the Player Account Cloud Gem's EBus API.
\dev\CloudGemSamples\UI\Canvases\PlayerAccount The UI canvases displayed for the player.

Note that in the sample, UI canvases do not include functionality for displaying error messages graphically; instead, error messages are output to the console. If you integrate this gem into an existing project, you should use the UI canvas to show error messages. For example, you could do this when the confirmation code is incorrect or the password does not meet the minimum password length. For more information on using the Player Account Cloud Gem in an existing project, see Integrating the Player Account Cloud Gem into an Existing Project.

The following diagram shows how the UI canvases are connected. For more information on the Amazon Cognito user pool signup process, see the Signing Up and Confirming User Accounts page in the Amazon Cognito Developer Guide.

                Player sign in workflow


This tutorial assumes the following:

  • You are using a Lumberyard project that has Cloud Gem Player Account enabled.

  • You have created a project stack in Cloud Canvas Resource Manager.

  • You have a deployment stack with Player Account Cloud Gem resources in Cloud Canvas Resource Manager.

If you don't meet the prerequisites, follow the steps in Enabling Gems to add Cloud Gem Player Account in the Project Configurator. For information on creating a project stack and a deployment stack, see Tutorial: Getting Started with Cloud Canvas.

PlayerAccountSample Tutorial

To test the Player Account Cloud Gem

  1. In the Project Configurator, select the CloudGemSamples project.

  2. Start Lumberyard Editor.

  3. On the Welcome to Lumberyard Editor screen, click Open level, Levels, PlayerAccountSample, Open.

  4. Click AWS, Cloud Canvas, Select a Deployment.

  5. Click the deployment that you want to use, and then click OK.

  6. Press Ctrl+G to start the game.

  7. In the main menu of the sample, click Create Account.

                        Create account

    If the Create Account option does not appear, click Sign Out and try again.

  8. Enter a user name, password, and an email account to which you have access.

                        Type test credentials
  9. Click Create.

  10. From the email account, copy the confirmation code that you receive.

  11. In Lumberyard, paste the confirmation code into the Verification Code box, and then click Verify.

                        Verification code
  12. Sign in using the password that you specified earlier. This tests the custom authentication flow.

                        Sign in
  13. Click Manage Account.

                        Manage account
  14. Click Edit Account.

                        Edit account
  15. Type in a name for Player Name, and then click Save. This step tests the player service API.

                        Type a player name

    The main menu displays the player name that you specified.

                        Player name in main menu
  16. Press ESC to stop the game.

  17. Open a command prompt to your Lumberyard dev directory.

  18. Use the show-players command to verify the player has been created.

    $ lmbr_aws player-account show-players
    {'AccountId': 'b8103676-1234-5678-9abc-def012345678',
     'CognitoUsername': 'TestUser',
     'IdentityProviders': {'Cognito': {'IdentityProviderId': 'Cognito',
                                       'create_date': 1613433006.709,
                                       'email': 'mary@example.com',
                                       'enabled': True,
                                       'gender': 'None',
                                       'last_modified_date': 1613433006.709,
                                       'status': 'FORCE_CHANGE_PASSWORD',
                                       'username': 'Mary Major'}}}
  19. Use the edit-player command to change the player name, to test the administrative service API. Replace the account ID shown in the example below with the actual account ID from the output of the previous step.

    $ lmbr_aws player-account edit-player --account-id b8103676-1234-5678-9abc-def012345678 --playername "Major Mary"
  20. Use the show-player-details command to verify the change in the profile for the player. Replace the account ID shown in the example below with the actual account ID of the player used in the previous step.

    $ lmbr_aws player-account show-player-details --account-id b8103676-1234-5678-9abc-def012345678