Enabling ARC in a Cocos2D project isn’t as straightforward as it should be. I already explained all the necessary steps and precautions in the Enable ARC in a Cocos2D Project guide.

For this post I wanted to actually show you what’s needed to enable ARC in a cocos2d project as a video. Because it may not be as complex as you think. And because I wanted to experiment making tutorial videos. If you like the video (please let me know in the comments), there will be more video tutorials in the future!

I understand the introduction is a bit lengthy, I should have gotten to the point quicker. Feel free to skip forward to 02:20 where I begin with the instructions.

Tagged with:  

While Cocos2D is compatible with ARC, simply enabling ARC in the project’s Build Setting will throw several hundreds of errors in your face. Cocos2D doesn’t provide ARC-enabled project templates. Thus this tutorial about how to enable ARC in a newly created Cocos2D Xcode Project.

While none of these steps are overly difficult, you’ll notice there’s plenty of steps to perform. Unavoidably, and on the off chance you don’t already know, I’d like to recommend Kobold2D to you if you want to write ARC enabled Cocos2D apps. Because none of the steps below, really zero, zilch, nada, niente, keine are necessary to enable ARC in Kobold2D. That’s because it ships with 15 template projects all of which have ARC enabled out of the box. And Kobold2D 2.0 with cocos2d-iphone 2.0 is just around the corner.

Self-advertisment aside, these steps are tested with cocos2d-iphone v2.0 but should also work with cocos2d-iphone v1.1 – but admittedly I haven’t tested the process with the v1.1 version. If you find anything that’s not quite working with v1.1 please leave a comment. Preferably with the solution, that’ll be awesome!

UPDATE: I released a video version of this tutorial:

Continue reading »

Xcode 4 Template Docs

On April 21, 2011, in , by Steffen Itterheim

What you’ll get in bulletpoints:

  • Five tutorials on how to create File and Project templates
  • Extensive reference for all known TemplateInfo.plist items (keys) and settings
  • Explanation of the placeholders (eg ___FILENAME___) and variables (eg ___*___)
  • Frequently Asked Questions answered
  • Many tips and tricks
  • Total of 70 pages of documentation (PDF) from 70+ hours of experimentation
  • File and Project Template example files

Synopsis

This unofficial but comprehensive Xcode 4 Template documentation explains how to create File and Project Templates for Xcode 4. Xcode 4 uses a template format significantly different from the one used in Xcode 3, which renders all previous information on Template creation useless. The new format is also much more complex and allows for greater flexibility, for example a template can now consist of multiple inherited templates.

This Xcode 4 Template documentation first gives you a quick overview what File and Project templates are. Step-by-step tutorials show you how to create your own File and Project Templates. In the reference section the format of the TemplateInfo.plist and related files are meticulously documented. Finally there’s the Frequently Asked Questions (FAQ) section with answers to common questions. The documentation is fully hyperlinked so that you can quickly look up keywords in the reference section. Several example files for File and Project Templates help you get started and can be used as the basis for your own templates.

Available for free

The documentation is now available for free:

Download Xcode 4 Template Documentation (ZIP, 6 MB)

Disclaimers

This is not official documentation. I can not guarantee that the documentation is 100% correct, much of the information was found out through lots of trial and error. Nevertheless this documentation contains a lot more information than what is currently available on the Internet.

THE DOCUMENTATION IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DOCUMENTATION OR THE USE OR OTHER DEALINGS IN THE DOCUMENTATION.

Xcode 4 Template Documentation & Cocos2D Podcast

On April 1, 2011, in cocos2d, Kobold2D, podcast, Xcode, by Steffen Itterheim

Xcode 4 Template Documentation


UPDATE:

You can get the Xcode 4 Template Documentation here!


The Xcode 4 Template Documentation has grown to nearly 40 pages (PDF) now, with only a few images and just reference material. The reference materials are nearly complete, including placeholders, variables and explanations for the use of every key available for Xcode 4 templates and a FAQ section. I still have to add the step-by-step tutorials (including example templates) for creating your own File Templates and Project Templates, and final proof reading and corrections.

