LearnCocosTV 5: Pretty State Machine

On February 13, 2012, in LearnCocosTV, by Steffen Itterheim

KoboldScript is coming! KoboldScript brings Lua scripting to Cocos2D and Kobold2D, with Objective-C performance for the StateMachine part and faster-than-Wax performance for the runtime Lua functions.

More details and first looks at some early development scripts in this LearnCocosTV episode. I’ll have something more visual to show in 2-4 weeks.

Episode #5 – Pretty State Machine

• KoboldScript: Lua Scripting for Cocos2D & Kobold2D
o Poll: Which scripting language for Cocos2D?
o iDevBlogADay: Text Editors for Lua
• KoboldScript combines:
o Lua StateMachine generator (full ObjC performance)
o Runtime Lua functions (faster than Wax)

Continue reading »

Tagged with:  

Detecting collisions on pixel-perfect boundaries is the holy grail of collision detection in 2D games. As such, it seems like the ideal, if not to say perfect, solution to collision detection in general. Yet, it’s also quite complicated and the straightforward solutions don’t perform very well until you start optimizing the code.

This first post focuses on creating a pixel mask by analyzing the raw image data, as proposed over 3 years ago by Ernesto Corvi. It’s the fastest solution if you want to test if a point collides with a pixel on an image, which also works for rotated and scaled sprites. However it does take some optimizing to speed up detecting collisions between a bounding box of a node and the pixel mask, or two pixel masks.

The alternative solution is to render the two colliding objects onto a CCRenderTexture, as developed by Dani and others on the Cocos2D forum. It is able to detect collisions of arbitrarily rotated and scaled sprites but can be expected to be noticeably slower than a pixel mask. I will discuss this solution in a future iDevBlogADay post.

The results will find their way into Kobold2D, to make the solutions readily available to all developers.

Continue reading »

I have no doubt that automatic reference counting (ARC) is the next big leap forward for Objective-C since the introduction of Objective-C 2.0. ARC allows you to put the burden of memory management on the (Apple LLVM 3.0) compiler, and never think about retain, release and autorelease ever again.

Since many user’s first experiences with ARC will be trying to convert an existing app, they will learn the hard way that converting existing code to ARC is not a fire & forget operation. And since this is the Internet, there’s also a lot of assumptions, false statements and other myths revolving around ARC going around.

So here’s just about everything you need to know about ARC, and some ARC-mythbusting too.

Continue reading »

Whaaaaaat?

You heard right: if you want to forget about using retain, release and autorelease in your code, then the newly introduced automatic reference counting (ARC) mechanism (aka “automatic memory management”) is the way to go. And guess what?

Kobold2D Preview 6 fully supports ARC out of the box!

Download Kobold2D Preview 6

You may have heard that Cocos2D is incompatible with ARC at this time, and you’re right. However, the Cocos2D version in Kobold2D Preview 6 released just now has been improved to work with ARC. This post explains the most important changes to make Cocos2D compatible with ARC. All 15 Kobold2D example projects compile with and without ARC, just like the other libraries Kobold2D makes use of!

Continue reading »

I haven’t been able to find a list of all Objective-C @ compiler directives in one place. We all know the keywords like @interface and @implementation but others like @dynamic and @encode are lesser known, and possibly even much less understood.

Although I know most of them already, I couldn’t shake the feeling that I may be missing a hidden gem. So I made an effort to document all the Objective-C @ compiler directives in one place.

Continue reading »

Xcode 4 Debugging Crash-Course

On October 6, 2011, in idevblogaday, by Steffen Itterheim

What do you do if your app doesn’t behave as it should, or even crashes?

Answer A: Post your problem in just about every programming forum.
Answer B: Use the Xcode Debugger to analyze what’s going wrong.

Since most of you already know how to do A I’ll focus on B in this Xcode 4 Debugging Crash-Course. It’s kind of aimed at beginning Xcode developers but that’s just because I hope – against better knowledge – that experienced developers already know that … thing … that debugger stuff. Ya know?

Continue reading »

This Kobold2D FAQ article explains the difference between Corona SDK and iPhone Wax library, and evaluates the existing and future options for Lua scripting in Kobold2D.

Continue reading »

Linkvent Calendar, Day 13: Balloon Ride Postmortem

On December 13, 2010, in Cocos2D Linkvent Calendar, by Steffen Itterheim

Today’s Linkvent Calendar entry comes from David Sutoyo. His second Cocos2D game, Balloon Ride, was published on the App Store on Dec 1st. David took some time to write a postmortem about making Balloon Ride. He starts out by saying that programming in Objective-C is hard, game design is even harder but marketing is the hardest part. However, he concludes that the overall design process is fun and he is now toying with the idea of using Corona because programming in Lua is simpler than Objective-C.

David also wrote a mini-postmortem about his first Cocos2D game Memory Flash.

Watch the Balloon Ride gameplay video:

Page 2 of 3123