I took some time to research the various ports which carry the Cocos2D name or are Cocos2D in spirit if not by name. The following list is – to the best of my knowledge and at the time of writing – complete and accurate. I counted a total of eight ports.

The dates are based on the earliest public record I was able to find. Of course the project might have been in development for longer, but not publicly or not where I’ve been looking (mostly google code and github). I usually checked the source code commit history, the first issue being tracked, the first post made on the forum or wiki, the history of downloadable files, and similar things. The list is sorted by date of inception. Underneath you’ll find my analysis of the state of the Cocos2D game engines, as I perceive it, and I try an outlook into the future.

The Complete List of Cocos2D Game Engines

Cocos2D

Language: Python
Platform(s): Mac OS, Windows, Linux
Around since: March 2008
Latest update: September 2010

Cocos2D for iOS

Language: Objective-C
Platform(s): iOS Devices, Mac OS X
Around since: June 2008
Latest update: November 2010 (Latest Stable: July 2010, Latest Commit: December 2010)

ShinyCocos

Language: Ruby
Platform(s): iOS
Around since: April 2009
Latest update: April 2010

CocosNet

Language: C#
Platform(s): iOS (MonoTouch)
Goal: to also support other .NET platforms like Windows, Windows Phone and Xbox 360
Around since: October 2009
Latest update: September 2010

Cocos2D for Android

Language: Java
Platform(s): Android
Versions: cocos2d-android (code on github), active branch: cocos2d-android-1 (code on github)
Notable: cocos2d-android-1 was branched off of cocos2d-android in October 2010 because some developers were dissatisfied with its slow progress. Apparently source code commits had stopped in June.
Around since: January 2010
Latest update: June 2010 (cocos2d-android), December 2010 (cocos2d-android-1)

Cocos2D for Windows

Language: C++
Platform(s): Windows, Windows Mobile
Notable: this project was apparently short-lived. One big code push, one blog post, no updates since, neither code nor blog or anything else. I believe we can consider this port dead, especially in light of Cocos2D-X.
Around since: April 2010
Latest update: May 2010

Cocos2D for Web

Language: Javascript
Platform(s): Web Browsers
Website with online demo: http://cocos2d-javascript.org/
Around since: June 2010
Latest update: December 2010

Cocos2D X

Language: C++
Platform(s): iOS, Android, uPhone, Win32, others
Notable: although the project started in July 2010 (from what I can tell) the project was not widely known until November 13th by announcing it on Twitter.
Around since: July 2010
Latest update: December 2010

The State of Cocos2D Game Engines

In my opinion, we currently have only two serious contenders: Cocos2D for iOS and Cocos2D X.

The former has a history of regular updates for over 2.5 years and a strong community, the latter is growing fast because there’s a whole team behind it which is sponsored/financed by China Unicom. If I extrapolate what has happened in recent months with these two game engines, I’m convinced that rather sooner than later Cocos2D X will be on par or overtaking Cocos2D for iOS in terms of maturity, stability and general applicability. You just have to consider a team of paid (?) developers vs. (for the most part) a single developer, and my guess is they don’t have a problem with and may even be supportive of 3rd party commercial add-on products. I do agree that Cocos2D for iOS will remain the most interesting platform for beginning developers, developers with a strong background in Objective-C programming and those who simply don’t want to take their games and apps to multiple platforms. For everyone else: keep a close eye on Cocos2D X. It certainly had a lot of developer’s eyebrows raised.

There’s one strong follow-up and that is Cocos2D for Web (cocos2d-javascript). Frequently updated and in a well protected niche that can’t be covered by the aforementioned Cocos2D versions. Plus, and this is freaky, you could even make web-based Cocos2D games that also run on the iPhone’s browser – think of the opportunities! It’s iRepetetiveWebBasedGameMakingTonsOfMoney time. Just kidding, except that I’m not. I think Cocos2D for Web stands a good chance at becoming relatively popular and seeing actual use, and with continued and relatively frequent updates this might be happening over the course of 2011. Keep at it!

