Getting Started with OUYA
A practical guide to developing games for the
revolutionary OUYA console
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.
35 Livery Street
Birmingham B3 2PB, UK.
Cover Image by Ruben Dario Hoyos Useche and Robinson Alexander Moncada
Velasquez (firstname.lastname@example.org, email@example.com)
Monica Ajmera Mehta
Content Development Editor
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
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
You might want to visit www.PacktPub.com for support files and downloads related to
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 www.PacktPub.com and
as a print book customer, you are entitled to a discount on the eBook copy. Get in touch
with us at firstname.lastname@example.org for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
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.
• 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
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine entirely free books. Simply use your login credentials for
Table of Contents
Chapter 1: Why OUYA?
OUYA is more than a console – it's a business model
OUYA – content restrictions
Marks or branding
Content scope, applications, and social networks
Development tools to build video games for OUYA
Android SDK/NDK (Java or C language)
Chapter 2: Setup Prerequisites
Installing the Java Runtime
Installing the Android SDK
Table of Contents
Installing the Android NDK
Installing and configuring Eclipse
Configuring the Android SDK in Unity3D
Chapter 3: Setup Instructions for the OUYA ODK
Creating an OUYA account
Installing the console
Downloading the ODK files
Setting up the ODK in Windows and Mac OS
For Mac OS
Disabling Windows 8 driver signature verification
The OUYA emulator (Virtual Device) configuration
Executing the OUYA emulator
Chapter 4: Guidelines for Setting Up the OUYA ODK
Chapter 5: Configuring the Controllers
Starting with the OUYA Development Kit
The ODK plugin within Unity3D
Importing the ODK plugin within Unity3D
Installing and configuring the ODK plugin
Installing and configuring the Java class
Identifying the user
Starter kit – examples
Common errors while working with OUYA
Errors with the emulator
Errors with Eclipse
Errors with the ADB connection USB
Errors in the OUYA panel
Setting the controls
Creating the first scene of the game
Assigning the OUYA controls
The menu or system button
Differences between an analog joystick and a touchpad
Testing changes in the state of the button
Compiling and executing the game
[ ii ]
Table of Contents
Chapter 6: The OUYA Marketplace
Chapter 7: Advanced OUYA Functions – Graphics and Controls
Update your user profile
Configuring the items of purchase
Creating a game in the OUYA store
Creating the Key.der file
Programming access to the marketplace
A general guide to OUYA game content
Testing the project with the emulator
Types of shader processors
The CG programming language for Nvidia Tegra 3
Characteristics of the Tegra 3 processor
Controller always pairing as the second controller
The second OUYA controller paired as the third controller
Chapter 8: The Future
Virtual reality – using Oculus Rift
Arduino – the peripheral interface
Nuidroid – 3D recognition for OUYA
OUYA – the Free the Games Fund campaign
[ iii ]
OUYA is the new video game console, announced in July 2012, based on the Android
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.
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.
Chapter 4, Guidelines for Setting Up the OUYA ODK, explains the contents of the
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.
Chapter 5, Configuring the Controllers, explains how to start our first project for the
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. You should also download the SDK for OUYA (the ODK) from https://devs.
ouya.tv/developers/odk. Moreover, you should have all the prerequisites for
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.
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:
"Open the c:\progs\ adt-bundle-windows-x86\sdk\extras\google\usb_
driver\android_winusb.inf file with the Notepad editor or another text editor."
A block of code is set as follows:
%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:
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.
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 email@example.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.
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
elsewhere, you can visit http://www.packtpub.com/support 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/
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.
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.
Please contact us at firstname.lastname@example.org with a link to the suspected
We appreciate your help in protecting our authors, and our ability to bring you
You can contact us at email@example.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
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
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.
The OUYA system has the following technical specifications. The developer
versions may vary slightly, but the retail OUYA console has the following
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.
• Micro USB (one port). This is the port that you should use for hooking
OUYA to your computer for development purposes. It is sometimes called
the outbound USB port.
The OUYA pack
The specifications of the OUYA controller bundled with the console are as follows:
• A wireless controller with a radio frequency of 2.4 GHz. This uses a standard
• 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.
• OUYA supports up to four controllers, as shown in the following diagram:
The control pad
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
OUYA is more than a console – it's a
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 ]
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:
• 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
The following variables are monitored in a Freemium business model:
• 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.
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:
• 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
• 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 ]
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
find it at https://www.ouya.tv/brand-guidelines/.
The corporate logo
Content scope, applications, and social
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.
The XBMC media center is an open source multimedia entertainment platform
under the GNU GPL license. Its official website is http://xbmc.org/.
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
[ 12 ]
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
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
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
Crunchyroll is an American website and international online community focused on
streaming media such as anime, manga, music, video games, and racing from East
Asia. Its official website is http://www.crunchyroll.com/.
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
In this section, we'll take a look at some of the developer tools for the OUYA system.
[ 13 ]
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.
Download the software from http://www.adobe.com/devnet/air/air-sdkdownload.html.
The official documentation for OUYA can be found at https://devs.ouya.tv/
Download the examples for OUYA from https://github.com/ouya/ouya-sdkexamples/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++
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 or http://developer.android.com/tools/sdk/
The official documentation for OUYA can be found at https://devs.ouya.tv/
Download the examples for OUYA from https://github.com/ouya/ouya-sdkexamples/tree/master/Android.
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 ]