Archive for January, 2011


Heapshot Analysis

This post wins the award for Best Walkthrough of Using Instruments EVAR — step by step details on how to track down those Really, Really Hard To Find memory leaks too subtle for the analyzer to pick up on:

When is a Leak not a Leak? Using Heapshot Analysis to Find Undesirable Memory Growth

The “Heap Growth” and “Still Alive” columns provide a summation of all of the objects in that heapshot that still exist in all subsequent samplings of the heap. That is, in Heapshot 3, there were 36.08K of allocations spread across 260 allocation events that continued to exist throughout the rest of the run…

… Not only can we expand any given Heapshot iteration to see the inventory of permanent objects allocated in that iteration, but we can dive all the way down to the individual allocations and see a backtrace of exactly where it was allocated.

Turn on Record reference counts in the Allocations instrument. When the app isn’t running, hit the little (i) in the Allocations track in Instruments and click the check box. Then run the application and do the same set of samples (or turn this on from the beginning if you didn’t forget like I did).

Now, when you click through any allocation, you’ll see a list of events that includes the point of allocation and all subsequent retain/release events…

Read the whole thing!


Game Engine Listings

In case you missed it, the good folk over at ManiacDev have updated their game engine listings:

iPhone Game Engine Comparison – Open Source

The Commercial iPhone Game Engine Comparison (3D and 2D)

Seems pretty comprehensive as of today, but if you’re reading this a little later you might want to see what’s happened since over at Pixelwave, particularly if you’re looking at Flash porting; and the Esenthel engine appears missing too.

And as if you’re researching game engine choices you probably have some cross-platform deployment in mind, there’s yet another ManiacDev list for that;

6 Cross Platform iOS And Android Solutions That You Can Use Right Now

and you might want to also consider cocos2d, if any of the various porting initiatives we listed a few days ago come to some deployable fruition.

Any other game engines/cross-platform development options that we should be collecting here, Dear Readers?


Hah! And just a couple days later, look what we have here:

Announcing cocos3d – a 3D extension for cocos2d

I am pleased to announce the public release of cocos3d, a significant extension to cocos2d that adds a full 3D modelling space, including 3D mesh models, perspective projection cameras, materials, and lighting. With cocos3d, you can populate your world with 3D models exported from 3D editors such as Blender, 3ds Max or Cheetah3D, combined with models you create dynamically in your Objective-C code.

Integration with cocos2d is seamless. Rendering of all 3D model objects occurs within a special cocos2d layer, which fits seamlessly into the cocos2d node hierarchy, allowing 2D nodes such as controls, labels, and health bars to be drawn under, over, or beside 3D model objects. With this design, 2D objects, 3D objects, and sound can interact with each other to create a rich, synchronized audio-visual experience…

That’s some serious additions … and still all MIT licensed, no less!


Project Management: ProjectPier

Here’s an interesting post on setting up a development technology stack:

How to setup a complete Project Management, Subversion and Issue Tracking ecosystem

Interesting because whilst the recommendations pretty much mirror exactly the setup of the Trollwerks code foundry, they include a project management system we had not heard of before, the open source self-hosted ProjectPier:

ProjectPier is an open source online management system very similar to the ultra popular Basecamp from 37signals. It doesn’t have those hard features of project management (like Gantt Charts, etc), it simply deals with projects as Tasks, Messages, Files, Milestones, Tickets and optional Wiki per project…

Using Project Pier is very easy and straightforward:

  1. Create a project.
  2. Create a “Client Company”.
  3. Add users to the client company.
  4. Set these users to the created project and give them appropriate permissions (permissions are related per project, which means that you may have hundreds of projects and the client will only see his related projects).
  5. Add milestones, tasks, files, etc, don’t forget to check notifications checkboxes when applied.

Now you can center everything related to your project in Project Pier and access everywhere: brainstorming, files, tasks, bug tracking, etc. Explain and invite your clients to not directly send project related emails, but to post Messages in Project Pier (everyone receives them by email after that).

Note that you can add “Private Items”: private milestones, tasks, etc that the involved clients won’t see. Those can be internal tasks/files/etc that you don’t want the client to see nor participate…

