<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>myCodeStudio &#187; cocos2d</title>
	<atom:link href="http://www.mycodestudio.com/blog/category/development/cocos2d/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mycodestudio.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 26 Mar 2011 01:34:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Cocos2d for iPhone 0.99 Beginner&#8217;s Guide Review</title>
		<link>http://www.mycodestudio.com/blog/2011/03/25/cocos2d-for-iphone-0-99-beginners-guide-review/</link>
		<comments>http://www.mycodestudio.com/blog/2011/03/25/cocos2d-for-iphone-0-99-beginners-guide-review/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 01:34:19 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.mycodestudio.com/blog/?p=157</guid>
		<description><![CDATA[Book Summary The book, Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz, is an introduction to game development using the cocos2d for iPhone framework (http://www.cocos2d-iphone.org/). cocos2d for iPhone is an open source game development framework for Objective-C based on the cocos2d framework originally written in Python. As the 2d in the title suggests, it [...]]]></description>
			<content:encoded><![CDATA[<h2>Book Summary</h2>
<p>The book, <a href="http://link.packtpub.com/ahECpv">Cocos2d for iPhone 0.99 Beginner's Guide</a> by Pablo Ruiz, is an introduction to game development using the cocos2d for iPhone framework (<a href="http://www.cocos2d-iphone.org/">http://www.cocos2d-iphone.org/</a>). cocos2d for iPhone is an open source game development framework for Objective-C based on the cocos2d framework originally written in Python. As the 2d in the title suggests, it is really geared towards 2D games, although there can be 3D effects. The framework is free to use even in commercial products and is actively maintained with a large community. The framework has even branched out towards iPad and Mac OS X development.<span id="more-157"></span></p>
<p>The book presents the cocos2d framework by walking the reader through building three different games: Coloured Stones (Bejeweled-like game), AerialGun (vertical shooter), and Totem Balance (physics puzzler). These games are presented through a series of steps, starting with installing cocos2d on through developing nearly complete games. Each of the steps are fairly small and the author doesn't present too many concepts in each step. However each step provides a concrete result so that the reader can quickly see the results of what was just added to the code. For example, one of the first steps in AerialGun simply displays the main player sprite. Then it quickly moves on to adding the enemy sprites and making them move and shoot. From there, steps are added to handle the accelerometer to steer the player sprite, shoot bullets from the player sprite, and handle collisions between sprites.</p>
<p>While none of these games are overly complex - there are probably hundreds in the app store like them - these games do hit the main concepts of cocos2d as well as provide an introduction to game development concepts. There are topics on touch/accelerometer handling, sprites, collisions, animations, scoreboards/huds, tile maps, menus, transitions, particles and physics. The author even adds the little extra "flash" to the games, especially in the Coloured Stones example. These include animating the appearance and disappearance of the stones, animating the background on major events, and animating score for the removed stones. While this does extend out the example a bit, it is nice that the author shows that adding effects like these are really simple to do in cocos2d yet add tremendous value visually.</p>
<p>In addition to just describing cocos2d, the author adds some game development insights along the way especially with respect to game performance such as sprite reuse, tiling backgrounds, avoiding large images, image and sound loading, and tips on using the physics engine. He also provides a brief tutorial on several common game development tools used to create tile maps and particle effects. At the end there is even a chapter on integrating OpenFeint, one of the more popular social networks for games.</p>
<h2>My Thoughts</h2>
<p><em> Full disclosure: I was sent a copy of this book to review by the publisher. However, this fact has no bearing on my review.</em></p>
<p>This book is geared towards beginners in cocos2d and to some extent game development. The author assumes the reader has basic knowledge of iPhone development and Objective-C. While a reader can start iPhone game development with this book, not having any other background in iPhone development will be an issue. If keywords like @selector, retain, and autorelease are not familiar to the reader, a good Objective-C and/or iPhone development book will be handy to have nearby.</p>
<p>In addition, while it touches on some concepts of game development as its primary purpose is cocos2d and so it does not provide information on items like artificial intelligence, multi-player, networking, and general game design. Another book or online resource is needed for these and other advanced topics.</p>
<p>As mentioned in the book summary above, the author does provide that extra little bit of detail on some of the examples to add some polish. However, I wish the book editing went through the same level of detail. There are numerous errors throughout, both in the code examples and the surrounding text, that detract from the overall book. These may confuse the reader, especially if they are truly beginners.</p>
<p>The other issue, which is common with all technical books detailing an active framework, is keeping up with the latest version of the cocos2d library (currently version 0.99.5, but 1.0 is on its way). For example, the book mentions the PVR textures can only be used for 2 or 4 bit textures, but the 0.99.5 release allows you to pack any type of texture in the PVR format for image loading speed gains.</p>
<p>As an experienced iPhone developer, with some previous exposure to cocos2d in the past, I found the book to be a good refresher on cocos2d basics. I did find the book really useful in its explanation of the more advanced topics like particle effects, node actions, and the Chipmunk physics engine. There were times I wish the book went into more details, but then again this book is a "beginner's guide" so that is expected.</p>
<p>Overall, I think this book is a good starting point for someone who wants to come up to speed on cocos2d. While a lot of information is available on the web, having all the information in one spot and presented in a consistent manner is very useful. That being said, unless the book is updated for the newer releases, the book will need to be used in conjunction with the latest API documentation on the website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2011/03/25/cocos2d-for-iphone-0-99-beginners-guide-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocos2d Book</title>
		<link>http://www.mycodestudio.com/blog/2011/01/11/cocos2d-boo/</link>
		<comments>http://www.mycodestudio.com/blog/2011/01/11/cocos2d-boo/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 01:57:01 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://www.mycodestudio.com/blog/?p=150</guid>
		<description><![CDATA[I've been reading Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz in preparation for an upcoming game I am writing. I'll post a review soon.]]></description>
			<content:encoded><![CDATA[<p>I've been reading <a href="http://link.packtpub.com/ahECpv">Cocos2d for iPhone 0.99 Beginner's Guide</a> by Pablo Ruiz in preparation for an upcoming game I am writing. I'll post a review soon.</p>
<p style="text-align: center;"><a href="http://link.packtpub.com/ahECpv" target="_blank"><img class="aligncenter size-full wp-image-130" style="margin-top: 10px; margin-bottom: 10px; padding: 10px; border: 1px solid #666666;" title="Cocos2D For iPhone Beginner's Guide" src="http://www.mycodestudio.com/images/Cocos2d.jpg" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2011/01/11/cocos2d-boo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cocos2d Part1</title>
		<link>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/</link>
		<comments>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 02:40:09 +0000</pubDate>
		<dc:creator>Gary</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cocos2d]]></category>

		<guid isPermaLink="false">http://mycodestudio.com/blog/?p=57</guid>
		<description><![CDATA[Just started development of a new iPhone game and decided to use cocos2d for the game engine (versus the one built for Kascade). Since there are upcoming API changes, I started with the latest 0.9 alpha/beta (latest tips from subversion) since it will likely be released before the game will be completed. This entry is [...]]]></description>
			<content:encoded><![CDATA[<p>Just started development of a new iPhone game and decided to use <a href="http://www.cocos2d-iphone.org/" target="_blank">cocos2d</a> for the game engine (versus the one built for Kascade). Since there are upcoming API changes, I started with the latest 0.9 alpha/beta (latest tips from subversion) since it will likely be released before the game will be completed.</p>
<p>This entry is part 1 of a series that provides a starting point for anyone using cocos2d. This post kicks things off with useful links and setting up your project.<br />
<span id="more-57"></span></p>
<h2>Starting Links</h2>
<p>In addition to the main <a href="http://www.cocos2d-iphone.org/">cocos2d</a> site, the following is a list of links that I found helpful in starting development:</p>
<ul>
<li><a href="http://monoclestudios.com/cocos2d_whitepaper.html" target="_blank">http://monoclestudios.com/cocos2d_whitepaper.html</a></li>
<li><a href="http://lethain.com/entry/2008/oct/03/notes-on-cocos2d-iphone-development/" target="_blank">http://lethain.com/entry/2008/oct/03/notes-on-cocos2d-iphone-development/</a></li>
<li><a href="http://beta.letstalkiphone.com/2009/05/tic-tac-toe-in-cocos2d/" target="_blank">http://beta.letstalkiphone.com/2009/05/tic-tac-toe-in-cocos2d/</a></li>
<li><a href="http://mitchallen.com/iphone/archives/254" target="_blank">Misc links including the ones above</a></li>
</ul>
<p>All the links above refer to the older versions of cocos2d and so all the examples will have to be slightly modified (new in 0.9 is that all classes are now prefixed with CC).</p>
<h2>Setting Up</h2>
<p>The good news that as of 0.8.1, cocos2d provides XCode templates to start your own project. It installs three templates: basic cocos2d, cocos2d + Box2D, and cocos2d + Chipmunk. Box2D and Chipmunk are two different physics engines (Chipmunk was derived from an early version of Box2D). Box2D is C++ and Chipmunk is C.</p>
<p>Once you select the XCode template, you have a simple example application that runs in the simulator after a build.</p>
<p>One thing to note is that the template copies all the cocos2d files (and its dependencies) into your project directory. This will be problematic if you to update your cocos2d install like I will need to do (especially with the pre-beta) since I would need to recopy all the files again. That sounds painful so there should be a better/easier way... static libraries to the rescue!</p>
<h2>Static Libraries</h2>
<p>Doing some research on the web, these two links provided most of the relevant information to enable making cocos2d a static library.</p>
<ul>
<li><a href="http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html" target="_blank">http://blog.stormyprods.com/2008/11/using-static-libraries-with-iphone-sdk.html</a></li>
<li><a href="http://www.clintharris.net/2009/iphone-app-shared-libraries/" target="_blank">http://www.clintharris.net/2009/iphone-app-shared-libraries/</a></li>
</ul>
<p>The first link shows how to create static libraries and use them in XCode for the iPhone. I'm not sure about prior releases, but the 0.9 version comes with static libraries already included as targets in the XCode project file so this link wasn't as relevant for the setup side of things (although it is a great read).</p>
<p>However, it did point out that you would need a version for every device/simulator combination you want to work with. Not ideal. After reading the second article, there is a way to avoid that.</p>
<p>Before I get into that, you should remove the 'cocos2d sources' from your newly created project. Down in the <strong>Targets</strong> section, remove the 'cocos2d libraries'.</p>
<p><img class="aligncenter size-full wp-image-75" title="LeftSide" src="http://mycodestudio.com/blog/wp-content/uploads/2009/12/LeftSide.png" alt="LeftSide" width="280" height="450" /></p>
<p>Right click on your main target and <strong>Get Info</strong>. On the <strong>General</strong> tab, remove the 'cocos2d libraries' reference from the <strong>Direct Dependencies</strong> as well as under the <strong>Linked Libraries</strong> section.</p>
<p><img class="aligncenter size-full wp-image-78" title="TargetInfo" src="http://mycodestudio.com/blog/wp-content/uploads/2009/12/TargetInfo.png" alt="TargetInfo" width="488" height="411" /></p>
<p>At this point, I followed Clint's steps (from the second article) - except I skipped his first one: <strong>Set up a <em>shared build output </em></strong><strong>directory that will be shared by all Xcode projects.</strong></p>
<p>I didn't do this and everything seems to work fine since the referenced project will build based on your current settings. Of course, I just started my development with this so time will tell if I really needed it.</p>
<p>Once you get to the step called <strong>Configure the Library Dependencies, Linking, and Header Files</strong>, you just copy the subset of libraries from the cocos2d project reference. A good starting point for inclusion: cocos2d. Chipmunk (for physics), libpng, and CocosDenshion (for sound).</p>
<h3>A Few Notes</h3>
<p>In 0.9 libcocos2d.a actually includes FontLabel so you don't need to explicitly pull that in (if you do you will have an issue with a duplicate symbol).</p>
<p>You will need to make a single change in this version of cocos2d in order to get the libpng.a to work. Open the cocos2d project and for the libpng target, remove (uncheck) the pngtest.c from the libpng static library target. This file has a main which causes a duplicate symbol issue when compiled in with your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycodestudio.com/blog/2009/12/06/cocos2dpt1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

