Getting Started with OUYA Ebook free dowwnload

  

Getting Started with OUYA

A practical guide to developing games for the

revolutionary OUYA console Ruben Hoyos Robinson Moncada

  BIRMINGHAM - MUMBAI

  Getting Started with OUYA

  Copyright © 2014 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: May 2014 Production Reference: 2290514 Published by Packt Publishing Ltd.

  Livery Place

  35 Livery Street Birmingham B3 2PB, UK.

  ISBN 978-1-78355-145-3

  www.packtpub.com

  Cover Image by Ruben Dario Hoyos Useche and Robinson Alexander Moncada Velasquez ( rubendhoyos@yahoo.com , moncadarobinson67@gmail.com )

  

Credits

Authors Project Coordinators

  Ruben Hoyos Sanket Deshmukh Robinson Moncada Sageer Parkar Reviewers Proofreaders

  Casey Leonard Simran Bhogal Matthew Traylor Ameesha Green Preston Turner

  Indexer Monica Ajmera Mehta

  Commissioning Editors Martin Bell

  Graphics Erol Staveley Ronak Dhruv

  Acquisition Editor Production Coordinator Owen Roberts Kyle Albuquerque

  Content Development Editor Cover Work Neil Alexander Kyle Albuquerque

  Technical Editors Krishnaveni Haridas Ankita Thakur

  Copy Editors Aditya Nair Kirti Pai Stuti Srivastava

  About the Authors

Ruben Hoyos is a systems engineer specializing in mobile development, with over

  10 years of experience in IT projects, along with skills in project management and software development. He is also interested in video game development, augmented reality, and mobile technologies. He has experience in software development using technologies such as Microsoft .NET, Delphi, SQL Server, MySQL, and PHP. He is also interested in video game development using Unity3D and Vuforia. He is a certified Project Management Professional (PMP) from the PMI Institute. He is also certified in Microsoft Project. He has participated as a speaker in several events, such as Barcamp 2011, OUYA CREATE 2013, Barcamp 2013, Creative Transmedia 2013, and ViveLabs Ruta N (Medellin, CO).

  I would like to thank my wife Beatriz, my son John Paul, and all my family members for supporting me during this process. Also, I would like to thank the entire team at Packt Publishing; without them, this project would not be a reality.

  Robinson Moncada is a multimedia development technologist with over five

  years of experience in game development for PC and mobile. He has worked on a range of projects in modeling/3D animation, augmented reality, audio and video editing for video games and applications, and multimedia in biotechnology and military applications. He has experience in 3D modeling and animation programs, such as Maya, 3DMax, and Blender. He is also interested in video game development with Unity3D, Unreal UDK, and Vuforia (augmented reality).

  He has participated as a speaker in several events, such as Global Game JAM 2010, Expo Shangai 2010, Barcamp 2011, fLiSOL 2011, OUYA CREATE 2013, Barcamp 2013, Creative Transmedia 2013, and ViveLabs Ruta N (Medellin, CO).

  I'd like to thank my family for supporting me during this process.

  About the Reviewers

Matthew Traylor has been writing about software and games since the days of the

  TRS-80 and magazine program listings. He is a former technical writer for the first Linux certification program and a combat veteran. Recently, he founded the Sarissa Game Studio, a game development company that focuses on the implementation of conflict simulation and design using functional programming.

  Thanks to Steph, Dan, Hamburguesa, and all the fine folks at Packt Publishing.

  Preston Turner is a computer programmer who began programming at the age

  of 12. He has worked on projects involving general software development as well as game design across Mac, PC, and Android. He is self-employed and works with some of his friends on various projects.

   Support files, eBooks, discount offers and more

   for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch for more details. for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM

  

  Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

  Why Subscribe?

  • Fully searchable across every book published by Packt • Copy and paste, print and bookmark content
  • On demand and accessible via web browser

  Free Access for Packt account holders

  

  

  PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

  Table of Contents

  Chapter 1:

  

  

  

  

  

  

  

  

  

  

  

  

  

  Chapter 2:

  

  

  

  Table of Contents [

ii

  

  

  

  

  

  

  

  

  Chapter 5:

  

  

  

  

  

  

  

  

  

  

  

]

  

  

  

  

  

  Chapter 3:

  

  

  

  

  

  

  

  

  

  

  Chapter 4:

  

  

  Table of Contents

