Amazon GameSparks FAQ
Amazon GameSparks is a managed service that provides game developers backend features for building, running, and scaling games on AWS. At GDC 2022, AWS announced the launch of Amazon GameSparks in preview with the SDK for the Unity game engine now available to download from the Amazon GameSparks website. The Amazon GameSparks team has worked closely with the game developer community to iterate and refine the service features. To learn more about Amazon GameSparks, click here.
1) What platforms and features will Amazon GameSparks support in preview?
For preview, Amazon GameSparks will support mobile (iOS and Android) and PC gaming platforms. It will also include features that will be familiar to existing GameSparks developers. Those features are Cloud Code, player storage, guest authentication, player messaging, test harness, user management, snapshot management and a Unity engine integration. Additional features and engine integrations will be added at a later date. Amazon GameSparks has new features including integrations with Amazons DynamoDB and AWS Lambda services. More details about these integrations are shared below.
- AWS Lambda : AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers. The AWS Lambda integration in Amazon GameSparks enables developers to invoke AWS Lambda functions from their AWS account directly in a Cloud Code handler. Developers can use this integration to build custom features that harness the power of Lambda and other AWS services. You can find more information about the Amazon GameSparks Lambda integration here.
- Amazon DynamoDB: Amazon DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale. Amazon DynamoDB integration in Amazon GameSparks enables developers to easily access data stored in a DynamoDB table from their AWS account directly in a Cloud Code handler. You can find more information about the Amazon GameSparks DynamoDB integration here.
2) Can I deploy a live game during the preview of Amazon GameSparks?
No, live game deployments are not enabled during preview. Amazon GameSparks will only support game development use cases and not production workloads/live games during preview. Developers can develop game backends and a maximum of 10 concurrent users will be supported per game during preview. The features to promote games to production will be provided when Amazon GameSparks is Generally Available. You can find more information about deploying configuration changes during the preview here.
3) What region will the preview of Amazon GameSparks be available in?
The preview for Amazon GameSparks will be available in the US East (Northern Virginia) Region.
4) How are Events in Amazon GameSparks compared to GameSparks?
In GameSparks, Events and their attributes are configured independently from Cloud Code. In Amazon GameSparks, Events are classified as a message type and can be created within the Cloud Code editor. All messages have fields which have 3 properties. A name, the shape of the field, and whether it's required or not.
- What Is a Shape? - GameSparks event attributes are known as Shapes on Amazon GameSparks. The shape of a field can be a primitive type like String, Integer, Boolean, or Any. You can also create a custom shape that is more complex and can have more types like List, Map, Enum, Structure or Variant. By using shapes, you can build out complex data objects for each of your message types. Custom shapes can be reused across multiple messages. For more information on shapes please see our documentation here.
There are 3 types of messages in Amazon GameSparks.
- Requests - When the client makes a request, a response is required from the backend. Requests are essentially the backend API to the game client. For example, the client requests a list of the magic gems the player has acquired. A request can optionally send a notification to the client. Requests are the equivalent of GameSparks Events in Amazon GameSparks.
- Events - A message that the client raises to the backend with no response required. For example, the player acquires one of eight magic gems. An event can optionally send a notification to the client.
- Notifications - Events and requests can send notifications from the backend to the client. For example, when the player has acquired all eight magic gems, a congratulations message is sent to the player.
5) How is Cloud Code in Amazon GameSparks compared to GameSparks?
The Cloud Code interface on Amazon GameSparks provides an improved user experience in comparison to GameSparks. In GameSparks, Events, Cloud Code and Messages were all accessed and configured independently of each other. In Amazon GameSparks, creating notifications, requests, events, defining shapes (attributes) and writing Cloud Code handlers can all be done within the Cloud Code editor itself. This streamlines developers workflow by reducing the need to navigate between pages to make small changes. GameSparks and Amazon GameSparks both support JavaScript to implement game logic in Cloud Code. Amazon GameSparks supports JavaScript ES5.1.
6) How is Test Harness in Amazon GameSparks compared to GameSparks?
The Test Harness in Amazon GameSparks will feel familiar to developers who have used it on GameSparks. The Test Harness can be used to mimic a connected device to invoke requests/events and examine request/response data, sent events and notifications received in the Log Inspector. This enables developers to iterate and test updates to game configurations quickly within the console without having to integrate changes all the way from backend to client. In Amazon GameSparks, you will need to deploy a snapshot in the Dev environment before you can test code changes in Test Harness.
7) How is the Unity Integration in Amazon GameSparks compared to GameSparks?
The process for integrating with Unity is similar for both services.
- In GameSparks developers can download the Unity SDK from the GameSparks documentation. They would then import the SDK package into their Unity project and add their games API key and secret to the GameSparks Settings in order to connect to the service. They could also create a C# file with custom functions from your game by clicking Get My Custom SDK from within the GameSparks Unity settings.
- In Amazon GameSparks the SDK is downloaded from the documentation (see here for more details). The custom code is now generated and downloaded from within the GameSparks game instance itself (see here for more details). From there it can be imported into your Unity project. After the game is configured on Amazon GameSparks, the game key can be added to your Unity project to establish the connection between the client and the backend. For more information on the set up process please see here.
8) How is user management handled in Amazon GameSparks compared to GameSparks?
In GameSparks you could add a collaborator to your game with an email address and configure access rights on a per game level. Amazon GameSparks is integrated with the IAM (Identity and Access Management) service. This services provides fine-grained access control across all AWS services. In GameSparks a group (role) would have to be created and configured in each individual game. On Amazon GameSparks IAM gives you the power to configure roles across multiple game instances and AWS resources. More information on the IAM integration can be found here.
9) How is logging handled in Amazon GameSparks compared to GameSparks?
- The Amazon GameSparks Cloud Code API for logging is quite similar to the GameSparks SparkLog API. Both APIs support logging at 4 different levels (Debug, Error, Info & Warn). In GameSparks your logs were written to a system script.log collection which could be viewed in the games Data Explorer. With Amazon GameSparks your game is integrated with Amazons Cloudwatch service on creation. Your games logs are stored in a Cloudwatch log group. A log group will be created for each stage in your pipeline. For preview only the Dev stage will be available so you will only have a single log group for any given test game.
- When testing your game in the Test Harness you will find a link to your games log group in the upper right hand corner of the console. You can also access the log group manually by navigating to the Cloudwatch service in the AWS console. More information on the Cloudwatch integration can be found here.
API Comparison
GameSparks
// debug log
Spark.getLog().debug("my debug log");
// error log
Spark.getLog().error("my errorlog");
// info log
Spark.getLog().info("my info log");
// warning log
Spark.getLog().warn("my warn log");
Amazon GameSparks
// debug log
GameSparks().Logging().Debug("my debug log");
// error log
GameSparks().Logging().Error("my errorlog");
// info log
GameSparks().Logging().Info("my info log");
// warning log
GameSparks().Logging().Warn("my warn log");
10) How is the messaging system in Amazon GameSparks compared to GameSparks?
The SendNotification Cloud Code API in Amazon GameSparks is similar to the GameSparks SparkMessage Cloud Code API. The SendNotification API allows a notification to be sent from Cloud Code to the current player or another player. As Notifications are a message type on Amazon GameSparks they are configured in the message window within Cloud Code.
API Comparison
GameSparks
// send a notification to a player
Spark.message("myMessage").setPlayerIds(playerIds).setMessageData({"myMessage":"myData"}).send();
Amazon GameSparks
// send notification to the current player executing the handler
GameSparks().CurrentPlayer().SendNotification("Custom.Game.myMessage", {"Message":"Hello World!"});
// send notification to another player
GameSparks().Player(playerId).SendNotification("Custom.Game.myMessage", {"Message":"Hello World!"});
11) How is the snapshot management in Amazon GameSparks compared to GameSparks?
- In GameSparks snapshots are created in the Preview stage and then published to the Live stage.
- In Amazon GameSparks a snapshot is deployed to a given stage (e.g Dev). Code changes in Dev must be deployed via snapshot before they can be tested in that environment. For preview only the Dev stage will be available. Additional stages to test and publish games will be available when Amazon GameSparks is Generally Available.
12) How is the player data managed in Amazon GameSparks compared to GameSparks? Amazon GameSparks player storage APIs are quite similar to those found on GameSparks. Both allow you to set, get and remove data that is stored on the system player object. Player data can also be stored in a DynamoDB table using the DynamoDB integration.
API Comparison
GameSparks
// set data in player storage
Spark.getPlayer().setScriptData("myKey", "myValue");
// get data from player storage
Spark.getPlayer().getScriptData("myKey");
// remove data from player storage
Spark.getPlayer().removeScriptData("myKey");
Amazon GameSparks
// set data in player storage
GameSparks().CurrentPlayer().SetData([{"myKey":"myValue"}]);
// get data from player storage
GameSparks().CurrentPlayer().GetData(["myKey"]);
// remove data from player storage
GameSparks().CurrentPlayer().RemoveData(["myKey"]);
13) How do I get started with Amazon GameSparks?
Step 1: Game setup
- Download the GameSparks SDK
- Login or Create an AWS Account
- Create an Admin User Account
- Create a game backend
Step 2: Configure game
- Review the Developer Guide and API references
- Integrate with Lambda and Amazon DynamoDB
Step 3: Deploy and test
- Use the console to define game constructs and deploy the game for testing.
- Use the test harness feature in the console to directly connect to the game backend and verify business logic.
Step 4: Game-client Integration
- Download and install the Amazon GameSparks plugin for Unity.
- Integrate backend game client using a game key or the sample game available following steps in the Developer Guide.
14) What is the pricing model on Amazon GameSparks ?
Currently, there are no charges for using Amazon GameSparks while in preview, though you will be charged for other AWS services you use during that time. After preview, you will be charged for your usage of Amazon GameSparks. Usage is measured in (1) Cloud Code API calls between Amazon GameSparks backend and feature micro-services, (2) Client API calls between game clients and Amazon GameSparks backend, and (3) storage. For more information on pricing, please visit here.