Trophy icon representing an achievement or award in a cloud service context. Work with the achievements examples - AWS GameKit

You are currently viewing content for use with Unreal Engine software. See all AWS GameKit documentation

Trophy icon representing an achievement or award in a cloud service context. Work with the achievements examples

The AWS GameKit plugin includes example assets for the achievements game feature.

Unreal Engine

The AWS GameKit plugin for Unreal Engine provides examples with C++ code, blueprints, and UI components. You can access the example files in the Unreal Editor content browser.

Work with the C++ examples

In the Unreal Editor content browser, find the example asset at the following location:

AwsGameKit C++ Classes > AwsGameKitEditor > Public > Achievements > AwsGameKitAchievementsExamples

This asset is a .cpp file. You can also find this file in the AWS GameKit plugin files, located at ...\AwsGameKit\Source\AwsGameKitEditor\Private\Achievements\AwsGameKitAchievementsExamples.cpp.

This example file contains sample code that illustrates how to call each of the identity and authentication API actions. This file contains the basic set of runnable code and includes detailed comments.

You can work with this example in two ways: view the code in your IDE, or experiment with the API calls in Unreal Editor.

To view or edit the example code:
  • Double-click the AwsGameKitAchievementsExamples asset to open the file in your IDE. You do not need to enter AWS credentials or deploy AWS resources before accessing this file, however none of the API calls can work without deployed resources.

    The example code includes a standard check to verify that AWS resources are deployed.

    Note that, as a first step, the example code creates an instance of the UAwsGameKitAchievementsCallableWrapper and initializes it. This must be done before making any API calls.

To experiment with the example in Unreal Editor:

You must have AWS resources deployed for identity and authentication and you must submit your valid AWS credentials in the AWS GameKit plugin project settings (see Set up the AWS GameKit plugin for your game).

  1. Drag the AwsGameKitAchievementsExamples asset into level in the view port. It doesn't matter what level you add the asset to, this is just a mechanism that enables you to work with the asset settings.

  2. In the Editor's Details pane, all of the achievements API calls are available with API request and response values.

  3. To make an API call, enter some input values and click Call. The response is displayed in the Return Value field.

  4. Try running the following call sequences to simulate standard achievements scenarios:

    • Retrieve all viewable achievement information and player status: Get Achievements.

    • Retrieve information and player status for a single achievement: : Get Achievement.

    • Update player status for a stateless achievement and verify earned status: Update Achievement, Get Achievement. For a stateless achievement, update the current value to "1", and then verify that the earned status has flipped to "true".

Work with the Blueprint and UI examples

In the Unreal Editor Content Browser, find the example assets at the following location:

AwsGameKit Content > Achievements >

There are two example assets:

  • BP_AwsGameKitAchievementsExamples

    This asset is a basic blueprint that illustrates how you might add achievement-related functionality to your game code.

    Actions:

    • To open the blueprint, double-click the asset.

  • BP_AwsGameKitAchievementsExamplesUI

    This asset includes a blueprint and sample UI objects for displaying achievement information and player status.

    Actions:

    • To open the blueprint, double-click the asset.

    To run the example, click Play.