Game Development Reference
In-Depth Information
I've also received plenty of questions from many readers all wanting to know the same
thing: can the topic be used with Kobold2D as well? Previously I had to say “Yes, but
there are a few things that are slightly different.” The third edition changes my answer
to a resounding “Yes, by all means!” Whenever there's anything that works differently
in Kobold2D, I mention that. I also highlight all the things that you don't need to do
anymore if you were using Kobold2D, because that's what Kobold2D is all about:
making cocos2d easier to use.
In case you passed on the second edition, here's a quick recap of what was new in the
second edition and was further adapted for this edition. First Andreas Löw joined as a
co-author for the topic, providing valuable help to improve the topic with instructions
for his Texture Packer and Physics Editor tools. Together we overhauled a lot of the
graphics and significantly improved several chapters with additional code and new fea-
tures. And two new chapters were added: one about integrating cocos2d in a UIKit app
and the other an introduction to the (then newly released) Kobold2D.
All About ARC
Then there's ARC. Woof? What? ARC? Yes, automatic reference counting (ARC) is
Apple's new and proven technology to simplify memory management for Objective-C
applications. In essence it does away with reference counting, meaning you no longer
have to concern yourself with remembering how many times you or other code has re-
tained an object, requiring you to release it the exact same number of times. Autore-
leasing objects further complicated that matter. If you didn't get retain, release, and
autorelease 100% matched up correctly every time for every object, you were either
leaking memory or the app would be prone to crashing.
It's also good to know that ARC is not garbage collection. It works fully deterministic,
which means if you run the same program through the exact same process every time,
it will behave exactly the same. ARC is also not a runtime component—it's the com-
piler inserting retain, release, and autorelease statements automatically for you
whenever they are needed. There is a set of simple rules followed by ARC that every
Objective-C programmer previously had to follow to avoid memory leaks and crashes.
You can imagine that if a human being does that job, a lot more errors sneak in, where-
as ARC is not only able to perform this job without fail, it also optimizes your code
along the way. For example, in manual reference counting you had the ability to retain
objects multiple times. ARC, however, realizes when additional retains are unnecessary
and omits them.
Search Nedrilad ::




Custom Search