Appstore Blogs

Appstore Blogs

Want the latest?

appstore topics

Recent Posts

Archive

Showing posts tagged with Amazon Fire TV

April 30, 2014

Jesse Freeman

One Game, Everywhere

Gone are the days where you can make a game and publish it to a single platform and expect to be successful. Like any business that sells consumer products, you need to go where the people are. That means the games you make should run on a multitude of different platforms and accept any number of different input types. There’s also one more catch: your players expect to be able to share their game data across all of these different platforms, especially if they are paying for your game multiple times. With that in mind I have outlined what I call “responsive game design,” which is modeled loosely after some of the core concepts of responsive web design. It’s also a framework that will help you think about enabling your games to scale across multiple platforms.

Applying Responsive Design Concepts To Games

On the web, responsive design is a set of guidelines and best practices that help websites scale from desktop to mobile. Web developers discovered early on that it was too difficult to maintain separate designs for desktop and mobile so this solution allows a site to re-adjust to any resolution based on a set of ideal screen sizes. While responsive design on the web focused solely on adapting a site’s visual design based on common viewports, the notion of responsive game design builds on this concept to include other key aspects you need to consider when making multi-platform games.

Responsive game design can be summed up in the following key requirements:

  1. Game graphics and UI support multiple resolutions
  2. Game mechanics work across multiple types of input
  3. Publish to multiple platforms with the same codebase
  4. Saved data is synced across all platforms

While most of these are already best practice for games in general, the collection of them represent a guideline for game designers moving forward to help reach the broadest audience possible.

1. Scaling Game Visuals Across Different Resolutions

If you come from desktop game development this is not going to be a big shock to you since it’s common practice to support multiple-resolutions and varying computer performance. While mobile development is relatively new in this space, over the past few years, mobile device resolutions have tended to normalize around a few key aspect ratios (3:2, 4:3 & 16:9) allowing the same desktop game concepts to be applied:

  • Build for aspect ratios not fixed resolutions
  • Create simplified, dynamic UI that can adapt to different resolutions
  • Have degradable graphics that can adapt to the power of the device

It’s also important to note that optimizing a game’s graphics goes well beyond just the resolution. Each system has different performance so being able to dynamically scale the game’s visual effects across these different platforms is critical as well. Especially when dealing with high pixel density displays, you could actually end up pushing incredibly high resolutions on devices that can’t fully support them. Also you may need to tone down specific special effects on mobile verses desktop or perform special optimizations when going to TV to account for slower display refresh rates. Make sure that you take into account these limitations and plan accordingly.

2. Supporting A Single Control System Across Different Input Types

A single game can support three types of input (mouse + keyboard, controller and touch) based on the device they are on. While thinking through each of these inputs, game designers should consider how their game will work going from desktop to tablet to phone and TV. Will the controls hold up on a system without physical buttons or should the gameplay be simplified a bit to account for the lowest common denominator?

It’s completely possible to have games work with a single input mechanic but a lot of planning and consideration must go into the overall design of the game. Most devices accept a game controller at this point so while not ideal, players can still plug one in if virtual controls are too frustrating. It’s especially important to take into account that not everyone who plays your games will have access to a controller. The Fire TV ships with a remote by default so if you want to capture the largest audience possible you’ll want to make sure you support the remote out of the box. You can still publish a controller only game but keep in mind that each input limitation you place on your game shrinks your potential audience accordingly.

3. Publishing a single game from the same codebase.

For years, developers had leaned on C++ as a cross platform solution to making games that work across multiple platforms. A successful port could be anything above 50% core reusability. I still know developers who build their own game engines that allow them to manually port from platform to platform but that process can be time consuming and if you are a small indie developer, the additional bug testing time may not possible to maintain across all the devices you want to support. That is why it is critical to find a cross publishing solution you feel comfortable with.

The most popular game engine today for indies is Unity 3D. From there other solutions, which grow in complexity, are Unreal Engine, CryEngine. There also some smaller more specialized game engines like GameMaker Studio. If pre-built game frameworks are not your thing, consider some cross compilers like HaXe, Monkey and CocoonJS. Either way there are many options and each will have some kind of impact on your end result or the platforms you can reach so do your research while designing your game.

4. Saving State Across Devices

What good is having a game that can be played on multiple platforms but the player needs to restart their progress every time? A key component to the responsive game design concept is allowing a single game session to extend across different devices allowing your player to start on one platform and continue on another. Imagine being able to play a Fire TV game at home then continuing your game on the go on any mobile device?

Steam was one of the first game publishing platforms to introduce cloud based game saving and since then more companies have offered similar solutions. The biggest issue is that these services are platform specific. For a developer to support different platforms, they would have to roll their own solution. However, built into our GameCircle API is WhisperSync, which can be used to not only have cross platform leaderboards but also sync game data across different mobile devices.

By adding GameCircle’s WhsperSync to your game, you can leverage this to let your players go from mobile (iOS, Android and FireOS) to the Fire TV for the full 10-foot experience then sync their game data back across all of these devices. While GameCircle doesn’t support PC syncing today, being able to have a consistent saved game mechanism for your mobile and Fire TV builds is a huge advantage for your players and a step in the right direction.

Where Do We Go From Here?

While this is just the foundation for a larger concept in game design, it’s up to you as the game designer to help define and shape the future of what gaming on multiple platforms means to the player. At Amazon we are incredibly focused on the customer and we build tools to help you as the developer serve them better. Over the next few years we will see more and more games that reach across platform walls to enable a gamer to pick the device and play style they want and with the correctly designed game, that player will have the same experience no matter where they choose to play your game.

Resources:

- Jesse Freeman (@jessefreeman)

 

April 22, 2014

Jesse Freeman