Chapter 6: The OUYA Marketplace

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

[ ]

iii

  Preface

  OUYA is the new video game console, announced in July 2012, based on the Android operating system. Its main challenge is to be an alternative for independent developers and small businesses that do not have direct access to the major consoles in the market. Its economy model is based on the freemium scheme, where all the games and content published on the console should have one free component and another that you can monetize. Welcome to Getting Started with OUYA, a book that will guide you through the wonderful world of this console: its hardware, its configuration, how to build your first project for the console, and how to make money with it. In the first three chapters, you will learn the general features of the console: origins, business model, technical prerequisites, and preparation of the development environment. In the next four chapters, the book explains the code base used to build video games for OUYA using the Unity3D engine Version 4.x. The last chapter shows the technologies that are being developed for the near future and that directly or indirectly impact the development and advancement of the console: Leap Motion,

  VR Oculus Rifts, and Arduino, among others. The aim of this book is to let the reader know all the requirements and the basic tools to start your game development projects for the OUYA console.

  To facilitate learning and practice during the course of this book, we will use a Lite version of our (the authors') project, THE LAST MAYA, a video game based on the mythological Mayan culture and the end of the world.

  Preface What this book covers

  Chapter 1 , Why OUYA?, describes the origins of the project, the company, and its

  business model and gives an overview of the types of content that can be published in the console.

  Chapter 2 , Setup Prerequisites, shows the readers all the technical prerequisites and basic configurations to prepare the development environment for Android. Chapter 3 , Setup Instructions for the OUYA ODK, explains how to create a new

  developer account on OUYA's site, how to download and install the SDK development environment for OUYA (the ODK), and how to configure the emulator.

  , Guidelines for Setting Up the OUYA ODK, explains the contents of the

  Chapter 4 ODK, installation and configuration of the ODK plugin to Unity3D, the starter

  kit, and common mistakes that can be made when starting a development project for the console.

  , Configuring the Controllers, explains how to start our first project for the

  Chapter 5 OUYA console and goes over the basic configuration of the main scene and the main character, their animations, and how to associate them with controls.

Chapter 6 , The OUYA Marketplace, explains how to program the monetization of our

video games using the integration features for OUYA's marketplace. Chapter 7 , Advanced OUYA Functions – Graphics and Controls, explains all the basics

  that readers need to know to optimize the graphics of their games, leveraging the capabilities of the TEGRA 3 graphics processor by Nvidia.

  Chapter 8 , The Future, describes all the emerging technologies that will impact the development and advancement of the console. What you need for this book Download the 4.x Version of the Unity3D game engine from https://www.unity3d. com https://devs.

  . You should also download the SDK for OUYA (the ODK) from

  ouya.tv/developers/odk . Moreover, you should have all the prerequisites for Android development.

  

[ ]

  

2

  Preface Who this book is for

  This book is for beginners and advanced programmers who want to build video games for the OUYA console. From beginners to advanced users, this book allows anyone to address various issues related to development projects for the OUYA console.

  Conventions

  In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows:

  c:\progs\ adt-bundle-windows-x86\sdk\extras\google\usb_

  "Open the

  driver\android_winusb.inf file with the Notepad editor or another text editor."

  A block of code is set as follows:

  ;OUYA Console %SingleAdbInterface% = USB_Install, USB\VID_2836&PID_0010

%CompositeAdbInterface% = USB_Install, USB\VID_2836&PID_0010&MI_01

  Any command-line input or output is written as follows:

  adb kill-server adb devices New terms

  and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Run the

  MANAGE

  | NETWORK option and configure your Internet connection." Warnings or important notes appear in a box like this.

  Tips and tricks appear like this.

  

[ ]

  

3

  Preface Reader feedback

  Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of. To send us general feedback, simply send an e-mail to feedback@packtpub.com , and mention the book title via the subject of your message.

  If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors .

  Customer support

  Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

  Downloading the example code

  You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com . If you purchased this book

  

http://www.packtpub.com/support

  elsewhere, you can visit and register to have the files e-mailed directly to you.

  Downloading the color images of this book

  We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: http://www.packtpub.com/sites/ default/files/downloads/1453OT_ColorImages.pdf .

  Errata

  Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.

  

com/submit-errata , selecting your book, clicking on the errata submission form link,

  and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support .

  

[ ]

  

4

  Preface Piracy Piracy of copyright material on the Internet is an ongoing problem across all media.

  At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

  copyright@packtpub.com

  Please contact us at with a link to the suspected pirated material. We appreciate your help in protecting our authors, and our ability to bring you valuable content.

  Questions

  You can contact us at questions@packtpub.com if you are having a problem with any aspect of the book, and we will do our best to address it.

  

[ ]

  

5

  Why OUYA?

  OUYA was officially announced on July 10, 2012, on the Kickstarter web portal. The project began with a funding goal of 950,000 USD to develop the console prototype. The project was financed by Kickstarter backers (this is the term that Kickstarter uses to refer to users who sponsor a project). Within 24 hours, they had already raised more than 2 million USD. By the end, they had reached 8.5 million USD. This makes OUYA one of the most popular projects launched on Kickstarter.

  In December 2012, the creators began delivering developer versions of the console. The launch of OUYA through Kickstarter was an innovative way to raise funds for financing. The first units were sent out to backers on March 28, 2013. After some delays, the console was thrown open for purchase to the general public on June 25, 2013.

  

OUYA's Kickstarter crowdfunding campaign

  Why OUYA?

  The publishing system used by major video game companies was one of the motivations behind the OUYA project becoming a reality. The big companies monopolize the market for video games, and independent developers need to pay a lot of money to publish their creations. OUYA changed this situation, allowing small developers to publish their work directly to final buyers without having to pay large sums of money to the big video game publishing companies.

  The official website of the company is http://www.ouya.tv .

  Technical specifications

  The OUYA system has the following technical specifications. The developer versions may vary slightly, but the retail OUYA console has the following standardized specifications.

  Hardware

  The specifications of the OUYA console unit are as follows:

  • It has a NVIDIA Tegra 3 (T33) processor (four cores). The processor is optimized for graphics processing and web browsing. It has a CPU clock speed of 1.6 GHz and a GPU clock speed of 520 MHz. Because it doesn't have to worry about battery life, OUYA runs this processor at the full clock speed all the time.
  • Optimized for video games with high graphical quality, including the reproduction of video in 1080p HD.
  • 1 GB LPDDR2 RAM.
  • 8 GB internal storage (expandable by means of an external hard disk via

  USB). Only approximately 6 GB of memory will be used. The remaining memory will be used by the Android and the OUYA OS. A 16 GB version has also been launched recently.

  • HDMI connection to TV to 1080p HD (one connection).
  • LAN Ethernet connection via an RJ45 port.
  • Wi-Fi 802.11 bgn.
  • Bluetooth 4.0 LE.
  • USB 2.0 (one port). This is the port where components such as mice, keyboards, and storage can be hooked up to. It is sometimes called the inbound USB port.

  

[ ]

  

8

  • Micro USB (one port). This is the port that you should use for hooking
  • >A wireless controller with a radio frequency of 2.4 GHz. This uses a standard Bluetooth connection.
  • A standard game controller layout (two analog joysticks, D-pad, eight action buttons, and one system button).
  • A touchpad, so that mobile games that are ported onto the system can be played more easily.
  • Battery operated; needs two AA batteries to power it.

  [

  

9

]

  OUYA to your computer for development purposes. It is sometimes called the outbound USB port.

  

The OUYA pack

Controller

  The specifications of the OUYA controller bundled with the console are as follows:

  Why OUYA?

  • OUYA supports up to four controllers, as shown in the following diagram:

  

The control pad

Software

  The default software specifications of OUYA are as follows:

  • Android operating system 4.1 Jelly Bean • Custom TV UI
  • It has an integrated storage, which allows us to search and download games

  (and other applications)

  • Includes the SDK for development (OUYA ODK), which is available online for download

  OUYA is more than a console – it's a business model

  The console is the beginning of an ecosystem of businesses that want to leverage e-commerce systems with the aid of the "micro" transactions system. Video games are the category leader of the applications market, beating competition from categories such as entertainment, utilities, and productivity according to the trends of software consumption in the information era.

  

[ ]

  

10

  • Selling the complete version of the video game (an unlocked version of the game or a version that has some restrictions removed)
  • Selling worlds or levels
  • Selling elements of the inventory, such as clothes, weapons, shields, and special powers
  • Daily Active Users (DAU)
  • Monthly Active Users (MAU)
  • Index, which combines Daily Active Users versus Monthly Active Users The OUYA portal offers some basic level of analytics for developers, such as downloads and purchases.
  • >Any content promoting hatred toward a person or a group of people for their race, ethnicity, religion, disability, gender, age, sexual orientation, or gender identity
  • Any content that promotes violence in the real world, in any form
  • Sexually explicit material is forbidden in the contents of the console and their applications
  • Content that infringes on any copyright; the creators of the content must respect intellectual property and third-party copyright laws, including patents, marks, commercial secrets, and laws of authorship and others laws of property that are guarded
  • Viruses, worms, malware, or any other items that may harm the gamers or the OUYA platform

  [

  

11

]

  The OUYA console is based on a system of monetization of games, referred to as the

  Freemium system, where the business model operates and consists of offering free basic services, combined with the option of purchasing additional items.

  The owner of a game published via the console has the opportunity to generate money in the following ways:

  The following variables are monitored in a Freemium business model:

  OUYA – content restrictions

  The company is very clear about the type of content that is permitted on the OUYA system. Explicit content is not permitted, including the following:

  Why OUYA? Marks or branding

  You can utilize the OUYA name, logo, and commercial mark, but you must respect that they are the intellectual property of the company, for which they should receive credit. OUYA has an official manual of corporate identity that should be used. You can

  https://www.ouya.tv/brand-guidelines/

  find it at .

  

The corporate logo

Content scope, applications, and social networks

  Besides the OUYA store, there are various media outlets, applications, and social networks that players and developers can use to reach out and make their games and content more popular. Some of these applications and networks include XBMC, TwitchTV, Onlive, VEVO, PLEX, and Crunchyroll, and we will learn about them in detail in the following sections.

  XBMC

  The XBMC media center is an open source multimedia entertainment platform under the GNU GPL license. Its official website is http://xbmc.org/ .

  TwitchTV

  TwitchTV is an original service where players enjoy sharing their games with other users. It also offers its own chat tools and channels. This website has been functioning since 2011. In November 2012, Planet Side 2 was released, the first game that natively supports TwitchTV capabilities, but many others are coming. This can be a fun tool to show others your skills in various game types. Its official website is http://www.twitch.tv/ .

  

[ ]

  

12

Chapter 1 Onlive Onlive is a video game distribution system that allows rental on demand (this

  means that you can rent the game for a few days or up to three years). This service is equivalent to cloud computing in the game industry, with the game being computed, rendered, and stored online. Onlive does not officially support OUYA, but you can get it to work by sideloading the APK on your system. Its official website is

  http://www.onlive.com/ .

  VEVO

  VEVO is a music video site owned by Sony Music Entertainment, Universal Music Group, Abu Dhabi Media Company, and Arthur Music Company. EMI Music has given them the license to reproduce its content. Its official website is

  http://www.vevo.com/ .

  PLEX PLEX is a media center that lets you organize the library of movies, series, and music.

  We can play it from the OUYA console and create a system of positive feedback for all the items related with high-level interactive content. Its official website is

  http://www.plexapp.com/ .

  Crunchyroll

  Crunchyroll is an American website and international online community focused on streaming media such as anime, manga, music, video games, and racing from East

  

http://www.crunchyroll.com/

Asia. Its official website is .

  The important point is that you have software and services that attract users. The OUYA development company is in talks with Hulu, Netflix, Amazon, and Google for their services.

  

Development tools to build video games

for OUYA

  In this section, we'll take a look at some of the developer tools for the OUYA system.

  

[ ]

  

13

  Why OUYA? Adobe Air

  Adobe AIR is a free development framework and platform to create games and applications for mobile devices; it allows developers to create games for the OUYA console as it allows the creation of native applications for Android.

  http://www.adobe.com/devnet/air/air-sdk-

  Download the software from download.html . The official documentation for OUYA can be found at https://devs.ouya.tv/ developers/docs/adobe-air .

  Download the examples for OUYA from https://github.com/ouya/ouya-sdk-

  examples/tree/master/AdobeAir .

  Android SDK/NDK (Java or C language)

  The Android SDK is a free development framework based on Java that allows developers to make games using development IDEs such as Eclipse. The Android

  native development kit

  (NDK) is an alternative development framework that is free and allows you to develop native applications using the C or C++ programming languages. It is worth mentioning that in an application written with NDK, you may need to use the Java Native Interface (JNI) to make use of only the used functions from Java.

  Download the software (Android SDK / Android NDK) from http://developer.

  android.com/sdk/index.html http://developer.android.com/tools/sdk/

  or ndk/index.html .

  https://devs.ouya.tv/

  The official documentation for OUYA can be found at developers/docs/android . Download the examples for OUYA from https://github.com/ouya/ouya-sdk- examples/tree/master/Android .

  Corona

  The Corona SDK can be used for all types of mobile developers, from beginners to those with advanced knowledge of programming. It is a framework and SDK to develop games on the Android platform and OUYA. It also allows us to blend HTML5 with OpenGL or to use enterprise features such as access to a SQLite local database, JSON libraries, and asynchronous HTTP connection to store data in the cloud.

  

[ ]

  

14

Chapter 1 The official documentation for OUYA can be found at https://devs.ouya.tv/

  developers/docs/corona .

  Download the examples for OUYA from https://github.com/ouya/ouya-sdk-

  examples/tree/master/Corona .

  GameMaker

  GameMaker is based on an interpreted programming language and software

  development kit

  (SDK) to develop video games. The program is designed to allow its users to easily develop games without having to learn a programming language such as C++ or Java. The program is free. However, there is an extended commercial version with additional features.

  Download the software from http://yoyogames.com/gamemaker/download .

  https://devs.ouya.tv/

  The official documentation for OUYA can be found at developers/docs/game-maker . Download the examples for OUYA from https://github.com/ouya/ouya-sdk- examples/tree/master/GameMaker .

  MonoGame

  MonoGame is an open source implementation of Microsoft's XNA platform. The goal when developing games using this framework is an additional way to create games and applications for iOS, Android, and Windows Phone 8; Mac OS X, Linux, and Windows 8; and OUYA and PlayStation.

  The official documentation for OUYA can be found at https://devs.ouya.tv/

  developers/docs/mono-game . https://github.com/ouya/ouya-sdk-

  Download the examples for OUYA from examples/tree/master/MonoGame .

  

[ ]

  

15

  Why OUYA? Unity3D

  Unity3D is a platform game engine that works as a development environment that supports OUYA. In the web console, developers can find documentation on how to prepare Unity to work with the console, and the ODK includes the files needed to integrate Unity with OUYA libraries. We also have to consider that programming for Unity is based on scripting, and for that we can use UnityScript languages such as C# or Boo.

  Among the engine options for video games development, Unity3D has the highest quality and technical support. In addition to the many applications, development kits, and source code that the Asset Store has, it can also be used to get useful material for projects and development on multiple platforms.

  Unity3D is available as a development platform for the Windows and Mac operating systems, and allows you to create games for Windows, iOS, Linux, Xbox 360, PlayStation 3, Wii, Wii U, iPad, iPhone, Android, and OUYA (actually). Thanks to the Web plugin that comes with Unity3D, you can also develop games for Windows and Mac browsers. In the following chapters, we will walk you through the process of downloading and installing Unity3D for creating the practice applications and examples mentioned in this book. Download the Unity3D software from http://unity3d.com/unity/download/ .

  https://devs.ouya.tv/

  The official documentation for OUYA can be found at developers/docs/unity .

  https://github.com/ouya/ouya-unity-

  Download the examples for OUYA from plugin .

  Summary

  In this chapter, we learned how to start a new project, the technical specifications of the console (hardware and software), the contents that are not allowed to be published on the console, and the main development tools that are currently available in the market.

  Also, we mentioned the key applications and online platforms that are currently available on the console.

  

[ ]

  

16 Setup Prerequisites

  OUYA is an interesting console for developers because it allows them to use different tools to create their video games. Everything from Java and the Android SDK to the most popular video game engines, such as Unity3D and UDK, can be used with OUYA, as shown in the following diagram:

  I want to make an OUYA Game Make game using Make Android Game cross-platform tools

  Adobe Air Eclipse Corona C++ / Jave Native Game Maker MonoGame Unity Adapt for OUYA

OUYA GAME

  

OUYA's development tools

  Although modern browsers such as Firefox and Chrome automatically download any file in a specific path predetermined by them, we suggest creating a directory

  C:\installers where you will download all the necessary installers, for example, .

  We also suggest creating a folder in the root of the hard disk, where all the programs that will be explained in the following sections will be installed. For now, you can

  progs

  C: create a directory called in .

  This chapter explains how to install and configure the prerequisites to prepare the development environment for OUYA. Without this step, it will be very difficult to start a project for the console.

  Setup Prerequisites Installing the Java Runtime

  The Java Runtime is the first component that must be installed. It should be downloaded from http://www.oracle.com/technetwork/java/javase/

  downloads/index.html .

  Download the appropriate version for your operating system (Linux, Mac OS, 32-bit Windows, 64-bit Windows) as shown in the following screenshot:

  

Java download options

  The installation process is very simple. Run the downloaded JRE file and follow the instructions using the default options. When finished, restart your computer.

  Installing the Android SDK

  Android SDK is the software that supplements the development environment for http://developer.android.com/sdk/index. OUYA. Download the SDK from

  html , making sure to select the appropriate version for your operating system (Linux, 32-bit Windows, 64-bit Windows, or Mac OS).

  

[ ]

  

18

Chapter 2 Android SDK download options The Android SDK does not require an installer; simply extract the main directory

  in the directory previously suggested ( C:\progs ) to facilitate the configuration later. When finished, restart the computer. Navigate to <C:\progs\adt-bundle-windows-xXX-xxxxx> and run the SDK

  Manager.exe file.

  Within the SDK Manager, we will install the components that are marked in the following screenshot, that is, Android SDK Tools, Android SDK Platform-tools, and Android SDK Build-tools from Tools; all the options under Android 4.1.2

  (API 16)

  ; and Android Support Library, Google USB Driver, and Intel x86

  Emulator Accelerator (HAXM) from Extras. We suggest that you install the

  API 16 Version; however, these components are available in the API 17 and API 18 Versions too. If you use Unity3D Version 3.5 or higher, we suggest that you install Rev. 21 of the Android SDK.

  

[ ]

  

19

  Setup Prerequisites [

  • ToolsAndroid 4.1.2 (API 16)
  • Extras ° Android Support Library ° Google USB Driver °

   20 ]

  The options that should be selected are mentioned in the following list:

  

Intel x86 emulator Accelerator (HAXM)

  The following screenshot also illustrates where the options are provided:

  Configuring the Android SDK

Chapter 2 You do not need to delete the other components of the SDK (such as other versions of Android) if you have them installed already. The next step is to set the PATH environment variable of the Windows operating

  system so the Android SDK components can be referenced from any application and run properly. In Windows, this option can be found by navigating to Control Panel | System | Advanced System Settings. You can edit the path variable as shown in the following screenshot:

  

Configuring environment variables

  In this variable, you must add the following line (if some data already exists, insert a semicolon after the last data; however, we recommend that you write the elements from the beginning):

  C:\progs\adt-bundle-windows-x86_64-xxxxxxxxx\sdk\tools; C:\progs\ adt-bundle-windows-x86_64-xxxxxxxxx\sdk\platform-tools; C:\progs\ adt-bundle-windows-x86_64-xxxxxxxxx\sdk\buildtools\android-X.X.X

  

[ ]

  

21

  Setup Prerequisites Installing the Android NDK

  The Android NDK is an additional component that is not mandatorily required for all development environments, but we suggest installing it right now, at the initial stages, for future use. Download the NDK from http://developer.android.com/tools/sdk/ndk/

  index.html

  and select the version that fits your operating system: 32-bit Windows 32-bit, 64-bit Windows, Mac OS, and Linux.

  

Android NDK download options

  You will now have the following file structure:

  

[ ]

  

22

Chapter 2 Directory structure Installing and configuring Eclipse The Eclipse IDE is used when you want to program natively with Java and Android SDK, and it can also be used with the NDK via the JNI. So it will be a prerequisite

  to have the Java Runtime or Java Development Kit (JDK) and the Android SDK installed. Download Eclipse from http://www.eclipse.org/downloads/ (the Eclipse

  Standard 4.3 option or the Eclipse IDE for Java Developers option is a good choice).

  

