Archive for September, 2010



And as a completely direct contrast to the frantic and minimal and solitary development of the October Challenge game we’re into right now, today we have for you an announcement of our latest completed game project making it to the App Store — the “Big Secret Project” that we’ve been hinting at for a very long time as it stately wound its way through development.

Introducing: Qmaster!

Masters of trivia have moved silently throughout time until now. You feel compelled to play the game. It’s not a choice and it’s a near universal compulsion among fellow Qmasters that they cannot resist – they must duel each other.

Gather online with those who dare to challenge your knowledge of trivia and embark on your journey to becoming the next Qmaster! Knowledge is power, and as each duel takes place, the opportunity for a promotion is at hand. Progressively improve and strengthen your abilities – where the few who remain will battle to the last…

Yes, you’re reading that right, it said “trivia” and “duel” in the description both. We think we’ve actually invented a new genre of game here, “Real Time Trivia”. At least, if there’s ever been any other networked head to head trivia duelling games, we couldn’t find them.

So the deal is, you’ve got a big whack of trivia questions — most of any trivia game in the App Store last anybody checked — and you answer those more or less as you’d expect in any trivia kind of game, aside from the fact that the questions and scoring are all provided by the server instead of on the device,


and you build up your level in all the various categories of questions, so you’d have a set of scores that look like this:


which your possible opponents can find as they browse for you on the map. Yes, as they browse for you on the map.


So we don’t just have a head to head networked trivia game, we have a geolocating head to head networked trivia game. By this time, I trust you’ll agree we’re well into territory which counts as distinctly unusual indeed, and quite likely actually unique.

(Oh, btw, HOT TIP to avoid a rejection cycle: Notice in that last screenshot the lower left “Google” logo isn’t visible because the map extends under the mildly translucent bottom button bar? Uh-uh. No approval for YOU! So be careful with those map view boundaries.)

So there’s quite a bit going on here, indeed. The gameplay and structural design was set out by Charcis Games, the company created new for this game that it’s listed under in the App Store; all the client code was of course pounded out by your humble troll; the server side is a production of Justin Johnson aka, whom we unreservedly recommend for your hardcore web server development needs; and the pretty artistry is the work of Justin Baker who brought the shiny real good as you can see.

Any-hoo, if that sounds interesting, it’s FREE! to download and build up your first few levels of questions with, and no ads either; the revenue model is that you purchase a subscription to gain levels past the first few, attack more often, reveal the correct answer when you’re wrong (that’s the green highlight in the first screenshot) and so forth. The idea being that there’s no barrier to getting people involved with the game. So here it is: go get involved!



OAuth Controllers

This isn’t news to pretty much any of you by now we trust, but a couple weeks back Google released an open source library for OAuth authentication:

OAuth Sign-in Controllers for iOS and Mac OS X Applications

Indeed, some standardization on that would be nice. Between Twitter and Facebook, we believe there’s five different OAuth implementations running in our last four apps, each with their own distinct set of issues. Hopefully this code will help that settle down!

Note that apparently it includes Google’s own newly released NSURLConnection wrapper gtm-http-fetcher, although we trust someone will rework it for ASIHTTPRequest before too long…

h/t: ManiacDev!



In case you missed it, there’s a nifty new addition to the multitudinous open source projects provided to us all by Matt Gallagher of CocoaWithLove:

A ZoomingViewController to animate a UIView to fullscreen

ZoomingViewController is a class you can attach to any existing view that will let you zoom the view to fullscreen with a single tap, rotate the view while in fullscreen by rotating the device and tap to return to the original inline state…

… ZoomingViewController is as simple to use as possible: create it, set its view and the view will immediately start responding to taps, zooming to fullscreen and rotating in fullscreen mode. You can apply it to any view in your hierarchy at any time where you need fullscreen display behavior.

Handy little tool to have around, that!


PoV’s October Challenge

Had you ever heard of Ludum Dare that runs accelerated game development competitions? Well, must admit, neither had we until this post today drawing our attention to The October Challenge aka PoV’s Challenge:

Make a game — take it to market — sell 1 copy (or license it, or earn $1 in ad rev)…

…Think of this as a race (or a Nanowrimo for games+business). Have something new for sale and in a store by the end of October. And if you can sell a copy (or sign a licensing deal, or earn $1 in ad revenue), you win.

Trolls do like a challenge, and whilst we’ve ported and/or programmed to specifications quite a number of games over the years including almost a handful on the iPhone, we’ve never actually made our own. And as it happens, we were actually kicking around the idea of doing something like this anyways, as we’ve got one of Those Letters From Apple here

You have not yet uploaded a binary for your app, REDACTED. Our records show that this app was created in iTunes Connect more than 90 days ago.

If you do not upload a binary for your app by 10 October 2010 (Pacific Time), it will be deleted from iTunes Connect. The app name will then be available for another developer to use…

for a game that we were considering developing with a former coworker artist quite a while ago, and we kicked around a bunch of design ideas then they disappeared off the face of the earth whilst we got consumed with developing app after app on contract; and we’d been thinking that it might be a worthwhile idea to whip something fairly trivial out that we did ourselves in the next couple weeks to keep the moderately amusing name and to explore programming for Game Center as that would no doubt be some handy experience in any event.

