The OUYA is a powerful and unique machine, because it gives hobbyists and independent developers a way to create and deploy professional-grade games without an overwhelming amount of groundwork. To begin making games for the OUYA, you won't need more than a basic understanding of game mechanics and a passion for development. This book will take you from your first prototype to a polished product ready to make its debut in the OUYA marketplace.
The lessons in this book will be demonstrated using the Unity3D engine, a popular development engine that's simple to learn with essential systems such as physics and user interface already built in. Unity and the OUYA both support a variety of scripting languages, but in this book, we'll be focusing on C#, a relatively easy yet versatile language that supports virtually any data structure your game will need.
You may already be familiar with the Unity engine; several popular games, such as Temple Run 2 by Imangi Studios and Scrolls by Mojang (of Minecraft fame), have been built using Unity. You'll soon learn that the OUYA can take full advantage of the 3D capabilities of Unity to make the game of your dreams become real.
This first chapter will be a basic review of the default configuration of the OUYA and a demonstration of its capabilities using a game as an example. If you've already had some time to play around with your OUYA and you feel ready to get started with development, feel free to skip ahead to the next chapter, where we'll install our development environment and start deploying code to the console.
Once you've plugged your OUYA in and started it up for the first time, it will ask you to configure Internet settings, either wirelessly or with an Ethernet cable. This is an important step because a network connection allows us to view the latest games submitted to the marketplace, and we'll also be able to download the latest version of the OUYA software for development. Once you've completed the configuration, you'll reach the launch screen, which looks similar to the following screenshot:
The OUYA console and the Unity engine are both able to display games in 1080p HD, so it's best to develop them on a monitor that supports widescreen. It's also good to make sure that the OUYA display fits within the bounds of your monitor, because you need an accurate reference when developing your user interface to make sure it doesn't run off the screen (we'll get more into this in the later chapters). The following are a few ways to do this:
Perform the following steps to install your first game in OUYA:
Now that you've covered the technical details, you can download a game from the OUYA marketplace to experience what a popular OUYA game looks like, and note small details that you can start thinking about for your own games. We'll use Canabalt HD as an example game, the latest iteration of Adam Saltsman's 2009 endless runner.
Click on the Discover button on the OUYA launch screen and you'll be brought to the marketplace's storefront, a showcase of featured games organized into several categories. This is where you'll see your published games once they gain some popularity. The following screenshot shows the storefront:
Press the Y button on your OUYA controller to bring up the search menu. Using the onscreen keyboard, search for Canabalt HD and then select it in the list of results. You'll be taken to the store page for Canabalt; here, you can click on DOWNLOAD and begin installing it on your console. The store page looks as shown in the following screenshot:
You've just successfully downloaded your first game on your OUYA console. The marketplace can be used to find all sorts of games that are always free to try, and once you download them, you can play them anytime from the OUYA's PLAY menu.
You may be wondering why you didn't see any prices while browsing the OUYA store or even while downloading your first title. Does this mean that all games for the OUYA are free to download? Well, the short answer is yes, but it's a little more complicated than that. Instead of following a conventional pricing system, the OUYA marketplace does things a little differently by providing at least one free element in each game. Canabalt incorporates monetization in the form of free-play credits, shown in the following screenshot:
In the case of Canabalt HD, the developers decided to offer a trial version that includes five free plays per day and an option to pay for an upgrade that unlocks unlimited play. The player can also unlock additional plays by making it past the 5000-meter mark in the game. However, this isn't the only payment model you can use; as long as there's something free in your game, you can have as many or as few purchasing options as you want. For instance, you could create a game that features unlimited playtime but limited free items, or make a game that's free up until a certain level. The OUYA SDK has an in-app purchase API that will let you get creative with priced elements in your game.
Now that the technical stuff is out of the way, take a few minutes (or several) to play Canabalt and get a feel of how the OUYA performs. Despite being part of the console family, the OUYA varies from its siblings such as the PS3 and Xbox 360. The games are often smaller and less expensive than full triple-A titles because of the abundant indie presence. You'll notice a few features about Canabalt that are pretty typical among many OUYA games. These features are as follows:
Arcade-oriented gameplay: This typically features simple mechanics that are easy to learn but offer a long progression of mastery
Score tracking/leaderboards: These allow players to see what they've accomplished and compare their score against others
Many of the arcade games out for the OUYA are also available for iPhone or Android or have been ported from them. Canabalt HD is an improved version of the original game for iPhone, remade with 3D graphics for the OUYA. You'll be able to think about mobile development beyond the OUYA as well; the Unity engine has the ability to deploy any game to iOS and Android with minimal tweaks, so you can consider porting your OUYA game to mobile devices.
While you're on the Canabalt HD menu, try making a swipe gesture on the touchpad of the OUYA controller. You will notice that a cursor appears; you can use this cursor to navigate menus. The touchpad can also be used as a secondary jump button while in the game. This functionality is pretty straightforward, but the creative applications of the touchpad are limitless. You could program a sword to slash with a swipe of the touch screen, let a player design custom decals by drawing them with their finger, or use touch input to calculate the direction and velocity of a cannon shot.
The OUYA console gives hobbyists and independent developers a way to create and play games without having to work through publishers. Every game on the OUYA marketplace is free to download but can include in-game purchasing in order to unlock the full game or new content. The OUYA also has a unique touchpad on its controllers, giving developers more ways to interact with the players. You'll be using the Unity engine to make games which is a versatile yet easily understandable 3D engine that can also deploy to mobile devices such as iPhones and Android phones.
Now that you've gotten to know your console, you're ready to start writing code. As you're working through the programming tutorials in the chapters that follow, don't be afraid to make a backup copy of what you're working on and try coding a mechanic based on the one you find in an existing game on the OUYA marketplace.
In the next chapter, you'll download the Unity3D game engine and configure it to deploy games to your OUYA console.