I got my first game console, the original Nintendo, in 1985 and it forever changed my life. Today, kids take for granted how accessible and abundant games are. From computers to phones and tablets, all the way up to dedicated gaming consoles, the next generation of gamers has numerous choices to play any type of game they could imagine. For developers, this means that we have multiple options where we can publish our games. In our house, the Fire TV will be my sons’ first video game console. If you are like me and you always wanted to build games for the TV, the Amazon Fire TV now offers you that opportunity, and access to an entirely new generation of kids growing up as gamers. With that in mind, I wanted to share the three key concepts I have found help make games more approachable to kids.

1. Make Engaging Games for Kids

Most developers think of kids’ games as matching, interactive storybooks and simple learning apps. Just look in the kids section of any app store and you’ll see these in droves. While a few games for kids stand out, the vast majority doesn’t take into account the fact that kids like to be challenged just like traditional gamers do. Developers can incorporate the game mechanics that core gamers have grown to love and adapt them for kids. These kinds of games will not only entertain kids, but will teach them critical thinking, teamwork, and even help them build the skills to play more advanced games.

For example, last year, I focused on making games that were similar to the games I liked to play on Nintendo but with my three year-old son in mind. The best example of this was my space exploration game Super Jetroid.

In this game, the player is challenged to explore a cave on an alien planet and try to survive while balancing their energy, health and air supplies. It’s a difficult game to master and a style of gameplay that I have always loved (it was heavily inspired by the classic game H.E.R.O. on the Atari). While the main game is way too challenging for my son, I have added in some special things to help him also enjoy the game. Some things to keep in mind to making a difficult game more approachable for kids:

  • Add a kids mode where they have extra health or are invincible
  • Remember that kids want to play the same games they see others playing so think through how the difficulty ramps up in your own game as to not frustrate them
  • Allow kids to replay the same level over and over again so they can practice and get better at it
  • Reward kids for completing levels. Add lots of collectables in the game including secret areas.
  • Kids love to explore so be careful with timed levels, try to remove timers as much as possible so they can move through a level at their own pace.

2. Encourage Collaborative Play

I cherish my game playing time with my son. Not all games are designed to be played at the same time but there are still lots of ways you can collaborate and let kids be part of the action, even in traditional single player games. Super Jetroid has a familiar level selection menu that is common among casual games these days. If you do well on a level, then you’ll unlock the next one. There are two difficulty settings: the “Serious” setting targets core gamers and the “Have Fun” setting targets kids.

In the “Have Fun” mode, the player doesn’t take damage, and has unlimited air and energy. Suddenly, the game was easy enough for my son. All of the other challenges still exist but he was able to experience the same game. Also, we could take turns playing the game as I unlocked new levels and he plays the ones that I’ve already beaten but at his own pace. When he feels more confident about the level, he can switch it over to “Serious” mode and challenge himself. This way he self-regulates the difficulty and still feels like he is accomplishing something by playing each level on the “Have Fun” mode.

Right now, I’m expanding the game for Amazon Fire TV. As I do this I am working on building in a more collaborative experience, especially around local multi-player and puzzle solving so we can work as a team to complete levels together. The Fire TV offers a great opportunity, similar to dedicated gaming consoles, to support up to 7 controllers (assuming you have a mini clan of gamers at home). It also has a second screen experience with tablets similar to what the Wii U leverages so there are lots of great multi-player and collaborative mechanics developer can explore.

3. Simplify the Controls

Knowing that every Fire TV ships with the Amazon Fire remote is an incredible opportunity to think about designing kid-friendly games with the remote in mind. There are already some great games on Fire TV that do this, including Despicable Me: Minion Rush and Badland. It only makes sense that more casual one-button style games are a natural fit on Fire TV.  

For years, gamers said touchscreens would never be good enough for immersive games because of the lack of hardware buttons. Now we are starting to see that some of the most successful games, such as Angry Birds, are the ones being built for touch. Building game controls that work on TV have their own set of limitations similar to what early mobile game developers faced. As developers, it’s up to you to think through how to make the best game possible with the broadest audience in mind, especially if you are designing for a younger player. Designing for the remote as the primary input for your game will not only capture the audience of Fire TV owners, but it also makes it easier for younger children to play. My son moves effortlessly from remote to game controller without a care in the world; he actually favors the remote since it’s easier to hold and use in his smaller hands.

In Super Jetroid there are only 3 buttons: left, right and up. On Fire TV for example, the game can be played with the remote or the controller for more precision. Even on touch screens the simplified controls work with a single virtual joystick and on desktop the keyboard. Across all of these different ways of playing I strive to have the game’s controls adapt to the device it is being played on so that anyone can simply pick up the game and play without a steep learning curve.

Start Building Games For the TV Now

While traditional console game development is still out of reach for most, the Fire TV enables developers to target the casual gaming audience right now. It’s also an opportunity to be one of the first TV-based games that kids play. There is no doubt in my mind that the types of games my son plays on the Fire TV will be his favorites for life, just like I still hold onto Mario, Zelda and Mega Man from my early gaming days. Even better, many of the games my son plays on the Fire TV are also with him on his Kindle Fire. The power of having the same game on tablet and TV with dedicated controls tailored to each experience has me incredibly excited as a game developer. This is a great opportunity to help shape the interests for the gamers of tomorrow by building fun, accessible, kid friendly games today.

So pick up a Fire TV and start making games for it as soon as you open the box!

Additional Resources

- Jesse Freeman (@jessefreeman)

 

April 17, 2014

David Isbitski

Amazon Fire TV offers your existing Android apps an entirely new set of potential customers to engage with. It also gives your customers the ability to experience your app across Kindle Fire Tablets, Android phones and tablets, and now Amazon Fire TV – all through the same Amazon Appstore. If a customer has already bought your app that you have made available for Fire TV, they can download it onto their new Amazon Fire TV instantly, without having to purchase an additional version. 

