No results found

Try a different or more specific query
Developer Console
Appstore Blogs

Appstore Blogs

Want the latest?

appstore topics

Recent Posts

Archive

Showing posts tagged with Game Engines

June 17, 2013

cjfrost

Some say the best developers code well because they optimize for their own laziness. They’ll invest time up front to automate a repetitive process, or extend existing code that gets them part way to where they want to be. In truth, most also struggle with the demon of NIH—Not Invented Here—because building something from the ground up scratches a programmer itch. It’s a fine line.

As the popularity of mobile devices has grown (exploded, actually) and mobile applications capture more and more eyeballs, competitive pressure is forcing more aggressive timelines. Many developers are leveraging game and application engines to speed time to market. As added benefits, these frameworks often simplify cross-platform development and reduce QA time as well.

In fact, ever since the original Kindle Fire was released in November of 2011, various game and application engines have been adding support for it. There are now several that enable building apps for Kindle Fire, can package them for the Amazon store, and provide direct support for Amazon services such as GameCircle and In-App Purchasing. I’ll list a few here and point you to more information for each, but first let’s mention their primary features and common benefits:

-          2D and 3D game development environments

Some game engines include sophisticated modeling environments that do the heavy lifting of code creation in the background, allowing you to concentrate on the story and game mechanics. They provide shortcuts to common patterns used in popular genres such as side-scrollers, puzzle games, and shooters.

-          Cross-platform simultaneous development

Engines can help you create apps for multiple platforms simultaneously, automatically generating platform-specific code as the app is designed. In many cases, all you have to think about is how your game will appear at the various screen resolutions available on different devices.

-          Ease of service integration

Most engines have plug-ins or extensions designed to allow easy integration of services like Amazon GameCircle, Insights, and In-App Purchasing. These service APIs can be pre-configured and included automatically when an engine-based project is built, so they don’t have to be added in a separate step.