Eclipse download options

[ ]

  

23

  Setup Prerequisites

  Android provides an Eclipse plugin called Android Development Tools (ADT) to configure new Android projects. This component must be configured within the Eclipse IDE. To install the plugin in Eclipse, perform the following steps: 1. Navigate to Help | Install New Software.

  2. Go to https://dl-ssl.google.com/android/eclipse and follow the installer instructions and use the default settings. You must then configure the path where the Android SDK was installed so that the Eclipse IDE can reference it. To do this, navigate to the Preferences menu as shown in the following screenshot:

  

Configuration of the Android SDK in the Eclipse IDE

  After performing the preceding steps, the Eclipse IDE will be ready to create Android projects, which is used to create OUYA video games.

  Installing Unity3D

  From this point onward, we will use the Unity3D engine for implementing a small game. Download the installer Unity Pro (a trial version for 30 days is available) from the following website:

  http://unity3d.com/unity/download/

[ ]

  

24

Chapter 2 After you download the file, run the installer and use the default options. After the

  installation, the program will ask for a Unity3D account. If you do not have one, you can create a new one with your e-mail ID, as shown in the following screenshot:

  

Configuration (creation) of a Unity3D user account

[ ]

  

25

  Setup Prerequisites

Configuring the Android SDK in Unity3D

  To configure the Android SDK in Unity3D, you just need to run Unity3D and configure the path to the Android SDK. To do this, you need to navigate to

  Edit

  | Preferences | External Tools | Android SDK Location, as shown in the following screenshot:

  Configuration of the Android SDK in Unity3D Summary

  By the end of this chapter, you will have installed all the prerequisites to develop a game with OUYA, the Java Runtime or Java Development Kit, Android SDK or NDK, Eclipse, Unity3D Engine, and basic settings in Unity3D. The next chapter will present the second part of the settings required to work with OUYA.

  [ ]

  