Adding Amazon Fire TV support to your existing Android App is as simple as following a few guidelines, compiling and uploading a new TV version of your apk, and then adding Amazon Fire TV as one of your app’s device targets inside the Developer Console.  

Amazon Fire TV opens up new discoverability possibilities for your app across many new customers. Most updates to your apps for Amazon Fire TV should be minor, and if you have been following the guidelines from Android on Designing for Multiple Screens all along, your app may already be ready for a large TV resolution. 

While you may be familiar with targeting Android tablets and phones, there are a few things you need to consider for your app to run correctly on Amazon Fire TV. This includes understanding the layout, dimensions and orientation of Amazon Fire TV views, changes to the user experience when interacting with a TV (10’ away on average), UI and navigation patterns, as well as some other TV-specific gotchas such as overscan and color reproduction.

Understanding Amazon Fire TV Video Output

You can think of the Amazon Fire TV screen as an Android device that is locked to landscape orientation, with a constant width of 960dp and with a height of 540dp. The rendering surface is always 1920x1080 with a screen density of 320dpi. Output is automatically scaled for 720p and 480p output resolutions.

The following table shows how the various video outputs of Amazon Fire TV map to their Android counterparts.

TV setting

Output resolution

(pixels)

Render surface

(pixels)

Density identifier

screen density

(dpi)

Display resolution

(dp)

Screen size identifier

1080p

1920 x 1080

1920 x 1080

xhdpi

320

960x540

large

720p

1280 x 720

1920 x 1080

xhdpi

320

960x540

large

480p

640 x 480

1920 x 1080

xhdpi

320

960x540

large



By following the Android best practices guide for Supporting Multiple Screens, you can create a different layout configuration just for Amazon Fire TV so that your existing layout adapts when it runs on the device. This is the same process you are most likely already using for generating different drawables and layouts and including them in your app’s /res directory. 

You can get a detailed overview of the resource configurations available for Amazon Fire TV here.

Thinking About the 10-Foot User Experience

TV interfaces in general are often referred to as 10-Foot User Interfaces (10-ft UI) because the user is viewing the screen from 10 or more feet away. Although the screen itself can be very large, the screen resolution is lower, and distance from the screen means a smaller angle of view.

The design choices you would make for an application or web page running on a desktop computer, tablet, or phone are fundamentally different from those of a TV, as users typically view those screens from much closer distances. In addition, as the television is used in a more relaxed fashion than a computer, a tablet or a phone, the UI on the TV should not require as much attention and precision. 10-ft UI may require you to rethink the design, layout, and navigation of an existing app.

Keep the design of your screen in a 10-ft UI simple and clean, with low information density. Limit the number of design elements or UI components (menus, buttons, images) on the screen, and ensure that those elements are large enough and spaced far enough apart to be read from a distance. Present a clear set of actions or options for each screen. Minimize the amount of text, as users do not read a lot of text on a television screen. Avoid requiring the user to input a lot of information and provide reasonable defaults where possible.

In your existing Android app for a phone or tablet, you can assume that touch is always present, and your UI elements reflect that. For example, if I run the existing Android Snake Game from my AWS re:Invent 2013 demo on a Kindle Fire, tapping the menu button with my finger brings up the standard Android options menu.

Figure 1- Android Options Menu for Touch on Kindle Fire

However, running the same app on an Amazon Fire TV shows a slightly different experience when interacting with the options menu. Instead of tapping our finger on a screen, we press the Menu button on the Amazon Fire TV remote or game controller, which brings up the Android options menu with the first item in the ListView (“New Game”) automatically highlighted.

Figure 2- Android Options Menu on Amazon Fire TV automatically highlights currently selected item for the user

This allows your users to know exactly where they are in the options menu. Pressing the SELECT button on the remote (the A  button on a game controller) raises that UI element’s ItemSelected event . 

Note that all of this works automatically, and you do not have to wire up any of the on screen highlighting for any of your user interface elements – that is done for you by FireOS itself. This does, however, affect the flow of interaction your customer has with your app when using a remote or a controller. Thoroughly test your app running on a TV screen with a remote or controller and make changes to the interaction where appropriate. 

For more helpful tips on modifying your app to work with remote and controllers be sure to check out our post with helpful tips.

Updating Your Android Views for TV

The Amazon Fire TV screen is always displayed in landscape orientation, with a display resolution of 960dp wide and 540dp high. In terms of Android supported screen size configurations, you should target large. If you have not created any large-screen assets, you need to verify that your existing sizes scale well.

Depending on the orientation you are using for your existing Android app, you may see some inaccurate screen sizing when running against the TV screen for the first time. In the example below I am using the code from my previous Ad Mediation post, which was set to run in portrait. 

Figure 3- App scaling and running in forced landscape

The first time the app runs you can see the scaling that occurs to accommodate the device screen size for an app forced into portrait mode. To fix this, call setRotation on any View like so:

 
myView.setRotation(90f);

This rotates the current view 90 degrees and places it into landscape mode. Another way to do this is to set the orientation of your main view inside of its layout file so that all children are rotated as well.

In fact, simply updating the orientation of the View of my main activity to run horizontally instantly fixed all of my screen issues and my app ran perfectly.

Figure 4- App scaled correctly and set to landscape

When testing out the Snake Game from the above example, I encountered a similar scaling and rotation issue.

Figure 5- Snake Game Demo running incorrectly

Instead of setting the orientation of the entire View you can also change the orientation of your activity itself. For example, inside the androidmanifest.xml file for my game, I provided an attribute for the orientation of the SnakeGameActivity.

Setting the android:screenOrientation to be landscape fixed all scaling issues with the game and made it instantly playable.