Cocos2D (Python), the grandparent, is a niche project and it’ll remain a niche project. Too long has it been a niche, too seldom do we see updates, too low is its version number still (v0.4 after 2.5 years), too little interest is there in general for entirely Python based game engines, too strong are the contenders both from the same language (specifically PyGame) as well as most other game engines with a focus on 2D games. The same goes for ShinyCocos – who would want to write iPhone games in Ruby? Don’t kill me, I know you’re out there, but you have to admit that you’re just a little too freaky for your own good. 😉

Cocos2D for Android and CocosNet are both ports I wish I could believe in, but I don’t just yet. For the former, the recent branch has made it more interesting and actively supported, but who knows for how long? And then there’s Cocos2D X which takes some wind out of both, but especially the Android version. Unless you’re Java-esque through and through. For CocosNet I wish it’ll one day reach its goal and hopefully be based on or ported to the XNA platform, and not Mono (yikes!), so that we can write Cocos2D games for the Xbox 360, Zune, Windows and Windows Phone 7 and publish them through/on Microsoft’s AppHub. That would rock! Count me in if that ever happens. :)

Which leaves Cocos2D for Windows. This is a project that’s so typical of a certain type of open source projects. I dub these occurrences “open source dumps”. It’s literally some programmer coming out of his apartment after months of hard work, telling the world “Hey guys, look, I’m bringing my trash out!”. Except that the trash is actually quite interesting, yet it’s incomplete, unfinished and de facto unusable so it stays in the trashbin and everyone stopping by and taking a sniff is going “Ewwwww!!!”. Well, and said developer goes back to his apartment, probably working on his next trash dump. If we’re lucky, it’ll be an update to the former project – but by the time the second update appears, most developers with an interest have lost faith in the project. But more often than not, we’ll never see or hear of this developer again. In other words: Cocos2D for Windows was practically dead the day it started. And now with Cocos2D X I seriously doubt we need it anymore. It’s a shame.

Add your link to the Cocos2D Linkvent Calendar

Do you have something to share with the Cocos2D community? I haven’t received enough submissions to fill all the days until Xmas, although I do have enough links to post one each day, I’d rather post a link to your website or blog post.

Tagged with:  

Dan Nelson has worked on his Cocos2D based game BATAK Duel (view it on iTunes) for 5 months. He received dozens of requests from fellow developers to share his source code. About 3 weeks ago he made the game’s source code available for purchase, for $297.

The feature list is quite impressive:

– A Complete iPhone Game Framework, can easily be customised for your next game!
– Seamless OpenFeint integration
– Learn how to set up OpenFeint achievements
– How to set up a menu system with multiple sections
– How to save and restore user settings
– How to implement a Singleton object for global variable support
– Discover how to create Fire and Smoke Effects
– How to set up a visually impressive ‘opponent ladder‘
– See how to use Particle systems to create superb visual effects (for example, a huge storm with torrential rain!)
– How to detect when a fast moving object has been touched by the player
– How to play multiple sound effects simultaneously
– How to play and pause music
– How to pause and resume the game
– How to handle the input of player ‘unlock codes‘ using a UITextField control
and a super cool transparent pop up keyboard!
– How to set up a smooth scrolling ‘Credits‘ section

Read Dan’s announcement or go ahead and purchase the BATAK Duel source code. What’s more, Dan has setup an affiliate link that you can put up on your website. For each sale made through the affiliate link you’ll get a 35% commission ($103.95). To make use of the affiliate link you have to register as affiliate with e-Junkie and select the BATAK Duel Cocos2D Source Code product.

By the way, you get the full Xcode project and all of the art, music and sound files but the asset files are not intended for redistribution, eg. you can’t include them in your own game.

Add your link to the Cocos2D Linkvent Calendar

Do you have something to share with the Cocos2D community? I haven’t received enough submissions to fill all the days until Xmas, although I do have enough links to post one each day, I’d rather post a link to your website or blog post.

Todays link is one that I came across recently and I believe you’ll find that very helpful. Simon Skinner (@vultuk) wrote a blog post and published the source code for his implementation of a UIScrollView-like page scrolling layer implemented with Cocos2D. It behaves similar to browsing photos in the Photo application, with snapping and bouncing and all that. See this video:

Read Simon’s article on the Debug, Design, Assemble, Play (DK101) blog and grab the source code here: Implementing Page Scrolling in Cocos2D

Add your link to the Cocos2D Linkvent Calendar

Do you have something to share with the Cocos2D community? I haven’t received enough submissions to fill all the days until Xmas, although I do have enough links to post one each day, I’d rather post a link to your website or blog post.

Nate Weiss, author of the commercial iPhone Game Kit, would like you to help build the first community driven RPG game for the iPhone. Read his announcement.

He wrote a game design document for you to wet your appetite and learn what needs to be done. It’s an ambitious project that I believe would be awesome to take part in, especially if you don’t have the time and energy to build a complete game project by yourself, but you still like to take part in fruitful game development activities. What the game needs most is to design levels using the popular Tiled Map Editor, and new artworks for tiles, characters and cutscenes.

You do need to have a copy of the iPhone Game Kit to participate, but currently it’s on sale with 30% off and costs only $69. For that you get the complete source code and assets for the Quexlor action RPG and a 150 page game development eBook. I think his product and ebook are excellent and well worth the money, and I’m currently running two ads for Nate on a voluntary basis. You can learn more about the pros and cons of the iPhone Game Kit from these independent reviews:

Add your link to the Cocos2D Linkvent Calendar

Do you have something to share with the Cocos2D community? I haven’t received enough submissions to fill all the days until Xmas, although I do have enough links to post one each day, I’d rather post a link to your website or blog post.

Tagged with:  

Learn Cocos2D Game Development: eBook is final!

On November 16, 2010, in Announcements, book, cocos2d, by Steffen Itterheim

Just today I was informed that the eBook version of Learn iPhone and iPad Cocos2D Game Development is now available in its final form!

UPDATE: the source code download (also on the book’s page, left side, under Book Resources) now includes all of the source code.

The print edition will follow sometime soon, hopefully within the next ~3 weeks.

On a related note, Ray Wenderlich joined forces with Rod Strougo to help finish Rod’s Cocos2D book, due to an oddly scheduled release date whose publisher apparently feels impossible to postpone. By that I mean to say: Rod’s wife is having a baby. Congratulations to that, and the book! :)

Tagged with:  

The Art of Assertion (as it pertains to Xcode)

On November 9, 2010, in Programming, Xcode, by Steffen Itterheim

Recently, I’ve changed all my project’s source code files from .m to .mm file extensions. This is telling the compiler to compile the files as Objective-C++/C++ code instead of the default Objective-C/C. I needed to do so because I’m using Box2D, and as a habit I intend to use .mm from now on for every source file I create.

However, beware the subtle differences. Previously, if an NSAssert was triggered, it halted the program execution. But in .mm files it simply prints the assertion message to the console while the App continues execution. This leads to overlooked assertions, or continuously dumping assertion messages to the console. Clearly not what I wanted. Changing the file extension from .mm back to .m fixed the problem, but that’s not an option I have for all files.

I looked around and found a blog article by Vincent Gable mentioning that NSAssert is considered harmful. That caught my attention, because it described the same problem that I experienced (NSAssert not halting execution) while basing the argument on Voodoo (“Sometimes it does, sometimes it does not …”) respectively no argument at all, it’s just telling you “NSAssert is unreliable, therefore dangerous”.

It’s as if he wants me to prove him wrong. :)

In Vincent’s defense, the wrong he’s done unto NSAssert he makes up for by having written a great logging method which I’m going to add to gocos because it’s so handy.

Why assert() is less useful than NSAssert

First of all, the assert() function has one big problem: it doesn’t allow parameters to be added to the output string, since the output string can only be a constant string, like in this example:

[cc lang=”objc”]
assert(value < maxValue && @"value too big!"); [/cc] With NSAssert you can actually embedd some values into the assertion message: [cc lang="objc"] NSAssert2(value < maxValue, @"value %i too big (max:%i)!", value, maxValue); [/cc] It is tremendeously helpful in many cases to actually see the offending or interesting values in the error message, without having to fire up the debugger. Especially when it comes to filenames, and even more so if end users might see those assertions. Not a problem on the iOS, but think of developing desktop Apps.