26 Setup Instructions for the OUYA ODK

  This chapter introduces developers to the first steps of setting up their development environment using the OUYA SDK (ODK) and the configuration of the emulator. Also, for those who already have the physical console, this chapter will explain the initial steps of installing it.

  Creating an OUYA account

  To enjoy the full experience of the console, you must create a user account on the website of the company, http://www.ouya.tv . There are two types of accounts: gamer and developer. You can create a gamer account on the OUYA device itself, but you will need to create a developer account on the official OUYA website. For the purposes of this book, you must create a developer account, as that will provide you access to a unique developer code called developer UUID. This code number is used to uniquely identify the developer and is associated with each game released on the console. The data that you enter while making your developer account (credit/debit card number, address, and so on) will be associated with your account. You can use your account to log in to more than one OUYA device.

  Setup Instructions for the OUYA ODK Installing the console

  The first step is to open the console package and identify all its components, listed as follows:

  • The console
  • A control pad
  • An HDMI cable
  • A power cable The next task is to perform the physical installation of the console. To do this, perform the following steps:

  1. Connect the console directly to your Internet connection (through the cable LAN or Wi-Fi).

  2. Connect the console to your TV and turn it on using the OUYA button.

3. Switch on the control pad by pressing the key so that it can be recognized by the console (the first time takes some time).

  4. Go to MANAGE | NETWORK and configure your Internet connection.

  It's better and highly recommended to use an Ethernet connection as it is more stable.

  5. The first time you run the console, the system performs an automatic update of the operating system.

  6. Attach the account you have previously created on the website to the console by navigating to MANAGE | ACCOUNT | USER.

  7. If you are creating the account for the first time, enter your credit/debit data by navigating to MANAGE | ACCOUNT | PAYMENTS.

  8. Download the games of your interest using the DISCOVER option. The following screenshot shows the steps for a console installation:

  

[ ]

  

28

Chapter 3 Downloading the ODK files In the previous chapters, we explained the steps to install the prerequisites to prepare the development environment. Now we will install the SDK development for OUYA (the ODK). Download the

  package from the website at https://devs.ouya.tv/developers/odk as shown in the following screenshot:

  

[ ]

  

29

  • https://devs-ouya-tv-prod.s3.amazonaws.com/odk/odk-1.0.1.zip
  • https://devs-ouya-tv-prod.s3.amazonaws.com/odk/odk-1.0.5.zip

  If you want to use the emulator, the prerequisites for the Windows and Mac OS operating systems are the same. The following are the list of prerequisites:

  export PATH=$PATH:~/android/android-sdk-macosx/tools

export PATH=$PATH:~/android/android-sdk-macosx/platform-tools

export ANDROID_HOME=~/android/android-sdk-macosx

  file and add the following lines of command to it:

  ~/.zprofile .bashrc (or ~/.zprofile.zshrc)

  1. Locate the