Setup Instructions for the OUYA ODK - Getting Started with OUYA (2014)

Getting Started with OUYA (2014)

Chapter 3. 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.

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 Installing the console button.

3. Switch on the control pad by pressing the Installing the console 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:

Installing the console

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:

Downloading the ODK files

The latest version of the ODK will be downloaded if you click on the Download ODK button. If you require an earlier version, you can use the following links:

· 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

After downloading the file, unzip the file to the root of the working directory where you installed the Android SDK and Android NDK. We should be left with something like this path: C:\progs\OUYA-ODK.

Setting up the ODK in Windows and Mac OS

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:

· Java Runtime or Java Development Kit (JDK) preinstalled

· Android SDK and Android NDK preinstalled (Android 4.1 / API 16 with Android Support Library and without Google APIs)

· Configure the installation paths of Android and Java in the PATH environment variable

Then, you must configure the USB driver as explained in the following section.

For Mac OS

1. Locate the ~/.zprofile .bashrc (or ~/.zprofile.zshrc) file and add the following lines of command to it:

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

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

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

5. Remember to keep in mind what the installation path of the Android SDK was, and modify the preceding lines of command if necessary to indicate the new location.

6. If you want your OUYA console to be recognized by the operating system, add 0x2836 to the ~/.android/adb_usb.ini file.

7. Connect the console through its USB cable and run the following lines of command:

8. adb kill-server

9. adb devices

After that, your console should appear in the list of available devices.

For Windows

You can find more information on ODK setup, including detailed instructions and videos, at https://devs.ouya.tv/developers/docs/setup.

Open the c:\progs\ adt-bundle-windows-x86\sdk\extras\google\usb_driver\android_winusb.inf file with the Notepad editor or any other text editor (note that it's possible that you may need administrator privileges to edit the file).

Disabling Windows 8 driver signature verification

If you are using the Windows 8 operating system, disable driver signature verification. To do this, perform the following steps:

1. Add the following lines of code under the [Google.NTx86] section:

2. ;OUYA Console

3. %SingleAdbInterface% = USB_Install, USB\VID_2836&PID_0010

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

4. Now, add the following lines of code under the [Google.NTamd64] section:

5. ;OUYA Console

6. %SingleAdbInterface% = USB_Install, USB\VID_2836&PID_0010

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

7. Save the changes.

8. Connect the console through its USB cable and run the following commands:

9. adb kill-server

10.echo 0x2836 >> "%USERPROFILE%\.android\adb_usb.ini"

11.adb start-server

12.adb devices

After that, your console should appear in the list of available devices in the Device Manager menu in Windows. It's possible that you may have to perform additional steps such as updating the driver for the device. This is because as soon as you connect it, Windows will try unsuccessfully to install drivers. The complete steps are in the OUYA Windows setup documentation available at https://devs.ouya.tv/developers/docs/setup.

After finishing all the steps, you can view the logs generating out of the device. You can do this with the Eclipse tools (LogCat) or using adb on the command line (for more information, visit http://developer.android.com/tools/help/logcat.html).

The OUYA emulator (Virtual Device) configuration

Before we begin, it is important to clarify that the use of the emulator is optional. It is much better to run games directly on the OUYA because the emulator's performance is generally extremely poor in comparison.

The initial steps are to open the Android SDK Manager, execute the Virtual Device Management option, and create a new device.

The suggested configuration template for the new device is as follows:

· Screen Size (in): This should be 32.0

· Resolution (px): This should be 1920 x 1080

· Sensors and Cameras: This should be disabled

· Input: This should be DPad

· RAM: This should be 1024

· Size: This should be xlarge

· Screen Ratio: This should be long

· Density: This should be tvdpi

The following screenshot shows the complete configuration of a Virtual Device:

The OUYA emulator (Virtual Device) configuration

Recommended configuration settings

We can create an OUYA emulator with the preceding template. The suggested configuration for the emulator is shown in the following screenshot:

The OUYA emulator (Virtual Device) configuration

It is important to note that there are several possibilities to set the resolution of an Android Virtual Device, such as its density and size variables. In the following screenshot, we see the various available options:

The OUYA emulator (Virtual Device) configuration

The Density and Size Screen tables to configure a Virtual Device

Executing the OUYA emulator

The last step is to run the OUYA emulator. For that, the first thing to do is load the Virtual Device created in the previous step from the Android Virtual Devices handler as shown in the following screenshot:

Executing the OUYA emulator

Running the Android Virtual Device

When you load the desktop's Android operating system, the system is ready to run the OUYA emulator. To do this, run the two applications that are within the OUYA-ODK directory (ouya-framework.apk and ouya-launcher.apk). Type in the following lines of commands:

adb start-server

adb install -r ouya-framework.apk

adb install -r ouya-launcher.apk

The launcher should now appear on the screen. Here, you are presented with two possibilities, the Android application launcher and the application launcher for OUYA. If you select the latter, you can use the OUYA emulator. The following screenshot shows the execution of the OUYA launcher:

Executing the OUYA emulator

From this point, you can install a .apk file on the emulator to see the execution of our own games. To install a game, copy the game's apk file into the root OUYA-ODK directory and then type in the following command:

C:\progs\OUYA-ODK\adb install your_demo_game.apk

Summary

By the end of this chapter, you should have the environment ready to deploy your first project for OUYA, that is, the OUYA SDK (ODK) and the console emulator.

The next chapter will explain the use of OUYA Development Kit (ODK).