<?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>Cold Constructs &#187; Discussions</title>
	<atom:link href="http://coldconstructs.com/category/discussions/feed/" rel="self" type="application/rss+xml" />
	<link>http://coldconstructs.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 30 Aug 2010 19:28:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3792</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Why SWF protection matters; Review of the current options</title>
		<link>http://coldconstructs.com/2010/07/swf-protection/</link>
		<comments>http://coldconstructs.com/2010/07/swf-protection/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 17:00:38 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[content protection]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://coldconstructs.com/?p=468</guid>
		<description><![CDATA[

Why try?
The tools

Protectors
Decompilers


The SWF files
Amayeta SWF Encrypt

Interface
Effectiveness
Overall


DComSoft SWF Protector

Interface
Effectiveness
Overall


Kindisoft secureSWF

Interface
Effectiveness
Overall


Ambiera irrFuscator

Interface
Effectiveness
Overall


Conclusion


The one (and only) counter-argument I&#8217;ve heard against SWF protection goes something like this:
It doesn&#8217;t matter what you do, thieves will always be able to steal your work, so don&#8217;t bother with SWF protection.
This is a textbook example of the &#8220;perfect solution&#8221; fallacy. Thieves will [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-why-try">Why try?</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-the-tools">The tools</a>
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-protectors">Protectors</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-decompilers">Decompilers</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-the-swf-files">The SWF files</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-amayeta-swf-encrypt">Amayeta SWF Encrypt</a>
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-interface">Interface</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-effectiveness">Effectiveness</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-overall">Overall</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-dcomsoft-swf-protector">DComSoft SWF Protector</a>
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-interface1">Interface</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-effectiveness1">Effectiveness</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-overall1">Overall</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-kindisoft-secureswf">Kindisoft secureSWF</a>
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-interface2">Interface</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-effectiveness2">Effectiveness</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-overall2">Overall</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-ambiera-irrfuscator">Ambiera irrFuscator</a>
<ol>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-interface3">Interface</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-effectiveness3">Effectiveness</a></li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-overall3">Overall</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2010/07/swf-protection/#toc-conclusion">Conclusion</a></li>
</ol>
</div>
<p>The one (and only) counter-argument I&#8217;ve heard against SWF protection goes something like this:</p>
<blockquote><p>It doesn&#8217;t matter what you do, thieves will <em>always </em>be able to steal your work, so don&#8217;t bother with SWF protection.</p></blockquote>
<p>This is a textbook example of the <a href="http://en.wikipedia.org/wiki/Perfect_solution_fallacy">&#8220;perfect solution&#8221; fallacy</a>. Thieves will always be able to crack safes, so why bother storing your money and valuables in them? And of course encryption can always be cracked, so why bother using it when transferring valuable information? <em>Why not just release all your work and hard-earned assets out to the wild for anyone to plunder, since apparently it will be plundered regardless of whatever you do to protect it?</em></p>
<h4 id="toc-why-try">Why try?</h4>
<p>Obviously we use safes and encryption <em>&#038;c</em> to minimize the chances of bad things happening to our precious stuff. It&#8217;s just the same for people like me who make money with SWF files&#8211;I don&#8217;t want anyone stealing my Intellectual Property and posting it elsewhere, claiming it as their own, so I do everything I can to make the process of stealing my SWF files as difficult as possible.<strong> The more difficult a thing is to steal, the less chance there is of it being stolen&#8211;and less often.</strong></p>
<p><span id="more-468"></span><br />
<h4 id="toc-the-tools">The tools</h4>
<p>Right now there are several tools, some even free, that allow you to decompile a SWF file to take a look at everything it contains. This is usually pretty easy because the SWF format is an <a href="http://www.adobe.com/devnet/swf/">open specification</a>. This means there&#8217;s no way to fully protect anything contained in the file, such as code, graphics, sounds, or videos. However, there are applications that take precautions against decompiling using a variety of methods. </p>
<h5 id="toc-protectors">Protectors</h5>
<p>I&#8217;ll review the biggest names in that market today:</p>
<ul>
<li>Amayeta <a href="http://www.amayeta.com/software/swfencrypt/">SWF Encrypt</a> 6.0.8</li>
<li>DComSoft <a href="http://www.dcomsoft.com/">SWF Protector</a> 3.0.1 (on <a href="http://twitter.com/SWF_Protector">twitter</a>)</li>
<li>Kindisoft <a href="http://www.kindisoft.com/">secureSWF</a> 3.5 (on <a href="http://twitter.com/secureswf/">twitter</a>)</li>
<li>Ambiera <a href="http://www.ambiera.com/irrfuscator/index.html">irrFuscator</a> 2.1.2 (on <a href="http://twitter.com/ambiera">twitter</a>)</li>
</ul>
<h5 id="toc-decompilers">Decompilers</h5>
<p>I&#8217;ll be using a combination of <a href="http://www.swfdecrypt.com/">SWF Decrypt 1.2</a> and Eltima&#8217;s Decompiler v4.1 to test the effectiveness of these applications. (Side note: Eltima&#8217;s Decompiler and Sothink&#8217;s are <em>freakishly</em> similar.) SWF Decrypt really upset the industry when Magus (the author who wishes to remain anonymous) released it completely for free. It apparently decompiles any SWF file &#8220;protected&#8221; by Amayeta&#8217;s and DComSoft&#8217;s applications. He&#8217;s very loud about it too, calling them out on their &#8220;tricks&#8221;, such as <a href="http://blog.swfdecrypt.com/2010/07/swf-protector-3-0-are-you-kidding-me/">their latest releases</a> (which I&#8217;m reviewing here). You&#8217;ll notice he left Kindisoft and Ambiera alone, and he claims that&#8217;s because they offer real protection schemes, such as renaming functions and variables in the code. But the others claim they also use renaming, so we&#8217;ll see who&#8217;s right.</p>
<h4 id="toc-the-swf-files">The SWF files</h4>
<p>I&#8217;m a Flash game developer so that&#8217;s all I&#8217;m going to focus on here&#8211;single SWF files containing AS3 code compiled to run on Flash Player 9 and 10+. The files contain references to the Stage object, multiple event listeners, very high frame rates (60fps usually), and numerous computationally expensive operations such as pixel-level manipulations and heavy math functions. Here are the files I&#8217;ll be using:</p>
<ul>
<li><a href="http://flixel.org/flxcollisions/">FlxCollisions</a></li>
<li><a href="http://www.adamatomic.com/mode/">Mode</a></li>
<li>My pixel-level collision <a href="http://coldconstructs.com/2009/11/pixel-perfect-collision-detection-with-5000-particles/">demo</a></li>
</ul>
<p>These are free with source code available so that I can alter it if the protector requires it. The first two use <a href="http://flixel.org/">Flixel</a> (an old and new version), but if you have any (or know where to find some) non-Flixel open sourced Flash games then I&#8217;ll try that too. The third is a demo I wrote a while ago that has some heavy computation and sensitive optimizations that could trip up the protectors. Now, let&#8217;s get into the apps and see how they perform.</p>
<h4 id="toc-amayeta-swf-encrypt">Amayeta SWF Encrypt</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/amayeta_logo.jpg" class="alignright" />Amayeta is a subsidiary focused solely on the Flash platform. It used to have a single product, SWF Encrypt, but now also provides a SWF compression utility. Magus, author of SWF Decrypt, provides <a href="http://www.gareth-jones.co.uk/2010/04/28/are-dcomsoft-and-eltima-the-same-company/">a deeper look</a> at their history and he isn&#8217;t kind about it.</p>
<p>The problem I have with Amayeta right off the bat is that its flagship product&#8217;s name is completely misleading since it&#8217;s not possible to <a href="http://en.wikipedia.org/wiki/Encryption">encrypt</a> a SWF. I mean you <em>can</em>, but then the Flash Player <em>wouldn&#8217;t be able to run it</em> because the player doesn&#8217;t have a way to decrypt it at runtime&#8211;that&#8217;s just not how the player was engineered. So they are being deceitful.</p>
<h5 id="toc-interface">Interface</h5>
<p>SWF Encrypt has two main areas in the window: on the left is a file explorer where you pick your SWFs to protect, and on the right is the main area where you check the ones to protect (again) and view their properties.</p>
<div id="postgallery"><a href="http://coldconstructs.com/siteFiles/blogImages/swf-protect_amayeta1.jpg" rel="prettyPhoto[amayeta]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protect_amayeta1.jpg" alt="The only screen" /></a> </div>
<p>It has an &#8220;encryption&#8221; setting with the values of &#8220;high&#8221;, &#8220;recommended&#8221;, &#8220;low&#8221;, and &#8220;custom&#8221;. If custom is selected you only have the option to set the &#8220;minimum data length&#8221;, which apparently just lets you put in a number that represents the level of &#8220;encryption&#8221; to use, with lower values being more protection.</p>
<h5 id="toc-effectiveness">Effectiveness</h5>
<p>First using the recommended settings, the SWFs worked fine, no performance hit that I could tell. When I tried to open them up in Trillix, I could get to all the assets, but when I tried to access the scripts, it gave me an &#8220;out of memory&#8221; error. I tried to put it through SWF Decrypt but then the SWF wouldn&#8217;t play at all. I told Magus about this and he&#8217;s going to release a new version of Decrypt next week that should break Amayeta&#8217;s latest patch. It appears that the junk code Amayeta put into the SWFs actually worked this time.</p>
<p>SWF Encrypt has the options to &#8220;encrypt names&#8221; which I think is their way of saying they rename indentifiers like variables and functions. But because I couldn&#8217;t look into the scripts, post-protection, I could not verify this. I have conflicting reports about whether or not they truly obfuscate code, so I&#8217;m going to wait to see if Magus can break their patch, then revisit them again later.</p>
<h5 id="toc-overall">Overall</h5>
<p>It appears this latest version actually keeps Trillix from being able to look through it. However, I can&#8217;t check to see if there&#8217;s any actual renaming going on. Without true indentifier renaming, your SWFs will never be guaranteed to stay safe since the arms race between decompilers and protectors escalates endlessly. So for now, I can&#8217;t say one way or another if SWF Encrypt is solid. I can say that the level of control provided by the app is extremely limited, so even if they did do renaming, the user can&#8217;t fix a problem if the protection is too aggressive. An option to comb through your SWF and control protection on a per-object basis (ideally, per-variable and -function basis) is needed.</p>
<h4 id="toc-dcomsoft-swf-protector">DComSoft SWF Protector</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/dcomsoft_logo.jpg" class="alignright" />DComSoft has a much bigger catalog than Amayeta, all focused on Flash. Better, but the company history doesn&#8217;t appear very legitimate. According to research done by <a href="http://blog.swfdecrypt.com/2010/04/dcomsoft-and-eltima-are-the-same-company/">this dude</a> and <a href="http://www.gareth-jones.co.uk/2010/04/28/are-dcomsoft-and-eltima-the-same-company/">this dude</a>, DComSoft is the same company as Eltima, a company that creates a SWF decompiler (one that I&#8217;m using for these reviews actually). That, my friends, is called &#8220;bad business practice&#8221;, if true. Besides that though, what the hell is up with the logo? If anyone has any idea what a tire has to do with Flash file protection, please let me know.</p>
<h5 id="toc-interface1">Interface</h5>
<p>Protector has two modes: Simple and Advanced. Switch between modes using the tabs at the top of the application window. In Simple mode you can batch protect files but there are zero options. In Advanced mode though you can only protect one file at a time, but you can comb through each object and variable and check the boxes next to them, which are &#8220;Obfuscate&#8221; and &#8220;Protect&#8221;.</p>
<div id="postgallery"><a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_dcom1.png" rel="prettyPhoto[dcomsoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_dcom1.png" alt="The Simple section" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_dcom2.png" rel="prettyPhoto[dcomsoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_dcom2.png" alt="The Advanced section" /></a></div>
<p>According to the help file:</p>
<blockquote><p>Obfuscate renames variables, features etc. in a definite way. It doesn&#8217;t prevent from decompilation, but makes the subsequent compilation impossible.</p></blockquote>
<p>And &#8220;protect&#8221; means</p>
<blockquote><p>Protect modifies ActionScript in such a way that a SWF file can be played, but it is impossible to decompile it.</p></blockquote>
<p>Right, we&#8217;ll see about that.</p>
<h5 id="toc-effectiveness1">Effectiveness</h5>
<p>The protected SWFs ran normally with no noticeable framerate drop. When I loaded it into Trillix though, everything appeared just fine with ZERO obfuscation&#8211;no renaming except for what Flash does automatically, no junk code/characters that would trip up the decompiler, nothing. All scripts I opened were very readable. I&#8217;d like to note however that I&#8217;m using an old version of Trillix (4.1), because the newest version would just crash if I tried to open the scripts (well, sometimes it&#8217;d work, but most of the time not). Anyway, really nothing else I can say here, just &#8220;epic fail&#8221;.</p>
<h5 id="toc-overall1">Overall</h5>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/bad.png" class="alignleft" alt="WHAT" />The interface is clean but offers very few options. If it actually worked I&#8217;d be ok with that, but maybe they need to add more granular controls so we can pick what we want obfuscated and by how much. It would also help if they added real obfuscation. Regardless, SWF Protector has a few licensing options. The Personal license ($40) doesn&#8217;t allow any of the SWFs protected by it to make money, while the Business license ($60) does. There&#8217;s other types for companies and OEMs too, but who cares&#8211;the software doesn&#8217;t work, end of story.</p>
<h4 id="toc-kindisoft-secureswf">Kindisoft secureSWF</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/kindisoft_logo.jpg" class="alignright" />Kindisoft doesn&#8217;t mess around. When I emailed them about reviewing their app, they sent back this:</p>
<blockquote><p>While I definitely love to hear your opinion of secureSWF, we&#8217;re not interested to see a comparison with SWF Encrypt and SWF Protector. We think of secureSWF as a professional level ActionScript obfuscator while SWF Encrypt and SWF Protector as single purpose tools that might prevent some decompilers from working for a while.</p></blockquote>
<p>Ok then. So we start out on a completely different footing with Kindisoft than the others already. But while Kindisoft doesn&#8217;t have dirt on it like Amayeta and DComSoft do, it&#8217;s still a niche-based company providing only one product. Although that should mean they make a really great product, right?</p>
<p>I&#8217;d like to note that the free web-based version of secureSWF that is available to developers who put their games up at FlashGameLicense.com is apparently a different product. When I tried to add its protection to my first game, it broke it. When I brought this up with Kindisoft, they replied saying:</p>
<blockquote><p>secureSWF is a completely different solution than FGL encryption feature. We built this complementary encryption feature for FGL community to help avoid more thief incidents. It does not use the same technology or techniques as secureSWF.</p></blockquote>
<p>I just hope their software is better than their grammar.</p>
<h5 id="toc-interface2">Interface</h5>
<p>SecureSWF is a bit more complicated but makes up for it in options. There are 5 tabs:</p>
<div id="postgallery"><a href="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft1.png" rel="prettyPhoto[kindisoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft1.png" alt="File browser" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft2.png" rel="prettyPhoto[kindisoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft2.png" alt="Indentifiers renaming" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft3.png" rel="prettyPhoto[kindisoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft3.png" alt="Protection options" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft4.png" rel="prettyPhoto[kindisoft]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protector_kindisoft4.png" alt="Configuration rules" /></a></div>
<p>The fifth one is just a summary of what it did after you hit the big &#8220;Protect SWF Files&#8221; button. The GUI is pretty much self-explanatory and gives you a fine level of control. Hovering your mouse over any option will bring up a tooltip that further explains what the option does. So far, looks great.</p>
<h5 id="toc-effectiveness2">Effectiveness</h5>
<p>The real meat of the app is in the renaming, since eventually all SWF files can be cracked open to reveal their code. SecureSWF does a great job in this area. By default it will leave alone most public functions, probably because they&#8217;re usually used by other classes, so renaming them inconsistently would break the SWF.</p>
<p>When I protected the SWF files with the default settings, I was able to play my collision demo and Mode (which uses the old version of Flixel). I could not run FlxCollisions though, instead I got back this error: <code>ReferenceError: Error #1056: Cannot create property D on _-9l._-68</code>. Obviously the renaming was set a little too aggressively for it to work (and the &#8220;strength&#8221; was only at 20% with most advanced options turned off). When I tried to open the working SWFs with the decompiler, I got an access violation and the program crashed.</p>
<h5 id="toc-overall2">Overall</h5>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/good.png" class="alignleft" alt="Good" />secureSWF only offers variable renaming in their Standard and Professional editions ($200 and $400 respectively), leaving it out in the Personal edition ($100). Considering the functionality SWF protectors provide (and how difficult they are to produce) these prices seem too high to me. The Pro edition (the version I&#8217;m using) does provide some nice additional features though, such as removing unused code (it happens), literal string encryption, and solid domain locking controls). </p>
<p>SecureSWF provides users with a lot of options and it would take me all day to go through them all. But the point is that secureSWF utilizes true obfuscation by renaming variables, encrypting literal strings (which Flash Player <em>can</em> deal with), and inserting illegal characters that will trip up decompilers&#8230; and sometimes the Flash Player too. So it takes some effort to get working, but the point is that <strong>it works</strong>. But is it good enough to justify the price? Let&#8217;s see what irrFuscator provides for its price to compare.</p>
<h4 id="toc-ambiera-irrfuscator">Ambiera irrFuscator</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/ambiera_logo.jpg" class="alignright" />Ambiera comes out of the gate with significant reputation points for having developed irrLicht and related creation tools&#8211;quality open source tools for the indie game developer. Ambiera got into the Flash scene when they decided to extend their game tools to the web via the Flash platform with their own 3D engine and creation apps. They figured developers will want to protect their games and, as the irrFuscator author told me via email, the current offerings in that market &#8220;sucked&#8221;, so he built his own. With this excellent history of software already under their collective belt, I had high hopes for irrFuscator.</p>
<h5 id="toc-interface3">Interface</h5>
<p>A quick glance at irrFuscator&#8217;s interface will bring a sigh a relief, since the layout is dead simple but all the options are there and well-explained.</p>
<div id="postgallery"><a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irr1.png" rel="prettyPhoto[ambiera]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irr1.png" alt="SWF File mode" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irr2.png" rel="prettyPhoto[ambiera]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irr2.png" alt="Flex Project mode" /></a></div>
<p>If you still have trouble figuring out what&#8217;s what, the online docs are helpful and there&#8217;s even an active forum for it at Ambiera if you&#8217;re still having trouble. Very nice.</p>
<h5 id="toc-effectiveness3">Effectiveness</h5>
<p>irrFuscator sets itself apart by allowing you to rename all variables BEFORE you compile your project, so you can see exactly what it did and, if it messed up somewhere, you can go in and manually fix it before compiling again. This is the best method of obfuscation since you know it works, you know what it does, and you know you can fix it easily with your debugger. ALL classes and variables can be renamed, plus it removes whitespaces&#8211;even Vectors were retyped to the renamed classes, and all packages were also renamed (Flash built-ins as well). The resulting code was impossible to read.</p>
<div id="postgallery"><a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irrs2.png" rel="prettyPhoto[ambierasrc]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irrs2.png" alt="Unprotected code" /></a> <a href="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irrs1.png" rel="prettyPhoto[ambierasrc]" title=""><img src="http://coldconstructs.com/siteFiles/blogImages/swf-protection_irrs1.png" alt="After irrFuscator, preserving whitespaces" /></a></div>
<p>I did run into a few problems though. I tried obfuscating my game, which references an SWC, but when I added it to the list, I got an error saying it couldn&#8217;t open it. I just removed it and it continued fine. Also, while it does encrypt literal strings (it replaces them with a function call to irrcrpt() to decrypt at runtime, which will impact performance a bit) it can&#8217;t encrypt them when they&#8217;re inside an Array or similar data structure. Not a big deal, but I was thrown off by that. The other thing is just a small UI annoyance, which is that it uses Windows&#8217; &#8220;browse folders&#8221; dialog to pick out your SWF (in &#8220;SWF File&#8221; mode). This dialog doesn&#8217;t remember where you last looked and it always starts you back at your computers root, so it takes me a while to drill down to the proper folder, which wastes a lot of time. Those are the only issues I found though, which is saying a lot.</p>
<p>Using the SWF File mode is nice, but it didn&#8217;t work for me; I got back this error when trying to run the protected version of FlxCollisions (again): <code>VerifyError: Error #1053: Illegal override of _iq39 in org.flixel.FlxEmitter</code>. Since this also happened with Kindisoft&#8217;s secureSWF, there&#8217;s something going on in the latest version of Flixel (v2.35) that gives them grief. Both packages give you ways to work around them though with their fine-grained controls. For irrFuscator, you just have to use the Flex Project option. In secureSWF you can just uncheck that file&#8230; if you knew which file that was, but there&#8217;s no way to find that out. irrFuscator wins that one.</p>
<h5 id="toc-overall3">Overall</h5>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/good.png" class="alignleft" alt="IT'S GOOD" />irrFuscator has Standard and Professional editions (~$100 and ~$200 respectively&#8211;original prices are in Euros). The difference is that the Pro edition has <em>comment directives</em>, which means you can be extremely precise in telling the app which portions of your code NOT to obfuscate using specially formated comments. This is because code obfuscation sometimes results in worse performance or breaks it completely, depending on the code, so this is a great feature. You decide whether or not the comment directives are worth $100 for your projects. Still, these prices are far more reasonable than Kindisoft&#8217;s&#8211;you get everything secureSWF does at a quarter of the price. Not bad.</p>
<h4 id="toc-conclusion">Conclusion</h4>
<p>I&#8217;m bummed that I couldn&#8217;t determine how effective Amayeta was, but maybe some of you will think the fact that it can&#8217;t be decompiled yet is good enough. Not for me though, because SWFs will eventually be cracked&#8211;we need better protection than that. What I did determine though is that Kindisoft&#8217;s secureSWF and Ambiera&#8217;s irrFuscator offer true obfuscation for sure and therefore true protection of your code. Assets cannot be encrypted and can always be wrestled out of a SWF, unfortunately, so obfuscation is really a Flash developer&#8217;s best weapon.</p>
<p>Overall I&#8217;d say irrFuscator takes the cake for being reasonably-priced and offering that Flex Project option which makes it very powerful, yet it still retains simplicity of use through an easy user experience, plus the program itself was fast to load and responsive. The others were written in Java or were otherwise slow to start, so they were a bit sluggish.</p>
<p>That&#8217;s it for now, but I will be updating this article later if/when we can determine if Amayeta&#8217;s obfuscation methods are valid. Thanks for reading <img src="http://coldconstructs.com/random/pint.gif" /></p>
]]></content:encoded>
			<wfw:commentRss>http://coldconstructs.com/2010/07/swf-protection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>5 ways to make bank on Flash games</title>
		<link>http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/</link>
		<comments>http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 17:00:27 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[commerce]]></category>
		<category><![CDATA[game industry]]></category>

		<guid isPermaLink="false">http://coldconstructs.com/?p=427</guid>
		<description><![CDATA[

Flattr
Microtransactions
Sponsorships
Shareware
Ads
Conclusion


This is a quick run-down on the status of the financial options that are available to independent developers who don&#8217;t have massive marketing budgets or corporate support. Please post a comment below and let us know how your experience has been with these options (or others I&#8217;ve missed).
Flattr
The latest option is a general-purpose micro-donation system [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-flattr">Flattr</a></li>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-microtransactions">Microtransactions</a></li>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-sponsorships">Sponsorships</a></li>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-shareware">Shareware</a></li>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-ads">Ads</a></li>
<li><a href="http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/#toc-conclusion">Conclusion</a></li>
</ol>
</div>
<p>This is a quick run-down on the status of the financial options that are available to independent developers who don&#8217;t have massive marketing budgets or corporate support. Please post a comment below and let us know how your experience has been with these options (or others I&#8217;ve missed).</p>
<h4 id="toc-flattr">Flattr</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/flttr_logo.png" class="alignleft"/>The latest option is a general-purpose micro-donation system called <a href="http://flattr.com/">Flattr</a>. It takes the &#8220;like&#8221;/&#8221;retweet&#8221; interactive device and applies it micro-funding. <a href="http://www.youtube.com/watch?v=9zrMlEEWBgY" rel="prettyPhoto">Watch this video</a> (1.8 minutes; opens a lightbox) to see how it works; or here&#8217;s a summary:</p>
<ol>
<li>Once invited/registered, you fill your monthly &#8220;means&#8221; account with some money. The devs like to call this account <em>cake</em>.</li>
<li>Whenever you click on a Flattr button, a slice of your cake is given to the thing associated with that button.</li>
<li>At the end of every month, your cake is sliced evenly and distributed among all the things you flattr&#8217;d that month.</li>
<li>Likewise, you will receive money from people who flattr&#8217;d YOUR content.</li>
</ol>
<p>You always have to have some cake to give in order to get some cake yourself. That&#8217;s the gist, and so far <a href="http://blog.flattr.com/2010/06/money-calculation-done/">it&#8217;s working well</a>. Of the 15k or so users, many got &euro;100 for a month and thousands more got more Euros than they spent (other currencies forthcoming&#8211;Flattr is still in invite-only beta). Pretty good considering this service just launched last month (March 2010) <em>and</em> it&#8217;s still in private/invite-only beta.</p>
<p><span id="more-427"></span>The relevance this service has to Flash games is obvious. Someday soon you will be able to put a Flattr button anywhere in your games and people will be able to easily support you&#8211;with <strong>all revenue going to you, the developer.</strong> It usually isn&#8217;t much per click, but it&#8217;s still a LOT more than anything ads could give you.</p>
<p>At the moment, you submit your game/post/whatever to the Flattr feed, or create a post for your game in your blog (like I did), and people will be able to flattr you that way. Still pretty easy, but the real deal is when you can directly embed a button in your game (coming soon, whenever they release their REST API and someone writes a Flash implementation of it).</p>
<h4 id="toc-microtransactions">Microtransactions</h4>
<p>Microtransactions (aka <em>MTX</em> or <em>micropayments</em>) are not as bad as ads because you get more money per click, but not as good as Flattr because you still have to share your revenue with the MTX service(s) you&#8217;re using. MTX are also the most difficult option. Not in terms of coding skill but rather design skill. You have to ensure correct usage/placement of MTX items within your game. Besides that, there&#8217;s <strong>choosing which service works best for you.</strong> You MUST read Lost Garden&#8217;s <a href="http://www.lostgarden.com/2009/07/flash-love-letter-2009-part-1.html">Flash Love Letter</a> that explains both of these factors in great detail.</p>
<p>Here&#8217;s the current most prominent micropayment services in no particular order:</p>
<table class="general" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Service name</th>
<th width="100px">Dev cut</th>
<th>Legally usable with other services?</th>
<th>Dual currency?</th>
<th>Game extras?</th>
<th>Usable on any website?</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://www.nonoba.com/developers">nonoba</a></td>
<td>70%</td>
<td class="yes"></td>
<td class="no"></td>
<td class="yes"></td>
<td class="yes"></td>
</tr>
<tr class="alt">
<td><a href="http://www.mochimedia.com/developers/coins.html">MochiMedia</a></td>
<td>60%</td>
<td class="no"></td>
<td class="no"></td>
<td class="yes"></td>
<td class="yes"></td>
</tr>
<tr>
<td><a href="http://www.heyzap.com/developers">HeyZap</a></td>
<td>70%</td>
<td class="yes"></td>
<td class="yes"></td>
<td class="yes"></td>
<td class="yes"></td>
</tr>
<tr class="alt">
<td><a href="https://www.gamersafe.com/index.php">GamerSafe</a></td>
<td>70%</td>
<td class="yes"></td>
<td class="yes"></td>
<td class="yes"></td>
<td class="yes"></td>
</tr>
<tr>
<td><a href="http://www.jambool.com/">SocialGold</a></td>
<td>90%</td>
<td class="yes"></td>
<td class="no"></td>
<td class="no"></td>
<td class="no"></td>
</tr>
<tr class="alt">
<td><a href="http://www.come2play.com/developer.asp">come2play</a></td>
<td>50%</td>
<td class="no"></td>
<td class="no"></td>
<td class="yes"></td>
<td class="yes"></td>
</tr>
<tr>
<td><a href="http://www.facebook.com/credits">Facebook</a></td>
<td>70%</td>
<td class="no"></td>
<td class="no"></td>
<td class="no"></td>
<td class="no"></td>
</tr>
</tbody>
</table>
<p><small>come2play took 3 months to respond. For that and they&#8217;re disappointing services, they get my infamous &#8220;Shit Eater&#8221; Award.</small></p>
<p>&#8220;Game extras&#8221; means the service provides an API for things like leaderboards, achievements, and other little things that increase player retention and increases general interest and replayability, as well as the all-important analytics tools. Ease of implementation for each service varies, but they&#8217;re all pretty careful to make it quite simple. I don&#8217;t have any personal experience with any of these but if YOU do then please leave a comment telling us how it went for you.</p>
<p>Note that <strong>nonoba</strong> is evolving their tools into <a href="http://playerio.com/">PlayerIO</a>, a full-blown multiplayer framework built specifically for Flash games, based on a subscription fee (there&#8217;s a free version). I&#8217;m not sure how their Payments system will handle the move and they haven&#8217;t gotten back to me yet. I&#8217;d like to mention that the crews at HeyZap, MochiMedia, and GamerSafe were by far the most responsive of the bunch, with HeyZap being the most eager (a very good thing).</p>
<p>It looks like a combination of services would be best, but that leaves you with HeyZap, GamerSafe, nonoba&#8230; and SocialGold, although SocialGold requires you to have complete control over the page your game is embedded in (ie you can&#8217;t post it on any portals) so that really isn&#8217;t much of an option (and you should read <a href="https://www.mochimedia.com/community/forum/topic/gamersafe-mochiads">this thread</a> that explains its serious security flaw).</p>
<p>In choosing the service(s), be sure to take a look at their developer forums and see how often they get answers too. Send them an email with some questions to find out how helpful they are. You can ask other devs about it, but my forum questions <a href="http://www.actionscript.org/forums/showthread.php3?t=241428">went</a> <a href="http://www.kirupa.com/forum/showthread.php?t=350305">unanswered</a>. You&#8217;ll have a bit more luck if you are more sociable than me <img src='http://coldconstructs.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<h4 id="toc-sponsorships">Sponsorships</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/fgl_logo.png" class="alignleft"/>Sponsorships are an excellent choice, if you have a game good enough to attract sponsors. Just beware of bad/dickish sponsors. Be sure to read <a href="http://www.gamasutra.com/view/news/27924/InDepth_Behind_Flash_Game_SteamBirds_Revenue_Deals.php">SteamBirds dev&#8217;s experience</a> vetting sponsors on <a href="http://www.flashgamelicense.com/">FGL</a> and check out FGL&#8217;s <a href="http://www.flashgamelicense.com/blog/2010/01/looking-back-at-2009-trends-and-statistics/">informative 2009 report</a>.</p>
<p>Remember that, besides FGL, there&#8217;s thousands of other sites that don&#8217;t check FGL that will be willing to sponsor your game with varying terms. Just shoot them an email and ask. You can charge more for one that requires you to completely re-brand your game, or for an exclusive (or time-sensitive exclusive) license to your game, or it could be as simple as putting in a logo somewhere and a link or two. Ask around, work out a good deal and see what happens.</p>
<h4 id="toc-shareware">Shareware</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/sharify_logo.png" class="alignleft"/>With the advent of Adobe Integrated Runtime (aka AIR) and tools like <a href="http://www.sharify.it/how-it-works">Sharify</a>, we can actually package our games as downloadable apps that can be played on just about ANY platform (thanks to Flash Player 10.1, this includes Androids and holy shit <em>TVs</em>). While Sharify and similar services can lock your game, <strong>you can do that part yourself</strong> and just use an MTX service to handle the money part.</p>
<h4 id="toc-ads">Ads</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/mochi_logo.png" class="alignleft"/>If your game is small and shitty (like my first one, and like the vast majority of Flash games), ads are a good option since MTX requires more time and skill implement. I&#8217;ve heard a few developers who have made a good amount of bank with ads, but they are few and far in-between. However, they do offer us a quick and easy way to earn (tiny amounts of) cash.</p>
<p>But there remains some pretty nasty problems with ads:</p>
<ol>
<li>Clicks or impressions (whatever the ad provider does) provide a microscopic amount of revenue in the first place.</li>
<li>You get little more than half of the revenue generated by the ads. (Most do a 60/40 split.)</li>
<li>Each big-name portal has their own rules on which ads you can use.</li>
</ol>
<p>Regarding that last one, as an example: you can&#8217;t show Mochi Ads on Kongregate; Newgrounds has their own ad system; Armor Games, the same. <em>We have to make a different version of our games for each portal.</em> This, my friends, is bullshit.</p>
<h4 id="toc-conclusion">Conclusion</h4>
<p>To get the most revenue from your games, you will need to decide what your business model is before you even write one line of code. Banking on the general goodwill of your audience? Use Flattr, add a PayPal donations button, and maybe an ad for a preloader. Have a multiplayer game? MTX is the way to go. Have an amazing single player experience? You&#8217;re probably better off with the shareware model. But in all cases, you should at least ask around for sponsorships, because the terms can be so flexible with good payoff. Also, don&#8217;t forget Twitter/Facebook/etc. share links!</p>
<p>So, all in all, I&#8217;m really happy to see people taking Flash games seriously and throwing some genuinely useful financial tools at developers. And as always, things will keep changing and we&#8217;ll see better ways to bake our cake and eat it too. Good luck and have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://coldconstructs.com/2010/06/5-ways-to-make-bank-on-flash-games/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is content still king? @UntoldEnt</title>
		<link>http://coldconstructs.com/2010/03/is-content-still-king/</link>
		<comments>http://coldconstructs.com/2010/03/is-content-still-king/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 00:33:11 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[commerce]]></category>
		<category><![CDATA[game industry]]></category>

		<guid isPermaLink="false">http://coldconstructs.com/?p=301</guid>
		<description><![CDATA[Ultimately, content is a banana and we&#8217;re all a bunch of monkeys :: photo by hvhe1 ::
Some loud dude (Ryan Creighton of Untold Entertainment fame) recently posted this article, claiming that content is actually &#8220;peasant&#8221; (rather vehemently) and that meta-aggregators (he simply calls them aggregators of aggregators) and advertisers are the ones at the top [...]]]></description>
			<content:encoded><![CDATA[<p><img class="header" src="http://coldconstructs.com/siteFiles/blogImages/monkey_hvhe1.jpg" /><span class="desc">Ultimately, content is a banana and we&#8217;re all a bunch of monkeys :: photo by <a href="http://www.flickr.com/photos/hvhe1/707212944/in/set-72157594337954023/">hvhe1</a> ::</span></p>
<p>Some loud dude (Ryan Creighton of <em>Untold Entertainment</em> fame) recently posted <a href="http://www.untoldentertainment.com/blog/2010/03/30/content-is-peasant/">this article</a>, claiming that content is actually &#8220;peasant&#8221; (rather vehemently) and that meta-aggregators (he simply calls them <em>aggregators of aggregators</em>) and advertisers are the ones at the top of the commerce chain. I&#8217;m going to question that conclusion here.</p>
<p>So. Why would people say content is king in the first place? I think it&#8217;s because advertisers, aggregators, meta-aggregators, and, uhm, salesmen (whom Sir Creighton says are the <em>real </em>kings, which we&#8217;ll simply call the 3 Horsemen&#8211;yes I ignored salesmen) would all be dead without content. That&#8217;s a pretty well-established fact. I mean, Creighton is right in that the 3 Horsemen are essentially clever leeches and content producers rather strong-headed asses, but it&#8217;s telling how he calls content the &#8220;vehicle&#8221;&#8211;<strong>without the vehicle, nobody moves.</strong> So there&#8217;s definitely some meat to the idea that content is, in fact, king because everything else feeds off of it, and it&#8217;s not possible to run it the other way around&#8230; unless you want to advertise <em>ads</em>&#8230; but then the ads would become content by definition.</p>
<p><span id="more-301"></span></p>
<p>Let&#8217;s turn this around by asking this: <em>would content be dead without the 3 Horsemen?</em> The obvious answer is <strong>&#8220;No&#8221;</strong>. There will always be content regardless of whether or not there&#8217;s a way to monetize it. Why? Because humans have a fundemental [sic] need to create. It&#8217;s in our species&#8217; best interest to create&#8211;it&#8217;s how we got to the top of the natural food chain and it&#8217;s how we&#8217;re going to stay there.</p>
<p>The sad news is that, even from King Content&#8217;s perspective, <strong>consumers are still at the bottom of the pile.</strong> For one, it&#8217;s because we will still make things even if nobody pays us to (and that&#8217;s still often the case, just take a look at any indie scene), so it doesn&#8217;t matter if consumers exist at all. However, I hope they&#8217;ll evolve into <em>prosumers</em>; that they actually become more useful in the grand scheme of things than just being &#8220;eyeballs&#8221;. I think we&#8217;re starting to see that trend with crowdsourcing and such&#8211;we just have to build the tools that can compile and analyze the data they create in their everyday lives as patterns. We also need to enable them to make meaningful decisions and connections in the things they do in order to steer content to the whims of the people. That way content producers can stay sharp by navigating the dynamic environment that is social trends and consumers will stay interested and support fresh content. I wanted to get into why we should be socially responsible by making content actually <em>useful </em>to people rather than mere <em>consumables</em> (you are what you eat!), but that&#8217;s a topic for another day.</p>
<p>I don&#8217;t understand why Creighton mentions microtransactions&#8211;which replaces ads quite nicely&#8211;and still insists ads are going to continue to fuel the heist, when they&#8217;re actually on their way out. The ecosystem won&#8217;t die, as he claims, but rather evolve, which is nice. Also, he groups TV networks into the meta-aggregator category, rather erroneously I think. They&#8217;re content producers with direct access to vast distribution channels (actual channels piped to TVs), which makes them a naughty mix of content producer and aggregator. I don&#8217;t think the meta-aggregator category even exists outside of things like feed aggregators like Google Reader as such, but I think that&#8217;s delving into the deep, dark caverns of semantics. So let&#8217;s just slowly step away from that one.</p>
]]></content:encoded>
			<wfw:commentRss>http://coldconstructs.com/2010/03/is-content-still-king/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AS3 to Pixel Bender guide</title>
		<link>http://coldconstructs.com/2009/10/pixel-bender-gap-guide/</link>
		<comments>http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 22:00:23 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActionScript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Pixel Bender]]></category>

		<guid isPermaLink="false">http://coldconstructs.com/?p=134</guid>
		<description><![CDATA[

Best resources for beginners
Syntax overview
More performance tips
Realtime use of Pixel Bender

Asynchronous mode
Synchronous mode


Conclusion


When I set out to write a very simple Pixel Bender (PB) kernel/script thingy, I expected it to be relatively straight-forward, mostly because Adobe has been so good writing quality documentation for its products and/or there is a wealth of info on their [...]]]></description>
			<content:encoded><![CDATA[<div class="toc">
<ol>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-best-resources-for-beginners">Best resources for beginners</a></li>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-syntax-overview">Syntax overview</a></li>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-more-performance-tips">More performance tips</a></li>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-realtime-use-of-pixel-bender">Realtime use of Pixel Bender</a>
<ol>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-asynchronous-mode">Asynchronous mode</a></li>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-synchronous-mode">Synchronous mode</a></li>
</ol>
</li>
<li><a href="http://coldconstructs.com/2009/10/pixel-bender-gap-guide/#toc-conclusion">Conclusion</a></li>
</ol>
</div>
<p>When I set out to write a very simple Pixel Bender (<em>PB</em>) kernel/script thingy, I expected it to be relatively straight-forward, mostly because Adobe has been so good writing quality documentation for its products and/or there is a wealth of info on their products produced by their users. Unfortunately I didn&#8217;t find the dev guide in the Help menu and I missed some key AS3 bits from the links I&#8217;ll post below, but even so I still had a lot of trouble finding some info that really should already have been out on the interwebs. So this post is to fill in the gaps when going from AS3 to Pixel Bender.<br />
Hope it helps <img src="http://coldconstructs.com/random/pint.gif"></p>
<h4 id="toc-best-resources-for-beginners">Best resources for beginners</h4>
<p>Here&#8217;s the best tutorials and explanations I&#8217;ve found so far:</p>
<ul>
<li><a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS3E659D01-10C0-479d-8175-B40950BBC223.html">The official guide</a> and <a href="http://help.adobe.com/en_US/AS3LCR/Flash_10.0/index.html">reference</a>. Slap that F1 key! Also, don&#8217;t forget the Help menu in the toolkit like I did (there&#8217;s the PB-specific language spec and dev guide there).</li>
<li><a href="http://www.flashmagazine.com/tutorials/detail/using_pixel_bender_to_calculate_information/">Using PB as a calculator</a>. Completes the official tutorial.</li>
<li><a href="http://www.kaourantin.net/2008/05/adobe-pixel-bender-in-flash-player-10.html">Great in-depth article</a> with general+performance tips.</li>
<li>Very <a href="http://blog.gamingyourway.com/default.aspx">straight-forward examples</a> + comedy. Can&#8217;t go wrong there.</li>
<li><a href="http://www.derschmale.com/2009/07/23/some-flash-pixel-bender-performance-tips-benchmarks/">Nice user article</a> on optimizations and some speed tests (turns out, for input <code>bitmapData</code> beats <code>ByteArray </code>beats <code>Vector.<T></code>)</li>
</ul>
<h4 id="toc-syntax-overview">Syntax overview</h4>
<p>As a casual programmer of high-level languages and no mid- to low-level ones, I was thrown off by PB&#8217;s awkward syntax. It&#8217;s strongly typed, which is fine, except I&#8217;m not familiar with low-level languages like C or any previous shader language (PB is based on GLSL from what I hear). Here&#8217;s a basic difference:</p>
<blockquote><p>AS3: <code>var i:Number = 12;</code><br />
&#8230;in PB is: <code>float i = 12.0;</code><br />
The decimal in <code>12.0</code> tells PB it&#8217;s a floating point number. If it was just <code>12</code> PB would think it&#8217;s an <code>int</code>.</p></blockquote>
<p>When dealing with &#8220;vectors&#8221; (which are arrays, as in Flash 10&#8217;s odd use of the word &#8220;vector&#8221;) it&#8217;s <code>float2 i = float2(12.0, 2.0)</code>. Notice there&#8217;s no brackets or anything suggesting any type of array present. It&#8217;s simply the type + how big the array is, eg <code>float3</code>. It goes up to 4, for the 4 channels in images: Red, Green, Blue, Alpha). Then, as you can see, intializing the array is a simple matter of putting in the numbers you said would be there. So <code>float4(1.0, 24.2, 0.1, 3.4)</code> is valid whereas <code>float2(1.0, 24.2, 2)</code> is not, because there&#8217;s an extra number in there and it&#8217;s an <code>int</code> (adding insult to injury).</p>
<p><span id="more-134"></span></p>
<p>An important thing to keep in mind is that Pixel Bender sees channels in the order described above (RGBA). This little detail cost me a bit of time because I&#8217;m used to AS3&#8217;s order of ARGB&#8211;the alpha channel is first in AS3 while it&#8217;s <em>last</em> in PB.</p>
<p>To use any of the built-in functions you simply call them as they appear in the reference doc: <code>all(x); atan(x,y);</code> etc., no <code>Math</code> calls like we have to do in Flash (this through me for a loop, lemme tell ya).</p>
<p>For those of you who use the shortcut operations like <code>var i:int = foo < bar ? foo : bar;</code>, then you'll be pleased to hear they're supported in PB too. Just about the only thing "Hydra" (formally the codename for Pixel Bender, now--I guess--the name of the PB Flash implementation) does not support is loops of any kind<strong> and their related break/continue statements</strong>. That last bit is bad because there are times when I want to stop the filter if a certain condition is met. You just have to design your logic to take this into account from the start.</p>
<p>That's the basics but take special note that <code>shader.data</code> is actually an array, so you can do some naughty stuff like iterate through some kinky data and set the input as <code>shader.data['whatever'+i].input = kinky[i]</code>. Also note that in order to set the input for a shader in AS3 you <strong>must</strong> set it to <code>shader.data.vdipb.INPUT = inputImage</code> where <code>vdipb</code> is the variable name you declared in the PB shader itself.</p>
<h4 id="toc-more-performance-tips">More performance tips</h4>
<p>Turns out that after I converted my kernel from using boolean methods (like <code>boolean4()</code> etc.) to <code>if</code> statements, it consistently executed faster. I also got some fractional FPS increases by using the age-old optimization of putting real values (eg 1.2) in the evaluation statement instead of references (eg pixel.r). See the last blog I linked above for some other obvious and not-so-obvious performance tips.</p>
<p>PB math is much faster than straight AS3 math but it's slightly brighter (I wouldn't say it <em>shines</em> per se...) when it runs in asynchronous mode, which is enabled by using <code>ShaderJob</code>. You use <code>addEventListener(Event:ShaderEvent...)</code> and then run <code>start(false</code>) to put it in asynchronous mode (the param is <code>waitForCompletion</code> and it's already <code>false</code> by default). See <a href="http://www.boostworthy.com/blog/?p=243">Ryan's post</a> for a great example of how the <code>ShaderJob</code> has to be setup (<a href="http://blog.gamingyourway.com/default.aspx">Squize's post</a>, linked above, is an even clearer example).</p>
<h4 id="toc-realtime-use-of-pixel-bender">Realtime use of Pixel Bender</h4>
<h5 id="toc-asynchronous-mode">Asynchronous mode</h5>
<p>Reading the above linked performance tips for PB you, like me, might be thinking "OH MAN I can rule the universe with ShaderJob doing bitchwork like heavy collision solving" and you'd be <em>totally wrong</em>. You only have to set the input for a shader once, but you <em>do</em> have to create <strong>a new ShaderJob per computation of the filter every frame/tick</strong>. This is the depressing because <strong>ShaderJob takes a LONG time to start up</strong> and it, unlike the job itself, <em>does</em> use CPU from Flash's main thread--you do not get the asynchronous hotness until the actual job is started. And it is <em>sloooooowwwww</em>. Unless you're doing some serious number crunching or temporary special effect, you will not see a huge benefit from using PB in your game.</p>
<p>To be clear, ShaderJob works well enough for realtime usage but my experiments have shown that it's not fast enough to be executed every frame (unless you're SWF is running at 20 FPS or so). I tried to get it to fulfill my game's collision detection system by processing the entire map, but PB just couldn't handle the job. Still, I do recommend you try it (using Squize's recursive implementation) and see if it works for you. Just keep your hopes down <img src='http://coldconstructs.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h5 id="toc-synchronous-mode">Synchronous mode</h5>
<p>You can set <code>ShaderJob.start(true)</code> but if you're going the synchronous route, I suggest applying your Pixel Bender kernel by using the filter method. It starts up much faster than ShaderJob and doesn't have to be restarted every time you want to update the input. You do have to wait for it to finish processing before it will move to the next line in your code though, but as I mentioned above, PB math is a lot faster than AS3's Math library. So if you're doing something intense(r) like severe image distortion then PB is definitely worth a shot, but if it's just conditionals then you're probably better off in pure AS3 land.</p>
<h4 id="toc-conclusion">Conclusion</h4>
<p>Besides doing complex calculations, another place where PB would really help though is processing large (like 600 or 10000 pixels wide or bigger) images. It loops through each pixel faster than AS3 does. But remember that in AS3 you can do loops, so easily skipping pixels (using the <code>continue</code> statement) can result in some significant performance gains if you're not processing all the pixels in the input data (eg skipping transparent pixels). There's a lot of pro/cons so experimenting is, as always, the way to go (if you can afford it).</p>
<p>So there it is, all the info I wish was out there when I started learning PB (<em>I can't stop thinking of Peanut Butter!</em>). Hope some of it was helpful and of course I could be wrong about something (except about declaring input once, I've heard otherwise but in practice it worked fine) so please don't hesitate to correct me if so. Good luck and have fun <img src="http://coldconstructs.com/random/pint.gif"></p>
]]></content:encoded>
			<wfw:commentRss>http://coldconstructs.com/2009/10/pixel-bender-gap-guide/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Status update: games, the MTX dilemma, housekeeping</title>
		<link>http://coldconstructs.com/2009/10/status-update-2/</link>
		<comments>http://coldconstructs.com/2009/10/status-update-2/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 23:16:11 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Discussions]]></category>
		<category><![CDATA[Housekeeping]]></category>
		<category><![CDATA[Cold Constructs]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[status update]]></category>

		<guid isPermaLink="false">http://coldconstructs.com/?p=187</guid>
		<description><![CDATA[Makin&#8217; games
I&#8217;ve been working on a couple game concepts and want to prototype a few more before committing to one to build out. I&#8217;ve been hacking the hell out of Flixel, which I&#8217;ve decided to use for a most of the games. There&#8217;s a screenshot of game3 on the right there. Weird, eh? Also fugly, [...]]]></description>
			<content:encoded><![CDATA[<h4 id="toc-makin-games">Makin&#8217; games</h4>
<p><img src="http://coldconstructs.com/siteFiles/blogImages/game3_screen01.png" class="alignright bordered" />I&#8217;ve been working on a couple game concepts and want to prototype a few more before committing to one to build out. I&#8217;ve been hacking the hell out of <a href="http://flixel.org">Flixel</a>, which I&#8217;ve decided to use for a most of the games. There&#8217;s a screenshot of game3 on the right there. Weird, eh? Also fugly, but it&#8217;s placeholder art so there. I have a new collision detection system for it that I&#8217;ll be posting about eventually (at least, I&#8217;ve never heard of it before).</p>
<h4 id="toc-the-microtransaction-mtx-dilemma">The microtransaction (MTX) dilemma</h4>
<p>I&#8217;m really excited about all the new services that have been released to allow Flash developers to monetize their games through microtransactions. I fucking hate ads, plus the ROI of them in Flash games is usually shit. Many many years ago I knew microtransactions (MTX) were the future of digital content and I&#8217;m pleased to see the idea coming to the mainstream (in America at least, Asia was quicker on it as usual).</p>
<p><strong>The problem</strong> I&#8217;m seeing with MTX is that Flash developers need to try a lot harder by making <strong>much</strong> bigger games in order to really reap the rewards. Before, you could make a pretty simple, fun and addictive game and monetize it easily with ads. But with MTX, you can&#8217;t do that as easily since you need to build more content for players to buy into. For example, to me, putting premium content in a Tower Defense game isn&#8217;t viable&#8211;the game concept is so small that I doubt anyone is going to pay anything for more turrets or maps (for example). There just isn&#8217;t enough <em>game </em>there.</p>
<p><span id="more-187"></span></p>
<p>So in order to realistically bring MTX into our games I think we&#8217;re going to have to build much bigger games, and that kind of sucks because that makes it much harder for indie devs to make good on their work. Hell, this might actually decrease the quality of Flash games due to the higher gate devs will need to jump to get in. Well, let&#8217;s just see how it goes but I for one am having to take a lot more time building a game worthy of MTX-enabled content <img src='http://coldconstructs.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>By the by, below is my current list of MTX-enabling services currently available. If you know of any others, please leave a comment <img src="http://coldconstructs.com/random/pint.gif"></p>
<ul>
<li><a href="https://www.gamersafe.com/index.php">GamerSafe</a> &#8211; Seems to be the best choice so far. Adds achievements, microtransactions, save games, leaderboards, etc in a unified, web-wide accessible account.</li>
<li><a href="http://www.nonoba.com/developers">Nonoba</a> &#8211; Like GamerSafe, but also has a multiplayer network&#8230; but you must have a nonoba account to keep multiplayer stats/items etc (but guests can still play, just not save). Anyone used their multiplayer API yet?</li>
<li><a href="http://www.mochimedia.com/developers/coins.html">MochiCoins</a> &#8211; MTX only. Can&#8217;t use with other systems so I&#8217;m completely ignoring this one.</li>
<li><a href="http://www.heyzap.com/developers">HeyZap</a> &#8211; Also MTX only.</li>
</ul>
<p>It&#8217;s best to include as many options for your players as possible, so given this list, you would allow premium content to be purchased with GamerSafe, Nonoba and HeyZap.</p>
<h4 id="toc-new-additions-to-c3">New additions to C<sup>3</sup></h4>
<p>I&#8217;ve made a significant number of changes to the site itself. Besides the better layout (<a href="http://960.gs">960gs</a> ftw) I added <a href="http://wordpress.org/extend/plugins/wp-codebox/">this awesome</a> Wordpress plugin that does an excellent job highlighting AS3 code (see previous posts with code)&#8230; except it&#8217;s fat and makes the site load slower, but whatever. I can fix that with another plugin (I <3 WP). </p>
<p>Also you can socialize my posts now, using <a href="http://blogplay.com/">Sociable</a>; you&#8217;ll also see new blog posts updating my Twitter status (I mainly wrote this post to test that actually). I still have a bit to do for the site aesthetically though&#8230; but I kinda like tweaking themes, and now that IE is growing up (sort of) web design has been a little easier. I still can&#8217;t wait for Google&#8217;s <a href="http://code.google.com/chrome/chromeframe/">bitch-slap</a> to MS though. That&#8217;s so baller.</p>
]]></content:encoded>
			<wfw:commentRss>http://coldconstructs.com/2009/10/status-update-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
