<?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>CoderHump.com</title>
	<atom:link href="http://coderhump.com/feed" rel="self" type="application/rss+xml" />
	<link>http://coderhump.com</link>
	<description>Game Development Technology, in Flash and Elsewhere</description>
	<lastBuildDate>Tue, 06 Jul 2010 17:18:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Real-time Rendering Reviews &#8220;Video Game Optimization&#8221;</title>
		<link>http://coderhump.com/archives/615</link>
		<comments>http://coderhump.com/archives/615#comments</comments>
		<pubDate>Tue, 06 Jul 2010 17:18:41 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Publication]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=615</guid>
		<description><![CDATA[ One of my favorite graphics technology blogs, Real-Time Rendering, reviewed Eric Preisz and I&#8217;s book, Video Game Optimization! Here&#8217;s the executive summary:
It’s a worthwhile book for just about anyone interested in optimization. These guys are veteran experts in this field, and the book gives specific advice and practical tips in many areas. A huge [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356"><img align="right" hspace="5" vspace="5" src="http://images.amazon.com/images/P/1598634356.01.ZTZZZZZZ.jpg"></a> One of my favorite graphics technology blogs, <a href="http://www.realtimerendering.com/blog/">Real-Time Rendering</a>, reviewed Eric Preisz and I&#8217;s book, <a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356">Video Game Optimization</a>! Here&#8217;s the executive summary:</p>
<blockquote><p>It’s a worthwhile book for just about anyone interested in optimization. These guys are veteran experts in this field, and the book gives specific advice and practical tips in many areas. A huge range of topics are covered, the authors like to run various experiments and show where problems can occur (sometimes the cases are a bit pathological, but still interesting), and there are lots of bits of information to mull over. Long and short, recommended if you want to know about this subject.</p></blockquote>
<p>You can read <a href="http://www.realtimerendering.com/blog/video-game-optimization-a-good-book/">the rest of the review here</a> or even (if you wanted to) buy your own copy of <a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356"><i>Video Game Optimization</i></a> from Amazon.</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/615/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Composition vs. Inheritance</title>
		<link>http://coderhump.com/archives/611</link>
		<comments>http://coderhump.com/archives/611#comments</comments>
		<pubDate>Sat, 12 Jun 2010 20:28:56 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=611</guid>
		<description><![CDATA[Steffen Iterheim over at learn cocos2d posted a good article discussing the benefits of composition in games, and he linked the &#8220;Understanding Components&#8221; QuickTalk I did for PushButton Engine:

Which reminded me I had never linked it here on my blog! So if you&#8217;re curious about why components are a great fit for games, I encourage [...]]]></description>
			<content:encoded><![CDATA[<p>Steffen Iterheim over at <a href="http://learn-cocos2d.com/">learn cocos2d</a> posted a good article <a href="http://www.learn-cocos2d.com/2010/06/prefer-composition-inheritance/">discussing the benefits of composition in games</a>, and he linked the &#8220;Understanding Components&#8221; QuickTalk I did for <a href="http://www.pushbuttonengine.com/">PushButton Engine</a>:</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/auaqZzcjl-Y&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/auaqZzcjl-Y&#038;color1=0x3a3a3a&#038;color2=0x999999&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object></p>
<p>Which reminded me I had never linked it here on my blog! So if you&#8217;re curious about why components are a great fit for games, I encourage you to watch my 5 minute video above, and check out the resources linked in <a href="http://www.learn-cocos2d.com/2010/06/prefer-composition-inheritance/">Steffen&#8217;s post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/611/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PushButton Labs Profiler</title>
		<link>http://coderhump.com/archives/606</link>
		<comments>http://coderhump.com/archives/606#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:42:05 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=606</guid>
		<description><![CDATA[Do you want your Flash content to perform well?
Have you struggled with the tools built into Flash Builder?
Well, if all you want is a basic functioning profiler, let me introduce the PBLabs Profiler! It shows you where your time is going:

It&#8217;s available under the GPL with source and binaries on GitHub. You can also post [...]]]></description>
			<content:encoded><![CDATA[<p>Do you want your Flash content to perform well?</p>
<p>Have you struggled with the tools built into Flash Builder?</p>
<p>Well, if all you want is a basic functioning profiler, let me introduce the <a href="http://github.com/bengarney/PBLabsProfiler">PBLabs Profiler</a>! It shows you where your time is going:</p>
<p><img src="http://coderhump.com/wp-content/uploads/2010/06/Picture-3.png" alt="" title="PBLabsProfiler Screenshot" width="502" height="382" class="aligncenter size-full wp-image-607" /></p>
<p>It&#8217;s available under the GPL with source and binaries on <a href="http://github.com/bengarney/PBLabsProfiler">GitHub</a>. You can also post on the <a href="http://pushbuttonengine.com/forum/viewforum.php?f=16">PBLabs Profiler forums.</a> There is more information on the profiler in the forums and on the github site.</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/606/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PushButton Engine 101 Talk Video Now Available</title>
		<link>http://coderhump.com/archives/599</link>
		<comments>http://coderhump.com/archives/599#comments</comments>
		<pubDate>Sun, 11 Apr 2010 09:00:27 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Publication]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=599</guid>
		<description><![CDATA[
I gave a talk on the PushButton Engine at the Flash Gaming Summit a few weeks ago, titled &#8220;PushButton Engine 101.&#8221; It is available online, thanks to Adobe&#8217;s kind support in sponsoring FGS and recording the sessions. You can view the PushButton Engine 101 talk here. It&#8217;s about 40 minutes long. People seemed to like [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://partners.adobe.acrobat.com/p26778869/"><img src="http://coderhump.com/wp-content/uploads/2010/04/ben_talk-300x95.jpg" alt="" title="ben_talk" width="300" height="95" class="aligncenter size-medium wp-image-601" /></a></p>
<p>I gave a talk on the <a href="http://pushbuttonengine.com/">PushButton Engine</a> at the <a href="http://flashgamingsummit.com/">Flash Gaming Summit</a> a few weeks ago, titled &#8220;PushButton Engine 101.&#8221; It is available online, thanks to Adobe&#8217;s kind support in sponsoring FGS and recording the sessions. You can <a href="http://partners.adobe.acrobat.com/p26778869/">view the PushButton Engine 101 talk here</a>. It&#8217;s about 40 minutes long. People seemed to like it!</p>
<p>If you have comments/questions/feedback, I highly recommend visiting the <a href="http://pushbuttonengine.com/forum/viewtopic.php?f=15&#038;t=789&#038;start=0">PushButton Engine forums thread about it</a>.</p>
<p>The Flash Gaming Summit was a blast. I got to spend time with the guys from <a href="http://8bitrocket.com/">8bit Rocket</a>, with <a href="http://lostgarden.com/">Dan Cook</a>, and, of course, the crews from Adobe and Mochi. For the second conference, <a href="http://www.adamatomic.com/">Adam Saltsman</a> eluded me, but I had a great conversation with <a href="http://ncannasse.fr/">Nicolas Cannasse</a> about building companies. Lunch was spent with the PBE crew in attendance &#8211; <a href="http://www.jdconley.com/blog/">JD Conley</a>, Dion Whitehead, and a couple of others. I had a million other awesome conversations, too, which is why I love going to conferences. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Other than the very early start, I thought FGS went a lot better than last year. (Perhaps because they had me on the <a href="http://www.flashgamingsummit.com/">advisory board</a> &#8211; conference organizers take note! <img src='http://coderhump.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) They had a solid tech track in addition to their business track. Maybe next year it can be two days &#8211; or just start a little later.</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/599/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I Wrote A Book: Video Game Optimization</title>
		<link>http://coderhump.com/archives/585</link>
		<comments>http://coderhump.com/archives/585#comments</comments>
		<pubDate>Mon, 05 Apr 2010 06:16:18 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Publication]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=585</guid>
		<description><![CDATA[
More precisely, Eric Preisz and I wrote a  book!
The book is called Video Game Optimization, and it covers everything you need to know to get maximum performance from any software project &#8211; but especially games. If you&#8217;re struggling with getting a great framerate out of your game, I highly recommend checking it out.  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356"><img src="http://coderhump.com/wp-content/uploads/2010/04/photo-225x300.jpg" alt="" title="Ben Garney With Video Game Optimization" width="225" height="300" class="alignleft size-medium wp-image-591" /></a></p>
<p>More precisely, <a href="http://www.torquepowered.com/account/profile/59817">Eric Preisz</a> and I wrote a  <a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356">book</a>!</p>
<p>The book is called <a href="http://www.amazon.com/Video-Game-Optimization-Eric-Preisz/dp/1598634356">Video Game Optimization</a>, and it covers everything you need to know to get maximum performance from any software project &#8211; but especially games. If you&#8217;re struggling with getting a great framerate out of your game, I highly recommend checking it out. <img src='http://coderhump.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>Video Game Optimization goes all the way from high-level concepts like planning for performance in your project&#8217;s timeline, to determining which broad area of your system is a bottleneck, down to specific tips and tricks for optimizing for space, time, and interactivity. Based on the course that Eric Preisz taught at Full Sail University on optimization, it isn&#8217;t the only book you&#8217;d ever want to read on the subject, but we think it is a great introduction!</p>
<p>The journey from that initial conversation where our mutual friend <a href="http://www.linkedin.com/in/jdmoore">Jay Moore</a> introduced us and suggested I would be a good co-author, to the day when we finished and shipped the book was a long but rewarding trek. Eric moved across the country from Florida to Nevada, as he moved from teaching at Full Sail University to running the Tech and Tools group at InstantAction. He also became a father with the arrival of his son, Grant. I left after 5 years at GarageGames and helped build a new company, <a href="http://www.pushbuttonlabs.com/">PushButton Labs</a>.</p>
<p>A lot has changed while we wrote it, but it still felt really good to arrive at GDC, visit the book store outside the exhibition hall, and finding a big stack of Video Game Optimization sitting front and center. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/585/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>3D in Flash 10 &amp; Git</title>
		<link>http://coderhump.com/archives/536</link>
		<comments>http://coderhump.com/archives/536#comments</comments>
		<pubDate>Mon, 14 Dec 2009 07:12:05 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=536</guid>
		<description><![CDATA[
I spent a little time with Flash 10&#8217;s 3d features recently. Since Flash 10.1 is imminent and FP10 has been at 90%+ penetration for a while now, it&#8217;s probably safe to start looking at using FP10 stuff in my projects.  
I also used this as an opportunity to try out git. It was easy [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://coderhump.com/wp-content/uploads/2009/12/picture-1.png" alt="picture-1" title="picture-1" width="231" height="196" class="alignright size-full wp-image-537" /></p>
<p><b>I spent a little time with Flash 10&#8217;s 3d features recently.</b> Since Flash 10.1 is imminent and FP10 has been at 90%+ penetration for a while now, it&#8217;s probably safe to start looking at using FP10 stuff in my projects. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I also used this as <b>an opportunity to try out git</b>. It was easy to get git installed on OSX (I used the command line version, installed from <a href="http://code.google.com/p/git-osx-installer/">git-osx-installer</a>) and put my code up on <a href="http://www.github.com/">Github</a>. You can browse my test code at <a href="http://github.com/bengarney/garney-experiments/tree/master/exploringFlash3D/">http://github.com/bengarney/garney-experiments/tree/master/exploringFlash3D/</a>.</p>
<p><b>My main concern was the transformation pipeline</b> &#8211; I think there might be some benefits to using 3d positions for the rendering pipeline in PBE. So I wanted to do a brief survey of the built-in 3d capabilities, then look more closely at the transformation routines.</p>
<p>My first test was making a DisplayObject rotate in 3d (<a href="http://github.com/bengarney/garney-experiments/blob/27c17dcd6a6daf828b631f93620b28f83e325038/exploringFlash3D/src/exploringFlash3D.as">minimal source code</a>). It runs well, and if you turn on redraw region display, you can see that it&#8217;s properly calculating the parts of the screen that need to be modified.</p>
<p>This was easy to write, but <b>it revealed the primary flaws with the built-in Flash 3d capabilities</b>. First, look closely &#8211; the edges of the shape were sharp, but the interior detail is aliased. This is because whenever the 3D rendering path is engaged, it turns on cacheAsBitmap. This is fine for simple scenarios (say, taking a single element in a UI and giving it a nice transition) but not for more complex situations.</p>
<p>Which brings us to the second and bigger flaw. I added a thousand simple particle sprites at different 3d positions (<a href="http://github.com/bengarney/garney-experiments/blob/4b2ed8fa9dcc2e9fca4eebc2783fb3b47fa3ce40/exploringFlash3D/src/exploringFlash3D.as">source code</a>). This runs extremely slowly because of <a href="http://www.bit-101.com/blog/?p=2391">an issue described by Keith Peters involving nested 3d transforms<a>. <b>Nested 3d objects cause excessive bitmap caching, dramatically reducing performance.</b> You might end up with bitmap-caching in action on every 3d object and every DisplayObject containing 3d objects.</p>
<p>In addition, because it&#8217;s cached, moving objects further/closer from the camera results in an upsampled/downsampled image. So you tend to get mediocre visual results if your objects move much.</p>
<p>My next step was to stop using the 3d capabilities of DisplayObjects, and just position them in x/y based on their 3D position (<a href="http://github.com/bengarney/garney-experiments/tree/249c73b1387d6e530caadafe1402ad679a79c5ac/exploringFlash3D/src">source code, notice it is two files now</a>). This gave a massive performance gain. At low quality, 1000 particles runs at 1440×700 at acceptable FPS. Most of the overhead is in the Flash renderer, not the code to update DisplayObject positions, but it still takes a while to do all the transformation, and it causes a lot of pressure on the garbage collector from all the 1000 temporary Vector3D instances that are created every frame. (600kb/second or so &#8211; not insignificant.)</p>
<p>Next I figured it would be helpful to make my camera move around (<a href="http://github.com/bengarney/garney-experiments/blob/1abbe2d5e874c5b7097cc55e610b5656e172ca96/exploringFlash3D/src/exploringFlash3D.as">sample code</a>). </p>
<p>This required that I understand the coordinate space all this operated in. What are the coordinate spaces? <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/geom/PerspectiveProjection.html#fieldOfView">According to the official docs</a>, screen XY maps to world XY. So forward is Z+, up is Y-, right is X+. Once I figured that out, I had to prepare a worldMatrix with the transform of the camera, then append the projectionMatrix. The PerspectiveProjection class always seems to assume screen coordinate (0,0) is the center of the projection so you will have to manually offset. Maybe I was not using the projection right, since the docs imply otherwise.</p>
<p>There were two other details to sort out. First, I had to reject objects behind the camera, and second, I had to scale objects correctly so they appeared to have perspective. The solution revolved around the same information &#8211; the pre-projection Z. By hiding all objects with <i>Z &lt; 0</i> and scaling by <i>focalLength / preZ</i>, I was able to get it to behave properly.</p>
<p>Next up is Matrix3D.transformVector… which is slow. <b>Transforming 1000 vectors eats 3ms in release build!</b> This is really slow in absolute terms (<a href="http://www.unitzeroone.com/blog/2009/03/18/flash-10-massive-amounts-of-3d-particles-with-alchemy-source-included/">Ralph Hauwert has a good example of the same functionality running much much faster</a>). I didn’t really want to introduce Alchemy for this project. But we can use AS3 code that avoids the allocations, saving us GC overhead and getting us an incremental improvement in performance.</p>
<p>Andre Michelle has some interesting thoughts on <b>the problem of temporary objects related to transformations</b> (see http://blog.andre-michelle.com/2008/too-late-very-simple-but-striking-feature-request-for-flash10-3d/). I did notice that Utils3D.projectVectors had some options for avoiding allocations, but it did not seem to run significantly faster (even in release build). (<a href="http://github.com/bengarney/garney-experiments/blob/7d98b9d905015002f9c4fcde0c02138ab2817c2c/exploringFlash3D/src/exploringFlash3D.as">sample code for using projectVectors</a>)</p>
<p>In the end, <b>I settled on my own implementation of transformVectors</b>, as it seemed to give the best balance between performance and ease of us. There&#8217;s a <a href="http://github.com/bengarney/garney-experiments/blob/342444710c9563df406b52d4936495d919e31538/exploringFlash3D/src/exploringFlash3D.as">final version of the sample app where you can toggle between transformVector and the AS3 version by commenting out line 105/106</a> up on github, so you can test it for yourself. The transform function took some effort to get right, so here it is to save you the pain of implementing it yourself. It transform i by m and stores it in o.</p>
<pre>        final public function transformVec(m:Matrix3D, i:Vector3D, o:Vector3D):void
        {
            const x:Number = i.x, y:Number = i.y, z:Number = i.z;
            const d:Vector.<Number> = m.rawData;

            o.x = x * d[0] + y * d[4] + z * d[8] + d[12];
            o.y = x * d[1] + y * d[5] + z * d[9] + d[13];
            o.z = x * d[2] + y * d[6] + z * d[10] + d[14];
            o.w = x * d[3] + y * d[7] + z * d[11] + d[15];
        }</pre>
<p>Time for some conclusions. I think that the 3D capabilities built into DisplayObject are OK, but very focused on light-weight graphic design use. <b>Building a significant 3D application requires you write your own rendering code built on Flash&#8217;s 2D capabilities (either DisplayObjects or drawTriangles and friends).</b> The 3d math classes are ok, but immature. Some things are very handy (like the prepend/append versions of all the methods on Matrix3D), but the tendency for Flash APIs to implicitly allocate temporary objects limits the usefulness of some the most central API calls. In addition, important assumptions like the order of the values in Matrix3D.rawData were not documented, leading to frustrating trial and error. <b>I am excited to see Flash&#8217;s 3d capabilities mature.</b> </p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/536/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Flash on iPhone: My Experience</title>
		<link>http://coderhump.com/archives/517</link>
		<comments>http://coderhump.com/archives/517#comments</comments>
		<pubDate>Sat, 10 Oct 2009 02:37:52 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=517</guid>
		<description><![CDATA[Hello, world! 
I wanted to post some real world information on Adobe&#8217;s latest big announcement, Adobe Flash Applications for iPhone. I participated in the pre-release beta along with several other very talented Flash developers. We got to be some of the first outsiders to work with the iPhone technology. To try out the tech, we [...]]]></description>
			<content:encoded><![CDATA[<p>Hello, world! <img src="http://pushbuttonlabs.com/wp-content/uploads/2009/09/flash_iphone_graphic.jpg" hspace=5 vspace=5 align=right></p>
<p>I wanted to post some real world information on Adobe&#8217;s latest big announcement, <a href="http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/">Adobe Flash Applications for iPhone</a>. I participated in the pre-release beta along with several other very talented Flash developers. <b>We got to be some of the first outsiders to work with the iPhone technology.</b> To try out the tech, we wrote and shipped <a href="http://tradingstuff.pushbuttonlabs.com/">Trading Stuff in Outer Space</a> in just 8 days.</p>
<p>By the way, <b>if this is Flash on iPhone stuff is new to you</b>, you should definitely read <a href="http://www.adobe.com/devnet/logged_in/abansod_iphone.html">Aditya&#8217;s &#8220;Developing for the Apple iPhone using Flash&#8221;</a> article on adobe.com. In addition to being an all around great guy, Aditya was also a huge help in working through the very early beta issues we encountered. <a href="http://onflash.org/ted/2009/10/source-to-4-flash-iphone-apps.php">Ted Patrick posted some cool iPhone example apps with source</a>. (Not only does Ted make <a href="http://www.flickr.com/photos/15543694@N06/3989934309/">a good jedi</a>, he also helped me debug some rendering issues in Trading Stuff at the last minute. Thanks, Ted!) And Mike Chambers, who brought me into the program, has posted <a href="http://www.mikechambers.com/blog/2009/10/05/building-applications-for-the-iphone-with-flash/">more explanation with a lot of useful links for Flash/iPhone work</a>.</p>
<p>It&#8217;s worth stating emphatically that <b>Adobe has a large, talented team working hard on iPhone</b>. I couldn&#8217;t hope to properly thank all the Adobe folk who explained, demonstrated, debugged, and implemented through long sleepless nights to build this tech and fix bugs so we could ship Trading Stuff. Guys, you rock!</p>
<p>A brief history of Ben &#8211; I spent five years working on <a href="http://www.garagegames.com/">3D and 2D C++ game engine technology</a> before I moved to Flash, so I have a little different background than most Flash developers.</p>
<p>Ok &#8211; thanks and context out of the way. Let&#8217;s get to the meat. What&#8217;s it like to develop for the iPhone with Flash?</p>
<p>First, <b>the toolchain is fantastic</b>. All you do to get on the iPhone is write a Flash app however you like, and then (more or less) click the &#8220;compile IPA&#8221; button. You get an IPA, you deploy it on your device, and bob&#8217;s your uncle. That&#8217;s the easy part, and it has been that easy since day one. (For comparison, I&#8217;ve seen builds with pre-release and final XBox 360 SDKs, with homebrew PSP and Nintendo DS, with PS3 and Wii &#8211; they are all a lot harder to start building on.) Sometimes takes a while for all the optimization to happen, but you don&#8217;t need that unless you are packaging a release for distribution.</p>
<p>Deploying to the iPhone is the easy part. The hard part is <b>getting your content to run silky smooth and in an iPhone-friendly way</b>. What do I mean by that? Performance? Sure, you have to be careful with performance, but you also need to make sure you respect the touch interface&#8217;s limitations, that you obey Apple&#8217;s guidelines, that your art fits the device, and so forth. We spent as much time on that stuff as we did on performance in Trading Stuff.</p>
<p><img src="http://pushbuttonlabs.com/wp-content/uploads/2009/09/031044.jpg" hspace=5 vspace=5 width="240" height="320" align=left>The main things to watch out for is <b>rendering</b> &#8211; you must use hardware acceleration, which acts a lot like cacheAsBitmap &#8211; and <b>memory allocation</b> &#8211; the iPhone has very slow memory, so the GC running is the kiss of death. I could list a bunch of specifics but at this stage in the game, they would be out of date by the next SDK update. The best thing to do in this and all other optimization cases is to measure, find the biggest bottleneck, change it, and measure again to see if you got a win. Repeat until you have adequate performance.</p>
<p><a href="http://devwhy.blogspot.com/2009/10/flash-on-iphone.html">Louis Gerbarg posted a great analysis of the iPhone tech</a> based on Trading Stuff. Since I wrote Trading Stuff, I figured I should comment on it. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>On the LLVM piece, Adobe has put in major effort to make this function properly. And it really does work. <b>Even on day one of the prerelease, the compiler worked pretty well.</b> Occasionally you&#8217;d hit an optimizer error &#8211; but it&#8217;s worth noting that in LLVM most optimization operations are separate from the backend. IMHO, Adobe was very smart to use LLVM as opposed to rolling their own or repurposing GCC, due to code maintainability and extensibility issues. You will notice that they have used LLVM before in <a href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a>, so there&#8217;s prior experience here. And though Louis cites Apple not using LLVM for iPhone compilation as a weakness, Apple <i>is</i> using LLVM for their desktop compilation, which shows that LLVM is going to be a good choice long term.</p>
<p>For the resource bundling, that&#8217;s entirely my fault &#8211; <b>I chose to embed all my resources in my SWF and when the SWF was converted, it was converted to a binary with those resources in it.</b> I could have put them alongside the SWF and they would have been bundled as part of the IPA (in fact, this is the case for Default.png, which is treated as a normal file even though it has special behavior thanks to OS X). I&#8217;m not so sure about this linker behavior Louis is referring to; checking the <a href="http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html#//apple_ref/c/tag/section">Mach-O segment reference</a> doesn&#8217;t reveal any insights beyond that yes, it is probably bad to keep the compressed version of assets in RAM. But Trading Stuff isn&#8217;t paging anyway, making it a non-issue.</p>
<p><img src="http://pushbuttonlabs.com/wp-content/uploads/2009/09/031044_4.jpg" hspace=5 vspace=5 width="240" height="320" align=right>For the rendering performance, <b>the build of Trading Stuff that is on the App Store is not using hardware acceleration at all</b>. And the ARM11 is a crappy chip for software rendering. I was showing a build at Adobe MAX that used hardware rendering, and it runs smoothly, like a real game should. I am waiting for a few bugs in Adobe&#8217;s SDK to be fixed, at which point I will release a new version on the store. The performance difference is night and day. I&#8217;ll post about that when I get the update out.</p>
<p>Let me put a caveat here: <b>the iPhone is something like a tenth of the machine your desktop PC is</b>. So if you want to do incredible 3d graphics and hand-optimize your assembly, maybe you should look into using XCode and Objective C, and build your content and code explicitly for the iPhone. However, if you know Flash (or have a project in it to port) and want to put something out quickly, this is a fantastic path, and worth a look. And it&#8217;s only going to improve from this very early version.</p>
<p>Time for some closing thoughts. Adobe has shown that they value the platform and want to bring their content to it by making some serious technology investments. <b>I hope that Apple will respect that, and work with Adobe to make sure Flash works well on the iPhone.</b></p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/517/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Adobe MAX 2009 BYOL: Build a Flash Based Platformer in 90 Minutes</title>
		<link>http://coderhump.com/archives/510</link>
		<comments>http://coderhump.com/archives/510#comments</comments>
		<pubDate>Sat, 03 Oct 2009 23:49:27 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PushButton Engine]]></category>
		<category><![CDATA[PushButton Labs]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=510</guid>
		<description><![CDATA[I will be doing a BYOL session at Adobe MAX 2009. It&#8217;s a lab where you learn how to build a platformer in Flash in 90 minutes, and it&#8217;s Wednesday at 4pm. It is titled &#8220;Build a Flash Based Platformer in 90 Minutes&#8221; in honor of its subject matter.
It is pretty cool stuff, and I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I will be doing a BYOL session at <a href="http://max.adobe.com/">Adobe MAX 2009</a>. It&#8217;s a lab where you learn how to build a platformer in Flash in 90 minutes, and it&#8217;s Wednesday at 4pm. It is titled &#8220;Build a Flash Based Platformer in 90 Minutes&#8221; in honor of its subject matter.</p>
<p>It is pretty cool stuff, and I&#8217;m excited to be sharing it! You get introduced to the <a href="http://www.pushbuttonengine.com/">PushButton Engine</a>, get a preview copy of Clint Herron&#8217;s excellent <a href="http://hanclinto.com/">Platformer Starter Kit</a>, and (assuming things go smoothly), you end up building this platformer:</p>
<p><a href="http://hanclinto.com/blog/demo"><img src="http://coderhump.com/wp-content/uploads/2009/10/picture-1.png" alt="picture-1" title="picture-1" width="637" height="359" class="aligncenter size-full wp-image-512" /></a></p>
<p><center><i>(Click image to play demo)</i></center></p>
<p>We&#8217;re excited about it. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you are a Flash game dev and at MAX or in the LA area, I&#8217;d love to talk games with you. Shoot me an e-mail (ben dot garney at gmail dot com) or DM me at <a href="http://twitter.com/bengarney">@bengarney</a> and let&#8217;s make it happen!</p>
<p>Also, with luck, Monday there should be a cool update on that secret project I was working on. <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>See you at MAX!</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/510/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>PBE Video Talks and Austin GDC</title>
		<link>http://coderhump.com/archives/503</link>
		<comments>http://coderhump.com/archives/503#comments</comments>
		<pubDate>Tue, 15 Sep 2009 19:25:40 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[PushButton Engine]]></category>
		<category><![CDATA[Talks]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=503</guid>
		<description><![CDATA[Hey there!
We&#8217;ve been trying different approaches for the documentation for PushButton Engine. We have reference docs, API docs, and tutorials. There are comments at the class, function, and body levels. There are example applications of varying size and complexity. There&#8217;s still a lot more to document, but what is covered seems to be making sense [...]]]></description>
			<content:encoded><![CDATA[<p>Hey there!</p>
<p>We&#8217;ve been trying <b>different approaches for the <a href="http://www.pushbuttonengine.com/docs/">documentation</a> for <a href="http://www.pusbuttonengine.com/">PushButton Engine</a></b>. We have reference docs, API docs, and tutorials. There are comments at the class, function, and body levels. There are example applications of varying size and complexity. There&#8217;s still a lot more to document, but what is covered seems to be making sense to people.</p>
<p>Lately, I&#8217;ve been doing short &#8211; 5 or 10 minute &#8211; Keynote presentations, recording them, exporting them with the iPod video export option, and putting them up on YouTube. They&#8217;re a nice workout for presentation skills; I spend an hour or so building a slide deck, then run through it a few times before recording and uploading. They also seem to be <b>a good way to explain high-level concepts about PBE</b>.</p>
<p>I&#8217;ve done them on <a href='http://www.youtube.com/watch?v=nYUwKGE2Efg' >Resources in PBE</a>,  on the <a href="http://www.youtube.com/watch?v=hvAbVpS0lJg">PBE profiler</a>, on <a href="http://www.youtube.com/watch?v=auaqZzcjl-Y&#038;feature=related">why components are a smart idea</a>, and how <a href="http://www.youtube.com/watch?v=nEZoxrP4JQs&#038;feature=related">your UI and PBE related</a>. Nearly 500 views across the four of them in the last month, which I think is pretty good for what is dry technical content at best. <img src='http://coderhump.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Speaking of presentations, <b>I will be talking about <a href="https://www.cmpevents.com/GDAU09/a.asp?option=C&#038;V=11&#038;SessID=9792">Developing in the Cloud</a> at Austin GDC this Friday, 4pm</b>. Talking to game developers, I have noticed there is not a lot of awareness of how cloud computing can help cut budgets, shorten development time, and increase features. We&#8217;ve been using cloud resources heavily at <a href="http://www.pblabs.com/">PushButton Labs</a>, so the talk will cover the risks, rewards, and tradeoffs related to things like EC2, S3, Google&#8217;s services, SVN hosting and so forth in terms of letting you focus on your game. I&#8217;ll also talk about how you can directly integrate things like Google Spreadsheet and Analytics directly into your game, and why it is a good idea to do so.</p>
<p>I&#8217;ll be at Austin GDC Wed-Fri. If you want to meet up and talk cloud computing, Flash game dev, or PBE, shoot me an e-mail, tweet, or comment and let&#8217;s make it happen!</p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/503/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>OMG AS3: Some thoughts on AS3 &amp; Adobe/Community relations</title>
		<link>http://coderhump.com/archives/481</link>
		<comments>http://coderhump.com/archives/481#comments</comments>
		<pubDate>Sat, 08 Aug 2009 23:05:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://coderhump.com/?p=481</guid>
		<description><![CDATA[Is AS3 any good at all? JavaScript keeps getting better &#8211; well, faster, anyway. C# is kicking ass in raw programming language chutzpah. haXe isn&#8217;t bad, either, and then there&#8217;s Objective-C for iPhone and Java and C/BREW on other mobile devices. And don&#8217;t forget the guys slaving away on AS2 and Flash Lite content!
What&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://coderhump.com/wp-content/uploads/2009/08/kid_sullivan-217x300.jpg" hspace="20" alt="kid_sullivan" title="kid_sullivan" width="217" height="300" class="alignleft size-medium wp-image-495" /><b>Is AS3 any good at all?</b> JavaScript <a href="http://code.google.com/p/v8/">keeps</a> <a href="https://developer.mozilla.org/En/SpiderMonkey/Internals/Tracing_JIT">getting</a> <a href="http://webkit.org/blog/189/announcing-squirrelfish/">better</a> &#8211; well, faster, anyway. C# is kicking ass in raw programming language chutzpah. <a href="http://www.haxe.org/">haXe</a> isn&#8217;t bad, either, and then there&#8217;s Objective-C for iPhone and Java and C/BREW on other mobile devices. And don&#8217;t forget the guys slaving away on AS2 and Flash Lite content!</P></p>
<p>What&#8217;s the Flash community been saying about AS3 recently?</p>
<ul>
<li>Nicolas Canasse, the guy behind <a href="http://www.haxe.org/">haXe</a>, wrote an insightful article about <a href="http://ncannasse.fr/blog/the_failure_of_as3">whether AS3 has really delivered on its promises</a>. Lack of language feature velocity and lack of conciseness are his major points.</li>
<li>Joa Ebert, a talented Flash hacker (<a href="http://code.google.com/p/as3v/">AS3V</a>, <a href="http://blog.joa-ebert.com/2009/08/05/alchemy-for-actionscript/">AS3C</a>, etc.), is <a href="http://blog.joa-ebert.com/2009/08/06/this-is-an-outrage/">a little bit incensed</a> about Adobe&#8217;s troubles with involving the community. He cites some examples where they have <a href="https://bugs.adobe.com/jira/browse/FP-487">ignored<a> <a href="https://bugs.adobe.com/jira/browse/SDK-18954">code contributions</a>.</li>
<li>Even Andre Michelle, of <a href="http://www.hobnox.com/audiotool">Hobnox audioTool</a> fame, and one of the guys who helped drive the <a href="http://www.make-some-noise.info/">Make Some Noise</a> petition to get Adobe to improve audio in FP, has <a href="http://blog.andre-michelle.com/2009/as3-failure/">weighed in</a> in some areas where Flash should improve.</li>
</ul>
<p></p>
<p>I&#8217;ll be honest about where I stand on this. <b>Flash 9 is great, 10 even better.</b> For desktop/web interactive apps I am very happy. There are a lot of things that would be nice to see, and a few things that need to be fixed. But I would not have stopped doing <a href="http://www.garagegames.com/">C++ 3d game development</a> unless Flash was good.</p>
<p>I hope to see Adobe releasing a lot of improvements to AS3 (perhaps even an AS4 someday!), and there are some features, like generics, delegates, overloads, and enums, that would make my daily life easier. But the fact is that <b>being able to target a single, mostly consistent platform with AS3 is great</b>, and that there are nearly a billion people with Flash Player makes it very worthwhile. It is easy to create quality interactive content accessible by hundreds of millions of people in Flash, and that is a huge win.</p>
<p>If I had to agree with one complaint out of all the comments by my fellow Flash developers, it would be that <b>Adobe is having some trouble getting the community involved in what they are doing</b>. I can&#8217;t blame them &#8211; the Flash community is hugely varied in skill level and interest area. You have artists using it to create TV shows, <a href="http://www.homestarrunner.com/">web content</a>, and <a href="http://youtube.com/">deliver video</a>. At the same time, there are skilled coders building <a href="http://www.hobnox.com/audiotool">DAWs</a> and <a href="http://papervision3d.org/">3d renderers</a>. There are developers making <a href="http://kongregate.com/">games</a> and <a href="http://www.adobe.com/devnet/flex/tourdeflex/">building business applications</a>. I&#8217;m not sure there&#8217;s a broader set of users out there.</p>
<p>The best thing to do in a situation like this is to <b>stop treating Adobe like a big faceless company and start to get to know the people who work on Flash</b>. In the last two years I&#8217;ve had opportunities to visit the Player VM team, the Flash Builder team, and several of the Flash community managers and members. Everyone on those teams is, in my experience, willing to listen to your problems and interested in improving their product. <b>Obviously, they don&#8217;t implement every hair brained idea that I propose.</b> But they listen and there is forward motion.</p>
<p>So what does this come down to? I have to agree with Ted&#8217;s advice from his <a href="http://onflash.org/ted/2009/08/future-of-flash-platform.php">The Future of Flash</a> &#8211; be public about it. But also make sure you are reaching out to Adobe. <b>They are human and they respond a lot better to respectful conversation from people they know than they do to internet rage. </b> <img src='http://coderhump.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://coderhump.com/archives/481/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