Figure 6- Snake Game fixed and running in landscape

With just a few adjustments to your apps’ Android Views and updates to their associated resource images, your apps can be displayed on an Amazon Fire TV connected screen with minimal changes.

Understanding TV Overscan, Text and Color

Overscan is the physical space TV hardware manufactures reserve around the displayable area of a TV screen and something you should be aware of when targeting Amazon Fire TV with your app. This space can exist on TVs of any size and limits the area in which your app is able to render its user interface. 

Figure 7- TV Overscan examples.

To avoid any issues with overscan, I recommend that you avoid placing any of your app's UI elements within the outer 5% of any edge on the screen.

Any onscreen text or UI elements should be fully within the inner 90% (the safe zone) of your user interface. Your text should also use larger type sizes (at least 14sp) so that they are viewable on large screens. Amazon Fire TV uses Helvetica Neue Regular as the system font throughout all of the system’s interfaces.

When testing your app you may also find that the colors are not represented the same when shown on a TV display as they are on a tablet. Because TV screens have a higher contrast, they have a tendency to make colors seem more saturated, brighter, and vibrant. The range of colors that can be displayed is also less than that of a PC or mobile device screen. Cool colors (blue, purple, grey) work better than warmer colors (red, orange) on a TV and a good rule to follow is to avoid using less saturated colors in your apps.

Figure 8- Color Saturation on TV Displays

Understanding Amazon Fire TV Navigation

If you choose to add an updated user interface to your app to better match that of Amazon Fire TV’s UI, there are a couple of guidelines you should follow. 

Figure 9- Navigation Screen Types on Amazon Fire TV

All navigation starts with the home screen which consists of a global navigation menu on the left and a set of content tiles on the right. 

Figure 10 - Home Screen

The global navigation menu is the primary system menu. It appears in a row on the left side of the screen. The global navigation menu allows the user to choose major content categories or other options including Search, Home, Movies, TV, Music, Games, Apps, and so on. Each item in the global navigation menu can be selected with the Up and Down directional buttons.

When the user focuses on any item in the global navigation menu, the home view for that node appears on the right side of the screen. Each node has its own home view with its own content. The overall system home view, sometimes called the launcher, is accessible with the Home key on the Amazon Fire TV remote, or by selecting Home from the global navigation menu.

Figure 11- Outer Space Has Been Focused on by User

Each home view contains multiple horizontal content rows. The title tile for the row indicates the type of content (for example, Most Popular, My Movies, Recommended for You). The remaining tiles show examples of that content. From these content rows, the user can:

  • Navigate between rows with the Up and Down directional buttons.
  • Move back to the navigation menu with the Left button.
  • Choose Select or Right to select a row and view a 1D list for that row.

Be sure to check out the Design and User Experience Guidelines for additional information on all of the screen types and important tips on creating an engaging user experience for Amazon Fire TV.

In addition to the global navigation, menu notifications are also displayed in a certain way within the base Amazon Fire TV user interface.

Figure 12- Informational Notification

Amazon Fire TV includes three kinds of notifications you can use inside of your own apps: Informational, Media and Modal. Informational Notifications can be used for general messages to the user, with optional actions. Media Notifications are used when the user is interacting with media inside your application (music with artist and title for example). Modal notifications are used for alerts that require user input. Modal notifications may appear at any time over your application. A modal notification takes the focus and the user must take actions to dismiss that notification.

Note: Modal notifications can only be generated by the Amazon Fire TV user interface in response to critical issues (such as an unavailable network connection). System-wide modal notifications cannot be generated by individual apps. You can use alert dialogs (AlertDialog) to create modal alerts within your app.

Figure 13- Modal Notification

Amazon Fire TV Notifications are slightly different from standard Android Notifications. Although the API for Android notifications is available in the Amazon Fire TV SDK, and apps that use that API will compile, standard Android notifications do not appear in any way on Fire TV. You must convert your app to use the Fire TV notifications API. 

One you have installed the Amazon Fire TV SDK Add-on, you will then need to import the Amazon device notification namespaces:

	import com.amazon.device.notification.AmazonNotification;
	import com.amazon.device.notification.AmazonNotificationManager;

Next, use AmazonNotification.Builder to create a notification object, as you would a standard Android Notification. The AmazonNotification.Builder class has a new required method, setType(), which indicates the type of notification. You have these notification types to choose from -- TYPE_INFO maps to Information Notifications and TYPE_MEDIA corresponds to Media Notifications.

Once you decide on the type of Notification to create you need to set up the Builder object like below:

 	AmazonNotification.Builder builder = new AmazonNotification.Builder(getApplicationContext());
	builder.setSmallIcon(R.drawable.notification_icon);
	builder.setContentTitle(title);
	builder.setContentText(text);
	builder.setType(AmazonNotification.Builder.TYPE_INFO);

Lastly, register the Notification object with the AmazonNotificationManager, as you would a standard Android Notification. You should also assign it an ID to update or cancel the Notification later.

 
        AmazonNotificationManager notificationManager = (AmazonNotificationManager)     
        getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.notify(notificationId, builder.build())

Please note that unlike the Kindle Fire, there is currently no Notification Tray on Amazon Fire TV so if your customer is in an immersive mode app, they will not see the Notification.

For full details and more sample code on implementing notifications, check out our developer documentation here.

Handling Web Content

If your app contains any web content, you will need to do some slight modifications. By default, Amazon Fire TV does not include a Web Browser, but web content is allowed using the Android’s WebView. To use web content, set the WebClient of the WebView and override url overloading. This can be done by calling the setWebViewClient method of the WebVew to a new WebViewClient whose shouldOverrideUrlLoading property has been set to return false. 

This code ensures that your app does not attempt to load an external browser with web content and instead loads it into the WebView. You can see the url being loaded successfully into the WebView below.