Hmmm. That sounds like a pretty darn attractive solution for working with clients that don’t have their own project management set up. Currently, when left to our own devices we pretty much rely on the amazingly awesome Things for short-term GTD-style task management — all there is in a client project, generally — and stash longer term issues in a free Lighthouse account accessed through the sweet Lighthouse Keeper native client. However, it would be nice to have something with a bit more structure, that

A) we could add our rather long and ever growing list of projects and clients to without paying ridiculous monthly fees, and

B) is simple enough that it would be realistic to convince non-technical clients to actually use the thing. Which eliminates popular programmer-centric alternatives like Trac, Redmine, yada yada yada, right there.

A) is a given here, and surfing around the web a bit it seems that ProjectPier has a pretty good chance of qualifying under B) as well. And since it sounds like it should be pretty simple to set up on our DreamHost account, why we do believe that soon as we have a bit of a break around here (ha!) we will indeed look into setting that up and seeing how it works. Any of you Dear Readers tried out ProjectPier? How did it work, or not, for you?


Here’s a roundup of online project management tools to check out — ProjectPier is the only self-hosted one on the list, we note, which keeps it front and center as the one we’re likely to try out whenever we get a chance.

And here’s a May 2011 roundup of 30 Best FREE Project Management Software. Free is a good price! Desktop and web both, ProjectPier is on that list too.

And a June 2011 40 Most Influential Project Management Tools roundup.


Review: Cocos2d for iPhone 0.99 Beginner’s Guide

So as we mentioned in our latest cocos2d links collection, the nice folk at Packt Publishing provided us a review copy of Pablo Ruiz’s book Cocos2d for iPhone 0.99 Beginner’s Guide,

Cocos2D For iPhone Beginner's Guide.jpg

and we’ve gone through it now for you, Dear Readers!


If you’ve completed a cocos2d game … no, this is not a reference; you’ll probably find some tidbits of value, but I wouldn’t make it a high priority purchase. You probably guessed that from the ‘Beginner’s Guide’ name.

However, if you are a complete beginner to game programming … no, the name notwithstanding, what this does cover will be over your head, and it doesn’t cover things not related to cocos2d directly a beginner needs introduction to. We heartily recommend the iPhone Game Kit for you.

If you’re a programmer new to the iPhone platform … you’ll struggle with the Objective-C, no doubt. Come back after you’ve done a program or two, got the Cocoa memory model down, and so forth.

So if none of those apply, presumably you know something about programming iOS already at the UIKit level and now you want to get into programming games, and you need a walkthrough of cocos2d design principles and the associated development toolchain? Excellent, you’re the person this is actually appropriate for — as long as you’re fully aware that much of the book has already been overtaken by recent developments.


First off, take a look at the chapter list in this cocos2d forum announcement. Topic selection is good, progression is straightforward. No complaints about the overall structure then, this is indeed a well designed introduction to cocos2d.

However …

One big problem with doing a book like this is that you will inevitably be overtaken by events. Let us take this exchange from the cocos2d forums:

cell-gfx: Reading through the timer example in the book on page 28, you use the schedule:@selector method of scheduling an update to your node. However, when I refer to the cocos wiki, it says to use scheduleUpdate…

pabloruiz55: Yes it would, but as the chapter was written a while back the scheduleUpdate method didn’t exist :)

scheduleUpdate was added in 0.99.3. The version of cocos2d distributed with the sample code as of right now is 0.99.1. The current version of cocos2d is 0.99.5. The changes are substantial enough that people are encountering some difficulty applying the book’s code with the current release. So it’s pretty difficult to recommend something wholeheartedly when you know people are going to struggle with it through no fault of their own; at the very least, if you publish a book like this you should at least keep the samples up to date with the current release, and a list of updates/errata such as the above, I’m thinking; in a designated blog for book discussions, if nothing else.

Same problem applies to the chapters about tools. It goes over the Zwoptex web version for sprite sheets, not the native version or Texture Packer. The fonts chapter, we were wincing at the Hiero and Angelcode discussion: “Both are very good tools” — no. No, they are not. Granted that Glyph Designer is brand spanking new right now and no doubt was completely unheard of as the book was written, but someone picking up cocos2d today really needs to be informed about that. Again, this is the kind of thing that would be most properly addressed by something like a designated blog, or perhaps errata updates mailed to registered users.