Cocos2d-x (http://www.cocos2d-x.org) is a free, open-source 2D game engine based on C++. It supports multiple platforms, including Kindle Fire and iOS devices. A GameCircle extension to Cocos2d-x is included in the Amazon Mobile App SDK, simplifying integration of leaderboards, achievements, and Whispersync for Games into your Cocos2d-x projects.

For more information about our Cocos2d-x extension, see Amazon GameCircle Cocos2d-x Extension.

Corona SDK (http://www.coronalabs.com/products/corona-sdk/) is a 2D engine that allows developers and hobbyists to create games, as well as apps of other types, such as business, utility, education, productivity, etc. Using Lua, you can build and package apps for Kindle Fire, Android, iOS, and Nook using industry standards like OpenGL and Facebook APIs. Corona Enterprise SDK adds support for Objective-C and Java.

For more information about using Corona SDK with Amazon Kindle, see Signing and Building — Kindle Fire.

Unity3D (http://www.unity3d.com) is one of the most widely used and highly regarded 3D game engines for targeting mobile, web, desktop, and dedicated hardware such as smart TVs, set-top boxes, and consoles. Recently, Unity announced that Android developers can build games and apps with their engine for free. Unity includes a powerful 3D rendering environment featuring modern graphics and animation, and the Amazon Mobile App SDK includes Unity3D plug-ins to support GameCircle and In-App Purchasing.

For more about the Amazon store and Unity3D, see Amazon GameCircle Unity Plug-In and In-App Purchasing Unity Plug-In.

Many more game and application engines are available in addition to the ones listed above, some supporting Amazon services and Kindle Fire devices. Check your favorite engine for more information.

The engines are running… the green flag is up… Go!

April 23, 2013

derekgeb

Mad Menace Games is the creator of the popular game GraveStompers: Zombie vs Zombie. GraveStompers is a console-style 3rd person shooter with intuitive touch-screen controls in which zombie eradication has never been more exhilarating. One way Mad Menace monetizes their game is through the Amazon In-App Purchasing API to allow users to purchase Ghostface, the villain from the Scream movies. Since the game is built using the Unity game engine, Mad Menace Games uses the free Amazon In-App Purchasing API plug-in for Unity to support their monetization strategy. According to Michael Stragey, GraveStompers lead developer, the Unity plug-in made it extremely easy to accomplish this and release their game on Amazon. In this post, we look at the following 4 steps used by Mad Menace Games for supporting an entitlement in-app purchase in Unity:

  1. Setting up the Amazon In-App Purchasing Unity plug-in and test environment
  2. Launching the Amazon purchase flow
  3. Handling the result of the Amazon purchase flow
  4. Determining if the user previously purchased the entitlement

Step 1: Setting up the Amazon In-App Purchasing Unity plug-in and test environment

To start off, Mad Menace Games had to install and setup the Amazon In-App Purchasing Unity plug-in. To do this for your app, with your Android game open in Unity, you add the Amazon plug-in and support for In-App Purchasing to your environment by completing the following steps:

  1. Right click on Project Pane
  2. Select “Import Package/Custom Package…”
  3. Select the “AmazonIAP.unitypackage” that was downloaded as part of the Amazon Mobile App SDK and click “Open”
  4. From the import dialog click “Import” and this package will be added to your project
  5. Select the “Amazon” menu
  6. Click “Generate AndroidManifest.xml file”
     

There is only one more setup task now that the Unity environment has Amazon In-App Purchasing available and the application specifies this support in its manifest. As a developer, you need to set up your sandboxed test environment for running in-app purchasing transactions. This means you install the AmazonSDKTester.apk from the Amazon Mobile App SDK on your emulator or device and provide a JSON file detailing your IAP items. More details on setting up your test environment can be found here.

Step 2: Launching the Amazon purchase flow

With setup now complete, let’s take a look at the more exciting stuff. After installing the plug-in, Mad Menace Games added the code for supporting the sale of their character “Ghostface”. The first step is to add the code for launching the Amazon purchase flow UI when the user wants to buy the character. This can be easily done with the following code:

AmazonIAP.initiatePurchaseRequest("com.gravestompers.characters.ghostface");

The string “com.gravestompers.characters.ghostface” is the SKU of the Ghostface IAP item specified on the Mobile App Distribution Portal along with being defined in the JSON file for testing. These places are where you also specify things such as the type of in-app item (consumable, entitlement, or subscription), price, title, and description.

Step 3: Handling the result of the Amazon purchase flow

Now with the purchase flow being in place and the user actually able to make a purchase, code is required for handling the result of the purchase flow and providing the user with the actual Ghostface character. The response for this purchase flow will be returned via the AmazonIAPEventListener methods: purchaseFailedEvent and purchaseSuccessfulEvent. Below is an example of what Mad Menace Games’ code may look like for this.

void purchaseFailedEvent( string reason )

{

      // Log the reasons for failure

      Debug.Log( "purchaseFailedEvent: " + reason );

}

 

void purchaseSuccessfulEvent( AmazonReceipt receipt )

{

      // Store receipt and verify it is legitimate with Amazon Receipt Verification Server

      storeAndVerifyReceipt( receipt );

      if (receipt.sku == "com.gravestompers.characters.ghostface")

            unlockGhostfaceChacter();

}

As a best practice, we recommend validating the receipt you receive from a successful purchase via your server that stores these receipts. More information on validation of receipts can be found here.

Step 4: Determining if the user previously purchased the entitlement

After creating a fully functioning purchase experience, there was one final coding task Mad Menace Games had to complete. Once a user owns this character, they should be able to access the character if they uninstall and reinstall the app, clear their app data, or change from playing the app on their phone to playing it on their Kindle Fire HD. To help make life easier for developers, Amazon keeps track of these entitlement in-app purchases. As a developer, you can receive these purchases via the AmazonIAPEventListener’s purchaseUpdatesRequestSuccessfulEvent method. This method will be called anytime there are new entitlements the running app needs to process. Below is an example code snippet:

void purchaseUpdatesRequestSuccessfulEvent( List<string> revokedSkus, List<AmazonReceipt> receipts )

{

  // Process New Receipts

  foreach ( AmazonReceipt receipt in receipts )

  {

   // Store receipt and verify it is legitimate with Amazon Receipt Verification Server

      storeAndVerifyReceipt( receipt );

      if (receipt.sku == "com.gravestompers.characters.ghostface")

        unlockGhostfaceChacter();

  }

}

That is all it took for Mad Menace Games to add Amazon In-App Purchasing support to their GraveStompers Unity game. You can find more information on Amazon In-App Purchasing and the Unity plug-in here.

Want the latest?

appstore topics

Recent Posts

Archive