Figure 14- WebView HTML content loaded successfully

Note that if you attempt to do a direct call to WebView.loadUrl without setting a new WebViewClient whose shouldOverrideUrlLoading method returns false like above you will see an error like this one:

Figure 15- webview.loadUrl security message

If you would like to link to other apps on the Amazon Appstore, for example, to cross-promote your own offerings, you can also use Android Intents with amzn:// urls, just as you can on the Kindle Fire. If you “deep link” to an app that is not ready for Amazon Fire TV we still show the detail page for the app, but customers are not able to download it. Check out this post for more information.  

Conclusion

Once your app is updated for Amazon Fire TV, your app’s listing on the Amazon Appstore runs across all the available devices you chose when you submit your app. Customers pay for your app once and begin to engage across all of their Kindle Fire tablets, Android phones and tablets, and now Amazon Fire TV. The opportunities for your customers to discover and engage with your app continue to grow!

In addition to the tips I’ve included here, be sure to check out these additional resources:

Purchase an Amazon Fire TV

Amazon Fire TV SDK Frequently Asked Questions

Amazon Fire TV SDK

Device Specifications

Display and Layout

User Interface

Design and User Experience Guidelines

Android Developer Multiple Screen Guidance

Supporting Different Screen Sizes

Supporting Different Densities

-Dave (@TheDaveDev)

 

April 10, 2014

Jesse Freeman

Add Remote and Game Controller Support to Your Amazon Fire TV Game in ­10 Steps

One of the most exciting prospects of publishing your game on Amazon Fire TV is that you can run Android games directly on the TV. If you are already building games for Android, you can use the same codebase you currently have, and make that game playable on Amazon Fire TV.

One thing to consider is how to add support for user input from the newly announced Amazon Fire TV remote and Amazon Fire game controller. Luckily, basic controller support is already built into Android.  You can leverage the Android input device APIs and the game controller API from the Amazon Fire TV SDK to get your game ready to publish in no time. Here are the top ten things you should do in order to get your game ready for Amazon Fire TV customers.

1. Think Remote First

An Amazon Fire TV remote is included with every Amazon Fire TV. That means at the very least, your app should support simple four-way navigation and selection input from the remote itself. Let’s take a look at the button layout:

 As you can see above, the remote has a standard set of navigational buttons and a single selection button in the center. That is your player’s primary means of input.  The remote also has some additional proprietary buttons including home, back and menu buttons which respond exactly how you would expect them to on any Android device. I highly suggest referring to the Guidelines for Controller Behavior for our recommendations around supporting the Amazon Fire TV remote in your game.

Also consider that the Amazon Fire TV remote is the most common input device users of Fire TV use. By designing games that will take advantage of the remote, you increase your chances of appealing to a broader audience. While you can publish games that only use the Amazon Fire game controller to the store, keep in mind that not everyone has a game controller -- those games that leverage the remote input will have a broader audience appeal.

2. Navigating the UI with a Remote

Now that we have gone through basic remote input, let’s look at how to implement the user flow in your game’s navigation. When it comes to basic UI, I simply focus on supporting 6 core inputs you receive from the Amazon Fire TV remote:

Action

Amazon Remote Button

Amazon Game Controller Button

Other Game Controller Button

Behavior

Select/
Main Action

D-Pad Center

A

A

Select the item in focus, confirm menu options or prompts, or perform the main game action.

Cancel/Back

Back

Back

B

B

Cancel the current operation, or return to the previous screen.

 

Intercept this action to provide confirmation dialogs ("Are you sure you want to quit?")

Up

Down

Left

Right

D-Pad

D-Pad

Left Stick

D-Pad

Left Stick

Move the input focus in the appropriate direction.

 

On game controllers, the left stick should have the same behavior as the D-Pad.

It is critical that you design your UI with the remote in mind. This means putting the starting focus at the correct location in the UI. This is often the most likely object your users will interact with first. Let’s look at a simple weapons store screen in Super Resident Raver and see how the UI flow works with basic directional input events:

 

Here you can see the game places the player’s focus in the store area, at number one. From there, the player can move DOWN to buy something via the Buy button, or continue moving down to the Continue button to move to the next screen. When the player is inside the actual store area, they can move from item to item using the LEFT or RIGHT navigation buttons. If they move up from the top of the item area or down from the Continue button, the focus moves to the Quit Button and the entire UI makes a full circle.

Not only should it be clear where the player can navigate to, but the game should also make sure that UI flow never lets the player get stuck or makes the user keep back tracking to find the operations they want, or missed when moving around too quickly.

3. Capturing Remote Key Events

Android has built-in support for D-Pad key events. These function similarly on the Amazon Fire TV as they did in the past when Android phones had rocker D-Pads. Let’s walk through a quick example of how to actually implement this in your own game. Just like you would support this in any Android project, simply override the onKeyDown() method in your View and use a switch statement to test the key code value that gets passed in.

Here we have some basic logic that captures the main input events from the Amazon Fire TV remote.

@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    boolean handled = false;
 
    switch (keyCode){
        case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_BUTTON_A:
                // ... handle selections
                handled = true;
                break;
        case KeyEvent.KEYCODE_DPAD_UP:
                // ... handle up action
                handled = true;
                break;
        case KeyEvent.KEYCODE_DPAD_RIGHT:
                // ... handle right action
                handled = true;
                break;
        case KeyEvent.KEYCODE_DPAD_DOWN:
                // ... handle down action
                handled = true;
                break;
        case KeyEvent.KEYCODE_DPAD_LEFT:
                // ... handle left action
                handled = true;
                break;
     }
     return handled || super.onKeyDown(keyCode, event);
}

