Archive for the ‘ipad’ Category

Detecting Multitasking Gestures

Wow, it has been a really long time since I wrote up a technical post here. But I finally had a technical challenge today that felt worth sharing, so here it goes!

As you may know, I’m working on a new game called Finger Tied. The game is a multi-touch puzzle game. Some of the levels require that you drag 4 fingers around on the screen at once. I sent an early build out to a limited set of testers yesterday afternoon and a few reported problems playing the 4-finger levels. This is why: Multitasking Gestures.

A while back Apple added a feature to iOS called Multitasking Gestures. This feature is turned on by default on the iPad, I believe. When it is active, you can use 4- or 5-finger gestures to do things like switch between running apps, close the active app, or bring up the multitasking bar. The problem is, as developers, we have absolutely no control over this. As far as I can tell, we can’t even query the OS to ask it if the feature is turned on, and we certainly can’t temporarily override the behaviour.

So testers were running into problems where they would start to play a level with 4 fingers, and the app would close. Or their iPad would switch to another app, etc. I had seen some other games bring up a message on first launch that say things like:

“Please disable Multitasking Gestures to play this game properly.”

But I don’t like the idea of ruining that initial play experience with a text-heavy popup that might not even be needed. I figured there had to be a way to detect when one of those gestures has happened. I started looking at what events I get in the game just before the gesture is captured at the OS level. It turns out, your app will receive a touches cancelled event when one of these gestures is captured. I realized I could use this in the game.

Here’s some pseudocode that runs inside touchesCancelled:

if (number of touches cancelled >= 4)
    save a BOOL that says a gesture was used

Any time I get 4 or more cancelled touches at the same time, I’ll save out that boolean value to NSUserDefaults. Now, the next time the user launches a level I do this:

gestureUsed = get saved BOOL value
if (gestureUsed && level requires >= 4 fingers)
    display a popup explaining how to turn off Multitasking Gestures
    clear the saved BOOL value from the save file

This means that the user can play through levels that don’t require 4 fingers to play without ever seeing that message. It also means if they never use a multitasking gesture (or have them turned off), they’ll never see the message. It’s only if they use a gesture and then try to play a level that needs 4 fingers that they’ll see it.

I also force the same check on applicationDidBecomeActive so that I catch the cases where the Gesture happened mid-level and the user was dumped out of the game. This means that in the case where the user has Gestures turned on (but doesn’t use them), then tries to play a 4-finger level, if they accidentally trigger a Gesture then return immediately to the game, the game will immediately pop this message up giving them an explanation of what happened.

However, this is not foolproof. Because I want to try to catch as many cases as possible, this code can generate some false positives in the following case:

  1. Player has Gestures enabled
  2. Player enters the game, then uses a Gesture to switch to another app (this will save that a Gesture occurred)
  3. Player returns to the game, realizes their Gestures will interfere with the app
  4. Player quits the game and turns off Gestures in the OS settings
  5. Player reenters the game, plays a 4-finger level
  6. The game will present the Gesture warning dialog

The other false positive that could happen occurs when a player places 4 fingers on the iPad, then drags all 4 fingers off the screen in the same frame of execution. In that case you would also get 4 touches cancelled in one event, but it would be extremely rare.

Update (2012-07-27): As Alex pointed out in the comments, you’ll also get 4 touches cancelled in the case where the user has 4 fingers on the screen then presses the Home button on the iPad. Again, I believe this is a rare enough occurrence that I’m OK with a few potential false-positives in order to catch the real ones.

So, it’s not perfect, but these are cases I can live with.

Finally, since I haven’t ever submitted this code to Apple, I make no guarantees that it will pass review. This is also untested against iOS 6, so it might fail down the road. Use at your own risk. 🙂


New Game Announcement: Finger Tied

Things have been rather quiet around here lately. From November of last year I spent 6 months doing contract work, but as May rolled around, I was finally free to start working on my own games again. I’ve since been working on a new game, which I’m announcing today!