Another example of this problem is that even the design walkthrough, which is generally good, can be significantly in error. We were brought up short on page 47 of the PDF for instance, with

“When you quit your game … the applicationWillTerminate method will be called. This is a good time to save your game’s state…”

Ah … no. Not on iOS 4. (Unless you go to some effort to get that behaviour). That would be a perfectly acceptable oversight in a book released in July last year. In December? Not so much. If lead times are so long that a statement that’s been wrong for six months can’t get corrected for publication, then there really needs to be some mechanism for distributing errata.

Moving on, we were mildly disturbed by the code samples in general. Picking on the Chapter 4 ‘ColouredStones’ example in particular, we load it up to find it’s looking for SDK 3.0. Sort that, we get

“Code Sign error: The identity ‘iPhone Developer: Pablo Ruiz (4LFH26A558)’ doesn’t match any valid certificate/private key pair in the default keychain”

and it’s set at project and target level both. OK, we can sort this out in 15 seconds, but a beginner cannot. Messr. Ruiz overlooking this before uploading, hey we can let that slide. Technical reviewers? Not so much, guys. Especially when we get around to Build and Analyze:

Screen shot 2011-01-29 at 2.21.33 AM.png

Okay, if you’re working for me, and you check in code with any warnings or analyzer results, we will have words. If you check in code with an analyzer error “Incorrect decrement of the reference count of an object that is not owned at this point by the caller”, we will have harsh words. That code which would only compile on the author’s machine and that contains significant errors made it through to the downloads? The reviewers have not done their job acceptably. Yeah, our standards are high. So should yours be.

That said, with a little coaxing we did get all three of the game samples to run, and they are well chosen to give a good overview of the functionality discussed throughout the book; so we’re only mildly disturbed, there is a good bit of value here.

We could nitpick a while more, but you’ve pretty much got our feeling now; the book is well designed for what it is, which would be more accurately named “Walkthrough of cocos2d Development for the iOS Programmer” than a “Beginner’s Guide”, that being somewhat of a misnomer. However, it’s well designed for the state of cocos2d development prior to iOS 4, which makes reading it now mildly problematic. And that goes even more so for the source code, which is not only somewhat outdated but really should have had much better review before letting it loose on the readers. Valuable, yes; exemplary, not by a long shot.

So clean the code, update it to current recommended practices, update the tools chapters, and put a process in place for updates to stay in sync with continuing cocos2d development; yep, we’d give 2nd Edition a nine, nine and a half as an excellent introduction to cocos2d. What we’re reviewing today … yes, we’d recommend it to someone who asked for the best way to start getting up to speed on cocos2d we knew of, but would make a point of telling them to read the caveats above. Six and a half, seven, that’s about the best we can muster up. Still, a fine effort by Messr. Ruiz, and we do hope sales go well enough to merit an update!



So here’s another worthwhile initiative around the use of URL schemes for iOS IAC

x-callback-url: iOS interapp communication

The goal of the x-callback-url specification is to provide a standardized means for iOS developers to expose and document the methods they make available to other apps. Using x-callback-url’s source apps can launch other apps passing data and context information, and also provide parameters instructing the target app to return data and control back to the source app after executing an action. Specific supported actions will be dependent on the individual apps…

Hey, if you’re planning to implement a URL schema for some reason, seems no good reason not to support it!

h/t: @joe_carney!


Designing To Succeed

Must reading for all you game designers out there, indie or not:

Indie Games: Designing To Succeed

The golden rule of game design is that if the game itself is of exceptional quality, it will succeed despite any shortcomings in its business plan. Games like this are rare, though we all seem to set out to make one. What follows here is not a recipe or guide to exceptional game design. Instead, this essay is meant as a road map to maximize your chances of your game becoming successful, from conception to release. It looks at everything from coding practices to business practices in an attempt to clarify common and critical mistakes, and point indie developers into a profitable direction…

Read it all!

h/t: @markjnet!


And here’s another piece on designing game mechanics, specifically rewards:

… studies have shown that the order in which players (that would be “customers” for most of us) actually value rewards is thus:

Status – ie: Platinum Elite in frequent flyer programs.

Access – ie: Gilt Noir members get access to sale items 15 minutes ahead of everyone else.

Power – ie: After a certain level of achievement, the player gets “power” over other players, like power moderators on Craigslist.

Stuff – ie: Buy ten coffees and get one free.

The best thing about this revelation is that this is the exact OPPOSITE order for which it costs to provide these rewards…

h/t: @rwenderlich!


Speech Stuff: OpenEars

Well, this certainly looks like a big jump in functionality over any of the open source speech libraries we were previously aware of:

Welcome to OpenEars!

OpenEars is an open-source iOS library for implementing round-trip English language speech recognition and text-to-speech on the iPhone and iPad, which uses the CMU Pocketsphinx and CMU Flite libraries.

Check out this veritable cornucopia of niftiness:

  • Listen continuously for speech on a background thread, while suspending or resuming speech processing on demand, all while using less than 10% CPU on average on an iPhone 3G (decoding speech and speaking uses more CPU),
  • Use any of 8 voices for speech,
  • Know whether headphones are plugged in and continue voice recognition during speech only when they are plugged in,
  • Dispatch information to any part of your app about the results of speech recognition and speech, or changes in the state of the audio session (such as an incoming phone call or headphones being plugged in),
  • Deliver level metering for both speech input and speech output so you can design visual feedback for both states.
  • Support JSGF grammars,
  • Be easily interacted with via standard and simple Objective-C methods,
  • Have all significant operating options controlled via configuration files,
  • Be installed in a Cocoa-standard fashion using static library projects that, after initial configuration, allow you to target or re-target any SDKs or architectures that are supported by the libraries (verified as going back to SDK 3.1.2 at least) by making changes to your main project only.

That’s a pretty serious helping of awesome there, indeed. And there’s even excellent-looking installation and configuration documentation available – starting with, eponymously enough, Getting Started With OpenEars!

h/t: ManiacDev!


Animated Water

Now this is some really serious niftiness in low overhead cool graphics effects — how to animate infinite water with one 300×300 texture:

The Cool Effect that No-one Noticed

… I painted a set of 4×4 ocean tiles that were tileable spatially (from one tile to any other tile), and temporally (through the horizontally adjacent neighbours). This allowed me to create a 3D ocean grid with a random texture tile in each grid cell. Each cell was then animated forwards in time from its starting frame. All tiles were guaranteed to match up with all neighbouring cells due to the arbitrary tiling nature of the texture…

Woah. There’s no way we’d even try to design a texture like that, trolls not being artists in approximately the same sense in which a fish is not a bird. Luckily, we don’t have to, as the good folks who came up with it freely sharing the texture in question:


Check out the link above for a video showing the in-game effect — no, seriously, go check it out, it’s really quite striking — and a visual explanation of how to set up the grid to display it. Cool effect, indeed!



cocos2d Linkapalooza

So it’s been a while since we made our last collection post of cocos2d goodies, just a few particularly interesting notes since; so this is a good time for another one of those. Particularly as we’ve just starting reading this new book on cocos2d development,

Cocos2D For iPhone Beginner's Guide.jpg

which the obviously brilliantly discerning folk at Packt have provided a review copy of in return for sharing our thoughts on it with you all, Dear Readers, which we’ll post in a few days no doubt you can read here.

In the meantime, here’s a jumble of links we’ve noted since that last collection:

Ray Wenderlich, of course, has posted more of those brilliant tutorials of his:

How To Drag and Drop Sprites with Cocos2D

How To Create A Mole Whacking Game with Cocos2D: Part 1/2 and Part 2/2

Steffen Itterheim has a starter Xcode project up on github that looks rather more fleshed out than the standard templates.

Miscellaneous interesting-looking tips and samples:

Infinite scrolling background with Cocos2D

Cocos2d Sprite Swipe Angles

Cocos2d Cool Gallery [allows users to scroll between data read from a plist]

Cocos2d Box2d Car

Cocos2D Sliding Menu Grid

AWTextureFilter implemented in cocos2d [blur/shadow effects]

Making it rain in Cocos2d

RPG-like text box with Cocos2D