Now we have the building blocks for moving through our game’s UI, and we can also use this code for simple movement in a game. In addition, you can build upon this foundation by adding support for the Amazon Fire game controller.

4. Adding Controller Support

Amazon Fire TV supports up to seven Bluetooth gamepads at the same time. Here is the key layout for the optional Amazon Fire TV game controller.

Since controller support is built into Android, if you have previously worked with adding controllers to your Android game, working with Fire TV controllers will be very familiar. Leverage the default onKeyDown() method for the controller buttons just like we used for the remote, and use onGenericMotionEvent() for capturing the joystick’s movement events. This is a key concept to understand since it means if you build your game to support navigation or in-game control via the built-in KeyEvent handler, you won’t have much additional work to do in order to capture the analog movement events from the controller that are not part of the remote.

Let’s look at the two  methods in Android for handling the Amazon Fire game controller events. The first is exactly the same as what we use for the Amazon Fire TV remote support:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    boolean handled = false;
 
    switch (keyCode){
        case KeyEvent.KEYCODE_BUTTON_X:
                // ... handle x button 
                handled = true;
                break;
            }
     return handled || super.onKeyDown(keyCode, event);
}

When it comes to dealing with movement input from the joystick, the second override we can make to capture those events are part of the View’s onGenericMotionEvent() method like this:

@Override
public boolean onGenericMotionEvent(MotionEvent event){
    // get changes in value from left joystick
    float deltaX = event.getAxisValue(MotionEvent.AXIS_X);
    float deltaY = event.getAxisValue(MotionEvent.AXIS_Y);
           
    return true || super.onGenericMotionEvent(event);
}

You can see the full list of controller input events here. As you may have noticed from the reference table, especially with the D-Pad controls, there are primary and secondary events. While the most granular way of getting analog movement input from a game controller is the MotionEvent, the secondary event is a useful fallback that allows you to support the Amazon Fire TV remote and Amazon game controller at the same time. Another example of this is the A button which has a secondary event of KEYCODE_DPAD_CENTER.

If your game only supports the D-Pad, take advantage of the onKeyDown() method and listen for the secondary event types while ignoring overriding onGenericMotionEvent(). Likewise you can simply listen to KEYCODE_DPAD_CENTER events ignore KEYCODE_BUTTON_A events for the controller’s A button. This ensures that your game works with the included Amazon Fire TV remote and also the optional Amazon Fire game controller. The only caveat is that if you listen to both primary and secondary events you may get multiple events saying the same thing so be prepared to handle that in your code.

5. Using the GameController API

Using the built-in event handlers is helpful for Android-based games that use of Views, some games may use a custom engine or need more direct access to the current input event on a frame by frame basis. The GameController API, part of the Amazon Fire TV’s SDK offers the following things:

  • Methods to associate game controllers with the player numbers as defined by the Amazon Fire TV.
  • Methods to query controller state at any time.
  • Input event constants specific to gamepads.
  • Behavior to enable you to process gamepad input events on a per-frame basis (that is, within a game loop).

To use the GameController API simply import the correct classes from the SDK:

import com.amazon.device.gamecontroller.GameController;
import com.amazon.device.gamecontroller.GameController.DeviceNotFoundException;
import com.amazon.device.gamecontroller.GameController.PlayerNumberNotFoundException;
import com.amazon.device.gamecontroller.GameController.NotInitializedException;

From there you will have to initialize the GameController in your onCreate() method:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //...
    //Initialize GameController with the context to attach to the game controller service
    GameController.init(this);
}

If you don’t initialize the GameController before accessing any of its APIs, it throws a NotInitializedException exception. Once you know it is properly initialized, you can begin using it. Here are some important APIs to get more granular data over each controller’s input state:

  • Getting GameController Objects by Player - simply use GameController.getControllerByPlayer() and supply the player number for access to that particular controller. There is a constant you can use to iterate through all the controllers called GameController.MAX_Players, which is capped at 4 by default.
  • Test for Key Down - Once your have the reference to the player’s controller you can call getKeyValue() on it and pass in a constant such as GameController.BUTTON_TRIGGER_LEFT to see if that key is pressed. It will return a true or false value.
  • Get Axis Value - Likewise you can also access the analogue stick by calling getAxisValue() on the reference to the player’s controller and supply a constant such as GameController.AXIS_STICK_LEFT_X to return a float value you can use to determine the direction it is being pushed in.
  • Testing Changes In Value - Finally you can test if a change has occurred since the last frame by calling getAxisValue() and supplying a constant such as GameController.AXIS_STICK_LEFT_Y. This will return a Boolean to help you decide if you need to apply a new change in the game.

While the above code is simply here to illustrate how this works, I suggest going through the GameController API documentation to see more sample code that you can use in your own game. Also, make sure you check out the GameController Event Constants as well.

6. Supporting Multiple Controllers

Now that we have covered the basics of the GameController API, let’s talk about multi-player games on the Amazon Fire TV. While you can connect up to seven Bluetooth game controllers to the Amazon Fire TV, only four of those controllers are assigned to player numbers in the GameController API. Getting the player’s number from the API is an easy way to manage your game’s players. You can use this by calling GameController.getPlayerNumber() and supply an Android Device ID to get the player number for that device. Likewise, there is a helper method to get you the Android Device ID if you call GameController.getDeviceID() and pass in a player number. You can iterate through all the devices by using the GameController.MAX_PLAYERS constant.

If your game supports more than four players, you can manage controllers and player numbers manually. For most games though, four is a great experience for local multi-player and you will find that the Amazon Fire TV is more than capable of keeping up with the action. While you can also do remote multi-player via standard networking APIs, keep in mind that you will have to manage that system separately from the game running on the Amazon Fire TV.

7. Handling Interruptions In Your Game