Why NSAssert isn’t harmful, and how to fix it

So then, why did my App not stop execution when an NSAssert triggered? I can’t really answer you that, Apple’s docs say that NSAssert will raise an NSInternalInconsistencyException. So that should stop the App from running? It does not seem to be the case when you’re using the Objective-C++ compiler, and I’m not running the code on a different thread either. Maybe someone can shed some light as to why NSAssert in C++ code doesn’t automatically stop the App from running.

The good thing is, there’s an easy way to fix that. In Xcode choose Run -> Show -> Breakpoints from the menu, to bring up the breakpoints list. In the breakpoint list you only need to add the symbol objc_exception_throw. Next time an NSAssert triggers, the App will stop immediately and bring up the debugger.

Some places (for example: here) will also tell you to add [NSException raise] to the breakpoints list. That’s not necessary, this has been replaced with objc_exception_throw since Mac OS X 10.5.

Turning off assertions

I must admit, I’m totally spoiled by Visual Studio. Why Xcode requires you to add NS_BLOCK_ASSERTIONS as a macro to your project’s build settings in order to not compile NSAssert in release builds is beyond me. If you’re using NSAssert in your code, make sure that your release and/or distribution builds define the NS_BLOCK_ASSERTIONS macro.

If you do use the assert() macro however, or if you’re using a 3rd party library that uses assert(), make sure to also define NDEBUG for release/distribution builds.

As a side note, when I update my cocos2d-project respectively replace it with gocos, it will have all these settings properly configured.

Catching uncaught exceptions

On a related matter, there’s always the issue of uncaught exceptions simply halting your App, with little chance to debug the actual cause. It happens rarely but when it does, it would be really helpful to also bring up the debugger with the current call stack and everything. You can set a global exception handler to catch uncaught exceptions by calling the NSSetUncaughtExceptionHandler in the applicationDidFinishLaunching method of your AppDelegate:

[cc lang=”objc”]
void onUncaughtException(NSException* exception)
{
NSLog(@”uncaught exception: %@”, exception.description);
}

-(void) applicationDidFinishLaunching:(UIApplication*)application
{
NSSetUncaughtExceptionHandler(&onUncaughtException);

}
[/cc]

In the onUncaughtException method you’ll simply log the exception and (very important) add a breakpoint. The NSLog message serves the purpose of being able to easily set a breakpoint inside this method. It should not be another NSAssert because that will throw another exception, which will only serve to make debugging more complicated when a simple breakpoint suffices.

Learn Cocos2d Alpha Book: Source Code now available!!

On August 30, 2010, in Announcements, book, cocos2d, by Steffen Itterheim

The Learn Cocos2d Alpha Book’s page now lists the source code for download. It’s 44 MB, contains the source code for the first 9 (!) chapters as zip files.

I’m not sure if everyone can download the source code, or only eBook purchaser. I wasn’t asked to login, so I think it may be available for everyone. Try it out! Here’s a direct download link:

Direct Download: Learn Cocos2d Alpha Book Source Code

Before you ask: no, Chapter 6 and beyond are still not available yet. They will have to wait until they have gone through the editorial process. I believe Chapter 5 is currently in this process so it will still take at least a week, maybe 2-3, before you’ll get your hands on Chapter 6. But I hope that once the editorial process has caught up with the already available 5 chapters, new ones should be available on a regular basis. Every 1-2 weeks I hope, but no guarantees. This process is very new to me too so I try to be very careful making any assumptions.

Tagged with:  

Starterkit Price Drop, Sales Numbers

On August 16, 2010, in Announcements, Marketing, by Steffen Itterheim

The important bit first: the price of the Line-Drawing Starterkit is back at $179!

The simple reason: customers voted with their wallet, it sold zero units at the $299 price point over the last two weeks while people kept asking me for rebates and price drops. I clearly misjudged the value proposition of the Starterkit and how much potential customers would be willing to spend.

About Thinking, Learning and Knowing

I’m going to be upfront about the sales numbers because I want to be instructive and convey the lesson’s I learned. I also find these numbers posts very intriguing myself. One of the things I love about working under my own terms is that I can choose how transparent you want to be. I feel there’s more to gain from transparency, being open and upfront, and sharing what you know then there is to lose.