Because the Xcode 4 Template Documentation has grown so big and I’ve already invested 50+ hours in it I want to try an experiment to see if creating documentation at this level of detail is sustainable. I’ll charge a small fee for access to the document, the standard price will be $15 and I’ll start selling it at an introductory price for a short period of time.

If this works out well in terms of revenue vs time investment I will likely offer more such in-depth documentation in the future. I was thinking that 50+ sales per month at $15 is a reasonable goal, and at this rate it would certainly be a welcome incentive for writing more documentation – next to me being generally inquisitive and interested in digesting challenging and diverse subjects.

I think the success of my book also ought to tell me that I can provide such in-depth treatments of game development topics. There’s certainly a lot of need for documentation on Cocos2D in general, but also there’s a big gap in general between what online documentation and tutorials offer (which often are only written for absolute beginners and/or to capture search engine traffic) versus the need of developers to learn more about a challenging niche subject in detail, including hard facts, recommendations, tips and tricks.

Cocos2D Podcast: coming soon …

Mohammad Azam aka @azamsharp recently approached me with the idea of creating a Cocos2D Podcast series. Azam has a lot of experience with creating podcasts and screencasts for the .NET crowd, and he has been a Cocos2D developer for about 6 months now with 4 kids apps already published to the App Store.

Two weeks ago we had a first dry run using Skype and liked the results, so we’re ready to record our first podcast this weekend if nothing gets in the way. I’m excited to try and see where we can take the Cocos2D Podcast and how you will like it.

The first podcast will be an introduction about ourselves and how we ended up working with Cocos2D, before we move on to trending topics in the Cocos2D space. If you have a suggestion for what we should discuss, or if you have a particular question that you like to get answered, please let me know (write a comment).

An apology

Lastly I wanted to apologize for missing last week’s update and not having much to report on this week. I was sick with a bad cold for the last ~10 days so nothing much happened in terms of Kobold2D or the Xcode 4 Template documentation. I’m still working on both of course.

I’m also responding to fewer and fewer emails, comments and forum posts as I’m getting swamped with them while spending a lot of time on other tasks. I realized I have to face the fact that as I gain popularity (much of it thanks to my book) I can no longer tend to everyone. Instead I’ll focus on listening in and providing value for a greater number of developers rather than responding to individual request. I’m sorry and I hope you understand.

Mohammad Azam is working on a serious of Tutorials with the goal to write a complete iPhone game, called Space Demon. You can view a demonstration of the game here:

So far, the Tutorial has 3 parts:

  • Part 1 – setup, particle effects, animated background
  • Part 2 – refactoring, code architecture
  • Part 3 – moving the ship, shooting and getting shot, enemy

Tutorials for Cocos2D for iOS are a plenty on the web. But I managed to find one that’s not very well known and provides a more technical introduction to the Cocos2D concepts and how to program menus, animations and detecting collisions. By technical I mean that the focus is clearly on providing working code.

Written by Hans Hamm the Tutorial Programming iPhone Games with Cocos2D is divided into four parts:

  • Part 1 – Cocos2D Architecture Overview
  • Part 2 – Buttons & Menus
  • Part 3 – Sprite Animations using a Texture Atlas
  • Part 4 – Scheduling updates & detecting collisions

Hans is also a co-founder of Anima Entertainment, they created the iPhone games Crash Birds (free) and Earth Defender:

Linkvent Calendar, Day 3: MVC with Cocos2D

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

Today’s link is about the Model-View-Controller (MVC) design pattern and how to implement it in Cocos2D. Bartek Wilczyński from Poland has written a two-part tutorial about how to implement this design pattern, and explains why this is a good design choice:

How to implement MVC pattern in Cocos2D game – Part 1
How to implement MVC pattern in Cocos2D game – Part 2