Your game should be prepared to handle interruptions. At the very least, make sure you support Android’s native onPause() and onResume() methods in your View. This is critical when the following events or situations happen:

·         Remote or Controller Drops - if you lose the connection to the main input of the device, possibly due to a battery or connection issue, you want to make sure your game is able to pause itself immediately. You should also build in some simple way to test that the controller is still active. This is critical in multi-player games; if one player drops you need to immediately pause the game.

·         User Presses the Home Button - if the user presses the home button on the controller, no event is raised, but onPause() is called. Your game exits back to the home screen.

·         User Performs a Search - once the user tries to perform a search, the event cannot be intercepted and onPause() will be called in your View.

·         User Presses the GameCircle Button - this immediately takes the user to the GameCircle dashboard while in your game.

It’s also important to capture ‘back’ events and handle exiting the game from a ‘back’ button properly. If you are on the home screen of your game and you receive a back button event, your game should prompt the user if they actually want to quit.

8. Building Controller Friendly UI

Each interactive UI element should have the following states:

  •           Enabled
  •           Disabled
  •           Highlighted
  •           Selected

These states are critical to helping your player understand where they currently are in the UI and also what action they can do. Sometimes you may need to have multiple states such as Disabled Selected in the case of the Resident Raver store scenario where it’s possible to select an item that can’t be purchased just to see what the price is.

On the same topic, it’s also important to take the Highlight state of the other UI elements into consideration. Here is a screenshot with the main UIs Selected states visible.  The selected state moves as the player moves around from main UI element to main UI element.

Finally, no matter what you end up designing, make sure there is consistency in each button state so that the player can intuitively understand where they are on the screen and what they need to do next.

9. Handling Joystick Dead Zone

Like all controllers, the joystick needs to be properly calibrated. Many things can happen that may mess-up the alignment of the joystick. At the very least, you need to account for adding a joystick dead zone to ignore joystick movements that are not large enough to cause an actual require a movement event to be recognized. Here is an example of how you can calculate this by using the GameController API.

gameController = GameController.getControllerByPlayer(1)
float x = gameController.getAxisValue(GameController.AXIS_STICK_LEFT_X);
float y = gameController.getAxisValue(GameController.AXIS_STICK_LEFT_Y);
float value = (float) Math.sqrt(x * x + y * y);

Here the formula returns a value between 0 and 1. You can choose how aggressively you want to ignore controller drift. A good place to start is somewhere above 0.25f - 0.35f. Test that the value is greater than your allowed dead zone value before applying the movement. In addition to this, I also suggest allowing the user to recalibrate their joystick in the options menu. Nothing is more frustrating than an unresponsive or “sticky” joystick control in a game.

10. Clearly Display What the Controls Are

Before any of my games start, I always show a screen with the game’s controls. While most people skip right over this, there will be a few who stop to read it in order to figure out what they will need to do in the actual game.

This also means making sure you remove any reference to touch controls, especially if you ported the game over from mobile. Also make sure you remove on screen pause buttons and sound buttons. Sound in your game should be managed via the TV’s remote. The only exception is if you have two separate user configurable volumes for the sounds effects and music which I would still keep in as long as it can be modified via the remote or controller directly.

Wrapping Up

There is a lot to consider as you begin to add support for the Amazon Fire TV remote and Amazon Fire game controllers to your game. It helps to take a step back and map out how this should all work. Having poor controls in your game will not go over well with your players, so nailing tight, responsive, and intuitive controls is critical to launching a successful game on the Amazon Fire TV. Also,look to other similar TV based gaming experiences for inspiration on how your UI and game controls should work.

For More Information

Amazon Fire TV Remote Input: Learn how to handle input from the Amazon Fire TV remote.

Amazon Fire Game Controller Input: Learn how to handle input from game controllers (both the Amazon Fire game controller and other game controllers).

GameController API: The Fire TV SDK includes a utility API for games to help you manage game controller input. This API includes the ability to associate player numbers with controllers and to manage input events on a frame-based basis.

Identifying Controllers: Users may pair up to seven Bluetooth controllers to the device at a time. Learn how to identify different controllers paired with the system and interpret input from those controllers.

Controller Behavior Guidelines: For consistency with the Fire TV user interface and across different apps we suggest you implement the guidelines in this document for controller behavior.

Controller Image Assets: If your app or game provides instructions or help screens for how to use a controller, you may freely use the controller images and button hints on this page in your app.

 

- Jesse Freeman (@jessefreeman)

 

April 02, 2014

Mike Hines

Today, Amazon announced Amazon Fire TV, a new device that makes it easy for users to stream movies, TV shows, and music as well as download apps and play games right on the HDTVs they already own. For developers, Fire TV can help you increase your customer base by putting your app in the living room, in front of people who enjoy entertainment and may not have seen your apps before. To promote rich user experiences, Fire TV enables full-featured game controllers, Dolby Digital Plus Certified surround sound and more. Android developers will find that developing for Fire TV is familiar, and optimizing their apps for the new controllers and TV display will not require learning a new language or new frameworks. Click here to learn more about how to setup your Fire TV developer environment.

Built with High Performance Gaming in Mind

A room with a large screen TV and surround sound audio is a great environment for gaming, and Fire TV has the performance to deliver a great gaming experience. From its inception, Fire TV has been designed around optimizing HDTV displays and powering demanding applications. It uses a Qualcomm Quad Core Snapdragon Krait 300 processor with Adreno 320 GPU and 2GB of RAM to support high performance game experiences. (See all the tech specs here).

Fire TV also supports a variety of controllers to let you design the best experience for your users. Fire TV supports a d-pad remote control, along with multi-function game controllers. Multi-function game controllers enable much more engaging gameplay for the TV than a typical d-pad remote can.

Second Screen via DIAL

