Notifications
Article
Controlling tvOS
Published 3 years ago
162
0
Without Controllers
When I got word we were about to receive one of the coveted tvOS Dev Kits, I immediately thought of local multiplayer gaming. For years, my favorite multiplayer experiences were those when a group of us would gather around a TV and work together to beat a challenging game or battle until one of us won the day. It was this that feeling helped us in our decision to choose Couch Heroes vs The Dungeon as our first game for tvOS.  That said, building a game that supports more than three local players presents a problem on the Apple TV. Out of the box, the Apple TV only has a single controller: the Siri Remote. You can connect up to two more external bluetooth controllers, but we assumed most people wouldn’t have those controllers on day one. Even so, that only brought us to three players. We wanted to support four.
Which brings us to Couch Control. As a solution to our controller problem, we decided to build an app that runs on both phones and tablets and also be able to connect to the game over Wi-Fi and act as a controller.
At its core, Couch Control is a fairly simple app. It has a join button which allows you to scan a QR code displayed within the game. Once it scans that code, it extracts the necessary network configuration settings needed to connect to the game’s internal network server. Once connected, it receives information from the game about the needed input settings to provide (touch pad, action zone, accelerometer input, etc.) and what interface to display. After that, it simply relays the player’s touches and taps along to the game for translation into movement, firing, or any other interaction.
On the game side, we run a Couch Control server which handles adding/dropping connections, deals with the QR codes, and manages the network traffic coming from multiple connected Couch Control clients. This is actually the most complicated aspect of the system.
Network traffic can be messy. Home networks, in particular, are a nightmare of dropped packets and lost connections. Most of the network messages we send are lossy. This means losing a few really won't matter since with there will be another sent along shortly with pretty much the same information. We do send some messages in a lossless manner, though. These are generally messages that must get through. Generally, that means stuff like “Pause sending me messages” or “I’m disconnecting from you”.
In the end, Couch Control works perfectly as a controller for Couch Heroes vs The Dungeon. Anecdotally some of our testers want to use Couch Control instead of the Siri Remote. We know that as time goes by, players will prefer full size game controllers, but having Couch Control as an option let’s everyone get in on the fun.
Apple, Apple TV, Siri Remote, and tvOS, are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc.
TC
Ty Christopher
8
Comments