Managing your games in Amazon GameSparks - Amazon GameSparks

Amazon GameSparks is currently in preview. Changes might be made to this service and to this documentation. We don’t recommend using this service for production workloads.

Managing your games in Amazon GameSparks

This topic describes how to manage your game in Amazon GameSparks.

Create, edit, and delete games

To create, edit, and delete games, go to the Amazon GameSparks console, and choose Games.

Create a game

When you create a game, you must give the Dev stage an IAM role. This IAM role must be configured with a policy that gives the Dev stage permissions to perform essential operations.

Choose either:

  • Create and use new roles for each stage Select ths option if you want to get started quickly, and you don’t have an existing role you want to use. You can later customize the IAM role and policy that are created for you, add new policies, and so on.

  • Use existing roles for each stage Select this option if you already have a custom IAM role that you want to use.

The IAM role that you use must be configured with the following permissions:

  • A permissions policy that allows the following actions. Replace MyFirstGame with the name of your game, and replace 012345678912 with your AWS account number.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "ContainerPutLogEvent", "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:CreateLogStream", "logs:CreateLogGroup" ], "Resource": [ "arn:aws:logs:us-east-1:012345678912:log-group:/aws/gamesparks/*" ] }, { "Sid": "ContainerInvokeBackend", "Effect": "Allow", "Action": [ "gamesparks:InvokeBackend" ], "Resource": [ "arn:aws:gamesparks:us-east-1:012345678912:game/MyFirstGame/stage/Dev" ] } ] }
  • A trust relationship that allows gamesparks.amazonaws.com to assume the role, as shown in the following IAM policy example:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "gamesparks.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

For information about the maximum number of games that you can create, see Amazon GameSparks service quotas.

Working with snapshots

As you develop your game, you make changes to the game configuration. These changes can include the following updates to the configuration:

  • Modifications to the cloud code in the message handlers.

  • Adding, renaming, and deleting messages.

  • Adding, modifying, and deleting custom shapes.

The currently active game configuration appears as a snapshot in the Snapshot pane, and your game runtime operates from this snapshot. If the active snapshot has an asterisk at the end, then your game configuration has undeployed changes. You must deploy your configuration as a new snapshot for these changes to take effect.

When you deploy a snapshot, a new game runtime is created. If there are any players connected to the previous game runtime, then both runtimes persist. Existing connections to the previous runtime are maintained. When a player disconnects, their next connection will be to the new runtime. When there are no connections to the previous game runtime, it is deleted.

Deploy game configuration changes as a new snapshot

To deploy a new snapshot

  1. In the navigation pane, select Dev.

  2. Choose Deploy as new snapshot.

After the deployment is complete, a message appears at the top of the console. You can now test your messages in the game harness and call them from your game client.

Understanding deployment result codes

If a deployment fails, you might see a message that includes one of the following result codes:

  • INVALID_ROLE_FAILURE This result code indicates that the IAM role associated with the current stage doesn’t exist in your account, or if the IAM role has missing or insufficient permissions. For information, see GameSparks stage roles.

  • UNSPECIFIED_FAILURE This result indicates that a system error occurred. If you encounter this error, we recommend that you retry the deployment after 30 minutes. If you continue to see deployment failures after multiple retries, contact AWS Support.

Export a snapshot

You can export the active snapshot of your game configuration as a JSON configuration file. You can then edit the JSON file directly on your development machine. This can be useful to:

  • Make bulk changes to the game configuration.

  • Check the configuration into a version control system to maintain and see the differences among versions.

  • Copy your game configuration into another game.

To export a snapshot

In the Snapshot pane, choose Actions, and then choose Export to download the JSON configuration file.

If you want to export a snapshot other than the currently active snapshot, deploy the earlier snapshot, and then export it.

For information about the schema of the game configuration file, see GameSparks.Core Sections.

Import a snapshot

You can import a game configuration file to deploy it as the active snapshot.

Importing a game configuration discards any undeployed changes to the currently active snapshot. If you want to retain those changes, deploy them to a snapshot before you import.

To import a snapshot

  1. In the Snapshot pane, choose Actions, and then choose Import.

  2. Select the file you want to import.

Deploy an earlier snapshot

To deploy an earlier snapshot of the game configuration, choose the snapshot in the All snapshots list, and then choose Deploy.

You can think of an earlier snapshot deployed from history as a temporary hotfix. Deploying the earlier snapshot is not like switching to a different version control branch. The earlier snapshot does not overwrite any of your game configuration changes, even if you deployed them. When you deploy your game configuration changes, they become the active snapshot and the earlier snapshot becomes inactive.

If you want to develop your game beginning from a configuration in an earlier snapshot, you can deploy the snapshot, export it to make changes to the configuration, and then import it to deploy the modified configuration.

Tagging games and stages

You can tag your games and the stages within those games. To tag:

  • Your game, in the navigation pane select Game details, and then choose Manage tags.

  • The Dev stage, select Dev in the navigation pane, choose Tags, and then choose Manage tags.

Tags provide some benefits, including:

  • With a single policy you can grant permission to the tagged items.

  • You can organize and track resource usage among the tagged items.

For example, you apply a tag with a key of Game and a value of SuperDungeon to the game, its Dev stage, some DynamoDB tables it uses, and some Lambda functions. You can now use the tag to organize these resources, track their costs, and grant permissions. To learn more, see Tagging AWS resources and Controlling access to and for IAM users and roles using tags.

Service endpoints and quotas

GameSparks is available through specific service endpoints and is subject to quotas. For more information, see Amazon GameSparks endpoints and quotas.

Inactive games

Important

If your game doesn’t receive any messages for 30 consecutive days, then your game stage might be deactivated. You can reactivate your game stage by deploying a snapshot.