Second Screen is a technology that allows your Amazon Fire TV app to interact with other mobile devices using DIAL, an open standard that enables customers to discover and open apps on their television right from their tablet or phone. For example, a user can sit on their couch and use their Kindle Fire HDX to control an app running on their TV screen.

It’s Time to Start Thinking About the 10-foot Experience

Running apps on a television opens up unique experiences for customers. Users are (on average) 10 feet away from the screen with different viewing habits and expectations. For example, users don’t need to stop what they are doing to view your app. Users can see the TV screen while they are making breakfast, unlike when they’re on phones or tablets. It is also easy for multiple people to have a good view of the TV at the same time, something which can be hard on PCs or mobile devices. There are several ways to use these large-screen characteristics to your advantage. One idea is to use the TV display productively during times it would otherwise be turned off. For example, you could display traffic and weather information on the TV or even show a family calendar or bulletin board app on the TV. Another idea is to use the screen size to support multi-player games in which the users can play concurrently, each able to see the screen without difficulty, each with their own game controller.

Controllers

There are two kinds of controllers available for the Amazon Fire TV. They are:

  • Amazon Fire TV Remote- Included with your Fire TV and supports a variety of apps and games.
  • Game Controllers- Bluetooth wireless game controllers, like the Amazon Fire game controller, provide all the controls you need for a richer gaming experience. (Learn more about the Amazon Fire game controller).

The Fire TV remote and game controllers trigger logical default events, so the game controller will work predictably in standard Android UI widgets. For example, the Menu button on the controller will pass through to Android and invoke the Android context menu (OptionsMenu), and the Back button on the controller will be ingested like the back button in the Android UI. Events for the remote and game controller can be customized, and trigger special events you can detect.

Fire TV remote (shown below) comes with Amazon Fire TV. The remote supports the remote input events shown here. The D-pad on the remote fires keycode events (like KEYCODE_DPAD_UP) and navigates through standard Android controls, moving UI focus up, down, left and right. In many cases, navigation around your UI will work right out of the box and won’t require any special event handling. Since the remote is the default controller that ships with Amazon Fire TV, you should test to see that your app is functional with Amazon Fire TV remote, even if you have optimized for a game controller.

The Game Controller - Multiplayer support comes to your TV

The Amazon Fire game controller offers the same level of default support for standard Android navigation controls as the remote does, but optimizing your game for the game controller offers a lot of additional options; just take a look at the game controller controls in the picture below. Up to 7 game controllers can connect via Bluetooth to an Amazon Fire TV at any one time and each controller can be associated with a player ID, so multi-player support is a real option for you.

Integrated with Amazon Payment Services

When a customer buys a Fire TV and registers with their Amazon Account, they are already set up with their verified Amazon Payment profile. Your user is ready to purchase apps or in-app items with no further effort. Amazon Fire TV supports the Amazon In-App-Purchasing API so you can offer consumable items, permanently entitled items, and even subscriptions for sale in your app.

To help you tune your gameplay and monetization implementation, Amazon offers A|B Testing and Analytics tools that can help you hone your app for maximum user retention and optimized monetization. And all of these tools work on Fire OS devices and Android devices, and most will work on iOS devices as well.

Optimizing Your App for a TV Screen

To make your app look sharp on a TV, you’ll want to make sure you have a layout for tvdpi and xhdpi to support the resolution on living room TV screens. Unlike most Android devices, Amazon Fire TV will render your app on 720p or 1080p screens of any size, so you should plan for a range of screen sizes. It is also important to remember that your user will typically be 10 feet away from the screen, and may appreciate larger controls and dialog boxes. Common tweaks to make apps look better on TV include:

  • Increasing the sizes of fonts and buttons
  • More clearly identifying the “selected” item
  • Adding additional padding between all elements on the page
  • Consider using more muted colors. Bright colors tend to over-saturate on TV screens and may appear to bleed into adjacent pixels
  • Keep away from the edges as some TV’s may clip the edge of the screen

Three Steps to Get Your Android App on Amazon Fire TV

Because you can use the Android code you’ve already written, getting started is easy.

Here are three steps you take to make your game or app available on Fire TV:

  1. Make sure your app looks good on an HDTV and is optimized for the living room setting, where the user is typically 10 feet away from the screen
  2. Check to see if the Amazon controller defaults work with you app, or add some code so that it does work with the Amazon Fire TV remote and game controllers
  3. Submit (or re-submit) your app in the Developer Portal

Once submitted and approved, depending on your app’s compatibility, a user may be able to purchase your app on Amazon Fire TV, Kindle Fire, the Amazon Appstore website, or on the Amazon Appstore of other compatible devices. This means that if your app is available for Kindle Fire devices, Android phones, and Amazon Fire TV, your user will be able to purchase your app once on any of those devices and use it across any of the other compatible devices. Not only does this expose your app to new users, it also makes your app available on more screens so it can be in front of your existing customers more often.

Get 500,000 Amazon Coins through Appstore Developer Select

When you launch your app on Fire TV, you will be considered for the Appstore Developer Select program. As part of the Appstore Developer Select program, developers who support Fire TV can receive 500,000 Amazon Coins and create campaigns where customers earn those Coins when they purchase apps and games. This is in addition to the regular program benefits that include 500,000 mobile ad impressions, enhanced merchandising, AWS credits, and additional Amazon Coins incentives. See this blog post for more details on Appstore Developer Select.

Developer Resources

While you can develop Android apps for Amazon Fire TV without an SDK, Amazon does provide an SDK you can download that includes sample code, Javadocs, two .jar files for controller support and messaging, and guidelines for fine-tuning formatting for HDTVs.

Amazon Fire TV resources

Amazon Appstore resources

Get Your App Ready Now

 

Want the latest?

appstore topics

Recent Posts

Archive