KoboldTouch: MVC Wrapper For Cocos2D

On October 4, 2012, in idevblogaday, Kobold2D, KoboldScript, by Steffen Itterheim

Here’s what I’m working on. Hopefully this answers the questions I’ve been getting, in particular those about KoboldScript. And what’s happening with it, when is it coming, when can we stop using Corona SDK, etc.

UPDATE: KoboldTouch is now available!

Well then, let’s start with …


Huh, what?

Well, the short answer is: KoboldTouch is an MVC wrapper around Cocos2D.

The long answer … let me start by saying that Cocos2D is suboptimal. From a code architecture point of view. Cocos2D has no concept of structure besides views (nodes), and doesn’t encourage structure in your own code. It happily lets users subclass views in order to add data and game logic.

I can’t stop but feel helpless to see beginners learning the things we’ve abandoned 20 years ago as bad practice. Yet Cocos2D code is written by subclassing views as if it were the most natural thing to do. It’s also the very thing Apple tells you not to do.

The result are projects lacking in what is called separation of concerns. It’s not just about experience. Without a clear architectural model frequently reminding you to consider separation of concerns, anyone is more likely to end up creating a blend of design patterns at best, or worse:

Continue reading »

A question I see frequently asked by Cocos2D developers, in simplified form:

"I have this node A, how can I access this other node B?"

Whether it’s executing a message or getting the node itself as a reference, developers have a problem accessing nodes in other parts of the scene. Or the scene itself.

The most obvious is also a potentially dangerous solution: initialize the node with the references to the other nodes it needs. The danger lies in retain cycles, when node A has a retaining reference to node B and vice versa – then neither of them will let go, memory is leaked, strange bugs appear.

From the Cocos2D questions on stackoverflow.com it’s obvious how prevalent retain cycles issues are among Cocos2D developers. Therefore this article with strategies for accessing other nodes in various situations with their benefits and drawbacks.

And an explanation why self.parent.parent.parent… is really terrible practice.

Essential Cocos2D: Free Sample

Today’s iDevBlogADay article is a sample article from the upcoming Essential Cocos2D online documentation. That’s why it’s on a separate page.

More about Essential Cocos2D soon. It’s growing fast. And not to forget: Learn cocos2d 2 is now available!

Tagged with:  

The Many Reasons Why A Cocos2D Node Won’t Show

On September 6, 2012, in idevblogaday, by Steffen Itterheim

As a cocos2d user you’ve probably encountered this before: you just added another sprite, a label, a particle effect or some other node to your scene – but it just won’t show up!

This article is an attempt at documenting the possible causes, providing steps you can take to verify and hopefully rectify the situation. You can use this as a checklist to provide help for this exact situation. Bookmark this page because you will have to use it eventually, I guarantee you.

Continue reading »

Tagged with:  

Apple Device Sales Statistics Q3 2012 (Including Macs)

On August 23, 2012, in idevblogaday, by Steffen Itterheim

This is an update to the last sales statistics post to include Apple’s Q2 and Q3 2012 results as well as adding Macintosh sales:

Apple Device Sales, accumulated (Q1/2007 – Q3/2012). Y Axis is in millions.

I got the Mac sales numbers from Apple’s quarterly Earnings Press Releases dating back to Q1/2007. Nearly all Macs sold from 2007 onwards are capable of running at least OS X 10.7 (Lion). The Mac numbers include both desktop (iMac, Mac mini, Mac Pro) and portable (MacBook series) machines.

This puts things in perspective from sheer numbers. There are now more iPads in the world than there are (relatively up-to-date) Macs!

On the other hand, given that most Macs cost over $1,000 the sales numbers aren’t reflecting revenue. But you can argue that making a Mac OS X (Mountain) Lion app has the potential to reach the same number of App Store users than an iPad exclusive app.

Continue reading »

Example ARC project. Pretty awesome.

When I wrote the tutorial how to enable ARC for a cocos2d project, I neglected to include an actual working project. I mean why read and follow a long tutorial if all you really need is a working project to get started with?

Therefore I decided to enable ARC in all twelve standard cocos2d Xcode project templates for both cocos2d versions (v1.1 and v2.0), both platforms (iOS and Mac OS), both physics engines (Box2D and Chipmunk) and publish them on github.

You can download the ARC-enabled cocos2d template projects either as ZIP file or TAR file.

Continue reading »

The Starting Point for a Train Game with Freeform Tracks

On July 12, 2012, in idevblogaday, by Steffen Itterheim

If you ever wanted to build your own 2D top-down view train driving game, here’s … well, the things you need to consider plus a rudimentary source code example. Because a train following tracks is not as simple as it might seem, unless you restrict curves and switches to 90° angles and allow only very short cars and locomotives.

Here’s a video of my example project. Any stuttering is due to the screen recording software taking a toll on my system combined with the video playback framerate not rendering 60 fps (I assume it’s the standard 24 or 30 fps for Youtube videos). The video shows a sequence of three runs with a medium curve radius, a large curve radius and a ridiculously small curve radius. The yellow line indicates the track being followed by the axles, the purple line indicates the car chassis position (center point between axles).

Continue reading »

Busted! Eight Reasons not to use ARC

On June 28, 2012, in idevblogaday, by Steffen Itterheim

So, you’ve heard about Objective-C automatic reference counting (ARC). And you’ve read about it here and there and every where. But you’re not using it.

Guess what? You’re not alone. There are developers out there who refuse to use ARC, who delay using it, who believe they just can’t use it or expressly decided against using ARC for the time being. They all have their reasons.

Most of them are wrong.

Here’s a summary of reasons I’ve heard (repeatedly) in the past months from developers who aren’t using ARC, or have tried it but gave up using it. And I’ll tell you why these rationalizations are wrong, or at least over-inflated.

Continue reading »

The Crazy Things you can do with Objective-C Dot Notation

On June 14, 2012, in idevblogaday, by Steffen Itterheim

Have a look at the following code example:

Did you find it strange somehow? Odd perhaps? Then you may be surprised to learn that this is perfectly valid Objective-C code. Go ahead and try it in your project. As long as the project is set to use the Apple LLVM Compiler this will work.

Continue reading »

Page 5 of 8« First...34567...Last »