Rebuilding the game from scratch in Unity, and shipping in time for the Apple TV launch
My "flagship" game is called Capitals Quizzer. It's a trivia game about geography, primarily learning the capital cities of countries. I call it the flagship game because it still gets downloaded much more than anything else I've built, even many years after it initially launched. In some ways it's quite frustrating as I can't seem to build anything new with the same traction of Capitals, but I guess I can't really complain!
Over the years I've tried to keep Capitals current and relevant, with several major updates and rewrites. The original game was written in Objective-C and Cocoa, but that only worked on the iPhone. So the first rewrite was into a C++ library called Cocos2d-x. That allowed me to port to game to all manner of other platforms. However, I've kind of fallen behind in the Cocos world - the Capitals codebase is a major version behind the library and it would take quite a bit of time to bring it up to date. As a one man band, I need to be careful where I spend my time.
A problem emerged: I wanted to put the game onto the new Apple TV, but the old version of Cocos2d-x I was using doesn't support it. You can't blame Cocos - it was built many years before tvOS was a twinkle in Apple's eye. I considered writing tvOS support into Cocos, but I think it would probably be a big pain and ultimately not that useful for the open source community given how behind the curve I am with that library. They've all moved onto bigger and better things by now.
Recently I've been writing a lot of stuff in Unity, which is pretty great. All of my latest games (Safe Cracker, Worldly, various prototypes for console) have been written in Unity, and I'm enjoying it a lot. So I made the decision a couple of weeks ago to completely rewrite Capitals Quizzer in Unity. They had already built Apple TV support into an early test version of their editor, so it would be all good. This will be the third rewrite of Capitals, and hopefully the last! :-)
Fortunately I was able to build on a strong existing foundation from Worldly. Much of the quiz data processing and UI flow was taken from Worldly and adapted. Of course I already had most of the artwork ready to go too - it just took a few small tweaks and some repackaging to make the original Cocos art suitable for Unity.
The data in Capitals was previously packed into quite dense XML files. These would be stored in a different way inside Unity, so I needed to regenerate all the data from the spreadsheets again. I was able to take the information from my Google Sheets readsheets and easily process it in Coda using the user-friendly regular expressions search and replace. None of this was a massive pain, but it took some time.
It took about 5 days to build Capitals into something you could play. I guess you could consider that an alpha, or content complete, version. The main struggle was getting the quiz state animations to fade in/out at the right time, but when I discovered how to use parameters properly on the Animator component then I was able to work around that.
The next week was spent getting tvOS platform stuff together. I rewrote a lot of the IAP systems to work with tvOS instead of iOS, and removed some of the things that aren't supported (i.e. Mobile stuff, like sending text messages or popping up native alert boxes). Also, building proper widescreen support in took some time - the original game was playable in portrait mode on mobile.
The biggest thing was moving from a touchscreen-based UI to a controller-based UI. Or, more accurately, making one UI in Unity which would support both styles. When using a touchscreen you don't need to worry too much about button placement or interactivity. As long as it looks like it should be tapped and is physically big enough for a finger to hit then you're good to go. However, with controller-based UI you need to think about things a bit more. On tvOS the user swipes up/down/left/right on the remote to move between buttons, and clicks the remote to select. This is much closer to a console style environment than a touchscreen. It meant that I needed to build new features into my buttons if I wanted them to work correctly.
The first, most obvious thing to try was a colour change. I initially wanted all the buttons to get a bit lighter when they received selection focus. The downside of this is that I had to make all the buttons darker so that the highlight would be obvious enough. On non-highlightable platforms (touch screens) this would result in dark, dull looking buttons. Not ideal. Of course I could try and detect whether you're running on a touchscreen and make adjustments that way, but what about platforms with both highlight (controller) support AND touchscreen support? Windows 8 introduced that, and I'd need a solution which would work for everything.
Then I tried changing the button image. I tried about a million different methods to see which one screamed "selected", and eventually came up with a new design with dark bands on the edges. This process was much harder than I imagined and took longer than I anticipated. It's easy to get one button appearing selected when positioned in a row of unselected buttons, but when you've only got two buttons it's quite difficult to instantly message to the user which one is highlighted.
It still didn't feel right though, so I ended up adding animations to each button so they got a bit bigger when you highlighted them, then shrunk to normal size when the focus moved away. Finally the buttons felt right and I could move on to fixing other button bugs. The remaining issues were things like being able to highlight offscreen buttons (they weren't being disabled properly when offscreen), and tightly controlling the flow between buttons when swiping around the place.
Adding support for the rest of tvOS was pretty easy. Both Unity and Apple did a great job with the platform, and made it a joy to work on. I was able to ship the brand new version of Capitals Quizzer in time for the Apple TV launch, and everything seems to be working great. There are a few little bugs to fix now, so that's priority number one, then I will start to roll out this brand new Unity version to smartphones and desktop platforms. After that I'm planning some new game modes and exciting new features, so watch this space!
Thanks for reading, and if you want to play Capitals Quizzer on tvOS then please download it here. Download links for other platforms are on the Capitals Quizzer website.