I’ve actually been told a few times that you can’t sell to cocos2d developers. Which I find astonishing. “I don’t think there are sufficient willing customers” was the one sentence I received in an email which I find most telling. Thinking is not knowing. Thinking is: not knowing! Trying and not succeeding is ok, but thinking and not even trying is not. The former you might regret financially but seldom will you regret having done it. The latter is just being complacent and accepting the status quo, or simply a reluctance of pursuing unconventional business ideas.

I can only say: I’ve learned a lot from running this website over the past 4 months. Certainly more valuable lessons and knowledge than from most of the books I own, and the above selection is just a fraction of my library. They are the books I hold most dear and are most relevant to my work right now, including Stephen Hawking’s Universe in a Nutshell as the perfect separator between left-brain (hard skill) and right-brain (soft skill) books. It puts everything in the proper perspective. I certainly didn’t expect to learn some of the lessons nor was it easy to deal with the very unexpected ones, but I did nevertheless. The good part about the hard lessons is that they make me think even harder to learn what I need to know to understand. I also have a bunch more unconventional ideas now. And I grok Invictus.

The Numbers

The Line-Drawing Game Starterkit has been on sale (40% off back then) from July 10th to August 1st, that’s 23 days. From July 10th until the public announcement on July 20th the sales were limited to my Newsletter subscribers, close to 670 people were given the password to access the sales page at the time.

When I formed the idea of selling a Starterkit, I punched some numbers about website traffic, pricing, conversion rates, looking at other products, thinking of what certain indicators could mean, why people are having success and why others don’t. Being a pessimist I came to about 3 sales per month if the price is around $200. That would have been nice, and would have allowed me a return of investment in less than 6 months. And when I was optimistic I thought I could be making up to 5-10 sales per month, perhaps by being featured prominently. I definitely had enough positive indicators to go ahead and try making and selling the Starterkit and being sufficiently convinced that it’ll have a positive impact, financially and otherwise.

The reality is that I sold 30 copies at $179 each within 23 days! Way, way more than my expectations. See the screenshot of the payment report to the left for the monetary details. Note that the first section with 3 sales were test sales by myself, so that amount should be deducted from the total. Also, 30 times $179 does not equal the sum on the bill because surcharge fees depending on the payment method have already been deducted. Net sales is the amount after Plimus took their share, which is close to 5% if I remember correctly.

I estimated my return of investment (break even) at about $4,000. So overall it’s not bad. Not bad at all given that I made all those sales in 23 days instead of months.

The downside to this story is that after setting the price high at $299 I did not make a single sale in the past 2 weeks! This price point seems past a certain pain threshold that developers are feeling comfortable spending. Customers voted with their wallets and I basically killed my own business by modifying just one (crucial) aspect of it. I was my own worst enemy by making a wrong judgement call.

And of course I’ll try to fix it: from this day on forward the Starterkit’s regular price will be back at $179! It has proven to sell at this price point and I’m hoping to see sales pick up again. Despite this no-sales period of over 2 weeks the Starterkit earned me $120 per day on average, or an hourly rate of $15 assuming a regular 8-hour work day.

The Future

If it turns out that continued sales from the Starterkit allow me to live off it, I’m going to run this website full-time in the near future. That means more free stuff, more intriguing blog posts and every once in a while a new commercial product that targets very specific unfulfilled needs of cocos2d game developers. You might consider the cocos2d book to be one of these commercial products, and I intend to improve it after press by listening to reader’s feedback and filling any holes with free Tutorials and FAQ entries on this website. It will be a book that continues to get written.

More Lessons to learn

If you want to learn some business & marketing lessons in general I recommend reading The Long Tail to understand how niche markets work and Influence: The Psychology of Persuasion for a lesson in marketing which I find important to understand both from the seller’s and the customer’s point of view. The Long Tail was instrumental for me to actually become comfortable with the thought of selling a product to a niche audience and why that idea might just work. But also instrumental because I just keep shaking my head when I read the naive comments of some people. That’s also where how to deal with critics comes in handy.

Page 3 of 41234