<?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>Acorn Heroes</title>
	<atom:link href="http://acornheroes.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://acornheroes.com</link>
	<description>iPhone Development from the Ends of the Earth</description>
	<lastBuildDate>Sun, 21 Aug 2011 03:53:30 +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>Setting up an Automated Build in an iOS environment &#8211; part 5</title>
		<link>http://acornheroes.com/2011/06/setting-up-an-automated-build-in-an-ios-environment-part-5/</link>
		<comments>http://acornheroes.com/2011/06/setting-up-an-automated-build-in-an-ios-environment-part-5/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 09:48:17 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[automated builds]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[Testflight]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=730</guid>
		<description><![CDATA[I&#8217;ve recently been trying out Testflight as a method for getting beta builds out to testers.  Testflight handles a number of things for you &#8211; over the air distribution of builds, notification e-mails, download stats and more.  It&#8217;s a great system, but my first thought when I started experimenting with it was: &#8220;Can I incorporate [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been trying out <a href="http://testflightapp.com">Testflight</a> as a method for getting beta builds out to testers.  Testflight handles a number of things for you &#8211; over the air distribution of builds, notification e-mails, download stats and more.  It&#8217;s a great system, but my first thought when I started experimenting with it was:<em> &#8220;Can I incorporate it into my build system?&#8221;</em> Fortunately the answer is yes, in fact it&#8217;s dead easy.  Let&#8217;s see how it&#8217;s done&#8230;</p>
<h2>Setting up&#8230;</h2>
<p>I won&#8217;t go into all the details of setting up a Testflight account, it&#8217;s fairly well covered on the site.  What you will need to do is set up one or more &#8216;teams&#8217; for beta testing.  Once you&#8217;ve done this, it&#8217;s time to investigate Testflight&#8217;s upload API.</p>
<h2>Automated uploading</h2>
<p>Most pages on the Testflight site have a set of links at the bottom, one of which is <a href="https://testflightapp.com/api/doc/">&#8216;Upload API&#8217;</a>.  This page gives details of how you can upload a build programmatically.  You&#8217;ll need to find a few details &#8211; an api token and a team token.  Both of these can be found by following links off the Upload API page.  Once you&#8217;ve got these, we can use <em>curl</em> to handle the communication with Testflight .com:</p>
<p>&nbsp;</p>
<pre class="brush:bash">

curl http://testflightapp.com/api/builds.json 
  -F file=@yourapp.ipa 
  -F api_token='your_api_token' 
  -F team_token='your_team_token' 
  -F notes='This build was uploaded via the upload API' 
  -F notify=True 
  -F distribution_lists='Your Team Name'
</pre>
<p>&nbsp;</p>
<p>And that&#8217;s all there is to it!  I&#8217;d recommend trying this from the command line until you&#8217;re happy that builds are uploading correctly, then simply drop this command line into your build system as a final build step.</p>
<p>I&#8217;ve been using this for a while and it works well.  The first time you create a build, your testers receive an email &#8211; if they read the email on their device, they&#8217;ll get instructions for setting up Testflight on their iDevice.  Having done this once it becomes a one click process for testers to get new builds.  Not only that, but you as the team leader will know who has downloaded the build, and on what device!</p>
<h2>Just a few of issues&#8230;</h2>
<p>Overall I&#8217;m really happy with Testflight as a system.  There are some things to be aware of though:</p>
<ul>
<li>Testflight only works on newer devices / OS versions (4.0 and later, I believe).</li>
<li>I&#8217;m not clever enough to interpret the results of curl to determine if an upload fails, so currently I get a &#8216;build succeeded&#8217; even if the upload fails.  If anyone can offer some advice on how to do this, I&#8217;d appreciate it.</li>
</ul>
<p>I hope you find this useful &#8211; I know I do &#8211; one click to go from Source Control to having a new build in tester&#8217;s hands?  Magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/06/setting-up-an-automated-build-in-an-ios-environment-part-5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Thoughts for my younger self</title>
		<link>http://acornheroes.com/2011/04/thoughts-for-my-younger-self/</link>
		<comments>http://acornheroes.com/2011/04/thoughts-for-my-younger-self/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 21:43:51 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[idevblogaday]]></category>
		<category><![CDATA[Self indulgent nostalgia]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=725</guid>
		<description><![CDATA[At a mobile devs meetup this week, it became apparent that I&#8217;m now one of the old guard.  I&#8217;ve always been someone who enjoys passing on useful information to others.  Teaching a game design course for University students also makes me realise how much they have to learn, how much I take for granted after [...]]]></description>
			<content:encoded><![CDATA[<p>At a mobile devs meetup this week, it became apparent that I&#8217;m now one of the old guard.  I&#8217;ve always been someone who enjoys passing on useful information to others.  Teaching a game design course for University students also makes me realise how much they have to learn, how much I take for granted after 15 or so years in the industry.</p>
<p><img class="alignright" style="margin: 10px;" src="http://acornheroes.com/wp-content/uploads/2011/04/guard-advance-l.jpg" border="0" alt="Guard advance l" width="300" height="193" /></p>
<p>If I had the chance, what would I tell my younger self?  What has worked out well for me and what would I do differently?  Here&#8217;s a few of the things I came up with.  What would you add?</p>
<h2>Failure is not the thing to be afraid of</h2>
<p>Some of the world&#8217;s <a href="http://www.businessweek.com/magazine/content/06_06/b3970001.htm">most successful people</a> have had massive, public failures &#8211; but it hasn&#8217;t stopped them.  Yes failure is painful and embarrassing.  But it&#8217;s also a great teacher, making us wiser and stronger.  Perhaps more importantly though, if we never fail, then we&#8217;re not taking any risks.  Tackling challenges that may be too much for you are where we get a chance to excel and surprise ourself and others.</p>
<h2>Always have a backup plan</h2>
<p>I have spent many years working in live television, covering sports events.  It was not uncommon to be adding new features to the software on site the night before the event.  I&#8217;ve arrived in foreign countries with broken computers.  I&#8217;ve turned up at events and lost a day because no one knew we were coming and so we had no space to work, no power to work with.  I&#8217;ve had machines die at 2am the day before we&#8217;re live.  This teaches you a few of things:</p>
<ol>
<li>Some deadlines simply can not move, so you must be adaptable.</li>
<li>Always have a backup option.  You may not get as much done as you hoped.</li>
<li>Worry early so that you don&#8217;t have to panic late.</li>
</ol>
<p>Plan your work to try and deliver in an iterative fashion.  Planning to deliver everything at once, on deadline is just plain stupid.  Working without <a href="http://hginit.com/">source control</a> is just plain stupid.</p>
<h2>There is no better time than now</h2>
<p>It&#8217;s taken me far too many years to realise that my dream is to work for myself, on the projects I want to work on.  I&#8217;ve learnt a lot working for other people and I enjoy being part of a team.  But after a while the urge to show the world what you can do, to craft something that&#8217;s all yours becomes very strong.</p>
<p>My point is this.  It&#8217;s hard to do that once you have a mortgage and a family (and a dog, cat, rabbit, guinea pigs, chickens and goldfish).  When you&#8217;re young you have a great opportunity to move quickly and try things out.  Also, we live in an age where it&#8217;s never been easier to get your product in front of customers &#8211; make the most of it.</p>
<h2>You will be wrong, often</h2>
<p>There&#8217;s no shame in being wrong.  It happens.  Accept that it happens and move on.  Keep your ego in check and always keep in mind that the people you work with probably aren&#8217;t stupid either.   Often arguments are caused because two people are so caught up in their own opinion that they forget they&#8217;re on the same team, trying to achieve the same goal.</p>
<p>Mistakes will happen and you don&#8217;t always make the best choices.  Learn to prototype ideas quickly.  Learn to leave a buffer in a project plan to handle the unexpected.  Tackle the biggest challenges first to avoid surprises.</p>
<h2>Always learn more</h2>
<p>Learn new languages, frameworks and techniques.  Read <a href="http://idevblogaday.com/">iDevBlogADay</a> and <a href="http://altdevblogaday.org/">altDevBlogADay</a>!  Challenge yourself not to stagnate.  If you find yourself criticising another platform, maybe it&#8217;s time to dive in and learn more about it.  One thing I can promise you is that the work environment and tools you use today won&#8217;t be the ones you use in 10 or 20 years.  Don&#8217;t end up a dinosaur.</p>
<h2>There are difficult or petty people in this world &#8211; deal with it</h2>
<p>Working with others is hard.  It&#8217;s at least as hard as the technical challenges you deal with, so put some effort into being good at it.  Working so-operatively is a skill you can develop.  Some people are harder to work with than others.  You might be <em><strong>That Guy</strong></em>.  Learn how to communicate clearly and without letting your emotions get in the way.  Work on solutions, not problems.  Be polite and always treat people with respect &#8211; especially the difficult ones.  You never know whio you&#8217;ll be working with or depending on in a couple of years.  Life is funny that way.</p>
<p>There&#8217;s no silver bullet here, it&#8217;s hard work but the effort will pay off, I promise you.</p>
<h2>You are so much more than a coder</h2>
<p>This is the big one.  Don&#8217;t believe that you&#8217;re just the tech guy.  Get out of your ivory tower and learn about what your colleagues do.  Know enough about Photoshop to take images from artists and get them into a usable form.  Understand how artists build models so that you can teach them (in their own terms) what can and can&#8217;t be done inside a game engine.  Talk to designers about flow and layout, and why moving that text two pixels to the left is so important.</p>
<p>Understand enough about business to know the effort that goes into giving you a pay cheque each fortnight.  Practice estimating tasks and tracking time spent to better understand what you can or can&#8217;t achieve in a given time frame.  Write documentation or reports to share knowledge with clients or customers.  Write a blog!  Speak in public.</p>
<p>Not only will this make you a better person, but others will enjoy working with you and helping you out when needed.  And when you make that transition to management, or all-in-one Indie developer, you&#8217;ll be much better prepared.</p>
<h2>And one more thing&#8230;</h2>
<p>Enjoy yourself.  Work hard and treat difficult problems as a fun challenge to crack.  Only boring people get bored.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/04/thoughts-for-my-younger-self/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Puzzle Planets Postmortem</title>
		<link>http://acornheroes.com/2011/03/puzzle-planets-postmortem/</link>
		<comments>http://acornheroes.com/2011/03/puzzle-planets-postmortem/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 19:41:51 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Postmortem]]></category>
		<category><![CDATA[Puzzle Planets]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=722</guid>
		<description><![CDATA[Time for a short break from Faerie stuff this week.  For three months at the end of last year I was contracted to work on a game for Runaway in conjunction with National Geographic.  We had a fairly simple brief &#8211; build a game around based on the TV show &#8220;Clash of the Continents&#8220;.  Clash [...]]]></description>
			<content:encoded><![CDATA[<p>Time for a short break from Faerie stuff this week.  For three months at the end of last year I was contracted to work on a game for <a href="http://www.runawayplay.com/">Runaway</a> in conjunction with National Geographic.  We had a fairly simple brief &#8211; build a game around based on the TV show &#8220;<a href="http://channel.nationalgeographic.com/episode/end-of-eden-4468/Overview">Clash of the Continents</a>&#8220;.  <em>Clash</em> was about a space traveller who, traveling at the speed of light, returns to Earth to find that some 250 million years have passed.  What has changed and why?  Is there any trace of Humanity?  Are the continents even recognizable?</p>
<p>The show is a great look at the changes our planet undergoes on a time scale that we can barely imagine.  We had three months, and a small team.  What sort of iPhone / iPad / Flash game could we create in that time?</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/PP1.jpg" border="0" alt="PP1" width="320" height="480" /></p>
<p> </p>
<p>The resulting game is called Puzzle Planets.  It&#8217;s an action / puzzle game where you need to create planets from the core outwards in three stages &#8211; adding tectonic plates, pulling continents out of the water and finally creating a stable environment for life.  If you want to know more you can see a gameplay video <a href="http://bit.ly/fph5Np">here</a>, or get it on the iTunes store <a href="http://bit.ly/fzCXam)">here</a>.</p>
<p>But if you&#8217;re reading this article, chances are you&#8217;re mainly interested in iOS development.  Let&#8217;s have a look at how the project went.  The final team was comprised of four programmers (not all full time, and not all at the same time), three artists a UI/UX designer and a creative director / project manager, plus support from National Geographic.  The code base uses OpenGL and mostly C++ (see notes on my current coding style <a href="http://acornheroes.com/2010/06/trying-something-new/">here</a>).  3d assets were built in Cinema 4d and exported as .obj files before conversion into final game form using a custom-made level editor tool.  The game&#8217;s creatures and UI were built in Illustrator and the textures, backgrounds etc mostly came from Photoshop.</p>
<p>On the project management side of things we used Google Docs for all documentation and SVN for source control.  Hudson was used to handle CI and AdHoc builds.</p>
<h1>What went right</h1>
<h2 style="font-size: 1.5em;">Working with artists</h2>
<p>It&#8217;s been a while since I worked on a team with great artists and I&#8217;d forgotten how much of a joy it can be.  Puzzle Planets required tight co-operation between code, 3d models, Vector and Pixel based art.  Our tile sets for the game were built flat, sitting at the origin.  These were then loaded into the level editor for the game and oriented / deformed to the shape of a sphere before being saved out in a game-specific format.  Textures were created that tiled nicely on both hexagons and pentagons (necessary in this case to smoothly tile a sphere).</p>
<p>Some coders and artists struggle to work in a cross discipline environment, and to those people I say learn to communicate, learn to understand the processes used by the &#8216;other side&#8217;.  You will benefit and your team will benefit.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/PP2.jpg" border="0" alt="PP2" width="320" height="480" /></p>
<h2 style="font-size: 1.5em;">Choice of tools</h2>
<p>We went straight to OpenGL for our graphics layer, rather than working with an engine such as Cocos 2d.  Although it meant writing a lot of boilerplate code it also gave us the flexibility to do odd and unusual things with meshes and textures.  This sort of freedom made it easy to iterate and refine the look of the game.  Building the user interface for the game in UIKit was a good choice too.  It became very easy to drop in new interface elements with minimal fuss.  Adding new views was also a simple process.  Limiting ourselves to OpenGL ES v1.1 (and ignoring the shader based v2.0) also kept the task manageable.</p>
<p>Later in the project we started using <a href="http://particledesigner.71squared.com/">Particle Designer</a> and <a href="http://www.texturepacker.com/">Texture Packer</a>.  I only wish we&#8217;d adopted them at the outset.  Particle Designer not only supports game engines such as Cocos2d, but also provides sample OpenGL code.  This made dropping Particle Designer effect files into the game trivial.</p>
<p>I&#8217;ve talked about Hudson <a href="http://acornheroes.com/2010/10/setting-up-an-automated-build-in-an-ios-environment-part-4/">at length before</a>.  It is so easy to set up and tinker with.  Creating AdHoc builds was simple and automatic.  We used Dropbox to distribute new builds and the system worked very reliably.  Next time I&#8217;ll look at &#8216;over the air&#8217; distribution options to make getting test builds out even simpler.</p>
<h2 style="font-size: 1.5em;">Partnership with National Geographic</h2>
<p>There&#8217;s not much to say hear except the National Geographic were a great team to work with.  They gave us the freedom to experiment and trusted us to make good choices.  We had to make a number of difficult decisions to make along the way &#8211; altering time frames, removing Flash support and so on.  All up we had a very supportive and positive environment to work in.  Communication was via email or weekly phone conferences and it worked very well.  Using Dropbox allowed us to easily share and update concepts, documentation and AdHoc builds.</p>
<h2 style="font-size: 1.5em;">Custom Level Editor</h2>
<p>Puzzle Planets made use of a custom-made level editor.  It was an iOS app that only ever ran on the simulator due to memory constraints.  It&#8217;s some of the ugliest code I&#8217;ve ever written.  But it works, and it made the process of designing and balancing levels simple.  It also meant that our creative director could design levels with minimal technical help, so iterating through level designs became a rapid process.</p>
<p>Even as mesh formats or tile models changed, the basic level editor remained able to take a level definition file and generate game-ready models.  At worst, we had to re-load and re-save each level if some aspect of the file formats changed.  This could normally be accomplished for all levels in a few minutes.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/PP3.jpg" border="0" alt="PP3" width="320" height="480" /></p>
<h2>Early prototyping</h2>
<p>Our initial designs were over the top and incredibly ambitious.  We put a lot of time and effort into prototyping game ideas, UI designs and concept art.  Typically we&#8217;d turn over or iterate several times a day on new prototypes.  With each prototype a number of team members would look at the new idea and provide feedback.  This was essential, as we had no &#8216;standard&#8217; reference to follow with the design of Puzzle Planet&#8217;s mechanics.  Puzzle Planets combines a number of familiar mechanics, but the exact combination and blend on a spherical surface took a lot of careful thought.</p>
<p>Anyone who puts a game design on paper and says it&#8217;s good is either a genius or misguided.  Make prototypes, play them and iterate repeatedly &#8211; it&#8217;s the only way to get to the core of a good game.</p>
<h2><span style="font-size: 24px;">What went wrong</span></h2>
<h2 style="font-size: 1.5em;">Slow start</h2>
<p>The <em>Clash</em> show covers a period of 250 million years.  An iPhone game normally comprises periods of game play that last for just seconds.  Our brief was very loose, with plenty of room for &#8220;Wouldn&#8217;t it be cool if&#8230;&#8221; scenarios.  We lost the best part of a month thinking all sorts of ideas for games &#8211; adventure-based mystery epics with the player trying to unravel the planet&#8217;s past.  There was much talk of animating continental movement over time, movie sequences and more.</p>
<p>It was a great time, with lots of wonderful ideas.  But in hindsight we spent a great deal of time on the big ideas without first focussing on the &#8216;second to second&#8217; game play that&#8217;s critical to a good game.  It wasn&#8217;t until we focussed on the size of the team, the time frame and the unique aspects of the device in question that we started to narrow in on fun gameplay.  We eventually ended up with a tight gaming experience, but it took a lot of false starts to get there.</p>
<h2 style="font-size: 1.5em;">Those &#8220;Gosh darned&#8221; provisioning profiles</h2>
<p>Apple&#8217;s set up for code signing is a major pain at the best of times.  Adding new devices for testing was always a time of trepidation.  Working through iTunes Connect is reasonably straight forward, it&#8217;s what happens when the new profile hits XCode that gets painful.  The problem is that placing the new profile in the correct place wasn&#8217;t enough.  Neither was loading the project and pointing it at the new profile.</p>
<p>Eventually we settled on the following reliable method (after a lot of gnashing of teeth!):</p>
<ul>
<li>Download new profile, put it in the appropriate directory.</li>
<li>Quit XCode</li>
<li>Open the project file in a text editor
<ul>
<li>Search for any reference to provisioning profiles and delete that line</li>
<li>Save project file</li>
</ul>
</li>
<li>Re-open project in XCode and re-assign required profiles.</li>
</ul>
<p>It&#8217;s a simple enough fix, but far too manual.  I thought I&#8217;d left my days of hand editing project files behind with Visual Studio 2005.  Hopefully XCode 4 will be better at this.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/PP4.jpg" border="0" alt="PP4" width="320" height="480" /></p>
<h2 style="font-size: 1.5em;">Reaching too far</h2>
<p>With such a short time frame, there would have been a good argument for taking a well known game play mechanic and adding a twist to it.  Or sticking to 2d.  Or use an existing engine such as <a href="http://www.cocos2d-iphone.org/">Cocos 2d</a> or <a href="http://www.anscamobile.com/corona/">Corona</a>.  Or concentrating on a single device (rather than Flash, iPhone and iPad).  It would have been a very good argument, but for better or worse, we were determined to craft something unique and beautiful.  I think that ultimately we succeeded &#8211; Puzzle Planets is fun to play, and the race against the clock or your friends adds a wonderful frenetic pace to the game.</p>
<p>It also forced us to delay shipping the game by three months.  Trying too many new things is not a bad idea as such, but you need to accept that new things take time.  If we had reduced the scope of the game in some manner we could have hit our Christmas target.  Although after EA&#8217;s <a href="http://www.tuaw.com/2010/12/18/eas-app-store-price-war/">lock out of the charts</a> over that period, perhaps it was as a good thing that we shipped late.</p>
<h2 style="font-size: 1.5em;">Gimbal lock</h2>
<p>One problematic area of the UI throughout the project was how to handle moving the &#8216;camera&#8217; around the poles.  There are two main options.  The first is to represent movement in two dimensions &#8211; side to side and up/down.  This means a swipe sideways always spins the planet around, and a swipe up / down tilts the planet.  This is nice and logical for most people.  The problem is that it gets weird at the poles and the only real option is to clamp the up/down movement so that you can&#8217;t ever go &#8216;over the top&#8217;.  This limitation can get very annoying at times, particularly in Stage 3 when the player is trying to get to a disaster on the other side of the planet, and the fastest route would be to go via the poles.</p>
<p>The other option is to use quaternions, an alternate representation which doesn&#8217;t have this issue and allows a free range of movement.  Sounds perfect, right?  The problem here is that spinning around the world in arbitrary directions means that you lose any sense of &#8216;up&#8217;.  It&#8217;s very possible to return to a point you&#8217;ve visited previously and discover that what was up is now facing down.  This can make it harder for the player to recognize features on the planet, but it&#8217;s even worse in Stage 1.  In Stage 1 a piece of the planet hovers in front of you and you must spin the planet to find the right place to drop the piece.  Using quaternions there was no easy way to ensure the piece was in the right orientation to drop in, even if it was in the right place.</p>
<p>Neither option suited us very well, but ultimately we went with the first system.  It works well 98% of the time, but it still annoys me.</p>
<h2 style="font-size: 1.5em;">Trying to support Flash</h2>
<p>Our initial brief was to provide a game on both Flash and iOS platforms.  We spent a lot of time trying to find a 3d platform that works well in Flash.  Generating scalable game objects that could look good when rendered in either hardware (iOS) or software (Flash) was a challenge.  Ultimately there&#8217;s a reason why there are no good 3d Flash games.  Six months later and we finally have WebGL entering circulation.  I&#8217;ve been waiting for a good 3d solution for the Web since 1999 &#8211; I think it&#8217;s finally here.</p>
<p>In the end we dropped Flash support and the game is substantially better as a result.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/PP5.jpg" border="0" alt="PP5" width="320" height="480" /></p>
<h1>Summing up</h1>
<p>Puzzle Planets is a great little game, far removed from the original concept we had.  I had a great time working on it and the feeling of putting a polished, successful game (in the Top 100 Games overall in the UK, Australia and Canada and Top 200 in the US) on the App Store is wonderful.  Not everything went to plan, but then it never does.  Above all, this project has reminded me, yet again, that change is constant.  You can&#8217;t ignore it, rather you must embrace it and develop techniques that allow you to handle and respond to change.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/03/puzzle-planets-postmortem/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 7</title>
		<link>http://acornheroes.com/2011/03/faeries-journey-part-7/</link>
		<comments>http://acornheroes.com/2011/03/faeries-journey-part-7/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 20:16:26 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Faerie]]></category>
		<category><![CDATA[Faerie OpenGL]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=712</guid>
		<description><![CDATA[In which George puts together the beginnings of a rendering system, trying to leave his bad Open GL habits behind him. Bad Habits It&#8217;s true.  I have been known to write bad Open GL code.  By bad I mean simple, immediate mode code.  I learnt GL programming on SGI machines that cost a fortune and [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George puts together the beginnings of a rendering system, trying to leave his bad Open GL habits behind him.</em></p>
<h2>Bad Habits</h2>
<p>It&#8217;s true.  I have been known to write bad Open GL code.  By bad I mean simple, immediate mode code.  I learnt GL programming on SGI machines that cost a fortune and weighed more than me.  In this world, writing rendering code was fairly simple &#8211; call glBegin(), pass a bunch of vertices one at a time and call glEnd() when you&#8217;re done.  Need things to run a bit faster?  Wrap it in a <a href="http://glprogramming.com/red/chapter07.html">call list</a>.  It was easy and fast enough for most situations.</p>
<p>What this style of programming tends to lead to is having drawing calls and GL state changes littered throughout the code base.  It is simple, but it can also be confusing, particularly when it comes to changing GL&#8217;s state &#8211; blending modes, enabled vertex arrays and so on.  GL has a lot of different state variables, and if you forget to return one to its expected value life can get interesting in unexpected ways.</p>
<p>With the move to Open GL ES v2.0 (GL v2 from here on), it seemed like a good time to kick a few bad habits.  Along the way, the plan was to create a more flexible, efficient and reliable rendering system.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/144753.jpg" border="0" alt="144753" width="200" height="166" /></p>
<h2>Something to aim for&#8230;</h2>
<p>After some thought, I came up with a some goals that described what I wanted to achieve:</p>
<ul>
<li>I&#8217;m sick of managing GL&#8217;s state &#8216;by hand&#8217;.  I want to be able to say &#8216;this effect needs these states set&#8217; and rely on the underlying system to handle this efficiently and automatically.</li>
<li>Drawing calls should be combined into batches automatically.  Especially in a 2d sprite based renderer, made up of lots of small elements, this is extremely important and can have a huge impact on rendering speeds.</li>
<li>Draw calls should be sorted to render correctly (back to front in general) and also to minimise state changes.</li>
<li>Component-based techniques should be used to lay out data for best memory usage (minimising cache misses).</li>
<li>Shaders should be highly configurable (and also the meshes that they render).</li>
<li>High level game objects should have full control over specific details  - do they use physics or not, do they consist of one sprite or many, what shader do they use and so on.</li>
</ul>
<h2>10,000 foot view</h2>
<p>After a few days holiday last week, things are starting to come together.   GL v2 is a streamlined beast.  There is no fixed function pipeline at all &#8211; no matrix stack, no lights &#8211; we have to provide it all in the form of shaders.  This freedom is wonderful and extremely powerful.  It also requires a lot of bits to fit in place before you get that first triangle on screen.  I&#8217;ll try to give a general overview of how things fit together.  The system is built on three main ideas &#8211; effect files, aggregating components and delayed render calls.</p>
<h3>Effect Files</h3>
<p>The idea behind an effect file is simple.  It should contain all the information we need to render a mesh.  In GL 2 terms, we need a vertex and fragment shader at a minimum.  I&#8217;ve also added state information such as textures used, blending mode, cull mode and so on.  These are all stored in a single file and retrieved / parsed using Philip Rideout&#8217;s <em><a href="http://prideout.net/blog/?p=11">glsw</a></em><a href="http://prideout.net/blog/?p=11"> code</a>.</p>
<h3>Components</h3>
<p>There&#8217;s a lot of great, detailed articles out there about component based engines.  This isn&#8217;t one of them.  But the basic idea is this.  Let&#8217;s say our Elephant game object needs to move with gravity (he&#8217;s sky diving) and respond to collisions (he may forget to open his parachute) He&#8217;ll also be rendered with four sprites (body, head, tail and hat) and a particle system (he farts a lot).</p>
<p>We could store his position, velocity, sprite data and so on all in one structure, but this can lead to inefficient memory use.  Instead, we build a game object out of components of different types (physics, sprites etc).  The elephant game object contains references to a physics component, sprite components and a particle system component.  All our physics components are stored in a single contiguous chunk of memory, sprites are stored in a similar large array as are the particle systems.</p>
<p>Why is this a good idea?  Just ask <a href="http://macton.smugmug.com/gallery/8936708_T6zQX/1/593426709_ZX4pZ#593426709_ZX4pZ">Mike Acton</a>.</p>
<h3>Delayed Render Calls</h3>
<p>Rendering efficiently on modern graphics hardware requires that we reduce the number of state changes and drawing calls to a minimum.  One way to do this is to batch up similar individual elements into a single mesh.  To do this, each graphical element has a &#8216;key&#8217; value that gets added into a big list, which is then sorted using qsort().  The key is created based on the element&#8217;s depth in the scene, the effect used to render it and so on.  Christer Ericson <a href="http://realtimecollisiondetection.net/blog/?p=86">describes this idea</a> brilliantly.</p>
<p>What does this do?  It allows us to iterate over all our rendered elements once, adding them to the list.  After sorting, the elements are not only ordered for correct rendering, they are also clumped into groups of similar elements, allowing us to avoid unnecessary state changes.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/03/1.1245845340.elephant-returning-hat.jpg" border="0" alt="1 1245845340 elephant returning hat" width="200" height="112" /></p>
<h2>The Main Loop</h2>
<p><a href="http://gafferongames.com/">Glenn Fiedler</a> has a great article on setting up your main game loop to best handle physics calculations.  The guts of his discussion is that you should always &#8216;step&#8217; forward your physics calculations using a fixed time step, even if this doesn&#8217;t match the amount of time that&#8217;s passing in between frames.  This means that for a given frame, we may step forward our physics simulation once, twice or more.</p>
<p>Let&#8217;s take an example.  Suppose that since the last frame 25 ms has passed.  If our physics time step is 10 ms, we advance the physics simulation twice (20 ms) but what do we do with the extra 5 ms?  If we stop at two physics steps, or go for three, we&#8217;ll get stilted, jerky animation.  Glenn&#8217;s answer is to take the third step, but then interpolate between the second and third step.  Glenn explains it much better than I can at 10 minutes to midnight so go <a href="http://gafferongames.com/game-physics/fix-your-timestep/">read his article</a>.</p>
<p>Here&#8217;s an example of what my main game loop ends up looking like:</p>
<pre class="brush:cpp">
void GameUtils::Update(Game &amp;game, float deltaTime)
{
    if (game.state.isInProgress &amp;&amp; !game.state.isPaused)
    {
        if (deltaTime &gt; 0.25)
        {
            deltaTime = 0.25;	  // Keep deltaTime from spiking
        }

        game.loop.accumulator += deltaTime;

        // Update physics
        while (game.loop.accumulator &gt; game.loop.dt)
        {
            game.state.gameTime += game.loop.dt;
            PhysicsUtils::Step(game.physics, game.loop.dt);
            game.loop.t += game.loop.dt;
            game.loop.accumulator -= game.loop.dt;
        }

        // Interpolate physics state...
        PhysicsUtils::Interpolate(game.physics, GameLoopUtils::GetAlpha(game.loop));

        // Update all game objects here, including updating sprite positions based on
        // physics data.

        DrawOrderList drawList;

        // Add all sprites to draw list
        const Sprite *spritesArray = game.sprites.list.Data();
        for (int i = 0; i &lt; game.sprites.list.count; ++i)
        {
            const Sprite &amp;s = spritesArray[i];
            unsigned int key = DrawOrderUtils::CreateKey(s.layerId, game.sprites.componentId, s.effectId);

            DrawOrderUtils::Add(drawList, DrawOrderElement(key, &amp;s));
        }

        // Likewise add particle systems and text...

        // Finally, sort and render in batches...
        DrawOrderUtils::Sort(drawList);
        RenderComponentUtils::Render(drawList);
    }
}</pre>
<h2>But wait, there&#8217;s more!</h2>
<p>Actually there isn&#8217;t, at least not this time.  There&#8217;s a lot of detail I&#8217;ve missed, far too much to pack into a single post.  Hopefully I&#8217;ve given an overview of how the system works.  Next time I&#8217;ll concentrate on one part of the system and describe it in more detail.  If there&#8217;s one aspect in particular you want to know more about, or that needs better explanation, please let me know in the comments below!</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/03/faeries-journey-part-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 6</title>
		<link>http://acornheroes.com/2011/02/faeries-journey-part-6/</link>
		<comments>http://acornheroes.com/2011/02/faeries-journey-part-6/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 08:04:46 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Faerie]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Prototyping]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=699</guid>
		<description><![CDATA[In which George is welcomed back into the fold after a long time in the blogging wilderness&#8230; iDevBlogADay First off, it&#8217;s nice to be back and contributing to iDevBlogADay.  When Miguel first kicked this off I don&#8217;t think anyone ever expected it to be as successful as it has been.  So a big thank you [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George is welcomed back into the fold after a long time in the blogging wilderness&#8230;</em></p>
<h2>iDevBlogADay</h2>
<p>First off, it&#8217;s nice to be back and contributing to <a href="http://idevblogaday.com/">iDevBlogADay</a>.  When <a href="http://twitter.com/#!/mysterycoconut">Miguel</a> first kicked this off I don&#8217;t think anyone ever expected it to be as successful as it has been.  So a big thank you to Miguel and everyone who has contributed or been a reader.</p>
<p>What&#8217;s that?  Never heard of iDevBlogADay?  Never mind, welcome anyway!  Chances are if you&#8217;re reading this you have an interest in iOS development, and you should check out <a href="http://idevblogaday.com/">iDevBlogADay.com</a> &#8211; there&#8217;s a wide range of articles covering all aspects of iOS including coding, design, marketing, art and more.  If you are specifically interested in game development, I can also recommend <a href="http://altdevblogaday.org/">altDevBlogADay</a>, which covers game development in general.</p>
<h2>Faerie?</h2>
<p>Part 6?  Faerie? If this is the first time you&#8217;ve come to this site, then you may be wondering what Faerie is.  Faerie (place holder name) is my next game project for iOS, and I&#8217;m documenting the process as I go.  Each article is reasonably stand alone, but if you&#8217;re interested in starting at the beginning, the first article can be found <a href="http://acornheroes.com/2011/01/faeries-journey-part-1/">here</a>.</p>
<h2>Paper Prototyping</h2>
<p><a href="http://acornheroes.com/2011/02/faeries-journey-part-5/">Last time</a>, I described the process of using Unity to do some rapid prototyping of Faerie&#8217;s basic mechanics.  What I forgot to mention was that there was a stage before this that was even more rapid and <em>most definitely</em> lower tech.  It involved nothing more complicated than some paper, a die and some poker chips.</p>
<p>It may seem strange to prototype an action/puzzle game this way, but in fact it worked surprisingly well.  And it was <em>fast</em>.  Getting a code prototype up and running takes time, even for the fastest / best prepared coder.  Working on paper I had the basics ready to test in about five minutes, and was able to iterate several versions of the mechanics in an hour.</p>
<p>The first step was to decide how to represent the game&#8217;s mechanics in a turn based way.  I used different coloured poker chips to represent different coloured leaves from the game &#8211; leaves are &#8216;chained&#8217; together to form combos, with the player losing points / life if an unfinished combo touches the ground at the bottom of the screen.  The initial rule set was something like this:</p>
<ul>
<li>Leaves fall d3 + 2 inches each turn (i.e. roll a die, halve it and add 2).  This there was one roll per turn, applied to all leaves uniformly.</li>
<li>Introduce a new leaf each turn with a randomly chosen colour.</li>
<li>The player can then take one action, either to select a new leaf to add to a chain or to &#8216;finish&#8217; a chain.</li>
<li>A chain must contain only leaves of the same colour, otherwise it is invalid and all the leaves are destroyed.</li>
<li>A finished chain is scored based on length (1 point for the first leaf, +1 for the second, +2 for the third, +3 for the fourth and so on).  This value is then multiplied by the value of the chain&#8217;s colour (1 for red, 2 for green and 3 for black)</li>
<li>Leaves that hit the ground are removed from play, and if they are part of a chain, all leaves in the chain are destroyed.</li>
</ul>
<p>It&#8217;s taken longer to type those out properly than it did to set the game up and start playing.  You may be wondering why the leaves move a random distance each turn.  This was introduced to add a degree of uncertainty in the player&#8217;s mind as a replacement for time pressure / reaction times that will be present in the real time version of the game.</p>
<p>As it stands, this wasn&#8217;t fun &#8211; it was lacking goals, end game conditions, balance and more.  But what became immediately apparent was that the core fun element in the game was choosing which pieces to select and when to finish a chain.  So I iterated on the ideas a little, introducing or modifying rules to maximise this aspect of the game.  Over the next hour or so I was able to try out the following changes:</p>
<ul>
<li>Different coloured leaves fall at different rates.  High value leaves fall faster &#8211; this gives the player a tough choice between the easy, low scoring option or taking a chance on the faster, high scoring colours.  My initial intention had been to simply make valuable leaves less common, but I like the speed variation much more.</li>
<li>I added the option to make &#8216;rainbow&#8217; chains, that is a chain that includes different coloured leaves, so long as the chain has the same number of each colour.  In other words 2 red + 2 green or 1 red + 1 green + 1 blue are both valid, 1 red + 2 blue is not.  Adding these in gives the player a &#8216;bail out&#8217; option if they can&#8217;t make the chain they intended to.  A nice reward for fast thinking players.</li>
<li>Tweaking of leaf speeds / points values and player actions.  It was possible to very quickly balance the game &#8211; spawning twice as many leaves, allowing the player two actions a turn and so on made the game play much better.</li>
<li>Experimenting with end-game conditions.  One thing that&#8217;s not immediately clear from the basic mechanic is how the player can lose or end the game.  I tried a few ideas and chatted to Sam before settling on the idea that the player has a &#8216;magic&#8217; meter that fills up as the player scores points.  Fill it up to unlock combos / power ups.  The negative is that the magic meter empties with every leaf that hits the ground, and empties even faster when a chain hits the ground.  When the meter is empty, it&#8217;s game over.</li>
</ul>
<p>So, in about two hours at most, I was able to test and iterate the basic logic of Faerie without once touching a keyboard.</p>
<h2>Give it a go!</h2>
<p>Paper prototyping can be tried with almost any game idea.  It&#8217;s a great way of looking at the core mechanics of your game without the computer colouring your perspective!  It takes very little time, and can be done with pen, paper and a little imagination.  You really have no excuse for not trying it!  If you&#8217;re interested in developing your paper-prototyping skills, I can thoroughly recommend <a href="http://www.amazon.com/gp/product/158450580X?ie=UTF8&amp;tag=acorhero-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=158450580X">Challenges for Game Designers</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=acorhero-20&amp;l=as2&amp;o=1&amp;a=158450580X" border="0" alt="" width="1" height="1" /> by Brenda Brathwaite and Ian Schreiber.  Each chapter in this book looks at different aspects of game design and how they can be prototyped in a non-digital environment.  You&#8217;ll be surprised at how well many genres, first person shooters for example, can be adapted to work with pen and paper and a few counters.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/02/faeries-journey-part-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developers helping Quake Victims</title>
		<link>http://acornheroes.com/2011/02/developers-helping-quake-victims/</link>
		<comments>http://acornheroes.com/2011/02/developers-helping-quake-victims/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 19:36:03 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Earthquake relief]]></category>
		<category><![CDATA[EQNZ]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=695</guid>
		<description><![CDATA[New Zealand was rocked this week by a massive earthquake right under Christchurch, one of our biggest cities.  Hundreds are dead or missing, the CBD is flattened and many suburbs have been flooded through liquifaction.  Acorn Heroes is proud to be part of an initiative to help raise money for relief efforts. It&#8217;s simple.  All [...]]]></description>
			<content:encoded><![CDATA[<p>New Zealand was rocked this week by a massive earthquake right under Christchurch, one of our biggest cities.  Hundreds are dead or missing, the CBD is flattened and many suburbs have been flooded through <a href="http://en.wikipedia.org/wiki/Soil_liquefaction">liquifaction</a>.  Acorn Heroes is proud to be part of an initiative to help raise money for relief efforts.</p>
<p>It&#8217;s simple.  All proceeds for the next week from the following apps (iOS and Mac) will go directly to the Red Cross relief effort.  For more details, go to <a href="http://www.appappeal.co.nz/">http://www.appappeal.co.nz/</a>.  There are some great apps here, and you&#8217;ll be directly helping the thousands of people affected by this disaster.</p>
<p>Apps involved in the appeal include:</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fchopper-2%252Fid363912842%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Chopper 2</a> &#8211; Majic Jungle Software – Universal App + Mac OS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Ftop-dog-farmyard-adventures%252Fid367309144%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Top Dog: Farmyard Adventures</a> - Flightless – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fscarlett-spark-life-scarlett%252Fid397685110%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Scarlet and the Spark of Life: Scarlett Adventures Episode 1</a> - Launching Pad Games  – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsheepish%252Fid300636948%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sheepish</a> –Pixelthis –  iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fminimonos-flight%252Fid388136679%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">MiniMonos Flight</a> –Minimonos – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Facorn-money%252Fid386530964%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Acorn Money</a> –Acorn Heroes – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fbird-strike-gold-edition%252Fid349263261%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Bird Strike</a> –PikPok – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fancient-frog-hd%252Fid364187960%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Ancient Frog HD</a> –Ancient Workshop  - iPad</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Ftwenty-chinups%252Fid306789203%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Twenty Chinups</a> –SoftwareX – iOS</p>
<p><a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-waves-pro%252Fid311413629%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker Waves</a>, <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-rain-pro%252Fid306576863%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker Rain</a>, <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-storms-pro%252Fid308969801%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker Storms</a>, <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-streams-pro%252Fid314339387%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker Streams</a>, <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-all-in-one%252Fid401073457%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker All in One</a> and <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fsleepmaker-wildlife-pro%252Fid319033926%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Sleepmaker Wildlife</a> -SoftwareX – iOS</p>
<p><a href="http://www.dejal.com/simon/">Dejal Simon</a>, <a href="http://www.dejal.com/timeout/">Dejal Time Out</a>, <a href="http://www.dejal.com/caboodle/">Dejal Caboodle</a>, <a href="http://www.dejal.com/blogassist/">Dejal BlogAssist</a> &#8211; Dejal &#8211; Mac OS</p>
<p>Please help us spread the word by telling people about <a href="http://www.appappeal.co.nz/">http://www.appappeal.co.nz/</a>.</p>
<p>I&#8217;d also like to offer a vote of thanks to Jos from <a href="http://www.pikpokgames.com/">PikPok games</a> and all the others who have been involved in putting this together so quickly.  And to everyone affected in Christchurch, we&#8217;d like to say <em><a href="http://en.wikipedia.org/wiki/Kia_kaha">Kia Kaha</a></em>, we are all with you in this horrible time.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/02/developers-helping-quake-victims/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 5</title>
		<link>http://acornheroes.com/2011/02/faeries-journey-part-5/</link>
		<comments>http://acornheroes.com/2011/02/faeries-journey-part-5/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 01:38:26 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Faerie]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=692</guid>
		<description><![CDATA[In which George tries something new, is impressed, but still insists on doing things the old fashioned way&#8230; OpenGL 2.0 &#8211; An apology OK, let&#8217;s get this out of the way.  I haven&#8217;t got very far with the shader / GL v2.0 side of things.  However I have been busy.  My current day job is [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George tries something new, is impressed, but still insists on doing things the old fashioned way&#8230;</em></p>
<h2>OpenGL 2.0 &#8211; An apology</h2>
<p>OK, let&#8217;s get this out of the way.  I haven&#8217;t got very far with the shader / GL v2.0 side of things.  However I have been busy.  My current day job is teaching a summer school course at the local University.  I&#8217;m lucky enough to get to teach <a href="http://cs.otago.ac.nz/student/papers.php?name=COSC360">Game Design</a>.  For one of the lectures I wanted to do a case study of a commercial engine.  <a href="http://unity3d.com/">Unity</a> seemed like a good choice, mainly because it&#8217;s cheap, reasonably powerful and cross platform &#8211; good options for budding game makers.  So rather than working on game code for Faerie I&#8217;ve gone back to prototyping ideas with Unity.  And it&#8217;s been great fun&#8230;</p>
<h2>Getting Started with Unity</h2>
<p>If you haven&#8217;t seen or heard of Unity before, here&#8217;s a quick run down.  It&#8217;s a cross platform engine that runs on PC, Mac, Web, iOS and most consoles.  It consists of an editor that is reminiscent of a 3d modelling package crossed with a programmer&#8217;s IDE.  Game Objects are dragged into the scene and arranged, terrains and vegetation can be added.  Game Objects in Unity work using a component model.  In other words, a &#8216;car&#8217; as such is just a collection of components that each do their own thing &#8211; mesh, mesh renderer, physics collider, particle systems, transforms and so on.  These objects can also be built into hierarchies &#8211; a car and its wheels for example.</p>
<p>So far so good, but how do we write our game logic?  One type of component is a script component.  You can work in Javascript, C# or a version of Python.  Each script has a number of predefined hooks that let you interact with the game world.  The two main ones are Start() and Update(), which let you control initialisation and per-frame logic.  Other hooks include responding to collisions, handling mouse events and so on.  There&#8217;s a lot of power in this very simple system, as code typically sits alongside the object it acts on.  Variables declared as public become visible in the IDE, making tweaking game play trivial.</p>
<p>Getting started though is something that, for a coder like me, felt very strange.  The Unity site comes with a great collection of detailed tutorials that show off a lot of the engine&#8217;s power.  And this was part of my problem getting started.  The tutorials tend to mainly be of the &#8220;Here&#8217;s a mostly completed game, now let&#8217;s add some more stuff&#8221; variety.  Going through these you don&#8217;t really get a solid understanding of how things fit together, simply because there&#8217;s so much there.</p>
<p>Eventually though, I did find one tutorial on scripting that started from an empty scene.  From there, I was able to get to grips with adding one thing at a time.  After this, things started to fall into place and I found it much easier to make some progress.  There&#8217;s a lot of reference material on the Unity site &#8211; take your time to sift through it and find the tutorials that work for you.</p>
<h2>Prototyping Faerie</h2>
<p>Once I had a basic grasp of what was going on, it was time to build a prototype of Faerie.  One thing that Unity is very good at is prototyping &#8211; adding objects into a scene and attaching simple scripts to them is very straight forward.  User input, selecting objects and collision detection is all handled for you, leaving only the actual game logic to be written.</p>
<p>Faerie&#8217;s made up of a surprisingly small set of objects.  We have a collection of differently coloured leaves falling down the screen, which can be joined into a chain by tapping on them.  Complete a chain before it touches the ground and you score points and also fill up a &#8216;magic&#8217; meter.  Miss enough leaves, or have a chain hit the bottom of the screen and your magic meter drops down.  If it hits 0, then it&#8217;s game over.  Fill it up and the combo / power up magic starts to happen.</p>
<p>Fumbling my way through the Unity API it took me about half a day to get the basic game play up and running.  Here&#8217;s a couple of screenshots, taken as I went.</p>
<p><img src="http://acornheroes.com/wp-content/uploads/2011/02/Faerie01_01.png" border="0" alt="Faerie01 01" width="360" height="520" /> <img src="http://acornheroes.com/wp-content/uploads/2011/02/Faerie02_01.png" border="0" alt="Faerie02 01" width="360" height="520" /></p>
<p>Obviously it&#8217;s very primitive, but the basic game mechanic is in there and it feels fun.</p>
<p>After a little tweaking of variables to get the basic balance of the game reasonable, I packaged up a build and sent it to Sam for his thoughts.  Then followed a fairly lively Skype conversation regarding what needed to be fixed.  One thing that becomes very obvious when you do this sort of prototyping is that feedback for the user is not a luxury, it&#8217;s essential &#8211; even at as early a stage as this.  When the game world is made up of red and green rectangles the player needs every possible help to know that their actions are having an effect.</p>
<p>Tomorrow&#8217;s job is now to take Sam&#8217;s ideas and mine and work them back into the prototype.  This should be pretty fun as it involves trying different types of power ups.  There will be a few standard ones (slow down time, score extra points etc), but I&#8217;m keen to try out a few fun ones, like auto-chaining or perhaps something to do with Unicorns.  Definitely something to do with Unicorns.</p>
<h2>Production Code with Unity?</h2>
<p>So it&#8217;s probably fair to say I&#8217;m pretty happy with Unity.  It&#8217;s a well put together system and well worth a look.  I&#8217;ll definitely do a lot of prototyping with it.  But for production code I&#8217;ll still go with C++ and OpenGL for now.  Maybe I&#8217;m a masochist, but I like to know the specifics of what my code is doing, and to have the ability to tweak at the low level.</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/02/faeries-journey-part-5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 4</title>
		<link>http://acornheroes.com/2011/02/faeries-journey-part-4/</link>
		<comments>http://acornheroes.com/2011/02/faeries-journey-part-4/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 00:41:19 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Faerie]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Warning!]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=688</guid>
		<description><![CDATA[In which George gets called a lazy git and discovers himself in a deep hole, holding a shovel and wondering how he ended up in this trap again&#8230; Analysis Paralysis I don&#8217;t know if that&#8217;s a well known phrase or if I just made it up, but it perfectly captures what happened to me over [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George gets called a lazy git and discovers himself in a deep hole, holding a shovel and wondering how he ended up in this trap again&#8230;</em></p>
<h2>Analysis Paralysis</h2>
<p>I don&#8217;t know if that&#8217;s a well known phrase or if I just made it up, but it perfectly captures what happened to me over the last week and a bit.  <a href="http://acornheroes.com/2011/01/faeries-journey-part-3/">Last time</a>, I mentioned I was moving on to look at OpenGL ES 2.0.  That&#8217;s where the trouble started.  Although I&#8217;ve done a lot of work with OpenGL over the years most of it has been using the fixed function pipeline, or if shaders became involved it was in addition to a predominantly fixed function set up.  This makes moving to OpenGL ES 2.0 a bit of a shock.</p>
<p>Why?</p>
<p>Because to maximise OpenGL&#8217;s adoption on mobile hardware, a lot of useful functionality has been ripped out by the Khronos group.  This isn&#8217;t a bad thing as such, but it does mean that a developer needs to supply code to handle things that the &#8216;full&#8217; version of OpenGl handles for you.  One shining example is that there is no matrix stack or utility projection matrix code.  In fact the programmer needs to supply matrix information, vertex and fragment shaders in all cases &#8211; there is no default option to fall back on, no glPushMatrix(), glTranslate() etc.</p>
<p>So, there&#8217;s a fair bit of overhead involved in getting that first triangle on screen.  And this is where the trouble starts.  My typical desire is to write &#8216;good&#8217;, &#8216;reusable&#8217; code.  But not having a working grasp of the best way to structure shader based code, this is not easy to do.  So a gradually tightening loop develops as I think, read and design a good solution.  Note that there&#8217;s no &#8216;do&#8217; stage in the last sentence.  The more you think, the more cases you try to cover, the worse it gets.  You get nowhere.</p>
<p>So, long story short, not much has happened over the last week, although I have found some really good articles about component based design and sorting of graphical elements:</p>
<ul>
<li><a href="http://www.insomniacgames.com/research_dev/articles/2010/1530793">Dynamic Components</a> by Terence Cohen</li>
<li><a href="http://gafferongames.com/game-physics/fix-your-timestep/">Fix your time step!</a> by Glenn Fiedler</li>
<li><a href="http://cmpmedia.vo.llnwd.net/o1/vault/gdccanada09/slides/marcinchadyGDCCanada.ppt">Object messaging</a> by Marcin Chady</li>
<li><a href="http://realtimecollisiondetection.net/blog/?p=86">Ordering graphics calls</a> by Christer Ericson</li>
</ul>
<p>Note that all these links come from a great <a href="http://altdevblogaday.com/growing-ginkgo-pt-1-the-reading-list-0">altDevBlogADay article</a> by Marttin Pichlmair.  If you haven&#8217;t checked out <a href="http://altdevblogaday.com/">altDevBlogADay</a> yet, you really should as there&#8217;s lot&#8217;s of fantastic information coming from industry professionals.</p>
<p>So, a warning before you find yourself becoming an <a href="http://www.joelonsoftware.com/articles/fog0000000018.html">Architecture Astronaut</a>:</p>
<blockquote>
<p style="text-align: center; font-size: 14px;">Learning by doing.  This is the only practical way to tackle an unfamiliar technology.</p>
</blockquote>
<h2>Thoughts on shader based OpenGL</h2>
<p>Having realised my mistake I have started to make a little progress. Between the Apple sample code and the <a href="http://www.amazon.com/gp/product/0321502795?ie=UTF8&amp;tag=acorhero-20&amp;link_code=as3&amp;camp=211189&amp;creative=373489&amp;creativeASIN=0321502795">OpenGL ES 2.0 Programming Guide</a>, it&#8217;s fairly simple to get basic shader code up and running.  A note on the programming guide &#8211; it is an invaluable reference, but not a particularly easy introduction to the topic.</p>
<p>My first challenge was to pull the shader data out into a struct and provide some helper code to go with it.  That&#8217;s mostly working now, with a &#8216;ShaderEffect&#8217; struct combining both vertex and fragment shaders into one object.  When the ShaderEffect object is initialised I also pull out the required attributes (colour, texture coordinates etc) for the shader.   This allows my mesh rendering code to activate only those attributes that are required, even if the mesh itself contains extra data.  All that&#8217;s left is to bind the shaders at render time and render your mesh.</p>
<p>Philip Rideout&#8217;s <a href="http://prideout.net/blog/?tag=glsw">Shader Wrangler</a> code is also a great help here, making it simple to combine shaders into a single &#8216;effect&#8217; file and avoid loading the same shader multiple times.  So my effect file currently contains both vertex and fragment shader in one place.  Next up, I&#8217;ll add a &#8216;setup&#8217; section as well, which can control things such as blending and culling modes.  The plan here is that rendering becomes a simple case of saying &#8216;here&#8217;s an effect, here&#8217;s a mesh now render it&#8217;, with all of the standard OpenGL state stuff being handled automatically.</p>
<p>So, not much achieved this week, but progress is being made by focusing on the small steps and not the big leaps.  Hopefully I won&#8217;t need @mysterycoconut to <a href="http://twitter.com/#!/mysterycoconut/status/32174656337219584">call me out</a> as a <a href="http://twitter.com/#!/mysterycoconut/status/32954842775289858">lazy git </a>again next week&#8230;</p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/02/faeries-journey-part-4/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 3</title>
		<link>http://acornheroes.com/2011/01/faeries-journey-part-3/</link>
		<comments>http://acornheroes.com/2011/01/faeries-journey-part-3/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 00:26:46 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Faerie]]></category>
		<category><![CDATA[GLSL]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[UIKit]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=679</guid>
		<description><![CDATA[In which George shows off some really ugly screens, ponders OpenGL and answers an important question&#8230; Screens! I mentioned in a previous post that one of the first things I like to do when starting a new project is get the basic flow from screen to screen sorted out.  First off, I looked around at [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George shows off some really ugly screens, ponders OpenGL and answers an important question&#8230;</em></p>
<h2>Screens!</h2>
<p>I mentioned in a previous post that one of the first things I like to do when starting a new project is get the basic flow from screen to screen sorted out.  First off, I looked around at games I enjoyed to see what they do well.  In particular I&#8217;d like to let the player jump straight into the game with the minimum of fuss.  <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Fninjump-deluxe%252Fid404701520%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Ninjump</a>, one of my current favourites, is a good example to copy here.  The main menu has three buttons that let you jump straight into a game (there are three different game modes).  Also, I like their pause screen, which only has two options: resume or main menu.  So without further blather, here&#8217;s the first draft&#8230;</p>
<p><a href="http://acornheroes.com/wp-content/uploads/2011/01/Screen-flow1.jpg"><img class="aligncenter size-medium wp-image-682" title="Screen flow" src="http://acornheroes.com/wp-content/uploads/2011/01/Screen-flow1-300x145.jpg" alt="" width="300" height="145" /></a></p>
<p>The first screen is the loading screen, using a placeholder image.  It gives you an idea of an effect I want to use in game &#8211; the background scene is initially grey and lifeless.  As the player starts stringing together chains and combos, splashes of life come into the background, adding colour and excitement as the player does well.  The main menu has three large buttons, one for each game play mode:</p>
<ul>
<li>Survival mode &#8211; keep going for as long as you can, score as many points as you can.</li>
<li>Time Limit mode &#8211; much like the Sprint mode in <a href="http://click.linksynergy.com/fs-bin/stat?id=tJcjmvCiUp8&amp;offerid=146261&amp;type=3&amp;subid=0&amp;tmpid=1826&amp;RD_PARM1=http%253A%252F%252Fitunes.apple.com%252Fus%252Fapp%252Flinkoidz%252Fid338887297%253Fmt%253D8%2526uo%253D4%2526partnerId%253D30">Linkoidz</a> , the aim here is to score as many points as possible in a set time frame &#8211; great for people who love scoring mega-combos.</li>
<li>Challenge mode &#8211; this one is a little less defined, but will probably require the player to get specific combos in a given time.  If they can get the required chain(s), they get a time bonus to keep going.  There&#8217;s still plenty of room to re-think this idea later.</li>
</ul>
<p>Now I know that <a href="http://acornheroes.com/2011/01/faeries-journey-part-1/">previously</a> I&#8217;ve talked about a minimum viable product.  So why include three game modes?  The simple answer is that if I&#8217;m to have a free version of the game, then the full version has to add something extra.  Hence three game modes instead of one.  However, while the modes are reasonably distinct from a gameplay point of view, there&#8217;s not a lot of difference in them from a coding point of view.  So I&#8217;m hopeful that for a small amount of work I can significantly increase the game&#8217;s value from a player&#8217;s point of view.</p>
<p>Otherwise the main menu is fairly standard.  The new ticker will incorporate ideas from a great post by <a href="http://pocketcyclone.com/2010/11/30/the-perfect-newsline/">Markus</a>.   All of the extra screens (options, help etc) will be single page screens with a back button to return to the main menu.  In each screen, the brightly coloured background is an OpenGL view.  The current plan is to use this to render subtly animated backgrounds for all the screens.</p>
<p>All of these screens are implemented using standard UIKit views and controllers.  I have an overall controller that maintains a stack of screens, and new screens can be pushed on to the stack, the current screen can be popped or a new screen can replace the existing stack.  It&#8217;s a nice simple mechanism, but it means I can, for example, have a settings screen that can be reached from the main menu or the pause screen, and when the settings screen is closed it can just &#8216;pop&#8217; itself leaving the original screen behind.  While none of the screens are in any way pretty, they&#8217;re functional so I can hook in more detail as we go.  Next up though it&#8217;s time to get some basic rendering code up and running&#8230;</p>
<h2>OpenGL v1.1 or v2.0?</h2>
<p>So last week I said I would need to decide between the two possible versions of OpenGL.  Supporting both is a headache I don&#8217;t need, so it&#8217;s one or the other.  In the end, I&#8217;ve chosen to go with 2.0, for the following reasons:</p>
<ul>
<li>I&#8217;m planning to support only iOS 4.0 and up, simply to keep things under control.  I&#8217;ve read recently that the number of devices running older versions of iOS is surprisingly small &#8211; maybe 10%.  By supporting only iOS 4, there is potential to use lots of useful frameworks &#8211; Accelerate, gesture recognizers, Game Center and so on.  It also means that most of the target devices will support OpenGL ES v2.0</li>
<li>I have a lot of experience with &#8216;old school&#8217; OpenGL, but far less with shaders.  This is something I want to learn more about.</li>
<li>I&#8217;m a programmer, not an artist.  By using a shader based engine, I have the opportunity to use my technical skills to give me an edge over purely sprite based games.  It&#8217;s a chance to produce a look and a style that can&#8217;t easily be matched with simpler sprite based engines.</li>
<li>There&#8217;s a number of cool effects I have in mind that will be difficult to implement with a fixed function pipeline.  I plan to revel in the freedom 2.0 gives me like a pig in muck.</li>
</ul>
<p>Ok, so maybe there are more rational arguments that could be made in favour of using 1.1, but in this case my personal motivation will be much higher using a shader based renderer.</p>
<p>I&#8217;m hopeful that by next week I can share some of my initial progress with the new OpenGL.  There&#8217;s a lot more to do before I can get pixels on screen and I&#8217;m learning as I go, but a basic plan of attack is starting to form in my mind.</p>
<h2>And finally, what does success mean to me?</h2>
<p>Noel asked me an interesting question after my first post:</p>
<p><a href="http://acornheroes.com/wp-content/uploads/2011/01/NoelQuestion1.png"><img class="aligncenter size-medium wp-image-683" title="NoelQuestion" src="http://acornheroes.com/wp-content/uploads/2011/01/NoelQuestion1-300x116.png" alt="" width="300" height="116" /></a></p>
<p>I tried to answer in 140 characters or less, and failed miserably, so here&#8217;s a more detailed answer, split into two parts.</p>
<h3>Financial success</h3>
<p>Sam and I set up Acorn Heroes as a part time business outside of our day jobs.  This has obvious disadvantages in terms of time available, but it removes the absolute necessity of covering our mortgages through App sales alone.  Which is good, looking at our current sales to date <img src='http://acornheroes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   So financial success for us isn&#8217;t just a matter of surviving as Indies, it&#8217;s more of a sliding scale:</p>
<ul>
<li><strong>Level One &#8211; Not failing</strong>.  The first level of success is just to reach the finish line and publish Faerie.  Of all the levels of success, this is the most important!</li>
<li><strong>Level Two &#8211; Pocket Money for gadgets! </strong> The second level is about making enough money to cover our costs (web hosting, developer&#8217;s license) with enough left over to, say, by an new iDevice each, or perhaps new MacBooks.  So we&#8217;re talking about a few thousand dollars in app sales.  With a bit of a nudge we should hit this mark this year.</li>
<li><strong>Level Three &#8211; Successful enough to up our game.</strong> We are a 2 person team, and unfortunately we&#8217;re both programmers.  We&#8217;re fortunate enough to know some great artists and designers, but not yet successful enough to afford to pay them.  Having enough money attached to a project to cover outsourcing art, design and music tasks would be a huge boon.</li>
<li><strong>Level Four &#8211; Financial freedom! </strong> Every Indie&#8217;s dream, the chance to work on your own project&#8217;s without worrying where the next meal is coming from.  Making enough in sales to cover a year or more in terms of salary.  Anything beyond this is gravy.</li>
</ul>
<p>But money&#8217;s not everything, which brings me to&#8230;</p>
<h3>Personal success</h3>
<p>One of the main reasons I started working on my own iDev projects is that writing software for other people can get a little tiresome.  I was well into my thirties and the idea of making the software I want to make and selling it to and interacting with the end user directly has a huge appeal.  So in terms of personal success&#8230;</p>
<ul>
<li><strong>Level One &#8211; Not failing</strong>.  See above.  That first copy sold to a person I don&#8217;t know yet is a wonderful ego boost to a man with my insecurities.</li>
<li><strong>Level Two &#8211; Positive feedback.</strong> An extension on the first level is when I get a chance to have positive interactions with customers, either through twitter, reviews or email.</li>
<li><strong>Level Three &#8211; Critical Acclaim.</strong> Receiving a positive review in the press, particularly from the likes of Touch Arcade, Kotaku or TUAW would be a defining &#8220;We&#8217;ve made it&#8221; or &#8220;We can do it!&#8221; moment.</li>
<li><strong>Level Four &#8211; The &#8220;You did this? effect.</strong> I think for me the ultimate success would be knowing that tens of thousands (or more) people had bought my game and were playing it often.  The  best part would be the moment someone I&#8217;ve just met shows me their favourite game, and it&#8217;s the game I wrote.  For me, professionally, I think that would be a highlight.</li>
</ul>
<p>So I hope that answers your question Noel!  I guess my sense of success comes from having the freedom to make games at all.  From there on it just gets better.  Faerie is built around a theme and game mechanic that should have reasonably wide appeal.  Really now it&#8217;s just up to me to implement it well and get the word out there.  As one of my friends like to say, &#8220;It&#8217;s all over bar the typing&#8221;&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/01/faeries-journey-part-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Faerie&#8217;s Journey &#8211; part 2</title>
		<link>http://acornheroes.com/2011/01/faeries-journey-part-2/</link>
		<comments>http://acornheroes.com/2011/01/faeries-journey-part-2/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 22:09:01 +0000</pubDate>
		<dc:creator>George</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Faerie]]></category>
		<category><![CDATA[Setting up]]></category>
		<category><![CDATA[Setup]]></category>

		<guid isPermaLink="false">http://acornheroes.com/?p=672</guid>
		<description><![CDATA[In which George lays out his initial project structure with the best of intentions, knowing full well that it&#8217;ll get all messy one way or another&#8230; Every journey begins with a single step&#8230; Yes I have been working on Faerie on and off for a while now, but this week marks the writing of the [...]]]></description>
			<content:encoded><![CDATA[<p><em>In which George lays out his initial project structure with the best of intentions, knowing full well that it&#8217;ll get all messy one way or another&#8230;</em></p>
<h2>Every journey begins with a single step&#8230;</h2>
<p>Yes I have been working on Faerie on and off for a while now, but this week marks the writing of the first actual lines of production code.  It&#8217;s an exciting time.  You have a blank canvas on which you can paint wonderful, clean, elegant and powerful code.  At least that&#8217;s how it starts.  Over time entropy, corner cases and flaws in your initial design have a tendency to muddy the code base.  But for now there&#8217;s wonder, cleanliness, elegance and the potential for power.</p>
<p>So where do we start?  For me it begins with the layout and structure of the project.  If you&#8217;re not a coder, you may want to skip all this technical stuff &#8211; I won&#8217;t be offended!  If you are a code nerd like me, perhaps this will be interesting to you, or maybe you can see flaws in the way things are laid out, or would like to share how you set up a project.  I&#8217;d love to hear what you think!</p>
<h2>Stay on target!</h2>
<p>The Faerie codebase contains four targets (at least for now).  The first target is the actual Faerie project.  It builds the Faerie app.  This target contains all the resources we use &#8211; textures, sounds and music, string resources, nibs and the like.  However this target contains virtually no code, just main.mm.  Why is this?</p>
<p>The answer is unit testing.  All the game code goes into a static library with the exciting name of GameLib.  By putting the code into a static library, it&#8217;s possible to unit test all the game code.  And it&#8217;s unit testing that comprises the other two targets in my project.  One is a static library containing the the <a href="http://unittest-cpp.sourceforge.net/">UnitTest++</a> framework, and the last is an executable target that links the UnitTest++ framework, GameLib and all out test code.  I&#8217;ve described this set up <a href="http://acornheroes.com/2009/06/unit-testing-and-linking-static-libraries-with-xcode/">previously</a> if you&#8217;re interested in the details.  The advantage of setting up the code this way is that our actual app doesn&#8217;t need to include any testing code, yet we are able to test the exact library that is used in the game itself.  So the target structure looks like the image below.  Note the final step in the Faerie target, which runs the GameLibTests executable with every build &#8211; very handy!</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/01/Targets1.png" border="0" alt="Targets.png" width="240" height="196" /></p>
<p>There is one issue we need to address however.  Our nib files need to be in the Faerie target to ensure they&#8217;re included in the app itself.  And for testing purposes, all the view controller code is in the GameLib library.  This causes a problem because the linker doesn&#8217;t know that it should get the view controller code from GameLib, and so we get errors when the nibs are constructed at run time.  To fix this, it&#8217;s necessary to add the following to our &#8220;Other Linker Flags&#8221; setting for the Faerie target:</p>
<pre>-force_load "$(BUILT_PRODUCTS_DIR)/libGameLib.a"</pre>
<h2>What about the code?</h2>
<p>I find it very hard to create a new project from scratch, so I start with the OpenGL template and rip out the stuff I don&#8217;t want and reorganise the rest into a layout that suits me  Here&#8217;s the basic layout:</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="http://acornheroes.com/wp-content/uploads/2011/01/Code-layout.jpg" border="0" alt="Code layout.jpg" width="237" height="342" /></p>
<p>These groups in XCode are matched with an identical file layout on disk.  XCode doesn&#8217;t require this, but I find it too confusing if they differ.  As you can see, the <em>Faerie</em> folder contains basically no code.  It&#8217;s <em>GameLib</em> that has all the good stuff.  <em>Acorn</em> is all the standard code I carry from project to project &#8211; code to handle maths, loading textures, playing sounds and more &#8211; all that low level stuff.  <em>GameLogic</em> gets all the game specific code, and <em>Views</em> contains all the view controllers for my nib files.  Why the split between <em>GameLogic</em> and <em>Views</em>?  The main reason is that my view controller code is (by necessity) largely Objective-C, while the rest of my code is (as much as possible) pure C++, so it seems reasonable to keep them apart.</p>
<p>The <em>Resources</em> folder contains all the game assets, sorted by type and/or purpose.  By the time the game is done, there&#8217;ll be a lot of folders and a lot of files in here, so it&#8217;s good to keep them organised.</p>
<h2>A simple trick to add a little polish</h2>
<p>Here&#8217;s something truly simple that you can do in any app for a little extra style.  On startup, our app shows Default.png (or equivalent), and then once the main view is loaded it &#8216;cuts&#8217; straight to the main view.  Wouldn&#8217;t it be nicer if we could smooth out that transition?  It turns out it&#8217;s easy to do.  Simply add a UIImageView to your main window, sitting above everything else.  The UIImageView should fill the screen and contain Default.png.  So what happens is that the main app loads and seamlessly replaces the loading screen with an identical screen, but one that we have control over.</p>
<p>Then, it&#8217;s a simple case of fading our Default.png image out, revealing the main view underneath, using a bit of code like this in your update loop:</p>
<pre class="brush:cpp">float deltaTime = (float)gameClock-&gt;GetFrameDuration();
if (!loadingDefaultView.hidden)
{
    defaultViewFadeOut -= deltaTime / fadeDuration;

    if (defaultViewFadeOut &lt; 0.0f)
    {
        defaultViewFadeOut = 0.0f;
        loadingDefaultView.hidden = YES;
    }
    else
    {
        loadingDefaultView.alpha = defaultViewFadeOut;
    }
}</pre>
<p>*UPDATE*</p>
<p>Miguel, the mighty <a href="http://twitter.com/#!/mysterycoconut">@mysterycoconut</a> pointed out that this could also be done using standard animation calls in UIKit, so here&#8217;s an alternate version that gets executed in the viewDidAppear method&#8230;</p>
<pre class="brush:cpp">- (void)hideLoadingDefaultViewDidStop
{
    loadingDefaultView.hidden = YES;
}

- (void)viewDidAppear:(BOOL)animated
{
    if (!loadingDefaultView.hidden)
    {
        [UIView beginAnimations:@"Hide loading screen" context:nil];
        [UIView setAnimationDuration:fadeDuration];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(hideLoadingDefaultViewDidStop)];
        loadingDefaultView.alpha = 0.0f;
        [UIView commitAnimations];
    }
}</pre>
<h2>So what&#8217;s next?</h2>
<p>I think after all this generic setup, it&#8217;s about time to add some actual game code, right?  Well the first thing I like to get going in a project like this is the flow from screen to screen, so that&#8217;s the next job on my list, adding the nibs and view controllers for the main menu, game, pause screen, credits and so on.  It won&#8217;t be pretty, but the aim is to get all the required buttons and such in place and working so that I can navigate around the app.  I find this to be a nice psychological stage to reach because, once done, I have a &#8216;complete&#8217; app, and all I have to do is fill in the gaps! <img src='http://acornheroes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>After that, I need to make a key decision &#8211; OpenGL ES v1.1 or 2.0?  I think that 2.0 will win out, but I&#8217;ll delay that decision for another post!</p>
]]></content:encoded>
			<wfw:commentRss>http://acornheroes.com/2011/01/faeries-journey-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