And this is just the little push we needed to put off starting any more big contracts for another couple weeks to do that! So here we are throwing our hat into the ring for this challenge, to make a game all ourselves and have it sell a copy in the next 33 days, 22 hours, 47 minutes, 46 seconds. Ho ho!

Now, there is one thing we won’t make ourselves though … and that’s the icon. The rest of it we can probably stumble through enough to look at least usable, but icons, ah, those take some actual talent, and hey your icon just has to look good in the store we think. We did a post mentioning some icon designers quite a while ago, but haven’t updated that in quite a while; any of you Dear Readers have recommendations for good, and hopefully cheap, icon designers for us?

UPDATE: Actually, we only got around to getting a quote from one icon designer — Kevin Andersson, seems like a nice guy and very prompt in responding, if you’re looking for one — before we ended up doing our own icon. It doesn’t suck. We think.

h/t: @Area161!


Button Design: AppControls

So we’ve mentioned before several options for bringing the shiny to your app’s buttons; well, if you really want to get your button look just so, here’s the tool for you: AppControls!

  • Creates buttons and other application controls with pixel-perfect precision
  • Automatically renders high-resolution “@2x” images for use with the iPhone 4
  • Creates color gradients with up to 8 color-stops
  • Text content is accurately rendered and can include an optional shadow
  • Designs can be saved as a single image, 3-part image or 9-part image for automatic scaling
  • CSS output can be generated for use in an external file or as an inline style element
  • Generates custom CSS for WebKit and Mozilla
  • Designs can be saved as Presets
  • Up to 3 Presets can be combined in a single file for use as a “rollover” image for the web

Yep, that gives you pretty much all the customization you could wish for in a standardish looking button, and it’s particularly convenient to have it export CSS along with the images so your app and its website can have a unified look. At $29.90 we’d have to be rather more serious about the look of our buttons than we happen to be at the moment to actually buy it, but hey, it’s always nice to have options!



Aaaaand today we have another fine, fine troll production for the handy pocket assisting of those home gardening aficionados in the audience: introducing HydroPro!


It’s a conversion calculator, it’s a product catalog, and it’s a weekly guide to your cultivation needs:


Client code by your humble troll; database support by the great folks at Appnovation; overall project under the auspices of Jake Press Agency. The same dynamic triplet that brought you Tap This by Sarah Melody and Touch To Give, and no doubt many more in future. Also it’s notable that they’ve done what’s by far the prettiest app website we’ve seen so far for anything we’ve worked on, and ranking up there with pretty much any of the prettiest you’ve seen as well we trust.


And hey, it’s free! So all you budding (heh) hydroponicists out there … this one’s for you!



The Great Dealloc Debate

Must have been a slow week for everyone else on the Cocoa programming front; the tempest in a teapot du jour is, wait for it … the proper etiquette for dealing with your releasable instance variables in -dealloc. Yes, really. Everybody agrees that using mutators is a bad idea, because it triggers KVO observers at a remarkably inopportune time would be the most obviously compelling reason. After that … opinions vary. Wildly.

A good point to pick up the debate is Jeff Lamarche’s Dealloc which lines up the options of setting to nil or not, and then Daniel Jalkut goes off in Don’t Coddle Your Code about how apps should crash if something’s wrong not hide it, and then Messr. Lamarche follows up with More on dealloc providing another pattern for super-defensive multithreading, and blahblahblah. One of the more interesting blahblahblah’s is digdog’s To nil, or not to nil, that is the question where he builds an interesting case for niling which turns out to be based on a compiler bug about not allowing access to synthesized ivars. Which you should realize is a bug not a design, if you don’t like we didn’t.

Personally, we come completely down on the side that software you put in the App Store should NEVER crash if POSSIBLY avoidable, because you can’t distribute a fix without a submission cycle! And niling out will avoid almost all crashes. So you should do that. If as in Messr. Jalkut’s ludicrously contrived example the effect of [receiver method] being called when receiver is nil is the wrong thing, well then test that receiver exists before calling it. We pretty much tend to follow a pattern that does that anyway whenever there’s a momentous decision at stake through leftover C++ habits, so that doesn’t strike us as ineffably wrongheaded as some more Cocoaheaded purist might find it.

However, we also come completely down on the side of finding whatever bugs you can before release. That’s not actually an argument for leaving the pointers dangling as most recommend; we’ve seen too many completely wacky behaviours in completely unrelated object YYY being caused by a dangling pointer in deallocated object XXX wasting more time to track down than the behaviour of a niled instance would have been noticed to think that seriously is all that good an idea.

No, what you really want is something like NSZombieEnabled without the overhead for your development cycles, and as non-crashing as possible in something the user gets through the App Store. So we vote for something along what Kevin Ballard provided as the very first comment to the “Dealloc” post [UPDATE: Now edited to compile correctly]:

#define MCRelease(x) do { [x release]; if (!getenv("NSZombieEnabled")) x = (id)0xDEADBEEF; } while (0)
#define MCRelease(x) [x release], x = nil

Yes. Yes, that would be the One True And Correct Way™ to handle releasing your variables in -dealloc, wethinks; and the entire rest of the ongoing debate is just a waste of time. But if there’s some actual problem with that strategy, be sure to throw your two cents worth in. At the rate this thing is going, we’ll be able to retire the national debt in no time…


cocos2d Collection

So in case you missed it, cocos2d v0.99.5b3 is out today; big news is that the API has moved from pixels to points for RetinaDisplay support — but looks like there’s some issues with that on the iPad, check out the release thread for details on that and other immediate issues.

Long as we’re mentioning that, this is a good time to sort through the various interesting-looking cocos2d bits we’ve collected hither and yon the last while to add to the various posts about cocos2d related stuff we’ve done before. First off, on the physics side of things:

If you haven’t stumbled across VertexHelper for Box2D & Chipmunk Vertices yet it’s a pretty nifty tool you can find on github here and read about in another of those majestic Ray Wenderlich tutorials.

And Nick Vellios wrote a series on adding radial gravity to Box2D. (h/t: ManiacDev)

On the 3D side of things, if you’d like to mashup cocos2d with the SIO2 3D engine we’ve mentioned occasionally, like this game, check out the writeup here and cocos2d forum threads here and here.

Or if it’s UIKit that you’d like to do some mashups with, check out cocos2d and UIViewControllers and CCUIViewWrapper – wrapper for manipulating UIViews using Cocos2D for some particularly good tips.

Moving on to architecture, if you’d like your cocos2d project to be a bit more MVC-ish than conventional, the cocosMNC (“Model-Node-Controller”) superframework available on github will no doubt be of interest, as will the Subclass CCSprite vs Model Class. Best Practice? thread for various perspectives on how to approach same.

Other little snippets of possibly more than trivial interest:

CCTableViewSuite is a good start on UITableView-ish cocos2d functionality.

Fog of War Technique discusses how to implement same with acceptable performance.

How To Handle Double Taps is a good tip for handling, well, you know.

CCZSprite and HudLevelSprite address the issues with getting sprite z-ordering right.

Objective-C Flocking Behaviors has a cocos2d example. (h/t: @cocos2d)

Aaaaand once you’ve got all that implemented, and it’s just not working like you’d envisioned, check out Performance tips for Cocos2d for iPhone for some help with that.

Finally, for another recent roundup check out Getting Started with Cocos2d which has a bunch more references that might be of interest as well!


Adding UIGestureRecognizer support in cocos2d (h/t: @wadevondoom)


Tip: GAE Local Testing

So you’re about to test that web service for your iPhone app you’ve dashed off in Google App Engine because it’s so cool, and — DOH! — this app doesn’t run in the Simulator, so Google App Engine Launcher’s default publishing on localhost isn’t going to work. What to do? What to do?

Well, turns out it’s really easy:

Locally testing a Google App Engine iPhone/Android web app

… In order to make your GAE web app accessible on your local network, configure the launcher to use the address instead of localhost. To do this, open the GoogleAppEngineLauncher, go to Application Settings for your app, add the following to the Extra Flags section “-a″, and restart. You will now be able to test your web app on an any device logged into your local network.


… and if your network setup is such that the iDevice isn’t considered “local”, then putting in your machine’s real IP works a treat. For other handy things to put in that flags field, check out

Google App Engine Launcher Options


NSOperation Tips

Find yourself creating NSOperation subclasses frequently? Here’s a handy helper for you:

NSOperation Xcode File Template

with followup notes to read about why there’s tokens in the template and pointing out that you’ll also need the variable argument invocation support that we mentioned a while back.

And speaking of that blog, it’s got a couple other NSOperation goodies as well:

Future Cocoa Operation

…. One common network activity is search-as-you-type, in this case you need to also cancel the previous operation if it has not yet been completed, so lets built this behavior into the generic solution as well.

What we want is an subclass of NSOperation that provides a future result, lets call this class CWFutureOperation. It is abstract, so users are supposed to subclass and implement main method just as for NSOperation, only difference is that the main method implementation must call setResult: before exiting.

The result that is set in the main method implementation can then be fetched using the blocking method result, equivalent to get() from the Java Future. As an alternative we would also like to be handed the method upon completion via a target-action pair. If the target-action pair is only called for finished operations that are not cancelled, then we get the search-as-you-type behavior for free…

That’s some handy design guidance there, yep; and also check out his

Queued Background Tasks for Cocoa

which has handy wrapper conveniences for NSInvocationOperation and a shared global queue.

Aaaand to finish up, wondering why your NSURLConnection operations suddenly stopped working? Here’s why:

iOS4 Issue: NSURLConnection and NSOperation

… Seems like Apple has made a change where in if the NSURLConnection’s initWithRequest method is called from a thread that’s not the main thread, it doesn’t start downloading the URL contents immediately. The bug fix for this issue is fortunately simple…

And it’s just calling -performSelectorOnMainThread to start from the background operation. Now you know!