My next game is called: Finger Tied.

I’m not saying too much about the game yet, but it’s a multi-touch, iPad-only puzzle game that requires dexterity, patience, and thought. I’m including a few screenshots below to give you a visual sense of what the game looks like (you may also be able to figure out how to play it). However, the game’s not done, so some of this may change before I ship.

How do you play it? How many levels are there? When will it launch? What do the menus look like (who doesn’t want to know this)? How awesome is it? These are all questions that will have to wait (except that last one: it’s very awesome).

I’ll be talking more about the game as I get closer to finishing it both here on the blog and on twitter.

Without further ado, the pictures!


S.O.U.L. Survivor

Last weekend (May 11-13, 2012) I took part in the annual Toronto Game Jam (or TOJam). It’s an incredible three day jam that happens at George Brown College in downtown Toronto. This year there were over 400 people jamming there!

I teamed up with Matt Rix, Dan Cox, and Whitaker Trebella to make an iPad game this year. The result is a game we’re quite proud of: S.O.U.L. Survivor

S.O.U.L. Survivor Title Screen

S.O.U.L. Survivor Title Screen

The game design started as an Action RPG, but we ran out of time to do any actual levelling or progression, so the game’s just and action/adventure game, I guess. 🙂 We wrote the game at the jam using cocos2d for iPad, but we liked it enough that I spent a couple of days porting it to run on the Mac this week. So with that, we’re making this Mac build available for download so you can check it out!

You can download the build here: S.O.U.L Survivor – Mac OS X (8.3MB)

Just unzip and run the app inside. Toggle Fullscreen with CMD-F. There’s a README with instructions and story in the zip, but I’m also including them here:

S.O.U.L. Survivor Gameplay

S.O.U.L. Survivor Gameplay

S.O.U.L. Survivor
(Where “S.O.U.L.” stands for “S.O.U.L. On Unknown Lands”)

Created at TOJam “The Sevening” ( – May 11-13, 2012 in Toronto, ON, Canada

By: Team Plain Cat
Dan Cox – Art
Owen Goss – Programming
Matt Rix – Programming
Whitaker Trebella – Music and Sound

Mac computer running Mac OS 10.6 or higher.
Unknown hardware requirements, but they should be pretty reasonable (it runs fine on my 2008 MacBook).

You have just crash landed on an island and you are the sole survivor. Parts of your plane have been scattered across the island. You must gather the parts of your plane, then return to the crash site to fix your plane and get off the island. But be careful…the island may not be as deserted as it looked from the air…

How To Play:
Goal: Gather plane parts (marked with wrench icons on the minimap) and return to the crash site to fix your plane.

Moving: Click on a tile to move to that tile.

Attacking: Click and drag a path from your character to plan an attack path. Release the mouse button to unleash your powers.

Note: You can combine a move then attack by clicking and dragging from a tile. You will first move to that tile, then launch your attack.

Good luck!

Best Infant App Ever

Thank you to everyone who voted for Baby’s Musical Hands in the 2011 Best App Ever Awards. Baby’s Musical Hands was voted as the winner for Best Infant App for iOS! Now I get to display this icon on my site (when I update it):

You can download Baby’s Musical Hands from the App Store.

Thanks again, everyone!


Best App Ever Voting is Open!

I want to thank everyone who nominated Baby’s Musical Hands for a Best App Ever Award. The app is a finalist in two categories, for both iOS and Android! If you wouldn’t mind casting your vote once again (this time to win the award), I’d really appreciate it. That is, if you think the app is deserving, of course. 🙂 Just click the buttons below to vote:


Vote for Baby’s Musical Hands for Best Infant App

Vote for Baby’s Musical Hands for Best Kid Distraction App


Vote for Baby’s Musical Hands for Best Infant App

Vote for Baby’s Musical Hands for Best Kid Distraction App