While I was reading that, I remembered that Jeremy Flores had created a github repository with his implementation of a MVC pattern in Cocos2D. He dubbed his project Cocos2D-MNC, as in Model-Node-Controller. The code is published under the MIT license.

The MVC pattern is somewhat similar to a game object component system that I described here. For both systems, the general idea is not to subclass CCSprite and put your game logic in there. CCSprite already is a complete visual representation class for your player, enemy, and what not. But in some cases, you need more than one sprite, or a combination of a sprite and particle effects. Once you get there, it’s much better to have a CCNode containing (aggregating) all the visual elements of your game object, while handling all the game logic of that object and updating the visual elements. The CCNode becomes the controller, controlling the views. As the views (sprites, effects, GL drawings, etc.) move on screen, the controller node polls the visual nodes for state information and runs the game logic code, which in turn may update the views.

In very simple terms, this is my pragmatic approach of the MVC pattern that also works quite well. It’s definitely already a big leap forward compared to extensively subclassing the CCSprite class. If you notice that you’re doing that a lot, you should do yourself a favor and read up on the MVC design pattern.

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.

The Cocos2D Linkvent Calendar 2010

On November 20, 2010, in Announcements, cocos2d, Marketing, by Steffen Itterheim

You may have heard about the Appvent Calendar by Blacksmith Games, creators of Floop and Plushed. From that idea emerged the popular Free App A Day website.

I thought, maybe I can take this idea and transform it into something slightly different: the Cocos2D Linkvent Calendar 2010. The idea being that I publish a blog post every day in December 2010 – you know, the month that ends after 24 days in that culminating event that will crash the App Store and end humanity’s existence. Or so I’ve heard. Each blog post will link to your website, blog post, tutorial, product, open source project or whatever else that might be of interest specifically to Cocos2D for iPhone developers, as long as it is “your thing”.

As my blog is closing in on 5,000 visits a week and my Twitter account is followed by over 1,400 hummingbirds and more and more of my book readers will come here and check out the site, I think that would be a nice gift to anyone who is interested in receiving some traffic from me. What you do to deserve a link is up to you. This is your chance to make your blog better known, or even kickstart it. The better and more relevant the content is to Cocos2D developers, the better your chances are that some of this traffic will stick, in form of return visits.

What you can do

Just to give you a few ideas:

  • write a postmortem of your game, and your game will surely get a few extra sales as well
  • open source your previous game’s source code, and in turn announce your new project
  • lower the price of your commercial product on that day
  • receive more attention for your technical essay about some aspect(s) of Cocos2D
  • write an awesome tutorial, for example about integrating UIKit controls in a Cocos2D project

The only thing that’s important is that the article, website, product, game, etc. is somehow relevant and of interest to Cocos2D developers. So if you “only” have a game made with Cocos2D, you should spice that up by, for example, talking about your development experience or explaining how you solved some tricky aspects of the game’s source code, including examples.

Accepting Offers Now!

I’m accepting offers now and until all 24 slots are filled, while holding a few reserve slots just in case. Please send all link requests by email to linkvent (at) learn-cocos2d.com – you don’t want to spoil the fun by posting it as a comment!

Also, you can reserve a slot by letting me know what you have in mind and are going to do, without actually having to have something to link to right now. You should be able to prepare and publish your content by early to mid December though.

I probably can’t answer all request, but if I do include yours then you’ll get a notice when I’ll publish it. Keep in mind that I will publish posts on midnight Central European Time (CET) (UTC+1), so you may have to factor in time zone differences.

Note: this is all about helping individual developers and products receive the attention they deserve while giving Cocos2D developers some useful information to digest. For that reason, I won’t link to posts on forums, wikis or other aggregating sites, to Apps on iTunes or to a code repository with just some files in it. There ought to be something to read, a little guidance if you will, and it should come from you, and it should be connected to you by putting that up on your blog or website. You can then of course link from your post to wherever you like.

Page 2 of 41234