Dabe Alan

Porting Get on Top to Ouya: The difficulty of bringing even simple games onto new platforms

Porting Get on Top to Ouya: The difficulty of bringing even simple games onto new platforms

Ben here! Shay Pierce contacted me about Get on Top during the Ouya's launch, but little did he know I had downloaded the game and was enjoying it immensely. We began to talk about the process of bringing the game to the Ouya, and when the conversation became really interesting I politely told him to shut up, write it down, and we can share it on PAR. The result is a fascinating look at ports, and what it's like to work with Ouya. I hope you enjoy it!

It was a Friday night in Austin. My wife was out of town, and I decided to attend two very different game-related events. The first was a small gathering of professional developers, getting to meet and ask questions of Julie Uhrman, the CEO of Ouya. The second was the first IndieCade Annex Meetup, a monthly public gathering where cool and innovative games are available for anyone to come play – especially multiplayer games.

Probably the most popular game that night was Get On Top, a two-player wrestling game developed by Bennett Foddy (the creator of the infamous QWOP). Bennett likes to develop simple games whose fun comes from the hilarious chaos produced by a physics engine.

Get On Top is his take on a two-player wrestling game. It has only three inputs: push, pull, and jump. The game was originally made to be played using trampolines as input. The game is a series of quick rounds, each of which is over when one player’s head hits the ground, and flies off their body. First to 11 wins. Very simple, but surprisingly fun.

I returned home from these two events and pondered. I had already started porting another cool game to the Ouya for a friend/client. I had also recently tested porting one of my own Flash game projects, Uncanny Alchemist Battle 1934, to the Ouya using AIR Mobile, and it had gone smoothly. I really wanted to take a break from Alchemist Battle anyway, and I missed the thrill of shipping a game.

Get On Top really needed to be on the Ouya. The tiny console seemed ideal for weird little local-multiplayer experiences, I felt. (This seems to be proving true!)

I had Bennett’s email address from meeting at a conference. I sent him a proposal that same night: I’d port Get On Top to the Ouya in my spare time, we’d sell it for $2, while letting free players play a free demo round once per day, and we’d split the profits. His reply was something like “Sure, why not?”

A few hours after he shared the game’s source code with me, I had it running on the Ouya - at a blazing 60 frames per second, no less! It seemed like the port was 80% done already.

20% == 80%

The last 20% of development always ends up taking 80% of the effort and that was no exception even on a tiny game like this. Only as we were finally approaching the Ouya launch date did I realize that we were to be the first Ouya game to ship that was built using Flash/AIR technology. Which meant we were going to be the guinea pig for actually piecing these technologies together into something final.

After overcoming several hurdles (more on those later), I finally had a game ready to ship so I submitted the game to Ouya. The Ouya server started its automated test of our APK executable file… and it crashed immediately with a strange error. Hmm.

I contacted Ouya support, but days passed. I started getting a bit nervous as my emails and forum posts weren’t being answered, and launch was now less than a week away. But I assumed that the Ouya folks were busy with E3, and this turned out to be the case. Once E3 ended they were back in touch with me quickly, and immediately I had access to some of their senior programmers. They quickly fixed the verification system to accept AIR Mobile-generated APK files, including ours! Whew!

Other problems that materialized with our submission turned out to be my fault. At one point, I found myself online at 1 a.m. (while my wife slept in the next room), video-chatting on Skype with one of their coders, who guided me through some caveats with their purchasing system.

Long story short, there were several hiccups, most of them my fault. But in all of them, the Ouya folks were awesome about responding to emails, taking action, and even escalating a simple-but-urgent patch to get through their review process quickly. I’ve never seen such proactive developer support, so kudos to their team especially in contrast to the horror stories about the bureaucratic process of publishing on certain consoles.

The Ouya certainly isn’t perfect, and much of that is because Ouya as a company doesn’t have the same resources as the console giants. But as an indie developer, I think I prefer dealing with the small-but-brilliant staff of a startup… people who are all on the same page, and who all “get it.” (I think it’s also a great sign for the future of the console: these guys know how to fix their mistakes.)

School of Hard Knocks

If you’re a Flash developer actually looking to ship a game, you’d probably like some specific steps. I didn’t want this to be a purely technical article (and the basics of publishing Flash to an AIR-for-Android app are well-documented,) but I thought I’d run down the specific hurdles I ran into and share some resources:

1. Your game runs slow. Your Flash game may render fast in the browser (and probably does if it’s using Flixel or FlashPunk)… but that doesn’t mean it will be fast on an Android device.

Luckily, Adobe added Stage3D recently, drastically improving all of Flash’s rendering performance… even on iOS and Android devices. Now you just have to use it. This probably means porting your game to a Stage3D-based framework. For 2D games, these include Axel, Starling, Away3D and Genome 2D.

If your Flash game was made in Flixel: I found porting to Axel to be relatively straight-forward. For my game, the major work for that port took less than a day, and performance on the Ouya went from 10 FPS to a solid 60 FPS!

2. Get the app ID right. Turns out that even if you specify an app ID like “net.foddy.GetOnTop” in your manifest XML file, AIR Mobile will turn it into “air.net.foddy.GetOnTop” whenever you publish. (Don’t ask me why.) If you don’t register your Ouya game with that ID in their portal, this will prevent you from shipping your game, and cause all your purchases to fail! Get this right when you first create your game in the Ouya system.

3. Gamepads! You now have two options for listening to Ouya controller input:

       A. An Ouya-specific ANE, developed by Gaslight Games. This is solid, and it’s what we shipped with.

       B. The “GameInput” class that Adobe has added to recent AIR SDKs (3.7 and 3.8) - with the Ouya being the first platform officially supported! I’ve heard there are issues and limitations with this class… but if you want to try this route, Terry Cavanagh shared some source code that looks like a good starting point.

4. Purchases. In the Ouya world, every game is “free” in some sense – the creator decides what that means. We used a simple “free demo, buy the game once” model; but any purchases must be validated with Ouya’s backend. Luckily, Gaslight Games once again created an ANE to talk to the Ouya In-App Purchase libraries from Flash. Still, there were a couple of caveats I encountered with this:

Ouya’s Purchases service takes a second or so to start up after you launch your app… when I queried the Purchasing system instantly on startup, it sometimes failed. A dumb-but-safe solution (which I used) was to wait for 3 seconds on startup before making this query.

If you ask Gaslight’s ANE to check the player’s “receipts” data, and the player has no receipts, it’ll never give any response. This means you can’t definitely confirm that someone doesn’t own the game – you have to treat them as a free player by default (until/unless you get a response indicating that they bought your product). It would be preferable to have a clear response either way. Fortunately, it sounds like Gaslight is adding that soon.

5. The “ouya_icon.png” file. This was a real pain. Basically you have to unzip the APK file, put an icon file into it that the Ouya expects, and then re-zip and sign the APK file using Android command-line tools. See these docs for more details. I made a simple shell script to simplify all this on Mac, which I plan to share soon.

If you want more juicy technical details, feel free to bug me or watch my blag, where I plan to share more detailed (and snippets of source code!) over the next few weeks as I have time.

Go Make a Game!

Whether you’re a frustrated professional game developer who’d like to make something cool in their spare time, or a hobbyist looking to learn game development on their first project, Flash technology can be easy and fun to get into… and the Ouya can let you put a Flash game in the living rooms of thousands of real gamers! Since an AIR Android app can be made with free tools from Adobe there’s nothing to stop you from making (and selling) that simple console game you’ve always wanted to make.

So what are you waiting for? Making a game will never be “easy,” but it’s certainly never been easier!