<?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>Streaming Colour Studios &#187; Technical</title>
	<atom:link href="http://www.streamingcolour.com/blog/category/technical/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.streamingcolour.com/blog</link>
	<description>The trials and joys of indie games development</description>
	<lastBuildDate>Sat, 28 Jan 2012 03:48:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Prototyping with Codea</title>
		<link>http://www.streamingcolour.com/blog/2011/11/30/prototyping-with-codea/</link>
		<comments>http://www.streamingcolour.com/blog/2011/11/30/prototyping-with-codea/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 18:15:13 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[iDevBlogADay]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[codea]]></category>
		<category><![CDATA[codify]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[Prototyping]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1629</guid>
		<description><![CDATA[It&#8217;s not very often that I talk about other games or apps on my blog, but I want to make an exception today to talk about a cool iPad app called Codea by developers TwoLivesLeft. This is a new iPad app that lets you write Lua code on your iPad and run it in-app. This [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not very often that I talk about other games or apps on my blog, but I want to make an exception today to talk about a cool iPad app called <a href="http://twolivesleft.com/Codea/" target="_blank">Codea</a> by developers <a href="http://twolivesleft.com" target="_blank">TwoLivesLeft</a>. This is a new iPad app that lets you write Lua code on your iPad and run it in-app. This means that you can use Codea to write and play game prototypes on your iPad. Say whaaaat?! Yes, on your iPad.</p>
<p>I first started hearing about the app on twitter a little before release, as some friends of mine were beta testing it. When it launched, I decided to check it out, long having wished for some way to write and run code on my iPad. I&#8217;ve spent several hours with it, and I&#8217;m quite impressed so far.</p>
<p>The first thing you need to know is that this will not let you create incredibly complex stuff. It&#8217;s 2D only, and it has a limited set of API calls available. However, what it is, is a fantastic prototyping tool, as long as you don&#8217;t mind typing on your iPad. They provide APIs that allow you to handle touches, and even accelerometer input. They also provide some basic vector graphic drawing tools (draw lines, rectangles, and ellipses). They even include <a href="http://www.lostgarden.com/" target="_blank">Daniel Cook&#8217;s</a> open source sprite collections, so that you can do some basic sprite work.</p>
<p>When I started playing around with it, two things annoyed me almost immediately:</p>
<ol>
<li>There was no font support</li>
<li>There was no way to add my own sprites to the app</li>
</ol>
<p>However, in reading through the (very active) <a href="http://twolivesleft.com/Codea/Talk/" target="_blank">forums</a>, I discovered a bunch of people sharing code to solve problems. One person wrote a vector-based font rendering class and shared it. I&#8217;m now using that and it&#8217;s great. Others pointed out that by using tools like iExplorer to access the iPad&#8217;s file system, you can dump folders of sprites into the app and have them show up. However, I quickly discovered was that I find myself using vector graphics for eveything instead of sprites. This keeps me focused on working on gameplay prototyping instead of getting bogged down in Photoshop doing pixel pushing to procrastinate. TwoLivesLeft say they&#8217;re also working on getting a bunch of this stuff working in future updates, so I can only see it getting better.</p>
<p>However, there are still some things you should be aware of:</p>
<ol>
<li>Right now there&#8217;s no way to get code to/from the app, except via copying/pasting, or using iExplorer</li>
<li>Support for Undo/Redo is pretty limited right now</li>
<li>You can&#8217;t (nor will you ever be able to) export a game right from Codea to the App Store</li>
<li>There&#8217;s no way to share code/projects with anyone else from within the app</li>
</ol>
<p>But these are limitations I&#8217;m OK with. Having some way to retrieve files and drop new files in from my computer would be pretty great, though. I&#8217;m missing not having any kind of source control on my files. <img src='http://www.streamingcolour.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Finally, I thought I&#8217;d share a screenshot of the game prototype I&#8217;ve been working on in Codea. This is for a word game concept I&#8217;ve been playing around with. What you see is about 4 hours of work. I have built a working button class, I can build words out of letter tiles, and the words detect touches.</p>
<div id="attachment_1633" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.streamingcolour.com/blog/wp-content/uploads/2011/11/IMG_0322.png"><img class="size-thumbnail wp-image-1633  " title="Codea Prototype" src="http://www.streamingcolour.com/blog/wp-content/uploads/2011/11/IMG_0322-150x112.png" alt="Codea Prototype" width="150" height="112" /></a><p class="wp-caption-text">Screenshot of my word game prototype running in Codea</p></div>
<p>The other cool thing is this is only 4 files of code, each no more than 100 lines of lua. The vector graphics make it very fast to get stuff quickly drawing, and with prototyping, that&#8217;s extremely important. And let&#8217;s not forget that I can now write code while I&#8217;m not at my computer!</p>
<p>So yes, colour me impressed. The app is still a little rough in places, but the developers seem to be actively working on improving it. Even still, at under $10 it&#8217;s an amazing prototyping tool to have on my iPad.</p>
<p>Owen</p>
<p><em>* I chose to write this review on my own. I did not receive a review copy from the developer, nor did they request that I write anything. I just think their app is cool. <img src='http://www.streamingcolour.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2011/11/30/prototyping-with-codea/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Universal OpenGL Apps</title>
		<link>http://www.streamingcolour.com/blog/2010/11/28/universal-opengl-apps/</link>
		<comments>http://www.streamingcolour.com/blog/2010/11/28/universal-opengl-apps/#comments</comments>
		<pubDate>Sun, 28 Nov 2010 18:31:27 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[iDevBlogADay]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[app store]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[UIUserInterfaceIdiomPad]]></category>
		<category><![CDATA[UI_USER_INTERFACE_IDIOM]]></category>
		<category><![CDATA[universal]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1398</guid>
		<description><![CDATA[I recently took part in the 360iDev Game Jam remotely from home. The game jam is always a lot of fun, even if you can&#8217;t get yourself to the 360iDev conference itself (which you should totally do, by the way, if you can. It&#8217;s an amazing conference). I created a game in 8 hours which [...]]]></description>
			<content:encoded><![CDATA[<p>I recently took part in the <a href="http://gamejam.360idev.com" target="_blank">360iDev Game Jam</a> remotely from home. The game jam is always a lot of fun, even if you can&#8217;t get yourself to the <a href="http://360idev.com" target="_blank">360iDev</a> conference itself (which you should totally do, by the way, if you can. It&#8217;s an amazing conference). I created a game in 8 hours which I&#8217;m calling &#8220;Dirty Diapers&#8221;, you can see the details of its creation on the <a href="http://gamejam.360idev.com/changing-the-world-one-diaper-at-a-time/" target="_blank">Game Jam site</a>. There&#8217;s a video of the game in action at the end of that page.</p>
<p>The game is about keeping a room full of babies happy. Over time, babies become unhappy because they either want to be fed, changed, or rocked. It&#8217;s your job to drag an action up from the bottom of the screen to make the baby happy again. As time goes on, they get more unhappy more frequently.</p>
<p>I think it turned out quite well, so I&#8217;ve decided to try to get it into the store at some point. Right now I&#8217;m extremely busy with some contract work, but I&#8217;m trying to find a few hours here and there to finish it up and submit it.</p>
<p>One of things I decided to try with this game was to build it as a universal app (that is, one app that runs on iPhone/iPod touch, and iPad, instead of separate apps for iPhone and iPad). The game is 100% OpenGL on the rendering side, so I needed to figure out how to set up my frame buffers for a universal app. I thought I&#8217;d go through that today. (Holy moly, a technical post instead of an indie lifestyle post! Hold on to your hats!)</p>
<h4>Project Setup</h4>
<p>The first thing you need to do for a universal app is set up your Xcode project so that it knows to build the app as universal. I went to Jeff LaMarche&#8217;s excellent blog and <a href="http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html" target="_blank">followed his instructions</a> to do this part (and read <a href="http://iphonedevelopment.blogspot.com/2010/04/few-more-notes-on-creating-universal.html" target="_blank">the follow-up post</a> for a few more details).</p>
<p>Once you&#8217;ve done that, you should have a project that can at least compile for iPad or iPhone. Good.</p>
<h4>Frame Buffer Setup</h4>
<p>Now that you&#8217;ve got your app building for multiple devices, you&#8217;re going to need to do some work to support multiple screen resolutions. As of this writing, there are three different resolutions to worry about:</p>
<ul>
<li>iPad: 1024 x 768</li>
<li>iPhone/iPod touch (non-retina display): 320 x 480</li>
<li>iPhone/iPod touch (retina display): 640 x 960</li>
</ul>
<p>However, Apple does some clever stuff to help you with the retina displays. If you query the size of the screen:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">CGRect screenFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>You&#8217;ll get 320 x 480 on <em>both </em>retina and non-retina displays. This is because they measure the screen in &#8220;points&#8221; instead of pixels now. On a retina display, there are 2 pixels for every point. The nice thing is that it lets you treat all iPhone/iPod touch screens the same way, with the same positioning code.</p>
<p>Ok, so we&#8217;ve got these different screen sizes, we need to tell OpenGL to create different sized frame buffers. Somewhere in your code you&#8217;ve probably got something <em>like</em> this, which creates a render buffer from an EAGLDrawable CAEAGLLayer:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">glBindRenderbufferOES<span style="color: #008000;">&#40;</span>GL_RENDERBUFFER_OES, buffer.<span style="color: #007788;">m_colorBufferHandle</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#91;</span>oglContext renderbufferStorage<span style="color: #008080;">:</span>GL_RENDERBUFFER_OES fromDrawable<span style="color: #008080;">:</span>drawable<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
glGetRenderbufferParameterivOES<span style="color: #008000;">&#40;</span>GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>buffer.<span style="color: #007788;">m_width</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
glGetRenderbufferParameterivOES<span style="color: #008000;">&#40;</span>GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, <span style="color: #000040;">&amp;</span>amp<span style="color: #008080;">;</span>buffer.<span style="color: #007788;">m_height</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>If you build and run, what you&#8217;ll find is that your render buffer will be created with the proper size for iPad and non-retina displays, but you&#8217;ll end up with a 320 x 480 render buffer for retina displays (which need 640 x 960), and your retina display game will look awful. This is because the CAEAGLLayer is telling OpenGL that it&#8217;s dimensions are 320 x 480 on the retina display.</p>
<p>In order to remedy this, we need to make use of two new UIView properties found in iOS 4.0 and up called: <strong>scale</strong> and <strong>contentScaleFactor</strong>.</p>
<h5>scale</h5>
<p>The new scale property will tell you the amount the point values of the UIView are being scaled. If you&#8217;re running on a non-retina display and query a view&#8217;s scale, it will be 1.0. If you&#8217;re running on an retina display, you&#8217;ll find that it&#8217;s 2.0. This gives you a way to test which kind of display we&#8217;re working with, and we&#8217;ll use this later.</p>
<h5>contentScaleFactor</h5>
<p>The contentScaleFactor is a different beast. This will always be 1.0. However, if you&#8217;re running OpenGL in a view on a retina display, <em>you</em> need to set this value to match the scale value of the view. This will tell the CAEAGLLayer to update its dimensions to match the actual pixel size of the screen, allowing you to create an appropriately sized render buffer.</p>
<p>Now, if you&#8217;re planning to support iOS versions prior to 4.0, these properties won&#8217;t be available, so you need to do runtime checks for them.</p>
<p>This is what I do inside my EAGLView&#8217;s -layoutSubviews method to set the contentScaleFactor on the view:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Set the scale factor to be the same as the main screen</span>
<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self respondsToSelector<span style="color: #002200;">:</span> NSSelectorFromString<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;contentScaleFactor&quot;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    <span style="color: #002200;">&#91;</span>self setContentScaleFactor<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> scale<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Now, when I tell the render buffer to create itself based on the size of the layer, it will create a 640 x 960 render buffer on a retina display, but a 320 x 480 buffer on a non-retina display. Hooray! But, we&#8217;re not quite there yet&#8230;</p>
<h4>Viewport Setup</h4>
<p>We&#8217;ve got our render buffer set up to create itself at the proper resolution now. It will match the screen dimension and contentScaleFactor of the EAGLView, which is what we want. Now we need to tell OpenGL to create an appropriately sized viewport. This code is for a 2D game, so adjust as necessary for a 3D game.</p>
<p>You&#8217;ll need to create a viewport that matches the frame buffer size for the given screen. Something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">glViewport<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span>, buffer.<span style="color: #007788;">m_width</span>, buffer.<span style="color: #007788;">m_height</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>For a 2D game, you then need to set up an orthogonal projection. There&#8217;s a good chance that you have a line in your code somewhere that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">glOrthof<span style="color: #008000;">&#40;</span><span style="color:#800080;">0.0f</span>, <span style="color: #0000dd;">480</span>.<span style="color: #007788;">f</span>, <span style="color: #0000dd;">320</span>.<span style="color: #007788;">f</span>, <span style="color:#800080;">0.0f</span>, <span style="color: #000040;">-</span><span style="color:#800080;">1.0f</span>, <span style="color:#800080;">1.0f</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>Clearly this isn&#8217;t going to work. Now, there are two options here for creating the transform:</p>
<h5>1) Create the transform based on the UIScreen size</h5>
<p>The code for this is simple:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;">CGRect appFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span>;
glOrthof<span style="color: #002200;">&#40;</span>0.0f, appFrame.size.width, appFrame.size.height, 0.0f, <span style="color: #002200;">-</span>1.0f, 1.0f<span style="color: #002200;">&#41;</span>;</pre></div></div>

<p>However, let&#8217;s look at what this does. On iPad, it creates a 1024 x 768 sized viewport. Great, that&#8217;s what we want. On a non-retina display, it creates a 320 x 480 viewport. Also good. But, on a retina display, it <em>also</em> creates a 320 x 480 display. Now, this is OK. The framebuffer is 640 x 960, so the pixels are there. So what does this mean?</p>
<p><strong>The Good</strong></p>
<p>You only need to write two code paths for positioning sprites on the screen: one for iPad, and one for iPhone, and let OpenGL handle matching the render buffer to the viewport appropriately for you. The only caveat here is that you&#8217;ll need to manually scale all your sprites&#8217; sizes by 50%. If you do this, you&#8217;ll scale them down to the correct point size, and then OpenGL will render them at 100% resolution when it pushes the textures through the render pipeline.</p>
<p>Confused? Think about it this way: you&#8217;ve got a view port of 320 x 480 but a render buffer of 640 x 960. Take a sprite that&#8217;s 100 pixels x 100 pixels and render it as a 100 x 100 <strong>point</strong> sprite in the viewport. This is <em>actually</em> 200 x 200 <strong>pixels</strong> in the render buffer. So in order to render it as 100 x 100 <strong>pixels</strong>, you need to scale your vertices down by 50% to a 50 x 50 <strong>point</strong> sprite.</p>
<p><strong>The Bad</strong></p>
<p>You&#8217;ll need to write some code into your sprite system (and bitmap font system) to scale things to 50% if you&#8217;re on a retina display.</p>
<p>This is the approach I use. At app startup, I get the screen scaling factor, and then use it to scale all my sprites:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> respondsToSelector<span style="color: #002200;">:</span> NSSelectorFromString<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;scale&quot;</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
    ScreenScaleFactor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> scale<span style="color: #002200;">&#93;</span>;
    InverseScaleFactor <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>.f <span style="color: #002200;">/</span> ScreenScaleFactor;
<span style="color: #002200;">&#125;</span></pre></div></div>

<h5>2) Create the transform based on the layer size</h5>
<p>The alternative is to create a different viewport size based on the actual pixel size of the screen. You can do this by getting the size of your created render buffer. Something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">glOrthof<span style="color: #008000;">&#40;</span><span style="color:#800080;">0.0f</span>, frameBuffer.<span style="color: #007788;">m_width</span>, frameBuffer.<span style="color: #007788;">m_height</span>, <span style="color:#800080;">0.0f</span>, <span style="color: #000040;">-</span><span style="color:#800080;">1.0f</span>, <span style="color:#800080;">1.0f</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></div></div>

<p>This will give you a viewport that matches the screen size in pixels, not points.</p>
<p><strong>The Good</strong></p>
<p>The advantage here is that you don&#8217;t need to do any sprite scaling. You just render everything at 100%.</p>
<p><strong>The Bad</strong></p>
<p>You&#8217;ll need to have three different code paths for sprite positioning, based on the size of the screen, as you&#8217;ll now have three different sized viewports to worry about.</p>
<h4>Art Work</h4>
<p>You&#8217;ll probably want to have different sized artwork for non-retina  displays than for iPad and retina displays. For Dirty Diapers I&#8217;ve got  two game texture atlases: one for iPad and retina displays, and one for  non-retina displays. The non-retina atlas is identical to the larger  one, it&#8217;s just scaled down 50% in Photoshop. You <em>could</em> scale your graphics in OpenGL, but it will never look as good. If you&#8217;re like me, the imperfections will just drive you nuts.</p>
<p>So I have two texture atlases, but there are 3 possible screen sizes  to worry about (see the next section). I do a check like this to  determine which texture atlas to load:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>UI_USER_INTERFACE_IDIOM<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> UIUserInterfaceIdiomPad <span style="color: #000040;">||</span>
    ScreenSizeConsts<span style="color: #008080;">::</span><span style="color: #007788;">ScreenScaleFactor</span> <span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span> <span style="color:#800080;">1.01f</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Load texture atlas for iPad/Retina display</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">else</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Load texture atlas for Original iPhone display</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>If you want to load 3 different textures (iPad, non-retina, retina),  you can use the @2x.png file naming convention (depending on how you&#8217;re loading your textures) and just check for iPad  or not, but now you&#8217;re dealing with 3 sets of textures. The choice is yours. If you&#8217;re loading textures manually and the @2x trick doesn&#8217;t work, you can split things out like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>UI_USER_INTERFACE_IDIOM<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> UIUserInterfaceIdiomPad<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Load texture atlas for iPad display</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>ScreenSizeConsts<span style="color: #008080;">::</span><span style="color: #007788;">ScreenScaleFactor</span> <span style="color: #000040;">&amp;</span>gt<span style="color: #008080;">;</span> <span style="color:#800080;">1.01f</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Load texture atlas for Retina display</span>
<span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">else</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #666666;">// Load texture atlas for Original iPhone display</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h4>Finally, Positioning</h4>
<p>Now you&#8217;ve got your different artwork loading, you&#8217;ve got your render buffer set up, and your viewport set up. Now you just need to tell your objects to render in different positions, based on the screen. To do this, I set up a bunch of member variables for positioning code (for static items), and then on init, check the device and screen scale factors and adjust them accordingly. This is necessary for 2D art layout, but if you&#8217;re working with a viewport into a 3D world, you may not need to do nearly as much work here.</p>
<h4>That&#8217;s it&#8230;</h4>
<p>There you go. I hope you were able to follow along and I wasn&#8217;t too confusing. If you&#8217;ve got better ways of doing any of this, feel free to post suggestions in the comments.</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/11/28/universal-opengl-apps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Game Dev: Getting Started</title>
		<link>http://www.streamingcolour.com/blog/2010/11/07/game-dev-getting-started/</link>
		<comments>http://www.streamingcolour.com/blog/2010/11/07/game-dev-getting-started/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 16:00:57 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[iDevBlogADay]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[game dev]]></category>
		<category><![CDATA[game loop]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[Prototyping]]></category>
		<category><![CDATA[scope]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1355</guid>
		<description><![CDATA[A friend of mine sent me a message on Twitter the other day asking if I had any tips for someone looking to get started in game development. I mentioned this was quite a large question, so I asked him to narrow the scope of his question. He came back with &#8220;between idea and prototype.&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine sent me a message on Twitter the other day asking if I had any tips for someone looking to get started in game development. I mentioned this was quite a large question, so I asked him to narrow the scope of his question. He came back with &#8220;between idea and prototype.&#8221; That seemed like a good subject for a blog post!</p>
<p>So, you&#8217;ve got some programming under your belt. Maybe you&#8217;ve been building web site back ends, or accounting software, and you&#8217;d like to try your hand at games. Where do you start? If you&#8217;ve got an idea, how on earth do you approach the process of turning that idea into a prototype?</p>
<h4>1. Consider Scope</h4>
<p>I&#8217;m putting this right up front, because it&#8217;s the biggest and one of the most common traps a new developer can fall into: your idea is just too big. It&#8217;s very easy to bite off more than you can chew with a game idea. If you&#8217;ve never made a game before, don&#8217;t try to build a huge RPG in a massive world for your first game; you will almost certainly not finish it. What about something like tic-tac-toe instead? Or your favorite card game? Or a match-3 game (my first game, <a href="http://www.streamingcolour.com/games/dapple" target="_blank">Dapple</a>, was chosen because it had a very defined scope, and it still <a href="http://www.streamingcolour.com/blog/2009/04/14/how-to-make-dapple-in-6-months/" target="_blank">took nearly 6 months to make</a>).</p>
<p>To put things into perspective: a triple-A Xbox 360 or PS3 game will have a team of 100-200 people working for 1-3 years on it. If you&#8217;re one person expecting to work on a game for six months, you need to make sure you&#8217;re working with an idea you can finish. You can&#8217;t build Halo by yourself. That&#8217;s ok. Pick a game idea you know you can finish; it will be challenging enough.</p>
<p>Also don&#8217;t forget that there are lots of parts to making a game that aren&#8217;t immediately obvious that you&#8217;ll need to build: menus, save systems, high score boards, platform specific requirements, etc, etc, etc. If you think your game is going to take you three months to make, bank on it taking six. So if you only have three months of savings to live off, maybe pick a game idea you think you can complete in a month and a half.</p>
<h4>2. Learn About Games</h4>
<p>This is a tough one, are you ready? You need to learn more about games. This means, yes, even playing other games for research. It&#8217;s a tough job, but someone&#8217;s got to do it. Take a look at other games in the genre that you&#8217;re targeting. Look at what they do well, and more importantly, what they don&#8217;t. What bugs you about the way they implemented things? What stands out as being done well? Are their menus clunky? Do the animations add that extra punch to really augment the gameplay? Does the music help draw you in? Take notes. Remember that you&#8217;re playing to learn, not just to have fun.</p>
<p>If you&#8217;re coming at this from a background other than game design, you may also need to do some reading. There are lots of great books written on the subject, and more being written every day, as the industry grows. See what expert game designers can teach you about designing games by reading their books.</p>
<p>One of my favourites, which is also a very quick read, is Raph Koster&#8217;s &#8220;<a href="http://www.amazon.com/Theory-Fun-Game-Design/dp/1932111972/" target="_blank">A Theory of Fun for Game Design</a>&#8220;. It&#8217;s great book to get you started thinking about designing games and what makes games fun. Another book I haven&#8217;t read yet, but have heard a lot of great things about, is Jesse Schell&#8217;s &#8220;<a href="http://www.amazon.com/Art-Game-Design-book-lenses/dp/0123694965/" target="_blank">The Art of Game Design: A Book of Lenses</a>&#8220;. There are many other great ones, I&#8217;m sure. The important thing to remember is that making games is a constant learning experience, so get learning!</p>
<p>If you&#8217;re already a game developer reading this, what about you? What are you favourite books? What developer forums do you read? What blogs are the most useful?</p>
<h4>3. Choose a Prototyping Technology</h4>
<p>So you&#8217;ve got your idea and you&#8217;ve got some ideas about how to make it work as a game. Now you need to choose your technology for implementing a prototype. I gave a talk in April at the amazing <a href="http://360idev.com" target="_blank">360iDev conference</a> (their fall conference starts today in Austin) on rapid prototyping. One of the things I talked about is that when you&#8217;re prototyping, use whatever technology you are most comfortable with. This doesn&#8217;t have to be the same technology you&#8217;re going to implement the game with. If you&#8217;re targeting releasing an iOS game, but you&#8217;ve never touched Objective-C, but you&#8217;re a Flash wizard, prototype in Flash. If you&#8217;re an expert in javascript, prototype in javascript. If you&#8217;re not overly comfortable in any technology, prototype with pen and paper! Do whatever you need to do to get a working version of the game as quickly as possible. All the planning in the world won&#8217;t tell you whether or not the game is fun. Playing it will tell you that instantly.</p>
<p>If you&#8217;re doing iOS development, cocos2D is a fantastic platform with which to do 2D game prototyping. Flash is a great prototyping tool. If you&#8217;ve used Unity, I&#8217;m told it&#8217;s also great for prototyping. If you&#8217;ve got your own engine you&#8217;ve been building, use that, just be careful not to spend your prototyping time implementing engine features.</p>
<h4>4. The 2-Minute Guide to Game Architecture</h4>
<p>Ok, so what I&#8217;ve talked about is all well and good, but if you&#8217;ve never looked at game code before, you may be wondering how on earth a game works. This is obviously a HUGE topic, one that&#8217;s covered in immense detail in many books. However, I will attempt to give the extremely high level overview of how a game works. Ahem&#8230;wish me luck.</p>
<h5>The Game Loop</h5>
<p>At the heart of your game is a loop. This loop executes as long as the game is running. In fact, in many games, it&#8217;s a while (1) loop. In iOS development, you&#8217;ll be working with an event-driven timer instead. However it&#8217;s structured, the important thing is that you&#8217;ve got a chunk of code that&#8217;s going to execute over and over again. This chunk of code makes up one frame of execution. Most games aim for either 30 or 60 fps (frames per second). This means that your game loop needs to execute in less than 1/30 or 1/60 of a second.</p>
<p>At its most basic, your game loop is going to do two things every frame: update and then render.</p>
<h5>The Update</h5>
<p>This is where your per frame game logic resides. The update will do things like: pump the physics system (if there is one), update all the active animations, handle collision detection, etc. Basically, it updates the state of the game world in 1/30 or 1/60 second intervals. It says, 1/60 second has passed since the last time I was called, what needs to update? Oh, this character animation needs to be updated, these sprite positions needs to change, these two objects collided, etc. At the end of the update function, your game is in a new state and is ready for rendering.</p>
<h5>The Render</h5>
<p>Now that the world&#8217;s state has been updated, it&#8217;s time to render everything to the screen. This means going through all the renderable objects in the world and drawing them. If you&#8217;re using a graphics engine, then renderable objects (like sprites) may automatically get a draw() call made on them. If you&#8217;re using OpenGL or DirectX directly, then this is where you&#8217;ll be making calls into the graphics libraries to do the drawing yourself.</p>
<p>Building a rendering engine that runs quickly is an absolutely massive topic. You&#8217;ll need to pick up a book or two (and brush up on your 2D and 3D linear algebra, as well as low-level graphics hardware achitecture) if you&#8217;re going to roll your own.</p>
<h5>Events</h5>
<p>But let&#8217;s remember, games are interactive media. This means that at some point you need to handle user interaction with the game. This is often event-driven, in that it&#8217;s handled outside your main game loop. You&#8217;ll get calls into your code saying &#8220;this button was pressed&#8221; or &#8220;the user touched the screen here&#8221;. Some more traditional game loops would have input polling before the update was done. Many modern game frameworks (or platform APIs) rely much more heavily on event-driven code. Much more of your game logic will happen in your event handlers.</p>
<p>At any rate, these events are where you&#8217;re going to change game state based on what the user is doing. In a board game, the user might click a button to roll the dice, so your button click event handler is where you&#8217;ll trigger a dice roll. In a first-person shooter, you&#8217;ll be handling analog stick position updates to update the camera orientation and player&#8217;s position in the world.</p>
<p>You may also need to respond to system events, like an iPhone going to sleep, or the user alt-tabbing out of your full-screen game.</p>
<h5>The Other Stuff</h5>
<p>Those are the basics, but there is so much more that goes into a game: audio systems, user interface systems, front end menus, HUDs (heads up displays), physics systems, animation systems, game logic systems, font rendering systems, save game systems, leaderboard systems, achievement systems, and localization systems (to name but a few). But remember, not every game needs all of these things. That&#8217;s why it&#8217;s important to remember #1 and limit the scope of your first game.</p>
<h4><strong>The hardest thing about creating your first game is finishing it.</strong></h4>
<p>It will take dedication to work through the bugs and the tedious parts of building a game (yes, there are tedious parts), but in the end, it&#8217;s worth it. You&#8217;ll have a game that you made ready for the world to play and enjoy. So what are you waiting for? Start learning. Go make a game!</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/11/07/game-dev-getting-started/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Presentation: Finding &amp; Fixing Mem Leaks</title>
		<link>http://www.streamingcolour.com/blog/2010/09/21/presentation-finding-fixing-mem-leaks/</link>
		<comments>http://www.streamingcolour.com/blog/2010/09/21/presentation-finding-fixing-mem-leaks/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 18:09:43 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[finding]]></category>
		<category><![CDATA[FITC]]></category>
		<category><![CDATA[fixing]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[leaks]]></category>
		<category><![CDATA[mem]]></category>
		<category><![CDATA[memory leaks]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1228</guid>
		<description><![CDATA[Last Friday I gave a talk at FITC Mobile 2010 called &#8220;Finding and Fixing Memory Leaks in iOS Apps&#8221;. As promised during the presentation, I&#8217;m making both the slides and code from the presentation available. You can read the presentation slides on SlideShare: Finding and Fixing Memory Leaks in iOS Apps View more presentations from [...]]]></description>
			<content:encoded><![CDATA[<p>Last Friday I gave a talk at FITC Mobile 2010 called &#8220;Finding and Fixing Memory Leaks in iOS Apps&#8221;. As promised during the presentation, I&#8217;m making both the slides and code from the presentation available. You can read the presentation slides on SlideShare:</p>
<div id="__ss_5251292" style="width: 425px;"><strong><a title="Finding and Fixing Memory Leaks in iOS Apps" href="http://www.slideshare.net/OwenGoss/finding-and-fixing-memory-leaks-in-ios-apps-5251292">Finding and Fixing Memory Leaks in iOS Apps</a></strong><object id="__sse5251292" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=owengossfitc2010-100921124846-phpapp02&amp;stripped_title=finding-and-fixing-memory-leaks-in-ios-apps-5251292&amp;userName=OwenGoss" /><param name="name" value="__sse5251292" /><param name="allowfullscreen" value="true" /><embed id="__sse5251292" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=owengossfitc2010-100921124846-phpapp02&amp;stripped_title=finding-and-fixing-memory-leaks-in-ios-apps-5251292&amp;userName=OwenGoss" name="__sse5251292" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/OwenGoss">Owen Goss</a>.</div>
</div>
<p>The Menu button in the bottom left will allow you to view it fullscreen, if you wish. It can be downloaded as a PDF if you click &#8220;view on SlideShare&#8221; and click the &#8220;Download&#8221; button at the top of the presentation.</p>
<p>When you get to the code part, you can download the sample project here:</p>
<p><a href="http://www.streamingcolour.com/presentations/memLeakExampleProject.zip">http://www.streamingcolour.com/presentations/memLeakExampleProject.zip</a></p>
<p>Note: The code and sample project are distributed under the MIT License. See the README inside the zip file for details on what that specifically means, but basically you&#8217;re free to use the code however you want as long as you keep the copyright notice and don&#8217;t blame me for anything. <img src='http://www.streamingcolour.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I hope those of you who attended the talk found it useful.</p>
<p><strong>Update (2010-09-21 &#8211; 5:44PM) -</strong> If you&#8217;re not familiar with the Leaks Instrument tool, have a read through my tutorial on how to use it. I demonstrated how to use the tool during the session, but there were no slides for that part: <a href="http://www.streamingcolour.com/blog/tutorials/tracking-iphone-memory-leaks/" target="_blank">Tutorial: Tracking iPhone Memory Leaks with Instruments</a></p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/09/21/presentation-finding-fixing-mem-leaks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FITC Mobile 2010</title>
		<link>http://www.streamingcolour.com/blog/2010/09/07/fitc-mobile-2010/</link>
		<comments>http://www.streamingcolour.com/blog/2010/09/07/fitc-mobile-2010/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 17:55:42 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[FITC]]></category>
		<category><![CDATA[Instruments]]></category>
		<category><![CDATA[leaks]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[memory leaks]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[ontario]]></category>
		<category><![CDATA[toronto]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1222</guid>
		<description><![CDATA[Can you believe it&#8217;s September already? Where did the summer go? Here in Southern Ontario we didn&#8217;t even get a transition; it was 33C one day, then two days later it was 12C. Anyway, I digress. With fall comes back to school (for those still in school), and the start of a new season of [...]]]></description>
			<content:encoded><![CDATA[<p>Can you believe it&#8217;s September already? Where did the summer go? Here in Southern Ontario we didn&#8217;t even get a transition; it was 33C one day, then two days later it was 12C. Anyway, I digress. With fall comes back to school (for those still in school), and the start of a new season of conferences!</p>
<p><a href="http://www.fitc.ca/mobile" target="_blank"><img class="aligncenter" title="FITC Mobile" src="http://www.fitc.ca/events/extras/mobile/2010/banners/MO10_MIW_500x180.jpg" alt="FITC Mobile 2010" width="500" height="180" /></a></p>
<p>I&#8217;m going to be speaking at <a href="http://www.fitc.ca/mobile" target="_blank">FITC Mobile in Toronto, running Sept 16-18, 2010</a>. I&#8217;m giving a talk on memory leaks in iOS on <a href="http://www.fitc.ca/events/presentations/presentation.cfm?event=109&amp;presentation_id=1314" target="_blank">Friday the 17th, from 12:00-1:00pm</a>. Specifically, I&#8217;ll be talking about memory management, what a memory leak is, some common ways they&#8217;re introduced in iOS programming, and show you how to use the tools to track them down and fix them. If you&#8217;re an iOS programmer and you&#8217;re coming to FITC Mobile, I hope you&#8217;ll check out my talk. Bring your coding hat, though; I&#8217;m going to be showing code, and actually demonstrating stuff in Xcode.</p>
<p>I hope to see you there!</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/09/07/fitc-mobile-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LandFormer Postmortem</title>
		<link>http://www.streamingcolour.com/blog/2010/08/27/landformer-postmortem/</link>
		<comments>http://www.streamingcolour.com/blog/2010/08/27/landformer-postmortem/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:45:38 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[in app purchase]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[LandFormer]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[postmortem]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[ad network]]></category>
		<category><![CDATA[ads]]></category>
		<category><![CDATA[artwork]]></category>
		<category><![CDATA[everything]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[gameplay]]></category>
		<category><![CDATA[iap]]></category>
		<category><![CDATA[ios 4]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[level editor]]></category>
		<category><![CDATA[multitasking]]></category>
		<category><![CDATA[right]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wrong]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1216</guid>
		<description><![CDATA[A couple of months after I launch a game, I like to sit down and take a hard and honest look at the things that went right and the things that went wrong: a postmortem. It&#8217;s a great exercise to go through after a game is launched to learn from your successes and, more importantly, [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of months after I launch a game, I like to sit down and take a hard and honest look at the things that went right and the things that went wrong: a postmortem. It&#8217;s a great exercise to go through after a game is launched to learn from your successes and, more importantly, your mistakes. I wrote up a <a href="http://www.streamingcolour.com/blog/2010/01/06/postmortem-monkeys-in-space/" target="_blank">postmortem after launching Monkeys in Space</a> that was based on the structure that <a href="http://www.gdmag.com/" target="_blank">Game Developer Magazine</a> uses. I&#8217;m going to use that same format for this LandFormer postmortem.</p>
<h4>Introduction</h4>
<p>If you haven&#8217;t played the game, <a href="http://www.landformer.net" target="_blank">LandFormer</a> is a puzzle game for iPhone/iPod touch. Each level is made up of a 5&#215;5 grid of terrain at different heights (oceans, up to mountains). The goal on each level is to use land forming tools to modify the heights of the terrain tiles to flatten things out. It&#8217;s a challenging game that starts off very easy, but get quite difficult in the harder levels. It&#8217;s a game that requires skill, patience, but most of all, intuition.</p>
<p>The game is free to download and try (there are 12 levels currently in the free version of the game), with In-App Purchase (IAP) available to upgrade to the &#8220;full&#8221; version of the game, as well as IAP for additional visual themes and additional levels. I think of it like a demo, where the user gets to try it and then decide if they want to spend money on more levels. The free version also contains ads, which are disabled if the player buys any content from the in-game shop.</p>
<p>The game launched on June 29, 2010 and has had 147,000 downloads of the free version of the game so far.</p>
<h4>What Went Right?</h4>
<h5>1) Gameplay</h5>
<p>I&#8217;m really happy with how the game itself turned out. LandFormer started as a <a href="http://toucharcade.com/2009/10/02/360idev-game-jam-10-hours-of-game-development-insanity/" target="_blank">prototype called &#8220;UpDown&#8221;</a> that I did in 6 hours at the all-night GameJam for 360iDev Denver in September, 2009 (I participated via Skype). After I launched Monkeys in Space, I returned to the prototype in early 2010 and started playing around with ways to make it more fun, and settled on the terraforming theme, which helps players understand what they&#8217;re supposed to do, and why.</p>
<p>What I like most about the game is that I haven&#8217;t really seen other puzzle games like it. It&#8217;s similar in play-style to sliding block puzzle games (it requires a similar combination of spatial reasoning and intuition), but the up/down movement of the pieces makes it feel very new and requires new ways of thinking. It&#8217;s also very easy to learn how to play, but takes time to really master it and get good at the more difficult puzzles. In the end, I think the gameplay stands as being strong, and I&#8217;m very pleased with how the game turned out.</p>
<h5>2) Strong Launch</h5>
<p>This is my 3rd game, and thus my 3rd game launch. However, with LandFormer I decided it was time to try a new launch strategy. With my previous games, I launched the games as soon as Apple approved them. This caused all sorts of problems in terms of getting press materials out, and reviews trickling out gradually. With LandFormer, I decided to set a proper release date. When Apple approved the game, I set the release date for a week and a half into the future. I immediately sent out press releases to sites along with promo codes (yes, they work once the game has been approved, but before it&#8217;s available in the store) for press to try the game. Because my content is all IAP on my server, I could also make it available to the press for free during the pre-launch review period. Very handy.</p>
<p>The result of this new launch strategy was that several large review sites had reviews out within one or two days of launch. This helped pick up momentum for the game, then the first Thursday after launch Apple featured it as a Hot New Game. The Friday immediately after the feature, <a href="http://gizmodo.com/5578615/this-weeks-best-apps/gallery/" target="_blank">Gizmodo ran a review</a> of the game, which boosted downloads tremendously for the following weekend.</p>
<p>I really couldn&#8217;t have asked for much better a launch. The only way it could have been better was by getting a front-page feature, or App of the Week feature from Apple. They&#8217;re probably just saving that for my next game (har har).</p>
<h5>3) Free + IAP</h5>
<p>As all developers do, I struggled a lot with the pricing model for the game. My other games are both paid games, but Dapple has a separate Lite version for players to &#8220;try before they buy&#8221;. The thing I don&#8217;t like about the Lite model is that it requires players to download two separate apps if they then want to buy the game. It always felt kludgy to me. Ultimately I decided to set things up like a PC or XBLA demo: free to download it, but if you like it, buy the full upgrade from within the game. This is the really exciting monetization path that IAP opened up when Apple introduced it.</p>
<p>Because I was implementing the in-game store for this anyway, it also allowed me to developing a theming system for the game and sell themes. It also means I can continue to release new level packs for users without having to update the game itself.</p>
<p>I think the model has a lot of potential on the app store. The free download gets you maximum visibility on the store (people are willing to download something just because it&#8217;s free), but then you have a way to earn some money within the app. However, it&#8217;s not all <a href="http://games.adultswim.com/robot-unicorn-attack-twitchy-online-game.html" target="_blank">rainbows and unicorns</a>: see the corresponding section in What Went Wrong.</p>
<h5>4) Level Editor</h5>
<p>When I started building the game, I was building levels as string of data then loading them into the game and testing them. This was ridiculous. I realized early on that building a level could be seen as solving a level in reverse. I was able to very quickly build a first pass at a level editor just by reversing the rules: start with a flat plane, and use the tools to deform it. This had two advantages: 1) it made building levels much easier, and 2) it meant that any level created in the level editor was guaranteed to have a solution.</p>
<p>Once I had it working for my own purposes I decided that it needed to be available to players in the game. The level editor is so easy and intuitive to use, I need people to be able to play with it. I&#8217;m happy I took the time to do the UI work required to build the level editor out into something that everyone could use.</p>
<p>The editor allows players to create their own levels, but beyond that, I implemented a sharing system based on URLs, where players could email a level to a friend. The friend clicks a link in the email and the level opens inside their copy of the game for them to play. It&#8217;s a simple system, that I think works quite nicely.</p>
<h5>5) Doing Everything (Almost)</h5>
<p>Since Monkeys in Space, I&#8217;ve been doing everything except the music in my games by myself. For both Monkeys and LandFormer I did all of the game design, programmer, artwork, UI design, sound design, PR, and marketing. I don&#8217;t do music, because that&#8217;s just something I&#8217;m not capable of doing myself. However, doing everything myself has given me a lot of freedom to make the game exactly how I want to make it. It also allows me to think about how a change will impact all the various aspects of the game. And, perhaps most importantly, it allows me to save a huge amount of out-of-pocket expense. I would love to have the funds to pay a full-time artist to work on the game, but that&#8217;s just not in the cards for me yet. I do have some art background, but doing all my own art for these games has helped me get a lot better than I was. I hope I&#8217;ll continue to improve. However, this is also another one of those things that also appears on the What Went Wrong section. So let&#8217;s get to that now.</p>
<h4>What Went Wrong?</h4>
<h5>1) Free + IAP</h5>
<p>I listed the reasons why I thought Free + IAP was great for LandFormer, but it&#8217;s also something that didn&#8217;t work great. One thing I was not at all prepared for was a backlash from users over the pricing model. I thought that players would be happy that they were given an opportunity to try the game before spending any money on it. However, the reaction from a lot of players instead was &#8220;The game says it&#8217;s free, but you have to buy stuff!&#8221; I got called a cheat, a liar, and a con artist.</p>
<p>My immediate reaction was that my app description clearly states that you only get the Beginner levels for free and have to buy the others. The app page in the store also lists the top IAP. But what I learned is that no one reads that stuff. I think I got a lot of downloads (especially after some of the big press stories ran) from people who saw the name, the icon, and &#8220;free&#8221; and downloaded it.</p>
<p>The problem is that there&#8217;s a disconnect between my view of the pricing model, and that of the minority of angry, vocal, app store consumers. I saw: &#8220;LandFormer offers you a way to try the game for free, and if you like it, buy it.&#8221; That customer sees: &#8220;Hey, a free game!&#8221; And then is angry when they discover they can&#8217;t play all the levels for free.</p>
<p>In the end, I&#8217;m not sure if the pricing model I chose for LandFormer was the right call or not. I&#8217;m not convinced that I wouldn&#8217;t have made more money by distributing a Lite version and a separate paid version (or only a paid version). App Store customers have gotten used to that model. I think it&#8217;s a problem with the fact that IAP didn&#8217;t exist from the start. Users had a year to get used to a certain business model, now we&#8217;re trying to change that. It&#8217;s going to be a difficult transition.</p>
<p>Not to go on about this for too long, but I think the Free + IAP model works best for games where you&#8217;re giving away a complete game for free, and then selling IAP for additional content that&#8217;s not required. If I ever do another free game, I&#8217;ll be looking toward that model.</p>
<h5>2) iOS 4 + Multitasking</h5>
<p>Apple launched iOS 4 on June 21, 2010, 8 days before I launched LandFormer, but 2 days after Apple had approved it. I had time with the beta SDK to make sure the game didn&#8217;t crash and that the game could be put into the background and restored properly before shipping it. However, I spent a great deal of time over the next 3 updates fixing weird little issues that cropped up because of iOS 4 multitasking. Multitasking caused all kinds of problems with my level sharing system, as well as my save system. I believe there was also one crash that only showed up in iOS 4 because of a change in the way some touch events fired. I&#8217;m not blaming Apple, it was just bad luck on my part that I launched so close to iOS 4, and I couldn&#8217;t afford to delay the launch of the game any more to deal with all the little issues that cropped up.</p>
<h5>3) Ad Network</h5>
<p>I mentioned in the introduction that I decided to include ads in the free version of the game. This is in this section for several reasons. At the peak of LandFormer&#8217;s popularity, it was being downloaded about 12,000 times per day. This translated into about 50,000 ad impressions a day. However, my click-through rate (CTR) was abysmal. It turned out that the way I was loading ads meant that a lot of people never saw the ads I requested. On my best day, I made about $5 off of ads. In the first update to the game (v1.1) I released a fix that made sure that ads were displayed properly to users. However, by the time it was approved I was down to a few hundred downloads a day of the free game. Even though my CTR increased dramatically with the change, my earnings averaged out around $0.30-0.40/day.</p>
<p>On top of that, the ad network I used had a crash bug in its code. After a couple of weeks trying to help them track the problem down, they told me they weren&#8217;t going to look into it any further. I was getting several support requests a week from players about this crash, so ultimately I pulled their ad network out of my game and I wrote my own custom system.</p>
<p>The game now (in v1.1.2) pulls ads of my own server. This is cool for several reasons. Now I get to decide what ads get shown in the game, it means I can cross promote my other games, and it means that I can promote games that I actually buy and play. I use LinkShare to get a small royalty any time someone actually buys through this system, but that&#8217;s been next to nothing so far. Still, I&#8217;d rather help support developers whose work I respect and have no crashes, than get the $0.30/day but with 10% of users experiencing a crash every time they launch the game.</p>
<h5>4) Themes</h5>
<p>When I built the IAP system I was very excited to be able to sell themes (skins) for the game. The way I had set up the graphics engine meant that it would be easy for me to load different textures to change the look of the game. I thought players would like the chance to be able to customize their experience a bit more too, but I was wrong. I&#8217;m seeing about a 0.1% conversion rate on themes (i.e. about 1 in 1000 people download a theme).</p>
<p>At this point, I only have one theme for sale. So it could be that people just don&#8217;t like that theme. It could also be that people just like the default art more. Or it could just be that people really don&#8217;t care about theming this kind of game. Though, if you think about it another way, if 1 in 100 people buy the premium content, the users who would buy a theme are probably a subset of that 1 in 100. So that means about 1 in 10 of those people have bought the theme, so maybe that&#8217;s ok. Still, when you do the math, that&#8217;s about $100 made off the theme so far, and it took almost a week of art work to build it (not even counting the time it took to put the theming system in place). When you look at it like that, it&#8217;s not as worth it.</p>
<p>I&#8217;m currently working on another theme. If it doesn&#8217;t sell, I probably won&#8217;t be releasing more themes. I think themes would sell better in a game where you could play the whole game for free. I think people might be willing to buy a theme in that case.</p>
<h5>5) Doing Everything (Almost)</h5>
<p>I&#8217;ve already outlined why I thought this worked for the project, but doing everything by oneself also comes with some big downsides. The biggest is time. LandFormer took 5 months from start to launch (then another month of work after launch). I&#8217;d guess that at least 2 months of that was doing the artwork and UI design for the game. If I could have afforded to pay a professional artist to do that for me, they probably would have taken half the time, and they could have been doing it while I programmed.</p>
<p>The other big downside is not having someone to bounce ideas off of. Working with an artist allows you to brainstorm, to try new things, and play with the concepts in the artistic direction of the game. When you&#8217;re doing it all yourself, it&#8217;s easy to get caught in the trap of just doing the first thing that comes to mind. It&#8217;s hard to force yourself to try multiple things and to find the best artistic solution to a problem.</p>
<h4>Conclusion</h4>
<p>In the end, I&#8217;m extremely pleased with the way that LandFormer turned out. I think it&#8217;s my strongest game to date. The game was also an opportunity for me to experiment with several new things I&#8217;d never tried before: IAP, free games, ad-supported games, and user-created content and sharing. I&#8217;m very happy with the number of free downloads the game has had. I find it absolutely amazing to think that almost 150,000 people have downloaded my game! At the same time, I&#8217;d be lying if I said I was happy with the conversion rate I&#8217;ve seen from free to paid.</p>
<p>The game continues to get a couple hundred downloads a day, and it seems to have stabilized there. I hope that it will maintain this level (or higher) for quite some time. The fact that it&#8217;s free seems to help keep the downloads alive.</p>
<p>Every game is an incredible learning experience, and I&#8217;ve learned a lot in making and launching LandFormer. I&#8217;ll be continuing to support it and add new content, but I&#8217;m also looking ahead to what&#8217;s next. Onward!</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/08/27/landformer-postmortem/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The Xcode Expressions Window</title>
		<link>http://www.streamingcolour.com/blog/2010/07/22/the-xcode-expressions-window/</link>
		<comments>http://www.streamingcolour.com/blog/2010/07/22/the-xcode-expressions-window/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 17:38:27 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Art]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[essays]]></category>
		<category><![CDATA[expressions]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[window]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1198</guid>
		<description><![CDATA[Last week I asked folks on twitter whether they&#8217;d like a tutorial on using the Expressions window in Xcode for debugging. Many people replied that they&#8217;d never heard of it, so I decided it was probably worth doing. I&#8217;ve just added the tutorial over on the Tutorials page: Using the Expressions Window The Expressions window [...]]]></description>
			<content:encoded><![CDATA[<p>Last week <a href="http://twitter.com/OwenGoss/status/18640477268" target="_blank">I asked folks on twitter</a> whether they&#8217;d like a tutorial on using the Expressions window in Xcode for debugging. Many people replied that they&#8217;d never heard of it, so I decided it was probably worth doing.</p>
<p>I&#8217;ve just added the tutorial over on the <a href="http://www.streamingcolour.com/blog/tutorials/">Tutorials</a> page: <a href="http://www.streamingcolour.com/blog/tutorials/using-the-expressions-window/">Using the Expressions Window</a></p>
<p>The Expressions window is a powerful debugging tool available in Xcode that allows you to evaluate expressions or even call methods on your objects while stopped at a breakpoint in your code. Check out the tutorial for an introduction to some of the cool things you can do with it.</p>
<p>You&#8217;ll also noticed that I added a new page in the sidebar for <a href="http://www.streamingcolour.com/blog/essays/">Essays</a>. I&#8217;ll group blog posts related to art and video games under that page. Right now there&#8217;s just one from January of this year, but I&#8217;ve been working on a new one that I hope to have up soon.</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/07/22/the-xcode-expressions-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom App URLs</title>
		<link>http://www.streamingcolour.com/blog/2010/06/28/custom-app-urls/</link>
		<comments>http://www.streamingcolour.com/blog/2010/06/28/custom-app-urls/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 16:12:01 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[iDevBlogADay]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[applicationDidFinishLaunching]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[didFinishLaunchingWithOptions]]></category>
		<category><![CDATA[launch]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[url identifier]]></category>
		<category><![CDATA[url schemes]]></category>
		<category><![CDATA[url types]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1094</guid>
		<description><![CDATA[Last week on twitter @mysterycoconut posted a blog post about his cool web-based level editor and that kicked off a discussion about us bloggers wanting to post more regularly to our blogs. With that, #iDevBlogADay was born and I&#8217;m happy to be a part of it. Each day of the week there are two iPhone [...]]]></description>
			<content:encoded><![CDATA[<p><em>Last week on twitter <a href="http://twitter.com/mysterycoconut" target="_blank">@mysterycoconut</a> posted a blog post about his cool web-based level editor and that kicked off a discussion about us bloggers wanting to post more regularly to our blogs. With that, <a href="http://search.twitter.com/search?q=%23iDevBlogADay" target="_blank">#iDevBlogADay</a> was born and I&#8217;m happy to be a part of it. Each day of the week there are two iPhone developers blogging about whatever they want. The rules are simple: post a blog article on your day, or you&#8217;re out. I&#8217;ve been assigned to Mondays, so this is my first post because of iDevBlogADay. You can see a full list of participants in the right sidebar of the site. You can subscribe to an aggregate feed of all posts here: <a href="feed://pipes.yahoo.com/pipes/pipe.run?_id=52b65f0bbfca4cc92db78d0b0408cac6&amp;_render=rss" target="_blank">Group RSS Feed</a>.</em></p>
<p>Have you ever thought &#8220;I wish there was a way to click a link in an email and launch my app&#8230;&#8221; Well there is, through the magic of custom app URLs. The basic idea is this: register a custom URL protocol with the iPhone, and if someone clicks a link with that protocol on that device, it will launch your app. But wait, there&#8217;s more: because it&#8217;s a URL, you can pass parameters into the app on launch. If you&#8217;re a C programmer, this is like being able to pass command line parameters into the application as an argv list.</p>
<p>I first started looking into this in detail while working on LandFormer. In LandFormer, I wanted a nice and simple way for users to share levels they had created without having to use a 3rd party social gaming system or Facebook. I started looking into custom URLs and discovered it could do everything I wanted. Using these URLs, I can encode a level&#8217;s data as a URL, embed it in an email, and let the user send an email to their friend. When the friend opens the email on their iPhone and clicks the link, LandFormer is launched, it parses the URL, and loads the level. It&#8217;s simple, elegant, and it&#8217;s easy to set up once you know where to look. So let&#8217;s do that now.</p>
<h5>Define a Protocol</h5>
<p>The first thing you need to do is decide on a custom URL protocol for your app. Choose something that other apps aren&#8217;t going to use. Don&#8217;t pick http, because that&#8217;s already taken. Pick something related to your app name, or website URL (e.g. &#8220;myAwesomeApp://&#8221;).</p>
<p>Once you&#8217;ve picked your custom protocol, you need to tell your app to register it with the phone. You do this through the app&#8217;s Info.plist file. Open the plist file in Xcode. Add a new row of type &#8220;URL types&#8221;. When created it will contain one item by default, &#8220;Item 0&#8243;. Expand Item 0 and you&#8217;ll see one element inside called &#8220;URL identifier&#8221;. This is an identifier that must be unique. Use the reverse domain naming system that Apple recommends (e.g. &#8220;com.mycompany.myawesomeapp&#8221;). Now add a new item to the array under the URL identifier row. Set the new item to &#8220;URL Schemes&#8221;. This creates an array with one item in it, &#8220;Item 0&#8243;. Set Item 0&#8242;s value to be your custom URL protocol (e.g. &#8220;myAwesomeApp&#8221;). Save the plist.</p>
<p><a href="http://www.streamingcolour.com/blog/wp-content/uploads/2010/06/customURL_01.jpg"><img class="alignnone size-full wp-image-1096" title="CustomURL" src="http://www.streamingcolour.com/blog/wp-content/uploads/2010/06/customURL_01.jpg" alt="Setting up the custom URL in the Info plist" width="547" height="357" /></a></p>
<p>Great! Now you&#8217;ve told the iPhone that when a URL starts with &#8220;myAwesomeApp://&#8221; that it should launch your app. If that&#8217;s all you want to do, you&#8217;re done! Go have a soda. However, this method allows us a lot more power over how we launch the app, so let&#8217;s see what we can do with it.</p>
<h5>Handling a Launch URL</h5>
<p>When your app is launched with a custom URL, you have access to that string when the app launches. This means that you can take different launch actions based on what&#8217;s in that string. Let&#8217;s take a look at how to do that.</p>
<p>Right now in your app you probably have a function in your app delegate that looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>applicationDidFinishLaunching<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> application
<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// Do some launch stuff</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>That&#8217;s the application where you&#8217;d set up your connections between your window and your root viewcontroller, etc. However, in order to handle that custom URL, we need to handle things a bit differently. There are two options.</p>
<p>1) Leave your code in applicationDidFinishLaunching: and handle the URL in a later call to application:handleOpenURL:</p>
<p>2) Replace your applicationDidFinishLaunching: method with application:didFinishLaunchingWithOptions:</p>
<p><strong>[</strong><strong>EDIT (2010-07-30): As Jerrod pointed out in the comments below, if you want your app to handle URLs when your app is in the background in iOS 4, you <em>must</em> use handleOpenURL. When an app regains focus because the user clicked a custom URL, you will <em>not</em> get a call to application:didFinishLaunchingWithOptions, but you <em>will</em> get a call to application:handleOpenURL.]</strong></p>
<p>I&#8217;m going to talk about the 2nd method, since I&#8217;m assuming we&#8217;re in a situation where we want to set up a different initialization sequence based on the URL passed in. So lets replace our applicationDidFinishLaunching: method with this:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>application<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application didFinishLaunchingWithOptions<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>launchOptions
<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// Do our launch stuff here now</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>Notice that we now get an extra parameter passed to us in the form of an NSDictionary of launch options. One of these options is our launch URL, so let&#8217;s fish that out:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>application<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIApplication <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>application didFinishLaunchingWithOptions<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSDictionary</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>launchOptions
<span style="color: #002200;">&#123;</span>
    <span style="color: #11740a; font-style: italic;">// Get our launch URL</span>
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>launchOptions <span style="color: #002200;">!=</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        <span style="color: #11740a; font-style: italic;">// Launch dictionary has data</span>
        <span style="color: #400080;">NSURL</span><span style="color: #002200;">*</span> launchURL <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>launchOptions objectForKey<span style="color: #002200;">:</span> UIApplicationLaunchOptionsURLKey<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// Get the part of the URL after the ://</span>
        <span style="color: #400080;">NSString</span><span style="color: #002200;">*</span> queryString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>launchURL query<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// Escape the string</span>
        <span style="color: #400080;">NSString</span><span style="color: #002200;">*</span> escapedQuery <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>queryString stringByReplacingPercentEscapesUsingEncoding<span style="color: #002200;">:</span> NSUTF8StringEncoding<span style="color: #002200;">&#93;</span>;
&nbsp;
        <span style="color: #11740a; font-style: italic;">// Parse the URL string</span>
        ...
    <span style="color: #002200;">&#125;</span>
&nbsp;
    <span style="color: #11740a; font-style: italic;">// Do our launch stuff here now</span>
<span style="color: #002200;">&#125;</span></pre></div></div>

<p>So all I&#8217;ve done there is grab the URL out of the dictionary. The call to [launchURL query] grabs the part of the URL after the ://. So if the URL was:</p>
<pre>myAwesomeApp://?myString=test&amp;myInt=0</pre>
<p>then calling -query on the URL returns:</p>
<pre>myString=test&amp;myInt=0</pre>
<p>The call to -stringByReplacingPercentEscapesUsingEncoding will convert all the URL-safe characters (like %20 for a &#8216;space&#8217; character) back into the proper ascii char (or in this case, UTF8 char).</p>
<p>Parsing the data can then be done with your favourite parsing method (in LandFormer I used NSScanner to parse each element). You could also parse the data and store the vars into an NSMutableDictionary so that you could then do key-based lookups on the data.</p>
<p>After that, it&#8217;s up to you how you want to use that data. You can make decisions about how you want the game to load.</p>
<h5>The LandFormer Example</h5>
<p>To put this into perspective, the LandFormer URL looks like this for a created level that someone is mailing to a friend:</p>
<pre>landformer://?title=Over%20The%20Hills%20And%20Mountain&amp;moves=13
    &amp;level=3343333333141222311002000
    &amp;check=13F24CFE848198A8BDB8196494904B16</pre>
<p>So you can see that the URL is made up of 4 variables: title, moves, level, and check. The check is a checksum done on the data to make sure that the URL hasn&#8217;t been messed around with (so as to stop players from sending their friends impossible levels). The rest of the data is self-explanatory.</p>
<p>When the game loads, if a URL is found, it parses the data to get all the information it needs to load that level, then lets the user start playing the level. So if the user has loaded the game directly from clicking on a link, they aren&#8217;t taken to the Main Menu, they&#8217;re taken straight into the game so they can play their friend&#8217;s level.</p>
<h5>Cool Side-Effects</h5>
<p>One of the really cool side-effects of this method for sharing levels is that these links work from inside a web browser, email, or even a twitter client. So if someone creates a level, sure, they can send it to a friend via email inside the game. But, they can also collect level URLs they&#8217;ve created and create their own level packs by posting the links to their website. Then anyone can click those links to play their levels. They can also share the links on twitter, and anyone browsing using an iPhone twitter client (who also has the game), can just click the link to download the level. The possibilities are endless!</p>
<p>Another cool potential use for this would be to allow you to pass data between two of your own apps. Say you make a new game. You could register a custom URL protocol for it, then add a special link inside your old game that allows users who have that game to click it to unlock something in the new game.</p>
<h5>A Word on Error Handling</h5>
<p>So far everything I&#8217;ve mentioned is all of the &#8220;look how awesome this is&#8221; variety. However, it&#8217;s important to mention code security. Any time you allow the user access to data that affects your game, you need to be careful. When parsing the URL coming into your app, make sure you&#8217;re handling failure cases well. You don&#8217;t want your app to crash if someone starts messing around with the URL manually. You don&#8217;t want to give them access to your app&#8217;s memory. Be careful with how you parse that data, make your error checking and handling robust, and you should be fine.</p>
<p>Now go have fun!</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/06/28/custom-app-urls/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>My First GDC</title>
		<link>http://www.streamingcolour.com/blog/2010/03/19/my-first-gdc/</link>
		<comments>http://www.streamingcolour.com/blog/2010/03/19/my-first-gdc/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 18:43:45 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[game developers conference]]></category>
		<category><![CDATA[GDC]]></category>
		<category><![CDATA[main]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[summits]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1020</guid>
		<description><![CDATA[I returned home from the Game Developers Conference (GDC) nearly a week ago, but I feel like it has taken me this long to be able to recover from the late nights, the jetlag, the cold I caught, and put things into perspective. I thought I&#8217;d share a summary of my experience there, for those [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" title="GDC at Night" src="/blog/wp-content/uploads/gdc2010_00.jpg" alt="GDC at Night" width="500" height="375" /></p>
<p>I returned home from the Game Developers Conference (GDC) nearly a week ago, but I feel like it has taken me this long to be able to recover from the late nights, the jetlag, the cold I caught, and put things into perspective. I thought I&#8217;d share a summary of my experience there, for those who are thinking of maybe going next year.</p>
<p>Executive Summary: SO AWESOME!!!</p>
<p>GDC is held every year in San Francisco. I&#8217;ve been in the games industry for over 6 years now, but this was my first time at the conference, so I wasn&#8217;t really sure what to expect. I managed to get an All Access Pass to the conference, so I was there for the summits and tutorials, as well as the main conference.</p>
<p>Let me back up a little and talk about my reasoning for going, as that will help you understand why the conference was so valuable to me. At the beginning of the year I started thinking about what conferences I wanted to attend. <a href="http://www.360idev.com" target="_blank">360iDev</a> was a must-attend for me, so I booked that first. However, I was torn between attending WWDC (Apple&#8217;s big annual conference) or GDC. I attended WWDC last year and it was great. But this year I felt like what I really needed was general game design inspiration, and less Apple-specific technical inspiration. With that in mind, I chose GDC. My goal for the conference was to focus mainly on game design sessions and take in a few technical and business sessions.</p>
<p>So, I arrived in San Francisco Monday, March 8th, the day before the Summits started. I managed to meet up with a bunch of iPhone devs I know from Toronto, other conferences, or Twitter. We had a few beers and tried to adjust to west coast time. It was a good way to ease myself into the week.</p>
<p>Tuesday and Wednesday were the Summit &amp; Tutorial days at GDC. There were two summits I was interested in: the iPhone Summit, and the Independent Games Summit (IGS). I think I spent about 60% of my time at the IGS and about 40% at the iPhone Summit. I saw some great technical iPhone talks by <a href="http://www.gamesfromwithin.com/" target="_blank">Noel Llopis</a> from <a href="http://www.snappytouch.com" target="_blank">SnappyTouch</a> and <a href="http://www.philhassey.com/" target="_blank">Phil Hassey</a> from <a href="http://www.galcon.com" target="_blank">Galcon</a>. I also saw some great IGS talks that ranged in topic from managing an independent game studio&#8217;s creative process, to how to better design indie games. I saw a session by Ron Carmel from <a href="http://2dboy.com/" target="_blank">2D Boy</a>, several awesome sessions by the people at <a href="http://thatgamecompany.com/" target="_blank">thatgamecompany</a> (Flower is one of my favourite games), and a terrific session by Randy Smith from <a href="http://www.tigerstylegames.com/" target="_blank">Tiger Style</a> (among so many others!). By the end of the Summits, my head was already spinning with inspiration. The IGS design talks in particular were extremely motivating for me. Getting a chance to meet and hear amazing indie game designers/developers talk about their processes was fantastic. It started me thinking about a lot of things as they relate to my own processes. More on that later&#8230;</p>
<div class="wp-caption alignnone" style="width: 510px"><img title="GDC Expo" src="/blog/wp-content/uploads/gdc2010_01.jpg" alt="GDC Expo" width="500" height="375" /><p class="wp-caption-text">A tiny segment of the massive GDC Expo</p></div>
<div class="wp-caption alignnone" style="width: 510px"><img title="IGF Awards" src="/blog/wp-content/uploads/gdc2010_02.jpg" alt="IGF Awards" width="500" height="375" /><p class="wp-caption-text">The IGF Awards</p></div>
<p>Thursday through Saturday were the main conference, expo, and Independent Games Festival Awards. I sat in session after amazing session listening to industry leaders in game design, technical development, and business talk about their processes. I saw <a href="http://en.wikipedia.org/wiki/Peter_Molyneux" target="_blank">Peter Molyneux</a> talk, <a href="http://en.wikipedia.org/wiki/Sid_Meier" target="_blank">Sid Meier</a> talk, and even <a href="http://en.wikipedia.org/wiki/Will_Wright_%28game_designer%29" target="_blank">Will Wright</a> talk. I saw a moving and inspirational talk by <a href="http://bbrathwaite.wordpress.com/" target="_blank">Brenda Brathwaite</a> on her exploration into board games with serious themes. I saw a head-ache inducing (in a good way!) talk on PixelJunk Shooter&#8217;s real-time fluid dynamics system that made me really miss doing PS3 SPU programming. I saw an in-depth and honest look a the successes and problems encountered by Naughty Dog&#8217;s attempts to create an active cinematic experience for Uncharted 2. I was blown away by the quality of the content, and I was left reeling by how the talks started forcing me to think about the direction I want to take with my own games.</p>
<div class="wp-caption alignnone" style="width: 385px"><img title="Crowds" src="/blog/wp-content/uploads/gdc2010_03.jpg" alt="Crowds!" width="375" height="500" /><p class="wp-caption-text">There were huge crowds in the halls between sessions!</p></div>
<p>But of course, the sessions are only part of GDC. The other part comes from meetings and parties. I was able to set up a few meetings with iPhone press to show them my new game. That was really great to be able to demo the game in person. I think it was extremely valuable. Then each night there were countless parties happening. Each party was a great chance to meet people in person who I&#8217;ve only communicated with on twitter or via email. It was a chance to discuss iPhone development with other people going through the same thing as me. It was a chance to discuss game design in general with other game designers and developers. It was a chance to have fun with people who share in the same daily challenges that I do.</p>
<div class="wp-caption alignnone" style="width: 510px"><img title="Will Wright" src="/blog/wp-content/uploads/gdc2010_04.jpg" alt="Will Wright" width="500" height="375" /><p class="wp-caption-text">Will Wright giving his presentation!</p></div>
<p>For me, I got out of GDC exactly what I wanted: design inspiration, new friends, new business connections and a wealth of knowledge. But perhaps most importantly, GDC helped me to put me back on track with where I want to take my games. When I decided to go indie in 2008, it was because I wanted to make the games that I was <em>compelled</em> to make. What I&#8217;ve noticed is that I&#8217;ve been making more and more design decisions lately based on what I think will sell well. This isn&#8217;t how I want to make games. I want to make the games that I <em>have</em> to make, not that I think I should make because I think it might make some money, even though the idea doesn&#8217;t excite me. Granted, I would love to be able to make the games that I feel compelled to make and have them also become a financial success. And obviously I can&#8217;t ignore the fact that I&#8217;m running a business. But GDC helped to remind me of what I want my priorities to be, and that, to me, is the most important part of having gone.</p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/03/19/my-first-gdc/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>GDC, 360iDev, and More</title>
		<link>http://www.streamingcolour.com/blog/2010/02/19/gdc-360idev-and-more/</link>
		<comments>http://www.streamingcolour.com/blog/2010/02/19/gdc-360idev-and-more/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 18:46:27 +0000</pubDate>
		<dc:creator>OG</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[360|idev]]></category>
		<category><![CDATA[contract work]]></category>
		<category><![CDATA[game jam]]></category>
		<category><![CDATA[GDC]]></category>
		<category><![CDATA[new game]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[rendering]]></category>

		<guid isPermaLink="false">http://www.streamingcolour.com/blog/?p=1009</guid>
		<description><![CDATA[It has been quite a while since my last post. I would have been posting, but I&#8217;ve been doing some contract work, so I haven&#8217;t had a lot of my own news to talk about. I&#8217;ve also been doing my year-end bookkeeping, and as exciting as that is, I&#8217;m not sure anyone wants to read [...]]]></description>
			<content:encoded><![CDATA[<p>It has been quite a while since my last post. I would have been posting, but I&#8217;ve been doing some contract work, so I haven&#8217;t had a lot of my own news to talk about. I&#8217;ve also been doing my year-end bookkeeping, and as exciting as that is, I&#8217;m not sure anyone wants to read about my adventures in recording business receipts from 2009.</p>
<p>However, over the last few days I&#8217;ve been returning to my own projects and getting back into the swing of things. As you might recall, I took part (remotely) in September&#8217;s <a href="http://toucharcade.com/2009/10/02/360idev-game-jam-10-hours-of-game-development-insanity/" target="_blank">360iDev Game Jam</a> night and created a prototype for a puzzle game idea I had. I&#8217;m happy to report that I&#8217;ve been developing that idea further and it&#8217;s coming along nicely. The game now looks very different from the screenshot I posted on Touch Arcade, by the way. As for a preliminary look at what the game is becoming, I might have  something to show early next week, so keep an eye out for that!</p>
<p>Yesterday I decided to rewrite the rendering part of my engine to take advantage of a bunch of optimizations I had been putting off making. It turns out that the changes I made over the last day reduced my render time by about 40%! That means that I can render nearly double the sprites on the screen without dropping my framerate. This is great news, and I&#8217;m looking at porting the changes back into Monkeys in Space at some point to help out with that game&#8217;s performance.</p>
<p>In other news, I thought I&#8217;d mention that I&#8217;ve decided to attend two conferences this spring: the <a href="http://www.gdconf.com/" target="_blank">Game Developers Conference</a> (GDC) in March and <a href="http://www.360idev.com" target="_blank">360iDev</a> in April. I&#8217;m looking forward to both conferences, but I&#8217;m especially excited about GDC as I&#8217;ve been in the games industry for over 6 years now, but I&#8217;ve never gone to GDC! I&#8217;m really excited to get a chance to finally go and see what all the fuss is about. I&#8217;m also looking forward to attending sessions on game design that are more broad than just iPhone games.</p>
<p>That being said, I&#8217;m also happy to be attending 360iDev again. It will be great to see the iPhone developers I speak with every day on twitter in person again. <a href="http://www.streamingcolour.com/blog/2009/03/06/360idev-35-days-of-awesomeness/" target="_blank">Last year I had a fantastic time</a> at the conference and I expect no less this time. I&#8217;ll also be speaking at 360iDev. For my presentation I will attempt to create an iPhone game prototype in 80 minutes based on audience suggestions. While doing that, I&#8217;ll be highlighting some of my best practices for rapid prototyping. If you&#8217;re attending the conference, I hope you&#8217;ll check it out. If you&#8217;re not attending the conference, why not? Check out this <a href="http://www.360idev.com/schedule" target="_blank">amazing schedule of speakers</a>. And if you&#8217;re thinking about it, <a href="http://360idev-OwenG.eventbrite.com" target="_blank">go register</a>! <img src='http://www.streamingcolour.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Owen</p>
]]></content:encoded>
			<wfw:commentRss>http://www.streamingcolour.com/blog/2010/02/19/gdc-360idev-and-more/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

