After a few weeks of developing with the Apple TV, I thought a share a little about our experience so far. We are currently working on a CO-OP Shoot-em up call Monster Medic and thought it would be great to port it from iOS to tvOS. Monster Medic is originally developed with Sprite Kit for iOS, so tvOS is the easiest platform we can port to. Unfortunately I have decided to suspend the porting process since I believe the tvOS controls do not work well with our game. Monster Medic is designed specifically for touch controls and doesn’t provide nearly the same experience using the Apple TV remote or traditional controllers. Our preview trailer can better explain how the game is played. So some games will not translate well to Apple TV, but I feel there are still a wide range of games that will work perfectly fine with the new platform.
Initial Impressions
I have been excited about of the Apple TV forth generation from both a consumer and developer’s stand point. As a “dormant” console gamer, it has been years since I owned a console. The last one I had the pleasure to own was the PS1 which was ages ago. I never had the time to justify purchasing an expensive console. Now I can purchase a “console” for less than $150.
The device is smaller than I expected and really was designed to blend with your existing AV system and not attract notice which is a departure from many Apple products. The setup was really easy and even allowed you to enter information from a paired Apple device which made entering information much easier. Otherwise, using the remote to type is still a pain without a keyboard. Initially there is only a small selection of app and games, but this will not be a problem as time progress.
I’ve tried a few games and it does feel like a console albeit a poor man’s version. The graphics are nice and can probably be pushed even harder. The weakest link is the remote controller. Games must support the remote which provides a touch surface as a DPad and two buttons: A button (pressing the touch surface) and B button (pause/play button). The remote can also detect it’s orientation and acceleration. Overall the remote is sufficient for simple games, but it still doesn’t match the control and responsiveness of a traditional game controller. Games that require require real time response and complex controls will feel frustrating with the remote. If you purchase a quality controller, the overall price of Apple TV goes up to over $200 which is getting close the console prices. Aside from complex fast twitch games, Apple TV will still succeed as a gaming platform.
Porting Process
The first thing you want to do is to read up on some documentation. Here a list of that may find helpful.
- Collection of tvOS documentation
- App Programming Guide for tvOS
- Apple TV Human Interface Guidelines
- Game Controller Programming Guide
To start the porting process, add a new tvOS target to your project. Just click on the list of targets and select “Add Target” at the end of the list.
Next you want to include project files that are required for the tvOS target. The easiest way to do this is to select multiple files at once and use the File Inspector include those files to the tvOS target. You will most likely include all your files in the tvOS project except for the following:
- .h files
- Retina image files – tvOS uses 1x images files only.
- Classes that are specific for iOS version.
For the most part your iOS classes can be used directly for tvOS, however there will be significant amount of code that you will still need to customize for tvOS. Instead of creating a separate file to handle tvOS, you can modify your existing class to include and exclude code for tvOS by using the follow directives:
#if TARGET_OS_IOS
.. add code for iOS version
#elif TARGET_OS_TV
.. add code for tvOS version
#endif
The largest amount of work is redesigning your interface to work with controllers instead of touch interface. For simple interfaces that consist mostly of buttons, little to no change to the UI is needed. You only need to add support for controllers. Interfaces that use complex touch gestures (swipe, drag, etc) will require more work and careful consideration of how you can use the Apple TV remote as a controller.
To add controller support for Monster Medic, we created a singleton class that handles controller input and executing call back blocks. When we enter a new scene, we clear the controller call back blocks and assign new ones. Then the use the singleton class to assign the call back blocks to the detected controllers. Here are links to the singleton class below that you can refer to.
Fortunately Monster Medic is under 200MB in size, but if your app is greater than 200MB than you will need to break up your app so that resources can be downloaded by demand. See On-Demand Resources Guide.
Feel free to comment and share your thoughts and experience with Apple TV development.