Reusable Particles and cocos2d

Create a Looping and Scrolling Menu in Cocos2D

iPhone platform game, how to create tiled maps and How the monsters are added in a game

Creating a Slider Control in cocos2d (discussion)

Game Kit Data Send/Receive Demo Project

Another Cocos2D gem: ClippingNode

Cocos2D and Hexagons

Spice up your game with Particle Effects

Page Scrolling CCLayer like UIScrollView

A SpaceManager Game [want to clone Angry Birds?]

Sure to be something for you in there! And to finish up, did you know how many versions of cocos2d are out there?

cocos2d: The Mac/Windows/Linux Python project that started it all

cocos2d-iphone: The project generally referred to simply as ‘cocos2d’ in the iOS world; increasingly inaccurately named as it’s added support for iPad and lately Mac OS X as well

ShinyCocos: Ruby wrapper for iOS

CocosNet: C# port for MonoTouch and potentially other .NET platforms

cocos2d-win: Intended Windows port, appears DOA

cocos2d-android / cocos2d-android-1 (more recently active fork): Java port to Android

cocos2d-javascript: HTML5 port to the Web

cocos2d-x: C++ port to iOS, Android, Win32, uPhone

Certainly be interesting to see development of all these branches shake out!


AdsReloaded Giveaway

So you remember back a bit we talked about the latest wild wooly frontier in marketing, directly paying users to install your app? Well, if that interested you, has Matt Sencenbaugh the CEO at AdsReloaded got a deal for you:

I would like to offer developers a free $5 dollar credit or campaign on AdsReloaded in exchange for feedback on what works, what doesn’t, and what they wish the service had. I really am trying to find a good market fit for what developers need. The $5 can be used as a stand-alone campaign or can be used as a credit toward purchasing a bigger campaign. Since the company is small I can’t promise to deliver big download numbers at all, but hey it’s a free $5.

If its a free app this $5 will get them 50 downloads. A campaign does require a small code snippet integration, and an update being approved; although the integration with the AdsReloaded framework usually only takes about 5 minutes.

Yesirree, Dear Readers; not only do you get delivered a never-ending cornucopia of development esoterica through your laudable choice of blog pursuance, now you’re getting FREE! MONEY! Woo-woo-woo-hoo!

The integration is pretty much as simple as simple gets,

… the framework is attached:

  1. Unzip
  2. Drag the folder “AdsReloaded.framework” into Xcode under Frameworks.
  3. Be sure to select “copy to destination folder”.
  4. #import <AdsReloaded/AdsReloaded.h> to your appDelegate
  5. Add the following line of code to the top of -applicationDidFinishLaunching:

[AdsReloaded registerDownload];

and we see from the credits that it was written by Oliver Drobnik, so you can be fairly complacent about the quality of product you’re letting into your codebase, we trust.

If you’re still wondering why on earth you’d even consider this whole pay to install thing for your marketing campaign, there are a few good points in its favor:

- A big problem with the freebie promotions is that free rankings aren’t transferable to paid rankings, and we get the impression that the vast majority of people see their paid rankings hardly move at all after these promotions. If you’re kicking back on paid installs, hey at least they’re pushing you up the paid charts.

- Unlike most other forms of advertising, you’re not paying for anything except results. You know exactly what your cost of acquisition is going to be going in, and you can limit it to exactly the number of acquisitions you’re willing to pay for. Particularly you poor suckers who tried out iAds for Developers, that sounds like a compelling advantage, doesn’t it now? (No, we’re not speaking from experience here, but not having heard of one single person who found them a good investment, generalization seems warranted. Feel free to correct us if they worked for you!)

- And while it’s still free to the user, or actually being paid in the case of free apps, observed user behaviour so far indicates, according to Messr. Matt, that they are actually rather discriminating in the apps they choose to download as opposed to chowing down on everything available. This, he posits, will avoid the ratings hit effect which is the bane of free apps. We’re mildly skeptical on that one, but hey could be.

So overall, if you do have a marketing budget you’re trying to figure out something effective to do with — and if you don’t, hey now you have one, it’s $5! — this pay to install them does sound worth an experiment, we’d say. The signup page is here, let us know how it works out for you!