Work with AWS GameKit sample games for Unity - AWS GameKit

You are currently viewing content for use with Unity game engine software. See all AWS GameKit documentation

Work with AWS GameKit sample games for Unity

Get a first look at AWS GameKit cloud features and how they behave in a game environment. The AWS GameKit sample Unity project contains four scenes that showcase each cloud feature in action. In addition, the sample project comes with the AWS GameKit package for cloud-based features already installed.

Get the AWS GameKit sample project

Download the AWS GameKit example project from the GitHub repo aws/aws-gamekit-unity and extract them.

Open the sample project in the Unity Editor. The project was created in Unity version 2021.3.6f1; you can update it to a newer version as needed.

On opening the project, look for the AWS GameKit menu in the Editor toolbar. This indicates that the AWS GameKit package is successfully installed and ready to use.

Deploy backend services

Before you can play the games and use the cloud-based features, use AWS GameKit to deploy a game backend on AWS. All the games in the project use the same backend.

To deploy a backend for the sample games
  1. Go to the Editor toolbar and open AWS GameKit, Settings.

  2. Open Environment & Credentials to set up a cloud project. Enter a project alias, select an environment and region (such as Development and us-west-2), and enter your AWS security credentials. You must have an AWS user account with access permissions for AWS GameKit. For more on creating a cloud project, see Set up a Unity project with AWS GameKit .

  3. Open Identity and authentication to deploy the game backend for this feature. You can modify the feature settings as desired. Choose Create to deploy AWS resources for the backend.

  4. Open other features and deploy AWS resources for each. Only one feature can be deployed at a time.

Play the sample games in the editor

When all features have finished deploying, you can play the games.

To play games
  1. Open the project's Main Menu scene, which is located at Assets/Samples/Runtime/MainMenu/Scenes/GameKit_MainMenu.unity. Play the game in the Editor.

    
    AWS GameKit sample project main menu

    In the main menu, each game lists the required features, games are disabled if the required features aren't yet deployed.

  2. Choose a game to play and log in. Depending on how you configured the identity and authentication feature, you might login in with a username and password or with a Facebook account.

    If you're logging in for the first time with a username, you have to register. Choose Create an account and enter a username and password.

    • Usernames can be between 1 and 128 characters long, contain uppercase and lowercase letters (a-z, A-Z), numbers (0–9), and the following special characters: + = , . @ and -.

    • Passwords can be between 8 and 98 characters long, contain uppercase and lowercase letters (a-z, A-Z), numbers (0–9), and the following special characters: ^ $ * . [ ] { } ( ) ? " ! @ # % & / \ , > < ' : ; | _ ~ ` = + -.

    When you complete the email confirmation process, your player ID is added to the project's user pool. Because all the games in the project use the same backend, you can use this login to play them all.

    Registration and login screens in the sample games display the responses received from your game backend. If you try to log in with incorrect information or make other mistakes, you can see the error. The log is located in the AWS GameKit Settings window.

    
    AWS GameKit sample project login screen

About the sample games

The sample project includes the following games.

Identity: Player registration and login

Experience AWS Cloud-connected player registration and login with this AWS GameKit feature. Players can log in from any supported device and resume gameplay with other AWS GameKit cloud-based features.

This game uses a basic login UI to illustrate the various login workflows, including player registration and confirmation, logging in with a password, logging in with Facebook, and resetting a forgotten password. Try deploying with different login mechanisms selected to see how each works.

Achievements: Endless Runner

Play this Endless Runner game to dodge enemies, collect seeds and watermelons, and earn achievements. In this game, you have one tool—the space bar—to make the chicken runner jump to catch seeds, reach elevated platforms, and avoid cacti.


     AWS GameKit sample project achievements game

Because this game showcases the achievements system, it needs some achievement definitions. Before starting gameplay, choose the scene button Add/Overwrite Sample Achievements. This action saves a pre-built file of achievement definitions to your project's backend. The scene is already coded to work with these achievements by sending updates during gameplay and displaying pop ups to the player whenever they earn an achievement.

With achievement definitions configured, you can start the game.

The sample achievements for this game demonstrate the achievement types supported by AWS GameKit, including:

  • Single-step: "Humble beginnings" marks a player's first log in.

  • Multi-step: "Airborne" tracks a player's jumps across multiple games.

  • Secret: These achievements are only revealed when the player earns them. This game reports the existence of secret achievements but doesn't reveal their details.

Between games, you can view a page that reports the status of all game achievements.


     AWS GameKit sample project achievements status

Game saving: Save the World

Clean the oceans, reverse deforestation, and Save the World (and your game). Sync game saves between cloud and a local device.

This game uses a simple game save directory that lets you track existing games and automatically syncs game saves to the cloud. To play, you can start a new game or choose a game save from the list. Gameplay is simple: mash that Clean Earth button as fast as you can to keep ahead of creeping pollution and deforestation. Save your game on occasion and check the directory to see updates.

To experience a cloud sync conflict, choose the Test Save Conflict button. This button forces a conflict between the last saved timestamps of the cloud and local versions. The feature requires the player to choose which version to keep.


     AWS GameKit sample project achievements status

User game data: Stevie the Magic Chicken

Navigate a perilous rogue-lite battlefield in Stevie the Magic Chicken. Improve each run by collecting upgrades purchased with your gameplay earnings, which are tracked in the cloud. Play this game on PC, Mac, or mobile.


     AWS GameKit sample project achievements status

As this game is all about data saving and integrity, here are the details on how this game handles its data. Player performance is tracked in two ways:

  • Enemy kills. Players get a certain number of points for each enemy killed. The number varies based on the enemy's level, but the minimum is 10 points per enemy. The final score is the total of all enemy kill points accrued during the game. Game scores are tracked to build a high score leaderboards, which are deleted when the player logs out of the game.

  • Seeds collected. Players collect seeds dropped from killed enemies. Seeds don't impact the game score, but are also tracked and carry across multiple games. At any time, players can purchase game upgrades with collected seeds. As with player high scores, seed totals are deleted out when the player logs out.

This game sends and receives updates more often than usual to showcase this capability. A real game would, as a best practice, use caching to save on resources and avoid connection issues.


     AWS GameKit sample project achievements status

Topics